appraisal 1.0.0.beta3 → 1.0.0
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/Rakefile +2 -8
- data/appraisal.gemspec +0 -2
- data/bin/appraisal +6 -1
- data/features/support/dependency_helpers.rb +27 -21
- data/lib/appraisal/appraisal.rb +30 -2
- data/lib/appraisal/dependency.rb +3 -5
- data/lib/appraisal/dependency_list.rb +21 -0
- data/lib/appraisal/gemfile.rb +37 -27
- data/lib/appraisal/gemspec.rb +5 -4
- data/lib/appraisal/git_source.rb +12 -4
- data/lib/appraisal/group.rb +11 -4
- data/lib/appraisal/path_source.rb +31 -0
- data/lib/appraisal/platform.rb +12 -4
- data/lib/appraisal/task.rb +10 -7
- data/lib/appraisal/utils.rb +21 -0
- data/lib/appraisal/version.rb +1 -1
- data/spec/acceptance/appraisals_file_bundler_dsl_compatibility_spec.rb +98 -0
- data/spec/acceptance/cli/clean_spec.rb +20 -0
- data/spec/acceptance/cli/generate_spec.rb +28 -0
- data/spec/acceptance/cli/help_spec.rb +17 -0
- data/spec/acceptance/cli/install_spec.rb +70 -0
- data/spec/acceptance/cli/run_spec.rb +47 -0
- data/spec/acceptance/cli/update_spec.rb +43 -0
- data/spec/acceptance/cli/with_no_arguments_spec.rb +16 -0
- data/spec/acceptance/gemfile_dsl_compatibility_spec.rb +107 -0
- data/spec/acceptance/gemspec_spec.rb +75 -0
- data/spec/appraisal/gemspec_spec.rb +22 -0
- data/spec/appraisal/utils_spec.rb +24 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/support/acceptance_test_helpers.rb +73 -35
- data/spec/support/dependency_helpers.rb +49 -0
- metadata +32 -48
- data/features/appraisals.feature +0 -105
- data/features/bundler_gemfile_compatibility.feature +0 -70
- data/features/gemspec.feature +0 -68
- data/features/missing_appraisals_file.feature +0 -23
- data/features/step_definitions/dependency_steps.rb +0 -24
- data/features/support/aruba.rb +0 -4
- data/features/support/env.rb +0 -11
- data/spec/acceptance/cli_spec.rb +0 -233
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7235cdefdbcdbd117d7af0c2d8cc5c32598afa9f
|
4
|
+
data.tar.gz: 61e43a15a3402034ab64749580abcfc06ff944f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfddd86b51ffb0fae598dd4751466f7ccbb826020ffb818c471cc6b2bf67a1208e2c7c913baa64ddfffed51fe7a5f3b85702e5f1f860b747c20a2853bf287ff5
|
7
|
+
data.tar.gz: c04030efcbe4c934206002e43552af9c28d7449324a6c53b7fb5d1e9b66105a4bac9c2faf51de7644447fd5c09bd013ce3af2593d25e3344345e8b4e805e7ab1
|
data/Rakefile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'bundler/gem_tasks'
|
3
3
|
require 'rspec/core/rake_task'
|
4
|
-
require 'cucumber/rake/task'
|
5
4
|
|
6
5
|
RSpec::Core::RakeTask.new do |t|
|
7
6
|
t.pattern = 'spec/**/*_spec.rb'
|
@@ -9,10 +8,5 @@ RSpec::Core::RakeTask.new do |t|
|
|
9
8
|
t.verbose = false
|
10
9
|
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Default: run the rspec examples and cucumber scenarios"
|
18
|
-
task :default => [:spec, :cucumber]
|
11
|
+
desc 'Default: run the rspec examples'
|
12
|
+
task :default => [:spec]
|
data/appraisal.gemspec
CHANGED
@@ -23,7 +23,5 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency('thor', '>= 0.14.0')
|
24
24
|
|
25
25
|
s.add_development_dependency('activesupport', '>= 3.2.13')
|
26
|
-
s.add_development_dependency('cucumber', '~> 1.0')
|
27
26
|
s.add_development_dependency('rspec', '~> 2.6')
|
28
|
-
s.add_development_dependency('aruba', '~> 0.5.1')
|
29
27
|
end
|
data/bin/appraisal
CHANGED
@@ -1,26 +1,32 @@
|
|
1
1
|
module DependencyHelpers
|
2
|
-
def build_gem(
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
2
|
+
def build_gem(gem_name, version)
|
3
|
+
FileUtils.mkdir_p "tmp/aruba/#{gem_name}/lib"
|
4
|
+
|
5
|
+
FileUtils.cd "tmp/aruba/#{gem_name}" do
|
6
|
+
gemspec = "#{gem_name}.gemspec"
|
7
|
+
lib_file = "lib/#{gem_name}.rb"
|
8
|
+
|
9
|
+
File.open gemspec, 'w' do |file|
|
10
|
+
file.puts <<-gemspec
|
11
|
+
Gem::Specification.new do |s|
|
12
|
+
s.name = #{gem_name.inspect}
|
13
|
+
s.version = #{version.inspect}
|
14
|
+
s.authors = 'Mr. Smith'
|
15
|
+
s.summary = 'summary'
|
16
|
+
s.files = #{lib_file.inspect}
|
17
|
+
end
|
18
|
+
gemspec
|
19
|
+
end
|
20
|
+
|
21
|
+
File.open lib_file, 'w' do |file|
|
22
|
+
file.puts "$#{gem_name}_version = '#{version}'"
|
15
23
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
FileUtils.rm_rf(File.join(current_dir, name))
|
23
|
-
dirs.pop
|
24
|
+
|
25
|
+
`gem build #{gemspec} 2>&1`
|
26
|
+
|
27
|
+
ENV['GEM_HOME'] = TMP_GEM_ROOT
|
28
|
+
`gem install #{gem_name}-#{version}.gem 2>&1`
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
data/lib/appraisal/appraisal.rb
CHANGED
@@ -14,8 +14,36 @@ module Appraisal
|
|
14
14
|
@gemfile = source_gemfile.dup
|
15
15
|
end
|
16
16
|
|
17
|
-
def gem(
|
18
|
-
gemfile.gem(
|
17
|
+
def gem(*args)
|
18
|
+
gemfile.gem(*args)
|
19
|
+
end
|
20
|
+
|
21
|
+
def source(*args)
|
22
|
+
gemfile.source(*args)
|
23
|
+
end
|
24
|
+
|
25
|
+
def ruby(*args)
|
26
|
+
gemfile.ruby(*args)
|
27
|
+
end
|
28
|
+
|
29
|
+
def git(*args, &block)
|
30
|
+
gemfile.git(*args, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def path(*args, &block)
|
34
|
+
gemfile.path(*args, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
def group(*args, &block)
|
38
|
+
gemfile.group(*args, &block)
|
39
|
+
end
|
40
|
+
|
41
|
+
def platforms(*args, &block)
|
42
|
+
gemfile.platforms(*args, &block)
|
43
|
+
end
|
44
|
+
|
45
|
+
def gemspec(options = {})
|
46
|
+
gemfile.gemspec(options)
|
19
47
|
end
|
20
48
|
|
21
49
|
def write_gemfile
|
data/lib/appraisal/dependency.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'appraisal/utils'
|
2
|
+
|
1
3
|
module Appraisal
|
2
4
|
# Dependency on a gem and optional version requirements
|
3
5
|
class Dependency
|
@@ -12,7 +14,7 @@ module Appraisal
|
|
12
14
|
if no_requirements?
|
13
15
|
gem_name
|
14
16
|
else
|
15
|
-
"#{gem_name}, #{
|
17
|
+
"#{gem_name}, #{Utils.format_arguments(requirements)}"
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -25,9 +27,5 @@ module Appraisal
|
|
25
27
|
def no_requirements?
|
26
28
|
requirements.nil? || requirements.empty?
|
27
29
|
end
|
28
|
-
|
29
|
-
def inspect_requirements
|
30
|
-
requirements.map { |requirement| requirement.inspect.gsub(/^\{|\}$/, '') }.join(", ")
|
31
|
-
end
|
32
30
|
end
|
33
31
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'appraisal/dependency'
|
2
|
+
|
3
|
+
module Appraisal
|
4
|
+
class DependencyList
|
5
|
+
def initialize
|
6
|
+
@dependency_names = []
|
7
|
+
@dependencies = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def add(name, requirements)
|
11
|
+
unless @dependency_names.include?(name)
|
12
|
+
@dependency_names << name
|
13
|
+
@dependencies << Dependency.new(name, requirements)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
@dependencies.map(&:to_s).join("\n")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/appraisal/gemfile.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
require 'appraisal/
|
1
|
+
require 'appraisal/dependency_list'
|
2
2
|
require 'appraisal/gemspec'
|
3
|
+
require 'appraisal/git_source'
|
4
|
+
require 'appraisal/path_source'
|
5
|
+
require 'appraisal/group'
|
6
|
+
require 'appraisal/platform'
|
3
7
|
|
4
8
|
module Appraisal
|
5
9
|
# Load bundler Gemfiles and merge dependencies
|
@@ -9,11 +13,12 @@ module Appraisal
|
|
9
13
|
def initialize
|
10
14
|
@sources = []
|
11
15
|
@ruby_version = nil
|
12
|
-
@dependencies =
|
16
|
+
@dependencies = DependencyList.new
|
13
17
|
@gemspec = nil
|
14
|
-
@groups =
|
15
|
-
@platforms =
|
16
|
-
@git_sources =
|
18
|
+
@groups = {}
|
19
|
+
@platforms = {}
|
20
|
+
@git_sources = {}
|
21
|
+
@path_sources = {}
|
17
22
|
end
|
18
23
|
|
19
24
|
def load(path)
|
@@ -25,26 +30,19 @@ module Appraisal
|
|
25
30
|
end
|
26
31
|
|
27
32
|
def gem(name, *requirements)
|
28
|
-
@dependencies.
|
29
|
-
@dependencies << Dependency.new(name, requirements)
|
33
|
+
@dependencies.add(name, requirements)
|
30
34
|
end
|
31
35
|
|
32
36
|
def group(*names, &block)
|
33
|
-
|
34
|
-
|
35
|
-
group = Group.new(names)
|
36
|
-
group.run(&block)
|
37
|
-
@groups << group
|
37
|
+
@groups[names] ||= Group.new(names)
|
38
|
+
@groups[names].run(&block)
|
38
39
|
end
|
39
40
|
|
40
41
|
alias_method :groups, :group
|
41
42
|
|
42
43
|
def platforms(*names, &block)
|
43
|
-
|
44
|
-
|
45
|
-
platform = Platform.new(names)
|
46
|
-
platform.run(&block)
|
47
|
-
@platforms << platform
|
44
|
+
@platforms[names] ||= Platform.new(names)
|
45
|
+
@platforms[names].run(&block)
|
48
46
|
end
|
49
47
|
|
50
48
|
def source(source)
|
@@ -56,16 +54,24 @@ module Appraisal
|
|
56
54
|
end
|
57
55
|
|
58
56
|
def git(source, options = {}, &block)
|
59
|
-
|
57
|
+
@git_sources[source] ||= GitSource.new(source, options)
|
58
|
+
@git_sources[source].run(&block)
|
59
|
+
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
@
|
61
|
+
def path(source, options = {}, &block)
|
62
|
+
@path_sources[source] ||= PathSource.new(source, options)
|
63
|
+
@path_sources[source].run(&block)
|
64
64
|
end
|
65
65
|
|
66
66
|
def to_s
|
67
|
-
[source_entry,
|
68
|
-
|
67
|
+
[source_entry,
|
68
|
+
ruby_version_entry,
|
69
|
+
git_sources_entry,
|
70
|
+
path_sources_entry,
|
71
|
+
dependencies_entry,
|
72
|
+
groups_entry,
|
73
|
+
platforms_entry,
|
74
|
+
gemspec_entry].reject{ |s| s.nil? || s.empty? }.join("\n\n").strip
|
69
75
|
end
|
70
76
|
|
71
77
|
def dup
|
@@ -91,19 +97,23 @@ module Appraisal
|
|
91
97
|
end
|
92
98
|
|
93
99
|
def git_sources_entry
|
94
|
-
@git_sources.map(&:to_s).join("\n\n")
|
100
|
+
@git_sources.values.map(&:to_s).join("\n\n")
|
101
|
+
end
|
102
|
+
|
103
|
+
def path_sources_entry
|
104
|
+
@path_sources.values.map(&:to_s).join("\n\n")
|
95
105
|
end
|
96
106
|
|
97
107
|
def dependencies_entry
|
98
|
-
dependencies.
|
108
|
+
@dependencies.to_s
|
99
109
|
end
|
100
110
|
|
101
111
|
def groups_entry
|
102
|
-
@groups.map(&:to_s).join("\n\n")
|
112
|
+
@groups.values.map(&:to_s).join("\n\n")
|
103
113
|
end
|
104
114
|
|
105
115
|
def platforms_entry
|
106
|
-
@platforms.map(&:to_s).join("\n\n")
|
116
|
+
@platforms.values.map(&:to_s).join("\n\n")
|
107
117
|
end
|
108
118
|
|
109
119
|
def gemspec_entry
|
data/lib/appraisal/gemspec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'appraisal/utils'
|
2
2
|
|
3
3
|
module Appraisal
|
4
4
|
class Gemspec
|
@@ -10,18 +10,19 @@ module Appraisal
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def to_s
|
13
|
-
"gemspec #{
|
13
|
+
"gemspec #{Utils.format_string(exported_options)}"
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def exported_options
|
19
19
|
# Check to see if this is an absolute path
|
20
|
-
if @options[:path] =~ /^(?:\/|\S:)/
|
20
|
+
if @options[:path] =~ /^(?:\/|\S:)/ || @options[:path] == '../'
|
21
21
|
@options
|
22
22
|
else
|
23
23
|
# Remove leading ./ from path, if any
|
24
|
-
|
24
|
+
cleaned_path = @options[:path].gsub(/(^|\/)\.\/?/, '\1')
|
25
|
+
exported_path = ::File.join("..", cleaned_path)
|
25
26
|
@options.merge(:path => exported_path)
|
26
27
|
end
|
27
28
|
end
|
data/lib/appraisal/git_source.rb
CHANGED
@@ -1,22 +1,30 @@
|
|
1
|
+
require 'appraisal/dependency_list'
|
2
|
+
require 'appraisal/utils'
|
3
|
+
|
1
4
|
module Appraisal
|
2
|
-
class GitSource
|
5
|
+
class GitSource
|
3
6
|
def initialize(source, options = {})
|
4
|
-
|
7
|
+
@dependencies = DependencyList.new
|
5
8
|
@source = source
|
6
9
|
@options = options
|
7
10
|
end
|
8
11
|
|
12
|
+
def gem(name, *requirements)
|
13
|
+
@dependencies.add(name, requirements)
|
14
|
+
end
|
15
|
+
|
9
16
|
def run(&block)
|
10
17
|
instance_exec(&block)
|
11
18
|
end
|
12
19
|
|
13
20
|
def to_s
|
14
|
-
dependencies =
|
21
|
+
dependencies = @dependencies.to_s.strip.gsub(/^/, ' ')
|
15
22
|
|
16
23
|
if @options.empty?
|
17
24
|
"git #{@source.inspect} do\n#{dependencies}\nend"
|
18
25
|
else
|
19
|
-
"git #{@source.inspect}, #{@options
|
26
|
+
"git #{@source.inspect}, #{Utils.format_string(@options)} do\n" +
|
27
|
+
"#{dependencies}\nend"
|
20
28
|
end
|
21
29
|
end
|
22
30
|
end
|
data/lib/appraisal/group.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
require 'appraisal/dependency_list'
|
2
|
+
require 'appraisal/utils'
|
3
|
+
|
1
4
|
module Appraisal
|
2
|
-
class Group
|
5
|
+
class Group
|
3
6
|
def initialize(group_names)
|
4
|
-
|
7
|
+
@dependencies = DependencyList.new
|
5
8
|
@group_names = group_names
|
6
9
|
end
|
7
10
|
|
@@ -9,9 +12,13 @@ module Appraisal
|
|
9
12
|
instance_exec(&block)
|
10
13
|
end
|
11
14
|
|
15
|
+
def gem(name, *requirements)
|
16
|
+
@dependencies.add(name, requirements)
|
17
|
+
end
|
18
|
+
|
12
19
|
def to_s
|
13
|
-
"group #{@group_names
|
14
|
-
|
20
|
+
"group #{Utils.format_arguments(@group_names)} do\n" +
|
21
|
+
@dependencies.to_s.strip.gsub(/^/, ' ') + "\nend"
|
15
22
|
end
|
16
23
|
end
|
17
24
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'appraisal/dependency_list'
|
2
|
+
require 'appraisal/utils'
|
3
|
+
|
4
|
+
module Appraisal
|
5
|
+
class PathSource
|
6
|
+
def initialize(source, options = {})
|
7
|
+
@dependencies = DependencyList.new
|
8
|
+
@source = source
|
9
|
+
@options = options
|
10
|
+
end
|
11
|
+
|
12
|
+
def gem(name, *requirements)
|
13
|
+
@dependencies.add(name, requirements)
|
14
|
+
end
|
15
|
+
|
16
|
+
def run(&block)
|
17
|
+
instance_exec(&block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
dependencies = @dependencies.to_s.strip.gsub(/^/, ' ')
|
22
|
+
|
23
|
+
if @options.empty?
|
24
|
+
"path #{@source.inspect} do\n#{dependencies}\nend"
|
25
|
+
else
|
26
|
+
"path #{@source.inspect}, #{Utils.format_string(@options)} do\n" +
|
27
|
+
"#{dependencies}\nend"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/appraisal/platform.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
+
require 'appraisal/dependency_list'
|
2
|
+
require 'appraisal/utils'
|
3
|
+
|
1
4
|
module Appraisal
|
2
|
-
class Platform
|
5
|
+
class Platform
|
3
6
|
def initialize(platform_names)
|
4
|
-
|
7
|
+
@dependencies = DependencyList.new
|
5
8
|
@platform_names = platform_names
|
6
9
|
end
|
7
10
|
|
11
|
+
def gem(name, *requirements)
|
12
|
+
@dependencies.add(name, requirements)
|
13
|
+
end
|
14
|
+
|
8
15
|
def run(&block)
|
9
16
|
instance_exec(&block)
|
10
17
|
end
|
11
18
|
|
12
19
|
def to_s
|
13
|
-
"platforms #{@platform_names
|
14
|
-
|
20
|
+
"platforms #{Utils.format_arguments(@platform_names)} do\n" +
|
21
|
+
@dependencies.to_s.strip.gsub(/^/, ' ') +
|
22
|
+
"\nend"
|
15
23
|
end
|
16
24
|
end
|
17
25
|
end
|