schema_dev 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/schema_dev/executor.rb +9 -4
- data/lib/schema_dev/matrix_executor.rb +1 -1
- data/lib/schema_dev/runner.rb +2 -1
- data/lib/schema_dev/version.rb +1 -1
- data/spec/gemfiles_spec.rb +3 -5
- data/spec/runner_spec.rb +70 -0
- data/spec/spec_helper.rb +10 -4
- data/spec/travis_spec.rb +3 -5
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a243f89c4a9cfec2c3e29c123bc4fad4ac11721a
|
4
|
+
data.tar.gz: 6d27a4c8b794f4ffee20189ad29214988b88ca47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f18188fb84170286ad74ca6a86ad6b979d2a034dbf40b02ed7004df7fea65767aedc8139d8bd069d2362ccce4a0fa08029930eb5830b51de0b56c93db7fa7b9
|
7
|
+
data.tar.gz: e7d2ecdf9fd7463aba97017b7bcf2319e575d37f3295f89a4b66550c5631e5c22a1acf278add87f126c921461bcbde798484206f9eb7a48f417ab0c5744f6e19
|
data/lib/schema_dev/executor.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'open3'
|
3
|
+
|
2
4
|
require_relative "ruby_selector"
|
3
5
|
require_relative "gemfile_selector"
|
4
6
|
|
@@ -17,10 +19,13 @@ module SchemaDev
|
|
17
19
|
puts "* #{fullcommand}"
|
18
20
|
return true if dry_run
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
@error = false
|
23
|
+
Open3.popen2e(fullcommand) do |i, oe, t|
|
24
|
+
oe.each {|line|
|
25
|
+
puts line
|
26
|
+
@error ||= (line =~ /(^Failed examples)|(rake aborted)|(LoadError)/)
|
27
|
+
}
|
28
|
+
@error ||= !t.value.success?
|
24
29
|
end
|
25
30
|
|
26
31
|
return !@error
|
data/lib/schema_dev/runner.rb
CHANGED
@@ -2,6 +2,7 @@ require 'shellwords'
|
|
2
2
|
|
3
3
|
require_relative 'matrix_executor'
|
4
4
|
require_relative 'travis'
|
5
|
+
require_relative 'gemfiles'
|
5
6
|
|
6
7
|
module SchemaDev
|
7
8
|
class Runner
|
@@ -10,7 +11,7 @@ module SchemaDev
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def travis
|
13
|
-
Travis.update(@config) and puts "* Updated #{
|
14
|
+
Travis.update(@config) and puts "* Updated #{Travis::TRAVIS_FILE}"
|
14
15
|
end
|
15
16
|
|
16
17
|
def gemfiles
|
data/lib/schema_dev/version.rb
CHANGED
data/spec/gemfiles_spec.rb
CHANGED
@@ -4,11 +4,9 @@ describe SchemaDev::Gemfiles do
|
|
4
4
|
|
5
5
|
it "copies listed files" do
|
6
6
|
config = get_config(ruby: %W[1.9.3 2.1.5], rails: %W[4.0 4.1], db: %W[sqlite3 postgresql])
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
expect(relevant_diff(config, "gemfiles")).to be_empty
|
11
|
-
end
|
7
|
+
in_tmpdir do
|
8
|
+
SchemaDev::Gemfiles.build(config)
|
9
|
+
expect(relevant_diff(config, "gemfiles")).to be_empty
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
data/spec/runner_spec.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'schema_dev/runner'
|
2
|
+
|
3
|
+
describe SchemaDev::Runner do
|
4
|
+
|
5
|
+
it "creates gemfiles" do
|
6
|
+
config = get_config(ruby: "2.1.3", rails: "4.0", db: "sqlite3")
|
7
|
+
runner = SchemaDev::Runner.new(config)
|
8
|
+
in_tmpdir do
|
9
|
+
expect{ runner.gemfiles }.to output("* Created gemfiles\n").to_stdout
|
10
|
+
expect(Pathname.new("gemfiles")).to be_directory
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "creates travis" do
|
15
|
+
config = get_config(ruby: "2.1.3", rails: "4.0", db: "sqlite3")
|
16
|
+
runner = SchemaDev::Runner.new(config)
|
17
|
+
in_tmpdir do
|
18
|
+
expect{ runner.travis }.to output("* Updated .travis.yml\n").to_stdout
|
19
|
+
expect(Pathname.new(".travis.yml")).to be_file
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "matrix" do
|
24
|
+
let(:config) { get_config(ruby: RUBY_VERSION, rails: "4.0", db: %W[sqlite3 postgresql]) }
|
25
|
+
let(:runner) { SchemaDev::Runner.new(config) }
|
26
|
+
|
27
|
+
let(:expected_output) { <<ENDOUTPUT.strip }
|
28
|
+
* Updated .travis.yml
|
29
|
+
|
30
|
+
|
31
|
+
*** ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3 [1 of 2]
|
32
|
+
|
33
|
+
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.sqlite3 SHELL=`which bash` chruby-exec ruby-#{RUBY_VERSION} -- %{cmd}
|
34
|
+
%{output}
|
35
|
+
|
36
|
+
*** ruby #{RUBY_VERSION} - rails 4.0 - db postgresql [2 of 2]
|
37
|
+
|
38
|
+
* /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.postgresql SHELL=`which bash` chruby-exec ruby-#{RUBY_VERSION} -- %{cmd}
|
39
|
+
%{output}
|
40
|
+
ENDOUTPUT
|
41
|
+
|
42
|
+
it "runs successfully" do
|
43
|
+
in_tmpdir do
|
44
|
+
expect{ runner.run("true") }.to output(expected_output % {cmd: 'true', output: nil}).to_stdout
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "reports error exits" do
|
49
|
+
in_tmpdir do
|
50
|
+
expect{ runner.run("false") }.to output(expected_output % {cmd: 'false', output: nil} + <<-ENDERR).to_stdout
|
51
|
+
|
52
|
+
*** 2 failures:
|
53
|
+
ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3
|
54
|
+
ruby #{RUBY_VERSION} - rails 4.0 - db postgresql
|
55
|
+
ENDERR
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "reports error messages" do
|
60
|
+
in_tmpdir do
|
61
|
+
expect{ runner.run("echo", "LoadError") }.to output(expected_output % {cmd: 'echo LoadError', output: "LoadError\n"} + <<-ENDERR).to_stdout
|
62
|
+
|
63
|
+
*** 2 failures:
|
64
|
+
ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3
|
65
|
+
ruby #{RUBY_VERSION} - rails 4.0 - db postgresql
|
66
|
+
ENDERR
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,12 +5,18 @@ require 'tmpdir'
|
|
5
5
|
|
6
6
|
require 'schema_dev/config'
|
7
7
|
|
8
|
-
def
|
9
|
-
SchemaDev::Config._reset
|
8
|
+
def in_tmpdir
|
10
9
|
Dir.mktmpdir do |dir|
|
11
10
|
Dir.chdir(dir) do
|
12
|
-
|
13
|
-
SchemaDev::Config.load
|
11
|
+
yield
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
15
|
+
|
16
|
+
def get_config(data)
|
17
|
+
SchemaDev::Config._reset
|
18
|
+
in_tmpdir do
|
19
|
+
Pathname.new(SchemaDev::CONFIG_FILE).open("w") {|f| f.write data.to_yaml }
|
20
|
+
SchemaDev::Config.load
|
21
|
+
end
|
22
|
+
end
|
data/spec/travis_spec.rb
CHANGED
@@ -8,10 +8,9 @@ describe SchemaDev::Travis do
|
|
8
8
|
db: %W[sqlite3 postgresql],
|
9
9
|
exclude: { ruby: "1.9.3", db: "postgresql" },
|
10
10
|
notify: 'me@example.com')
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
11
|
+
in_tmpdir do
|
12
|
+
SchemaDev::Travis.update(config)
|
13
|
+
expect(Pathname.new(".travis.yml").read).to eq <<ENDTRAVIS
|
15
14
|
# This file was auto-generated by the schema_dev tool, based on the data in
|
16
15
|
# ./schema_dev.yml
|
17
16
|
# Please do not edit this file; any changes will be overwritten next time
|
@@ -40,7 +39,6 @@ matrix:
|
|
40
39
|
gemfile: gemfiles/rails-4.1/Gemfile.postgresql
|
41
40
|
env: POSTGRESQL_DB_USER=postgres
|
42
41
|
ENDTRAVIS
|
43
|
-
end
|
44
42
|
end
|
45
43
|
end
|
46
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ronen barzel
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- schema_dev.gemspec
|
182
182
|
- spec/config_spec.rb
|
183
183
|
- spec/gemfiles_spec.rb
|
184
|
+
- spec/runner_spec.rb
|
184
185
|
- spec/spec_helper.rb
|
185
186
|
- spec/travis_spec.rb
|
186
187
|
- templates/gemfiles/Gemfile.base
|
@@ -228,5 +229,6 @@ summary: SchemaPlus development tools
|
|
228
229
|
test_files:
|
229
230
|
- spec/config_spec.rb
|
230
231
|
- spec/gemfiles_spec.rb
|
232
|
+
- spec/runner_spec.rb
|
231
233
|
- spec/spec_helper.rb
|
232
234
|
- spec/travis_spec.rb
|