Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
image: mysql:5.7
ports:
- 3306

env:
JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
MYSQL_USER: root
Expand Down
19 changes: 10 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.DS_Store
*.gem
.bundle
.rvmrc
Gemfile.lock
pkg/*
specs/*.db
coverage
gemfiles/
/Gemfile.lock
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/test/*.db
/tmp/
4 changes: 3 additions & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
parallel: true # default: false
# For available configuration options, see:
# https://github.com/standardrb/standard
ruby_version: 2.7 # default: RUBY_VERSION
format: progress # default: Standard::Formatter
53 changes: 53 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- Add Rails 7.0 support
- Add support for dumping views from multiple schemas in Postgres
- Require Ruby 2.7+
- Require Rails 7.0

## [6.0.0] – 2022-02-21

- Add Rails 6.0 support

## [2.0.0] – 2019-12-17

- Add support for materialized views
- Drop support for the the mysql gem
- Require Ruby 2.2+

## [1.2.0] – 2017-07-21

- Add support for skipping views when dumping the schema

## [1.1.0] – 2016-01-15

## [1.0.1] – 2015-09-29

## [1.0.0] – 2015-09-28

## [0.5.3] – 2015-03-16

## [0.5.2] – 2014-12-05

## [0.5.1] – 2014-02-07

## [0.5.0] – 2014-01-03

## [0.4.1] – 2013-11-14

## [0.4.0] – 2013-10-10

## [0.3.1] – 2013-10-04

## [0.3.0] – 2013-09-27

## [0.2.0] – 2013-04-22

## [0.1.0] – 2013-01-14

## [0.0.2] – 2012-02-10
132 changes: 132 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "http://rubygems.org"
source "https://rubygems.org"

# Specify your gem's dependencies in spectacles.gemspec
gemspec
Expand Down
20 changes: 0 additions & 20 deletions LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2012-2024 Adam Hutchison, Brandon Dewitt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
31 changes: 15 additions & 16 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rake/testtask"
require "standard/rake"
require "minitest/test_task"

namespace :test do
adapters = [:mysql2, :postgresql, :sqlite3]
task all: [:spectacles] + adapters
Minitest::TestTask.create :spectacles do |t|
t.test_globs = ["test/spectacles/**/*_test.rb"]
t.warning = false
end

adapters = %i[mysql2 postgresql sqlite3]
adapters.each do |adapter|
Rake::TestTask.new(adapter) do |t|
t.libs.push "lib"
t.libs.push "specs"
t.pattern = "specs/adapters/#{t.name}*_spec.rb"
t.verbose = true
Minitest::TestTask.create adapter do |t|
t.test_globs = ["test/adapters/#{t.name}*_test.rb"]
t.warning = false
end
end

Rake::TestTask.new(:spectacles) do |t|
t.libs.push "lib"
t.libs.push "specs"
t.pattern = "specs/spectacles/**/*_spec.rb"
t.verbose = true
end
task all: %i[spectacles] + adapters
end

task default: ["test:all", "standard:fix"]
require "standard/rake"

task default: %i[test:all standard:fix]
62 changes: 35 additions & 27 deletions spectacles.gemspec
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "spectacles/version"
# frozen_string_literal: true

Gem::Specification.new do |gem|
gem.version = Spectacles::VERSION
gem.name = "spectacles"
gem.authors = ["Adam Hutchison, Brandon Dewitt"]
gem.email = ["[email protected], [email protected]"]
gem.homepage = "http://github.com/liveh2o/spectacles"
gem.summary = "Spectacles (derived from RailsSQLViews) adds database view functionality to ActiveRecord."
gem.description = "Spectacles adds database view functionality to ActiveRecord. Current supported adapters include Postgres, SQLite, Vertica, and MySQL."
gem.license = "MIT"
require_relative "lib/spectacles/version"

gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
gem.require_paths = ["lib"]
Gem::Specification.new do |spec|
spec.version = Spectacles::VERSION
spec.name = "spectacles"
spec.authors = ["Adam Hutchison, Brandon Dewitt"]
spec.email = ["[email protected], [email protected]"]

##
# Dependencies
#
gem.required_ruby_version = ">= 2.7.0"
gem.add_dependency "activerecord", "~> 7.0.0"
gem.add_dependency "activesupport", "~> 7.0.0"
spec.summary = "Spectacles adds database view functionality to ActiveRecord."
spec.description = "Spectacles adds database view functionality to ActiveRecord. Current supported adapters include Postgres, SQLite, Vertica, and MySQL."
spec.homepage = "http://github.com/liveh2o/spectacles"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.7.0"

##
# Development dependencies
#
gem.add_development_dependency "minitest", ">= 5.0"
gem.add_development_dependency "rake"
gem.add_development_dependency "standard"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = spec.homepage + "/blob/main/CHANGELOG.md"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
gemspec = File.basename(__FILE__)
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
ls.readlines("\x0", chomp: true).reject do |f|
(f == gemspec) ||
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
end
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "activerecord", "~> 7.0.0"
spec.add_dependency "activesupport", "~> 7.0.0"

spec.add_development_dependency "minitest", ">= 5.0"
spec.add_development_dependency "rake"
spec.add_development_dependency "standard"
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "spec_helper"
require "test_helper"

describe "Spectacles::SchemaStatements::Mysql2Adapter" do
config = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "spec_helper"
require "test_helper"

describe "Spectacles::SchemaStatements::PostgreSQLAdapter" do
config = {
Expand Down
Loading
Loading