schema_dev 1.2.3 → 1.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 065e03de91b32086d40e9503141ba424c3c08414
4
- data.tar.gz: fffb037423b5964c2c3b336008c8db4c2f4bccd6
3
+ metadata.gz: b3e90e72ec9c8d5f4ad5f33892d5a17f496700bf
4
+ data.tar.gz: caf430be490dde34eb6e58082c2fe9de12e7d96b
5
5
  SHA512:
6
- metadata.gz: d4ff7b29b23e8d439ffd7e511ab6f729e48536e8d005dac22378d7cb3b258653417992011e6c663b5ca77f8f6ad6fd5738e19b4854d551a2c3d6850f29bb22ef
7
- data.tar.gz: 774c1251427f514aba1cc3dde84539aa122faa2d1a6b9c1e8e5af6553a1f013967b0437438d16ce7cea821eb13d35fb435b59b2e6d494541af5b258c5114ec62
6
+ metadata.gz: 3a08016cbd5d97ec57805fcc60ef43f890378434c31cf22ce180af876f04c55e911ff9b5d96bf592abc053f32dd35f1982e8c06a9ce6296ce46b20206a63d7cd
7
+ data.tar.gz: 0327f9e26f5afc36ba900e6cbcfa09312737dc3fcde6377da84afec6de577ac2fc5f80f0db08af0d86c932edb970010338d331d3448bce64c004e58cc396fd66
data/.travis.yml CHANGED
@@ -1,2 +1,3 @@
1
1
  sudo: false
2
2
  rvm: 2.1.5
3
+ script: bundle exec rake travis
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/schema_dev.svg)](http://badge.fury.io/rb/schema_dev)
4
4
  [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_dev.svg)](http://travis-ci.org/SchemaPlus/schema_dev)
5
+ [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_dev.svg)](https://coveralls.io/r/SchemaPlus/schema_dev)
5
6
 
6
7
  Development tools for the SchemaPlus family of gems.
7
8
 
data/Rakefile CHANGED
@@ -2,3 +2,7 @@ require "bundler/gem_tasks"
2
2
 
3
3
  require 'rspec/core/rake_task'
4
4
  RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require 'coveralls/rake/task'
7
+ Coveralls::RakeTask.new
8
+ task :travis => [:spec, 'coveralls:push']
@@ -8,6 +8,9 @@ module SchemaDev
8
8
  end.new
9
9
  @@selector.command ruby
10
10
  end
11
+ def self._reset # for rspec, to avoid stickiness
12
+ @@selector = nil
13
+ end
11
14
 
12
15
  class Chruby
13
16
  def initialize
@@ -1,3 +1,3 @@
1
1
  module SchemaDev
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
data/spec/runner_spec.rb CHANGED
@@ -20,50 +20,85 @@ describe SchemaDev::Runner do
20
20
  end
21
21
  end
22
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) }
23
+ Selectors = {
24
+ 'chruby-exec' => "SHELL=`which bash` chruby-exec ruby-#{RUBY_VERSION} --",
25
+ 'rvm' => "rvm #{RUBY_VERSION} do",
26
+ 'rbenv' => "RBENV_VERSION=#{RUBY_VERSION}"
27
+ }
26
28
 
27
- let(:expected_output) { <<ENDOUTPUT.strip }
29
+ Selectors.each do |selector, selection_command|
30
+
31
+ describe "matrix (#{selector})" do
32
+ before(:each) do
33
+ # mocking RubySelector to find selector
34
+ SchemaDev::RubySelector._reset
35
+ Selectors.keys.each do |k|
36
+ allow(SchemaDev::RubySelector).to receive(:system).with("which -s #{k}").and_return k == selector
37
+ end
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, rails: "4.0", db: %W[sqlite3 postgresql]) }
58
+ let(:runner) { SchemaDev::Runner.new(config) }
59
+
60
+
61
+ let(:expected_output) { <<ENDOUTPUT.strip }
28
62
  * Updated .travis.yml
29
63
 
30
64
 
31
65
  *** ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3 [1 of 2]
32
66
 
33
- * /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.sqlite3 SHELL=`which bash` chruby-exec ruby-#{RUBY_VERSION} -- %{cmd}
67
+ * /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.sqlite3 #{selection_command} %{cmd}
34
68
  %{output}
35
69
 
36
70
  *** ruby #{RUBY_VERSION} - rails 4.0 - db postgresql [2 of 2]
37
71
 
38
- * /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.postgresql SHELL=`which bash` chruby-exec ruby-#{RUBY_VERSION} -- %{cmd}
72
+ * /usr/bin/env BUNDLE_GEMFILE=gemfiles/rails-4.0/Gemfile.postgresql #{selection_command} %{cmd}
39
73
  %{output}
40
74
  ENDOUTPUT
41
75
 
42
- it "runs successfully" do
43
- in_tmpdir do
44
- expect{ runner.run("true") }.to output(expected_output % {cmd: 'true', output: nil}).to_stdout
76
+ it "runs successfully" do
77
+ in_tmpdir do
78
+ expect{ runner.run("true") }.to output(expected_output % {cmd: 'true', output: nil}).to_stdout
79
+ end
45
80
  end
46
- end
47
81
 
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
82
+ it "reports error exits" do
83
+ in_tmpdir do
84
+ expect{ runner.run("false") }.to output(expected_output % {cmd: 'false', output: nil} + <<-ENDERR).to_stdout
51
85
 
52
86
  *** 2 failures:
53
- ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3
54
- ruby #{RUBY_VERSION} - rails 4.0 - db postgresql
55
- ENDERR
87
+ \truby #{RUBY_VERSION} - rails 4.0 - db sqlite3
88
+ \truby #{RUBY_VERSION} - rails 4.0 - db postgresql
89
+ ENDERR
90
+ end
56
91
  end
57
- end
58
92
 
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
93
+ it "reports error messages" do
94
+ in_tmpdir do
95
+ expect{ runner.run("echo", "LoadError") }.to output(expected_output % {cmd: 'echo LoadError', output: "LoadError\n"} + <<-ENDERR).to_stdout
62
96
 
63
97
  *** 2 failures:
64
- ruby #{RUBY_VERSION} - rails 4.0 - db sqlite3
65
- ruby #{RUBY_VERSION} - rails 4.0 - db postgresql
66
- ENDERR
98
+ \truby #{RUBY_VERSION} - rails 4.0 - db sqlite3
99
+ \truby #{RUBY_VERSION} - rails 4.0 - db postgresql
100
+ ENDERR
101
+ end
67
102
  end
68
103
  end
69
104
  end
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec :path => File.expand_path('..', __FILE__)
3
3
 
4
- gem "byebug" if RUBY_VERSION > "2"
4
+ platform :ruby do
5
+ gem "byebug" if RUBY_VERSION > "2"
6
+ 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.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ronen barzel