appraisal 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/appraisal.gemspec +1 -1
- data/lib/appraisal/cli.rb +10 -6
- data/lib/appraisal/dependency.rb +2 -1
- data/lib/appraisal/dependency_list.rb +3 -7
- data/lib/appraisal/file.rb +1 -1
- data/lib/appraisal/version.rb +1 -1
- data/spec/acceptance/cli/help_spec.rb +7 -0
- data/spec/acceptance/cli/install_spec.rb +6 -6
- data/spec/acceptance/gemfile_dsl_compatibility_spec.rb +32 -0
- data/spec/appraisal/appraisal_spec.rb +14 -22
- data/spec/appraisal/dependency_list_spec.rb +31 -0
- data/spec/appraisal/file_spec.rb +2 -2
- data/spec/appraisal/gemfile_spec.rb +9 -9
- data/spec/spec_helper.rb +7 -3
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c8641eb507a5a88d169b42f0b7f30c2aac144b
|
4
|
+
data.tar.gz: 5cb6384b487d939ff578c4f7e65c436632a6bd60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d1db3a083df8492fff63e046d57bdb05fbe24779e2b3c0262a0cfdb58c72cbeec1598a26eee03eed46ccdb1e99e64770e9f076afd2f76018471572d6593dc25
|
7
|
+
data.tar.gz: 0823f36867e229073caad10ae47ccb0cc3d2c3660832e7414e167b77809c3c960ea2a8faeed301f84f7470a2a0c389c7e7d142ab9ee9930b99abfc97d1975b81
|
data/.travis.yml
CHANGED
@@ -3,8 +3,8 @@ before_install: gem install bundler
|
|
3
3
|
rvm:
|
4
4
|
- 1.9.3
|
5
5
|
- 2.0.0
|
6
|
-
- 2.1.
|
7
|
-
- rbx
|
6
|
+
- 2.1.2
|
7
|
+
- rbx-2
|
8
8
|
- jruby-19mode
|
9
9
|
- ruby-head
|
10
10
|
- jruby-head
|
@@ -12,7 +12,7 @@ rvm:
|
|
12
12
|
matrix:
|
13
13
|
fast_finish: true
|
14
14
|
allow_failures:
|
15
|
-
- rvm: rbx
|
15
|
+
- rvm: rbx-2
|
16
16
|
- rvm: jruby-19mode
|
17
17
|
- rvm: ruby-head
|
18
18
|
- rvm: jruby-head
|
data/appraisal.gemspec
CHANGED
data/lib/appraisal/cli.rb
CHANGED
@@ -15,12 +15,15 @@ module Appraisal
|
|
15
15
|
|
16
16
|
If APPRAISAL_NAME is given, only run that EXTERNAL_COMMAND against the given
|
17
17
|
appraisal, otherwise it runs the EXTERNAL_COMMAND against all appraisals.
|
18
|
-
|
19
|
-
Available Appraisal(s):
|
20
18
|
help
|
21
19
|
|
22
|
-
File.
|
23
|
-
shell.say
|
20
|
+
if ::File.exist?('Appraisals')
|
21
|
+
shell.say
|
22
|
+
shell.say 'Available Appraisal(s):'
|
23
|
+
|
24
|
+
File.each do |appraisal|
|
25
|
+
shell.say " - #{appraisal.name}"
|
26
|
+
end
|
24
27
|
end
|
25
28
|
|
26
29
|
shell.say
|
@@ -33,8 +36,9 @@ module Appraisal
|
|
33
36
|
end
|
34
37
|
|
35
38
|
desc 'install', 'Resolve and install dependencies for each appraisal'
|
36
|
-
method_option 'jobs', aliases
|
37
|
-
|
39
|
+
method_option 'jobs', :aliases => 'j', :type => :numeric, :default => 1,
|
40
|
+
:banner => 'SIZE',
|
41
|
+
:desc => 'Install gems in parallel using the given number of workers.'
|
38
42
|
def install
|
39
43
|
invoke :generate, [], {}
|
40
44
|
|
data/lib/appraisal/dependency.rb
CHANGED
@@ -3,19 +3,15 @@ require 'appraisal/dependency'
|
|
3
3
|
module Appraisal
|
4
4
|
class DependencyList
|
5
5
|
def initialize
|
6
|
-
@
|
7
|
-
@dependencies = []
|
6
|
+
@dependencies = {}
|
8
7
|
end
|
9
8
|
|
10
9
|
def add(name, requirements)
|
11
|
-
|
12
|
-
@dependency_names << name
|
13
|
-
@dependencies << Dependency.new(name, requirements)
|
14
|
-
end
|
10
|
+
@dependencies[name] = Dependency.new(name, requirements)
|
15
11
|
end
|
16
12
|
|
17
13
|
def to_s
|
18
|
-
@dependencies.map(&:to_s).join("\n")
|
14
|
+
@dependencies.values.map(&:to_s).join("\n")
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data/lib/appraisal/file.rb
CHANGED
data/lib/appraisal/version.rb
CHANGED
@@ -14,4 +14,11 @@ describe 'CLI', 'appraisal help' do
|
|
14
14
|
expect(output).to include 'appraisal [APPRAISAL_NAME] EXTERNAL_COMMAND'
|
15
15
|
expect(output).to include '1.0.0'
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'prints out usage even Appraisals file does not exist' do
|
19
|
+
output = run 'appraisal help'
|
20
|
+
|
21
|
+
expect(output).to include 'Usage:'
|
22
|
+
expect(output).not_to include 'Unable to locate'
|
23
|
+
end
|
17
24
|
end
|
@@ -59,12 +59,12 @@ describe 'CLI', 'appraisal install' do
|
|
59
59
|
it 'ignores --jobs option if the job size is less than or equal to 1' do
|
60
60
|
output = run 'appraisal install --jobs=0'
|
61
61
|
|
62
|
-
expect(output).not_to include
|
63
|
-
'bundle install --gemfile=gemfiles/1.0.0.gemfile'
|
64
|
-
expect(output).not_to include
|
65
|
-
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=0'
|
66
|
-
expect(output).not_to include
|
67
|
-
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=1'
|
62
|
+
expect(output).not_to include(
|
63
|
+
'bundle install --gemfile=gemfiles/1.0.0.gemfile')
|
64
|
+
expect(output).not_to include(
|
65
|
+
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=0')
|
66
|
+
expect(output).not_to include(
|
67
|
+
'bundle install --gemfile=gemfiles/1.0.0.gemfile --jobs=1')
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -104,4 +104,36 @@ describe 'Gemfile DSL compatibility' do
|
|
104
104
|
gemspec :path => "../"
|
105
105
|
Gemfile
|
106
106
|
end
|
107
|
+
|
108
|
+
it "merges gem requirements" do
|
109
|
+
build_gem "bacon", "1.0.0"
|
110
|
+
build_gem "bacon", "1.1.0"
|
111
|
+
build_gem "bacon", "1.2.0"
|
112
|
+
|
113
|
+
build_gemfile <<-Gemfile
|
114
|
+
gem "appraisal", path: #{PROJECT_ROOT.inspect}
|
115
|
+
gem "bacon", "1.2.0"
|
116
|
+
Gemfile
|
117
|
+
|
118
|
+
build_appraisal_file <<-Appraisals
|
119
|
+
appraise "1.0.0" do
|
120
|
+
gem "bacon", "1.0.0"
|
121
|
+
end
|
122
|
+
|
123
|
+
appraise "1.1.0" do
|
124
|
+
gem "bacon", "1.1.0"
|
125
|
+
end
|
126
|
+
|
127
|
+
appraise "1.2.0" do
|
128
|
+
gem "bacon", "1.2.0"
|
129
|
+
end
|
130
|
+
Appraisals
|
131
|
+
|
132
|
+
run 'bundle install --local'
|
133
|
+
run 'appraisal generate'
|
134
|
+
|
135
|
+
expect(content_of "gemfiles/1.0.0.gemfile").to include('gem "bacon", "1.0.0"')
|
136
|
+
expect(content_of "gemfiles/1.1.0.gemfile").to include('gem "bacon", "1.1.0"')
|
137
|
+
expect(content_of "gemfiles/1.2.0.gemfile").to include('gem "bacon", "1.2.0"')
|
138
|
+
end
|
107
139
|
end
|
@@ -6,42 +6,34 @@ require 'active_support/core_ext/kernel/reporting'
|
|
6
6
|
describe Appraisal::Appraisal do
|
7
7
|
it "converts spaces to underscores in the gemfile path" do
|
8
8
|
appraisal = Appraisal::Appraisal.new("one two", "Gemfile")
|
9
|
-
appraisal.gemfile_path.
|
9
|
+
expect(appraisal.gemfile_path).to match(/one_two\.gemfile$/)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "converts punctuation to underscores in the gemfile path" do
|
13
13
|
appraisal = Appraisal::Appraisal.new("o&ne!", "Gemfile")
|
14
|
-
appraisal.gemfile_path.
|
14
|
+
expect(appraisal.gemfile_path).to match(/o_ne_\.gemfile$/)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "keeps dots in the gemfile path" do
|
18
18
|
appraisal = Appraisal::Appraisal.new("rails3.0", "Gemfile")
|
19
|
-
appraisal.gemfile_path.
|
19
|
+
expect(appraisal.gemfile_path).to match(/rails3\.0\.gemfile$/)
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
it "generates a gemfile with a newline at the end of file" do
|
23
|
+
output_file = Tempfile.new("gemfile")
|
24
|
+
appraisal = Appraisal::Appraisal.new("fake", "fake")
|
25
|
+
allow(appraisal).to receive(:gemfile_path).and_return(output_file.path)
|
26
26
|
|
27
|
-
|
28
|
-
@output.close
|
29
|
-
@output.unlink
|
30
|
-
end
|
27
|
+
appraisal.write_gemfile
|
31
28
|
|
32
|
-
|
33
|
-
appraisal = Appraisal::Appraisal.new('fake', 'fake')
|
34
|
-
appraisal.stub(:gemfile_path) { @output.path }
|
35
|
-
appraisal.write_gemfile
|
36
|
-
@output.read.should =~ /[^\n]*\n\z/m
|
37
|
-
end
|
29
|
+
expect(output_file.read).to match(/[^\n]*\n\z/m)
|
38
30
|
end
|
39
31
|
|
40
32
|
context 'parallel installation' do
|
41
33
|
before do
|
42
34
|
@appraisal = Appraisal::Appraisal.new('fake', 'fake')
|
43
|
-
@appraisal.
|
44
|
-
Appraisal::Command.
|
35
|
+
allow(@appraisal).to receive(:gemfile_path).and_return("/home/test/test directory")
|
36
|
+
allow(Appraisal::Command).to receive(:new).and_return(double(:run => true))
|
45
37
|
end
|
46
38
|
|
47
39
|
it 'runs single install command on Bundler < 1.4.0' do
|
@@ -51,9 +43,9 @@ describe Appraisal::Appraisal do
|
|
51
43
|
@appraisal.install(42)
|
52
44
|
end
|
53
45
|
|
54
|
-
Appraisal::Command.
|
46
|
+
expect(Appraisal::Command).to have_received(:new).
|
55
47
|
with("#{bundle_check_command} || #{bundle_single_install_command}")
|
56
|
-
warning.
|
48
|
+
expect(warning).to include 'Please upgrade Bundler'
|
57
49
|
end
|
58
50
|
|
59
51
|
it 'runs parallel install command on Bundler >= 1.4.0' do
|
@@ -61,7 +53,7 @@ describe Appraisal::Appraisal do
|
|
61
53
|
|
62
54
|
@appraisal.install(42)
|
63
55
|
|
64
|
-
Appraisal::Command.
|
56
|
+
expect(Appraisal::Command).to have_received(:new).
|
65
57
|
with("#{bundle_check_command} || #{bundle_parallel_install_command}")
|
66
58
|
end
|
67
59
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "appraisal/dependency_list"
|
3
|
+
|
4
|
+
describe Appraisal::DependencyList do
|
5
|
+
describe "#add" do
|
6
|
+
let(:dependency_list) { Appraisal::DependencyList.new }
|
7
|
+
|
8
|
+
it "adds dependency to the list" do
|
9
|
+
dependency_list.add("rails", ["4.1.4"])
|
10
|
+
|
11
|
+
expect(dependency_list.to_s).to eq %(gem "rails", "4.1.4")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "retains the order of dependencies" do
|
15
|
+
dependency_list.add("rails", ["4.1.4"])
|
16
|
+
dependency_list.add("bundler", ["1.7.2"])
|
17
|
+
|
18
|
+
expect(dependency_list.to_s).to eq <<-GEMS.strip_heredoc.strip
|
19
|
+
gem "rails", "4.1.4"
|
20
|
+
gem "bundler", "1.7.2"
|
21
|
+
GEMS
|
22
|
+
end
|
23
|
+
|
24
|
+
it "overrides dependency with the same name" do
|
25
|
+
dependency_list.add("rails", ["4.1.0"])
|
26
|
+
dependency_list.add("rails", ["4.1.4"])
|
27
|
+
|
28
|
+
expect(dependency_list.to_s).to eq %(gem "rails", "4.1.4")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/spec/appraisal/file_spec.rb
CHANGED
@@ -6,8 +6,8 @@ require 'appraisal/file'
|
|
6
6
|
require 'rspec/matchers/built_in/raise_error'
|
7
7
|
|
8
8
|
describe Appraisal::File do
|
9
|
-
it "
|
10
|
-
::File.
|
9
|
+
it "complains when no Appraisals file is found" do
|
10
|
+
allow(::File).to receive(:exist?).with("Appraisals").and_return(false)
|
11
11
|
expect { described_class.new }.to raise_error(Appraisal::AppraisalsNotFound)
|
12
12
|
end
|
13
13
|
end
|
@@ -5,14 +5,14 @@ require 'active_support/core_ext/string/strip'
|
|
5
5
|
describe Appraisal::Gemfile do
|
6
6
|
it "supports gemfiles without sources" do
|
7
7
|
gemfile = Appraisal::Gemfile.new
|
8
|
-
gemfile.to_s.strip.
|
8
|
+
expect(gemfile.to_s.strip).to eq ''
|
9
9
|
end
|
10
10
|
|
11
11
|
it "supports multiple sources" do
|
12
12
|
gemfile = Appraisal::Gemfile.new
|
13
13
|
gemfile.source "one"
|
14
14
|
gemfile.source "two"
|
15
|
-
gemfile.to_s.strip.
|
15
|
+
expect(gemfile.to_s.strip).to eq %{source "one"\nsource "two"}
|
16
16
|
end
|
17
17
|
|
18
18
|
it "preserves dependency order" do
|
@@ -20,13 +20,13 @@ describe Appraisal::Gemfile do
|
|
20
20
|
gemfile.gem "one"
|
21
21
|
gemfile.gem "two"
|
22
22
|
gemfile.gem "three"
|
23
|
-
gemfile.to_s.
|
23
|
+
expect(gemfile.to_s).to match(/one.*two.*three/m)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "supports symbol sources" do
|
27
27
|
gemfile = Appraisal::Gemfile.new
|
28
28
|
gemfile.source :one
|
29
|
-
gemfile.to_s.strip.
|
29
|
+
expect(gemfile.to_s.strip).to eq %{source :one}
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'supports group syntax' do
|
@@ -36,7 +36,7 @@ describe Appraisal::Gemfile do
|
|
36
36
|
gem "one"
|
37
37
|
end
|
38
38
|
|
39
|
-
gemfile.to_s.
|
39
|
+
expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip
|
40
40
|
group :development, :test do
|
41
41
|
gem "one"
|
42
42
|
end
|
@@ -50,7 +50,7 @@ describe Appraisal::Gemfile do
|
|
50
50
|
gem "one"
|
51
51
|
end
|
52
52
|
|
53
|
-
gemfile.to_s.
|
53
|
+
expect(gemfile.to_s).to eq <<-GEMFILE.strip_heredoc.strip
|
54
54
|
platforms :jruby do
|
55
55
|
gem "one"
|
56
56
|
end
|
@@ -61,7 +61,7 @@ describe Appraisal::Gemfile do
|
|
61
61
|
context "no contents" do
|
62
62
|
it "shows empty string" do
|
63
63
|
gemfile = Appraisal::Gemfile.new
|
64
|
-
gemfile.to_s.
|
64
|
+
expect(gemfile.to_s).to eq ''
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -71,7 +71,7 @@ describe Appraisal::Gemfile do
|
|
71
71
|
gemfile.source "source"
|
72
72
|
gemfile.gem "gem"
|
73
73
|
gemfile.gemspec
|
74
|
-
gemfile.to_s.
|
74
|
+
expect(gemfile.to_s).to match(/[^\n]\z/m)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -80,7 +80,7 @@ describe Appraisal::Gemfile do
|
|
80
80
|
gemfile = Appraisal::Gemfile.new
|
81
81
|
gemfile.source "source"
|
82
82
|
gemfile.gem "gem"
|
83
|
-
gemfile.to_s.
|
83
|
+
expect(gemfile.to_s).to match(/[^\n]\z/m)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,7 +6,11 @@ PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze
|
|
6
6
|
TMP_GEM_ROOT = File.join(PROJECT_ROOT, "tmp", "gems")
|
7
7
|
|
8
8
|
RSpec.configure do |config|
|
9
|
-
config.
|
10
|
-
|
11
|
-
}
|
9
|
+
config.raise_errors_for_deprecations!
|
10
|
+
|
11
|
+
config.define_derived_metadata(:file_path => %r{spec\/acceptance\/}) do |metadata|
|
12
|
+
metadata[:type] = :acceptance
|
13
|
+
end
|
14
|
+
|
15
|
+
config.include AcceptanceTestHelpers, :type => :acceptance
|
12
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appraisal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Ferris
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '3.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '3.0'
|
84
84
|
description: Appraisal integrates with bundler and rake to test your library against
|
85
85
|
different versions of dependencies in repeatable scenarios called "appraisals."
|
86
86
|
email:
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- spec/acceptance/gemfile_dsl_compatibility_spec.rb
|
131
131
|
- spec/acceptance/gemspec_spec.rb
|
132
132
|
- spec/appraisal/appraisal_spec.rb
|
133
|
+
- spec/appraisal/dependency_list_spec.rb
|
133
134
|
- spec/appraisal/file_spec.rb
|
134
135
|
- spec/appraisal/gemfile_spec.rb
|
135
136
|
- spec/appraisal/gemspec_spec.rb
|
@@ -174,6 +175,7 @@ test_files:
|
|
174
175
|
- spec/acceptance/gemfile_dsl_compatibility_spec.rb
|
175
176
|
- spec/acceptance/gemspec_spec.rb
|
176
177
|
- spec/appraisal/appraisal_spec.rb
|
178
|
+
- spec/appraisal/dependency_list_spec.rb
|
177
179
|
- spec/appraisal/file_spec.rb
|
178
180
|
- spec/appraisal/gemfile_spec.rb
|
179
181
|
- spec/appraisal/gemspec_spec.rb
|