schema_dev 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/prs.yml +49 -0
- data/.simplecov +20 -0
- data/Gemfile +2 -0
- data/README.md +7 -7
- data/Rakefile +3 -5
- data/bin/schema_dev +25 -21
- data/lib/schema_dev/config.rb +62 -44
- data/lib/schema_dev/executor.rb +9 -8
- data/lib/schema_dev/gem.rb +45 -37
- data/lib/schema_dev/gemfile_selector.rb +7 -7
- data/lib/schema_dev/gemfiles.rb +6 -5
- data/lib/schema_dev/github_actions.rb +266 -0
- data/lib/schema_dev/matrix_executor.rb +4 -2
- data/lib/schema_dev/readme.rb +17 -10
- data/lib/schema_dev/rspec/db.rb +44 -33
- data/lib/schema_dev/rspec.rb +4 -9
- data/lib/schema_dev/ruby_selector.rb +29 -14
- data/lib/schema_dev/runner.rb +14 -10
- data/lib/schema_dev/tasks/dbms.rb +34 -26
- data/lib/schema_dev/tasks.rb +2 -3
- data/lib/schema_dev/templates.rb +5 -5
- data/lib/schema_dev/version.rb +3 -1
- data/lib/schema_dev.rb +3 -1
- data/schema_dev.gemspec +23 -26
- data/spec/schema_dev/config_spec.rb +60 -0
- data/spec/schema_dev/gem_spec.rb +74 -0
- data/spec/schema_dev/gemfile_selector_spec.rb +11 -0
- data/spec/schema_dev/gemfiles_spec.rb +41 -0
- data/spec/schema_dev/github_actions_spec.rb +818 -0
- data/spec/schema_dev/runner_spec.rb +103 -0
- data/spec/spec_helper.rb +5 -6
- data/templates/README/uses.schema_dev.md.erb +1 -2
- data/templates/gem/GEM_NAME.gemspec.erb +15 -14
- data/templates/gem/Gemfile.erb +2 -0
- data/templates/gem/Gemfile.local.erb +2 -0
- data/templates/gem/README.md.erb +1 -2
- data/templates/gem/Rakefile.erb +2 -0
- data/templates/gem/schema_dev.yml.erb +4 -1
- data/templates/gem/simplecov.erb +20 -0
- metadata +38 -87
- data/.travis.yml +0 -4
- data/lib/schema_dev/tasks/coveralls.rb +0 -3
- data/lib/schema_dev/travis.rb +0 -147
- data/spec/config_spec.rb +0 -61
- data/spec/gem_spec.rb +0 -77
- data/spec/gemfile_sepector_spec.rb +0 -10
- data/spec/gemfiles_spec.rb +0 -41
- data/spec/runner_spec.rb +0 -106
- data/spec/travis_spec.rb +0 -392
data/spec/config_spec.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
describe SchemaDev::Config do
|
2
|
-
|
3
|
-
it "computes matrix" do
|
4
|
-
config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[4.0 4.1], db: %W[sqlite3 postgresql])
|
5
|
-
expect(config.matrix).to match_array [
|
6
|
-
{ ruby: "1.9.3", activerecord: "4.0", db: "sqlite3" },
|
7
|
-
{ ruby: "1.9.3", activerecord: "4.0", db: "postgresql" },
|
8
|
-
{ ruby: "1.9.3", activerecord: "4.1", db: "sqlite3" },
|
9
|
-
{ ruby: "1.9.3", activerecord: "4.1", db: "postgresql" },
|
10
|
-
{ ruby: "2.1.5", activerecord: "4.0", db: "sqlite3" },
|
11
|
-
{ ruby: "2.1.5", activerecord: "4.0", db: "postgresql" },
|
12
|
-
{ ruby: "2.1.5", activerecord: "4.1", db: "sqlite3" },
|
13
|
-
{ ruby: "2.1.5", activerecord: "4.1", db: "postgresql" },
|
14
|
-
]
|
15
|
-
end
|
16
|
-
|
17
|
-
it "excludes explicit elements from matrix" do
|
18
|
-
config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[4.0 4.1], db: %W[sqlite3 postgresql],
|
19
|
-
exclude: [
|
20
|
-
{ ruby: "1.9.3", activerecord: "4.1", db: "postgresql" },
|
21
|
-
{ ruby: "2.1.5", activerecord: "4.0", db: "sqlite3" } ]
|
22
|
-
)
|
23
|
-
expect(config.matrix).to match_array [
|
24
|
-
{ ruby: "1.9.3", activerecord: "4.0", db: "sqlite3" },
|
25
|
-
{ ruby: "1.9.3", activerecord: "4.0", db: "postgresql" },
|
26
|
-
{ ruby: "1.9.3", activerecord: "4.1", db: "sqlite3" },
|
27
|
-
# { ruby: "1.9.3", activerecord: "4.1", db: "postgresql" },
|
28
|
-
# { ruby: "2.1.5", activerecord: "4.0", db: "sqlite3" },
|
29
|
-
{ ruby: "2.1.5", activerecord: "4.0", db: "postgresql" },
|
30
|
-
{ ruby: "2.1.5", activerecord: "4.1", db: "sqlite3" },
|
31
|
-
{ ruby: "2.1.5", activerecord: "4.1", db: "postgresql" },
|
32
|
-
]
|
33
|
-
end
|
34
|
-
|
35
|
-
it "excludes slices from matrix" do
|
36
|
-
config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[4.0 4.1], db: %W[sqlite3 postgresql],
|
37
|
-
exclude: [
|
38
|
-
{ ruby: "1.9.3", activerecord: "4.1"},
|
39
|
-
{ ruby: "2.1.5", db: "sqlite3" } ]
|
40
|
-
)
|
41
|
-
expect(config.matrix).to match_array [
|
42
|
-
{ ruby: "1.9.3", activerecord: "4.0", db: "sqlite3" },
|
43
|
-
{ ruby: "1.9.3", activerecord: "4.0", db: "postgresql" },
|
44
|
-
#{ ruby: "1.9.3", activerecord: "4.1", db: "sqlite3" },
|
45
|
-
#{ ruby: "1.9.3", activerecord: "4.1", db: "postgresql" },
|
46
|
-
#{ ruby: "2.1.5", activerecord: "4.0", db: "sqlite3" },
|
47
|
-
{ ruby: "2.1.5", activerecord: "4.0", db: "postgresql" },
|
48
|
-
#{ ruby: "2.1.5", activerecord: "4.1", db: "sqlite3" },
|
49
|
-
{ ruby: "2.1.5", activerecord: "4.1", db: "postgresql" },
|
50
|
-
]
|
51
|
-
end
|
52
|
-
|
53
|
-
it "uses last cell for --quick" do
|
54
|
-
config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[4.0 4.1], db: %W[sqlite3 postgresql])
|
55
|
-
expect(config.matrix quick: true).to match_array [
|
56
|
-
{ ruby: "2.1.5", activerecord: "4.1", db: "postgresql" },
|
57
|
-
]
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
end
|
data/spec/gem_spec.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'schema_dev/gem'
|
2
|
-
|
3
|
-
describe SchemaDev::Gem do
|
4
|
-
|
5
|
-
around(:each) do |example|
|
6
|
-
in_tmpdir do
|
7
|
-
suppress_stdout_stderr do
|
8
|
-
example.run
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
Given(:user_name) { "My Name" }
|
14
|
-
Given(:user_email) { "my_name@example.com" }
|
15
|
-
|
16
|
-
Given {
|
17
|
-
allow_any_instance_of(SchemaDev::Gem).to receive(:`).with("git config user.name").and_return user_name
|
18
|
-
allow_any_instance_of(SchemaDev::Gem).to receive(:`).with("git config user.email").and_return user_email
|
19
|
-
}
|
20
|
-
|
21
|
-
context "builds" do
|
22
|
-
|
23
|
-
Given {
|
24
|
-
stub_request(:get, 'https://rubygems.org/api/v1/versions/schema_plus_core.json').to_return body: JSON.generate([
|
25
|
-
{ number: "1.0.0.pre", prerelease: true},
|
26
|
-
{ number: "0.2.1"},
|
27
|
-
{ number: "0.1.2"},
|
28
|
-
{ number: "0.1.1" },
|
29
|
-
])
|
30
|
-
}
|
31
|
-
|
32
|
-
When { SchemaDev::Gem.build gem_name }
|
33
|
-
|
34
|
-
When(:gemspec) { File.read "#{gem_name}/#{gem_name}.gemspec" }
|
35
|
-
When(:readme) { File.read "#{gem_name}/README.md" }
|
36
|
-
|
37
|
-
Invariant { expect(readme).to include %q{<!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->} }
|
38
|
-
Invariant { expect(readme).to include %q{<!-- These lines are auto-inserted from a schema_dev template -->} }
|
39
|
-
|
40
|
-
Invariant { expect(gemspec).to include %q{"schema_plus_core", "~> 0.2", ">= 0.2.1"} }
|
41
|
-
Invariant { expect(gemspec).to match %r{authors.*#{user_name}} }
|
42
|
-
Invariant { expect(gemspec).to match %r{email.*#{user_email}} }
|
43
|
-
|
44
|
-
context "flat gem" do
|
45
|
-
Given(:gem_name) { "new_gem" }
|
46
|
-
Then { expect(gemspec).to include %q{require 'new_gem/version'} }
|
47
|
-
Then { expect(File.read "new_gem/lib/new_gem.rb").to include %q{SchemaMonkey.register NewGem} }
|
48
|
-
end
|
49
|
-
|
50
|
-
context "subdir gem" do
|
51
|
-
Given(:gem_name) { "schema_plus_new_gem" }
|
52
|
-
Then { expect(gemspec).to include %q{require 'schema_plus/new_gem/version'} }
|
53
|
-
Then { expect(File.read "schema_plus_new_gem/lib/schema_plus_new_gem.rb").to include %q{require_relative 'schema_plus/new_gem'} }
|
54
|
-
Then { expect(File.read "schema_plus_new_gem/lib/schema_plus/new_gem.rb").to include %q{SchemaMonkey.register SchemaPlus::NewGem} }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
context "complains" do
|
60
|
-
|
61
|
-
context "when no git user.name" do
|
62
|
-
Given(:user_name) { "" }
|
63
|
-
Then { expect{SchemaDev::Gem.build("NewGem")}.to raise_error SystemExit, /who are you/i }
|
64
|
-
end
|
65
|
-
|
66
|
-
context "when in git worktree" do
|
67
|
-
Given { expect_any_instance_of(SchemaDev::Gem).to receive(:system).with(/^git rev-parse/).and_return true }
|
68
|
-
Then { expect{SchemaDev::Gem.build("NewGem")}.to raise_error SystemExit, /\bgit\b/ }
|
69
|
-
end
|
70
|
-
|
71
|
-
context "when gem directory exists" do
|
72
|
-
Given { FileUtils.touch "new_gem" }
|
73
|
-
Then { expect{SchemaDev::Gem.build("NewGem")}.to raise_error SystemExit, /exists/ }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'schema_dev/gemfile_selector'
|
2
|
-
|
3
|
-
describe SchemaDev::GemfileSelector do
|
4
|
-
|
5
|
-
it "infers db from env" do
|
6
|
-
test_dbname = 'this_is_a_test'
|
7
|
-
ENV['BUNDLE_GEMFILE'] = SchemaDev::GemfileSelector.gemfile(activerecord: '4.1', db: test_dbname).to_s
|
8
|
-
expect(SchemaDev::GemfileSelector.infer_db).to eq test_dbname
|
9
|
-
end
|
10
|
-
end
|
data/spec/gemfiles_spec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'schema_dev/gemfiles'
|
2
|
-
|
3
|
-
describe SchemaDev::Gemfiles do
|
4
|
-
|
5
|
-
it "copies listed files" do
|
6
|
-
config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[5.2 6.0], db: %W[sqlite3 postgresql])
|
7
|
-
in_tmpdir do
|
8
|
-
expect(SchemaDev::Gemfiles.build(config)).to be_truthy
|
9
|
-
expect(relevant_diff(config, "gemfiles")).to be_empty
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it "only copies files once" do
|
14
|
-
config = get_config(ruby: %W[1.9.3 2.1.5], activerecord: %W[5.2 6.0], db: %W[sqlite3 postgresql])
|
15
|
-
in_tmpdir do
|
16
|
-
expect(SchemaDev::Gemfiles.build(config)).to be_truthy
|
17
|
-
expect(SchemaDev::Gemfiles.build(config)).to be_falsey
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def relevant_diff(config, dir)
|
22
|
-
Dir.mktmpdir do |no_erb_root|
|
23
|
-
no_erb_root = Pathname(no_erb_root)
|
24
|
-
erb_root = SchemaDev::Templates.root + dir
|
25
|
-
Pathname.glob(erb_root + "**/*").select(&:file?).each do |p|
|
26
|
-
d = (no_erb_root+p.relative_path_from(erb_root)).sub_ext('')
|
27
|
-
d.dirname.mkpath
|
28
|
-
d.write p.read
|
29
|
-
end
|
30
|
-
|
31
|
-
diff = `diff -rq #{no_erb_root} #{dir} 2>&1`.split("\n")
|
32
|
-
|
33
|
-
# expect copy not to have entry for activerecord not in config
|
34
|
-
diff.reject!{ |d| d =~ %r[Only in #{no_erb_root}: activerecord-(.*)] and not config.activerecord.include? $1 }
|
35
|
-
|
36
|
-
# expect copy not to have entry for db not in config
|
37
|
-
diff.reject!{ |d| d =~ %r[Only in #{no_erb_root}.*: Gemfile.(.*)] and not config.db.include? $1 }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
data/spec/runner_spec.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'schema_dev/runner'
|
2
|
-
require 'which_works'
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
describe SchemaDev::Runner do
|
6
|
-
|
7
|
-
it "creates gemfiles" do
|
8
|
-
config = get_config(ruby: "2.1.3", activerecord: "5.2", db: "sqlite3")
|
9
|
-
runner = SchemaDev::Runner.new(config)
|
10
|
-
in_tmpdir do
|
11
|
-
expect{ runner.gemfiles }.to output("* Updated gemfiles\n").to_stdout
|
12
|
-
expect(Pathname.new("gemfiles")).to be_directory
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
it "creates travis" do
|
17
|
-
config = get_config(ruby: "2.1.3", activerecord: "5.2", db: "sqlite3")
|
18
|
-
runner = SchemaDev::Runner.new(config)
|
19
|
-
in_tmpdir do
|
20
|
-
expect{ runner.travis }.to output("* Updated .travis.yml\n").to_stdout
|
21
|
-
expect(Pathname.new(".travis.yml")).to be_file
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
Selectors = {
|
26
|
-
'chruby-exec' => "SHELL=/usr/local/bin/bash chruby-exec ruby-#{RUBY_VERSION} --",
|
27
|
-
'rvm' => "rvm #{RUBY_VERSION} do",
|
28
|
-
'rbenv' => "RBENV_VERSION=#{RUBY_VERSION}"
|
29
|
-
}
|
30
|
-
|
31
|
-
Selectors.each do |selector, selection_command|
|
32
|
-
|
33
|
-
describe "matrix (#{selector})" do
|
34
|
-
before(:each) do
|
35
|
-
# mocking Which.which to find selector
|
36
|
-
SchemaDev::RubySelector._reset
|
37
|
-
allow(Which).to receive(:which) {|cmd| ["bash", selector].include?(cmd) ? "/usr/local/bin/#{cmd}" : nil }
|
38
|
-
case selector
|
39
|
-
when 'chruby-exec'
|
40
|
-
expect_any_instance_of(Pathname).to receive(:entries).and_return [Pathname.new("ruby-#{RUBY_VERSION}")]
|
41
|
-
when 'rbenv'
|
42
|
-
expect_any_instance_of(SchemaDev::RubySelector::Rbenv).to receive(:`).with("rbenv versions --bare").and_return RUBY_VERSION
|
43
|
-
end
|
44
|
-
|
45
|
-
# mocking execution
|
46
|
-
original_popen2e = Open3.method(:popen2e)
|
47
|
-
allow(Open3).to receive(:popen2e) { |cmd, &block|
|
48
|
-
cmd = case cmd
|
49
|
-
when /false$/ then "false"
|
50
|
-
when /true$/ then "true"
|
51
|
-
else cmd.sub(/.*echo/, "echo")
|
52
|
-
end
|
53
|
-
original_popen2e.call(cmd, &block)
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
|
-
let(:config) { get_config(ruby: RUBY_VERSION, activerecord: "5.2", db: %W[sqlite3 postgresql]) }
|
58
|
-
let(:runner) { SchemaDev::Runner.new(config) }
|
59
|
-
|
60
|
-
|
61
|
-
let(:expected_output) { <<ENDOUTPUT.strip }
|
62
|
-
* Updated .travis.yml
|
63
|
-
* Updated gemfiles
|
64
|
-
|
65
|
-
|
66
|
-
*** ruby #{RUBY_VERSION} - activerecord 5.2 - db sqlite3 [1 of 2]
|
67
|
-
|
68
|
-
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/activerecord-5.2/Gemfile.sqlite3 #{selection_command} %{cmd}
|
69
|
-
%{output}
|
70
|
-
|
71
|
-
*** ruby #{RUBY_VERSION} - activerecord 5.2 - db postgresql [2 of 2]
|
72
|
-
|
73
|
-
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/activerecord-5.2/Gemfile.postgresql #{selection_command} %{cmd}
|
74
|
-
%{output}
|
75
|
-
ENDOUTPUT
|
76
|
-
|
77
|
-
it "runs successfully" do
|
78
|
-
in_tmpdir do
|
79
|
-
expect{ runner.run("true") }.to output(expected_output % {cmd: 'true', output: nil}).to_stdout
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
it "reports error exits" do
|
84
|
-
in_tmpdir do
|
85
|
-
expect{ runner.run("false") }.to output(expected_output % {cmd: 'false', output: nil} + <<-ENDERR).to_stdout
|
86
|
-
|
87
|
-
*** 2 failures:
|
88
|
-
\truby #{RUBY_VERSION} - activerecord 5.2 - db sqlite3
|
89
|
-
\truby #{RUBY_VERSION} - activerecord 5.2 - db postgresql
|
90
|
-
ENDERR
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
it "reports error messages" do
|
95
|
-
in_tmpdir do
|
96
|
-
expect{ runner.run("echo", "LoadError") }.to output(expected_output % {cmd: 'echo LoadError', output: "LoadError\n"} + <<-ENDERR).to_stdout
|
97
|
-
|
98
|
-
*** 2 failures:
|
99
|
-
\truby #{RUBY_VERSION} - activerecord 5.2 - db sqlite3
|
100
|
-
\truby #{RUBY_VERSION} - activerecord 5.2 - db postgresql
|
101
|
-
ENDERR
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
data/spec/travis_spec.rb
DELETED
@@ -1,392 +0,0 @@
|
|
1
|
-
require 'schema_dev/travis'
|
2
|
-
|
3
|
-
describe SchemaDev::Travis do
|
4
|
-
|
5
|
-
it "creates travis file" do
|
6
|
-
config = get_config(ruby: %W[1.9.3 2.1.5],
|
7
|
-
activerecord: %W[4.0 4.1],
|
8
|
-
db: %W[mysql2 postgresql sqlite3],
|
9
|
-
exclude: [
|
10
|
-
{ ruby: "1.9.3", db: "postgresql" },
|
11
|
-
{ ruby: "1.9.3", db: "sqlite3" },
|
12
|
-
],
|
13
|
-
notify: 'me@example.com')
|
14
|
-
in_tmpdir do
|
15
|
-
SchemaDev::Travis.update(config)
|
16
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
17
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
18
|
-
# ./schema_dev.yml
|
19
|
-
# Please do not edit this file; any changes will be overwritten next time
|
20
|
-
# schema_dev gets run.
|
21
|
-
---
|
22
|
-
rvm:
|
23
|
-
- 1.9.3
|
24
|
-
- 2.1.5
|
25
|
-
gemfile:
|
26
|
-
- gemfiles/activerecord-4.0/Gemfile.sqlite3
|
27
|
-
- gemfiles/activerecord-4.1/Gemfile.sqlite3
|
28
|
-
before_script: bundle exec rake create_databases
|
29
|
-
after_script: bundle exec rake drop_databases
|
30
|
-
script: bundle exec rake travis
|
31
|
-
notifications:
|
32
|
-
email:
|
33
|
-
- me@example.com
|
34
|
-
jobs:
|
35
|
-
exclude:
|
36
|
-
- rvm: 1.9.3
|
37
|
-
gemfile: gemfiles/activerecord-4.0/Gemfile.sqlite3
|
38
|
-
- rvm: 1.9.3
|
39
|
-
gemfile: gemfiles/activerecord-4.1/Gemfile.sqlite3
|
40
|
-
include:
|
41
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.mysql2
|
42
|
-
rvm: 1.9.3
|
43
|
-
services:
|
44
|
-
- mysql
|
45
|
-
env: MYSQL_DB_USER=travis
|
46
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.mysql2
|
47
|
-
rvm: 1.9.3
|
48
|
-
services:
|
49
|
-
- mysql
|
50
|
-
env: MYSQL_DB_USER=travis
|
51
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.mysql2
|
52
|
-
rvm: 2.1.5
|
53
|
-
services:
|
54
|
-
- mysql
|
55
|
-
env: MYSQL_DB_USER=travis
|
56
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
57
|
-
rvm: 2.1.5
|
58
|
-
addons:
|
59
|
-
postgresql: '9.6'
|
60
|
-
env: POSTGRESQL_DB_USER=postgres
|
61
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.mysql2
|
62
|
-
rvm: 2.1.5
|
63
|
-
services:
|
64
|
-
- mysql
|
65
|
-
env: MYSQL_DB_USER=travis
|
66
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
67
|
-
rvm: 2.1.5
|
68
|
-
addons:
|
69
|
-
postgresql: '9.6'
|
70
|
-
env: POSTGRESQL_DB_USER=postgres
|
71
|
-
ENDTRAVIS
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'when only using postgresql and not overriding the version' do
|
76
|
-
it "creates travis file using the default PG version" do
|
77
|
-
config = get_config(ruby: %W[2.4.0],
|
78
|
-
activerecord: %W[4.1],
|
79
|
-
db: %W[postgresql])
|
80
|
-
in_tmpdir do
|
81
|
-
SchemaDev::Travis.update(config)
|
82
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
83
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
84
|
-
# ./schema_dev.yml
|
85
|
-
# Please do not edit this file; any changes will be overwritten next time
|
86
|
-
# schema_dev gets run.
|
87
|
-
---
|
88
|
-
rvm:
|
89
|
-
- 2.4.0
|
90
|
-
gemfile:
|
91
|
-
- gemfiles/activerecord-4.1/Gemfile.postgresql
|
92
|
-
env: POSTGRESQL_DB_USER=postgres
|
93
|
-
addons:
|
94
|
-
postgresql: '9.6'
|
95
|
-
before_script: bundle exec rake create_databases
|
96
|
-
after_script: bundle exec rake drop_databases
|
97
|
-
script: bundle exec rake travis
|
98
|
-
ENDTRAVIS
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when specifying a single postgresql version' do
|
104
|
-
it "creates travis file using that as the PG version" do
|
105
|
-
config = get_config(ruby: %W[2.4.0],
|
106
|
-
activerecord: %W[4.1],
|
107
|
-
db: %W[postgresql sqlite3],
|
108
|
-
dbversions: {postgresql: %W[9.6]})
|
109
|
-
in_tmpdir do
|
110
|
-
SchemaDev::Travis.update(config)
|
111
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
112
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
113
|
-
# ./schema_dev.yml
|
114
|
-
# Please do not edit this file; any changes will be overwritten next time
|
115
|
-
# schema_dev gets run.
|
116
|
-
---
|
117
|
-
rvm:
|
118
|
-
- 2.4.0
|
119
|
-
gemfile:
|
120
|
-
- gemfiles/activerecord-4.1/Gemfile.sqlite3
|
121
|
-
before_script: bundle exec rake create_databases
|
122
|
-
after_script: bundle exec rake drop_databases
|
123
|
-
script: bundle exec rake travis
|
124
|
-
jobs:
|
125
|
-
include:
|
126
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
127
|
-
rvm: 2.4.0
|
128
|
-
addons:
|
129
|
-
postgresql: '9.6'
|
130
|
-
env: POSTGRESQL_DB_USER=postgres
|
131
|
-
ENDTRAVIS
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
context 'when specifying multiple postgresql versions with excludes' do
|
137
|
-
it "creates travis file including those variants for postgresql versions" do
|
138
|
-
config = get_config(ruby: %W[1.9.3 2.1.5 2.4.0],
|
139
|
-
activerecord: %W[4.0 4.1],
|
140
|
-
db: %W[sqlite3 postgresql],
|
141
|
-
dbversions: {postgresql: %W[9.6 10 11]},
|
142
|
-
exclude: [{ ruby: "1.9.3", db: "postgresql" }])
|
143
|
-
in_tmpdir do
|
144
|
-
SchemaDev::Travis.update(config)
|
145
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
146
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
147
|
-
# ./schema_dev.yml
|
148
|
-
# Please do not edit this file; any changes will be overwritten next time
|
149
|
-
# schema_dev gets run.
|
150
|
-
---
|
151
|
-
rvm:
|
152
|
-
- 1.9.3
|
153
|
-
- 2.1.5
|
154
|
-
- 2.4.0
|
155
|
-
gemfile:
|
156
|
-
- gemfiles/activerecord-4.0/Gemfile.sqlite3
|
157
|
-
- gemfiles/activerecord-4.1/Gemfile.sqlite3
|
158
|
-
before_script: bundle exec rake create_databases
|
159
|
-
after_script: bundle exec rake drop_databases
|
160
|
-
script: bundle exec rake travis
|
161
|
-
jobs:
|
162
|
-
include:
|
163
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
164
|
-
rvm: 2.1.5
|
165
|
-
addons:
|
166
|
-
postgresql: '9.6'
|
167
|
-
env: POSTGRESQL_DB_USER=postgres
|
168
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
169
|
-
rvm: 2.1.5
|
170
|
-
addons:
|
171
|
-
postgresql: '10'
|
172
|
-
apt:
|
173
|
-
packages:
|
174
|
-
- postgresql-10
|
175
|
-
- postgresql-client-10
|
176
|
-
env: POSTGRESQL_DB_USER=postgres
|
177
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
178
|
-
rvm: 2.1.5
|
179
|
-
addons:
|
180
|
-
postgresql: '11'
|
181
|
-
apt:
|
182
|
-
packages:
|
183
|
-
- postgresql-11
|
184
|
-
- postgresql-client-11
|
185
|
-
env: POSTGRESQL_DB_USER=travis PGPORT=5433
|
186
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
187
|
-
rvm: 2.1.5
|
188
|
-
addons:
|
189
|
-
postgresql: '9.6'
|
190
|
-
env: POSTGRESQL_DB_USER=postgres
|
191
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
192
|
-
rvm: 2.1.5
|
193
|
-
addons:
|
194
|
-
postgresql: '10'
|
195
|
-
apt:
|
196
|
-
packages:
|
197
|
-
- postgresql-10
|
198
|
-
- postgresql-client-10
|
199
|
-
env: POSTGRESQL_DB_USER=postgres
|
200
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
201
|
-
rvm: 2.1.5
|
202
|
-
addons:
|
203
|
-
postgresql: '11'
|
204
|
-
apt:
|
205
|
-
packages:
|
206
|
-
- postgresql-11
|
207
|
-
- postgresql-client-11
|
208
|
-
env: POSTGRESQL_DB_USER=travis PGPORT=5433
|
209
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
210
|
-
rvm: 2.4.0
|
211
|
-
addons:
|
212
|
-
postgresql: '9.6'
|
213
|
-
env: POSTGRESQL_DB_USER=postgres
|
214
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
215
|
-
rvm: 2.4.0
|
216
|
-
addons:
|
217
|
-
postgresql: '10'
|
218
|
-
apt:
|
219
|
-
packages:
|
220
|
-
- postgresql-10
|
221
|
-
- postgresql-client-10
|
222
|
-
env: POSTGRESQL_DB_USER=postgres
|
223
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
224
|
-
rvm: 2.4.0
|
225
|
-
addons:
|
226
|
-
postgresql: '11'
|
227
|
-
apt:
|
228
|
-
packages:
|
229
|
-
- postgresql-11
|
230
|
-
- postgresql-client-11
|
231
|
-
env: POSTGRESQL_DB_USER=travis PGPORT=5433
|
232
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
233
|
-
rvm: 2.4.0
|
234
|
-
addons:
|
235
|
-
postgresql: '9.6'
|
236
|
-
env: POSTGRESQL_DB_USER=postgres
|
237
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
238
|
-
rvm: 2.4.0
|
239
|
-
addons:
|
240
|
-
postgresql: '10'
|
241
|
-
apt:
|
242
|
-
packages:
|
243
|
-
- postgresql-10
|
244
|
-
- postgresql-client-10
|
245
|
-
env: POSTGRESQL_DB_USER=postgres
|
246
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
247
|
-
rvm: 2.4.0
|
248
|
-
addons:
|
249
|
-
postgresql: '11'
|
250
|
-
apt:
|
251
|
-
packages:
|
252
|
-
- postgresql-11
|
253
|
-
- postgresql-client-11
|
254
|
-
env: POSTGRESQL_DB_USER=travis PGPORT=5433
|
255
|
-
ENDTRAVIS
|
256
|
-
end
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
context 'when specifying only postgresql as the db with versions' do
|
261
|
-
it "creates travis file including only addon variants" do
|
262
|
-
config = get_config(ruby: %W[2.1.5 2.4.0],
|
263
|
-
activerecord: %W[4.0 4.1],
|
264
|
-
db: %W[postgresql],
|
265
|
-
dbversions: {postgresql: %W[9.6 10 11]})
|
266
|
-
in_tmpdir do
|
267
|
-
SchemaDev::Travis.update(config)
|
268
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
269
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
270
|
-
# ./schema_dev.yml
|
271
|
-
# Please do not edit this file; any changes will be overwritten next time
|
272
|
-
# schema_dev gets run.
|
273
|
-
---
|
274
|
-
rvm:
|
275
|
-
- 2.1.5
|
276
|
-
- 2.4.0
|
277
|
-
gemfile:
|
278
|
-
- gemfiles/activerecord-4.0/Gemfile.postgresql
|
279
|
-
- gemfiles/activerecord-4.1/Gemfile.postgresql
|
280
|
-
before_script: bundle exec rake create_databases
|
281
|
-
after_script: bundle exec rake drop_databases
|
282
|
-
script: bundle exec rake travis
|
283
|
-
jobs:
|
284
|
-
include:
|
285
|
-
- addons:
|
286
|
-
postgresql: '9.6'
|
287
|
-
env: POSTGRESQL_DB_USER=postgres
|
288
|
-
- addons:
|
289
|
-
postgresql: '10'
|
290
|
-
apt:
|
291
|
-
packages:
|
292
|
-
- postgresql-10
|
293
|
-
- postgresql-client-10
|
294
|
-
env: POSTGRESQL_DB_USER=postgres
|
295
|
-
- addons:
|
296
|
-
postgresql: '11'
|
297
|
-
apt:
|
298
|
-
packages:
|
299
|
-
- postgresql-11
|
300
|
-
- postgresql-client-11
|
301
|
-
env: POSTGRESQL_DB_USER=travis PGPORT=5433
|
302
|
-
ENDTRAVIS
|
303
|
-
end
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
context 'when specifying multiple postgresql versions' do
|
308
|
-
it "creates travis file including those variants for postgresql versions" do
|
309
|
-
config = get_config(ruby: %W[2.1.5 2.4.0],
|
310
|
-
activerecord: %W[4.0 4.1],
|
311
|
-
db: %W[sqlite3 postgresql],
|
312
|
-
dbversions: {postgresql: %W[9.6 10]})
|
313
|
-
in_tmpdir do
|
314
|
-
SchemaDev::Travis.update(config)
|
315
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
316
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
317
|
-
# ./schema_dev.yml
|
318
|
-
# Please do not edit this file; any changes will be overwritten next time
|
319
|
-
# schema_dev gets run.
|
320
|
-
---
|
321
|
-
rvm:
|
322
|
-
- 2.1.5
|
323
|
-
- 2.4.0
|
324
|
-
gemfile:
|
325
|
-
- gemfiles/activerecord-4.0/Gemfile.sqlite3
|
326
|
-
- gemfiles/activerecord-4.1/Gemfile.sqlite3
|
327
|
-
before_script: bundle exec rake create_databases
|
328
|
-
after_script: bundle exec rake drop_databases
|
329
|
-
script: bundle exec rake travis
|
330
|
-
jobs:
|
331
|
-
include:
|
332
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
333
|
-
rvm: 2.1.5
|
334
|
-
addons:
|
335
|
-
postgresql: '9.6'
|
336
|
-
env: POSTGRESQL_DB_USER=postgres
|
337
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
338
|
-
rvm: 2.1.5
|
339
|
-
addons:
|
340
|
-
postgresql: '10'
|
341
|
-
apt:
|
342
|
-
packages:
|
343
|
-
- postgresql-10
|
344
|
-
- postgresql-client-10
|
345
|
-
env: POSTGRESQL_DB_USER=postgres
|
346
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
347
|
-
rvm: 2.1.5
|
348
|
-
addons:
|
349
|
-
postgresql: '9.6'
|
350
|
-
env: POSTGRESQL_DB_USER=postgres
|
351
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
352
|
-
rvm: 2.1.5
|
353
|
-
addons:
|
354
|
-
postgresql: '10'
|
355
|
-
apt:
|
356
|
-
packages:
|
357
|
-
- postgresql-10
|
358
|
-
- postgresql-client-10
|
359
|
-
env: POSTGRESQL_DB_USER=postgres
|
360
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
361
|
-
rvm: 2.4.0
|
362
|
-
addons:
|
363
|
-
postgresql: '9.6'
|
364
|
-
env: POSTGRESQL_DB_USER=postgres
|
365
|
-
- gemfile: gemfiles/activerecord-4.0/Gemfile.postgresql
|
366
|
-
rvm: 2.4.0
|
367
|
-
addons:
|
368
|
-
postgresql: '10'
|
369
|
-
apt:
|
370
|
-
packages:
|
371
|
-
- postgresql-10
|
372
|
-
- postgresql-client-10
|
373
|
-
env: POSTGRESQL_DB_USER=postgres
|
374
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
375
|
-
rvm: 2.4.0
|
376
|
-
addons:
|
377
|
-
postgresql: '9.6'
|
378
|
-
env: POSTGRESQL_DB_USER=postgres
|
379
|
-
- gemfile: gemfiles/activerecord-4.1/Gemfile.postgresql
|
380
|
-
rvm: 2.4.0
|
381
|
-
addons:
|
382
|
-
postgresql: '10'
|
383
|
-
apt:
|
384
|
-
packages:
|
385
|
-
- postgresql-10
|
386
|
-
- postgresql-client-10
|
387
|
-
env: POSTGRESQL_DB_USER=postgres
|
388
|
-
ENDTRAVIS
|
389
|
-
end
|
390
|
-
end
|
391
|
-
end
|
392
|
-
end
|