rubygems-tasks 0.2.4 → 0.2.6

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.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +27 -0
  3. data/.gitignore +4 -3
  4. data/.travis.yml +9 -0
  5. data/ChangeLog.md +13 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE.txt +1 -1
  8. data/README.md +23 -12
  9. data/Rakefile +7 -66
  10. data/gemspec.yml +16 -4
  11. data/lib/rubygems/tasks/build/gem.rb +0 -2
  12. data/lib/rubygems/tasks/build/tar.rb +0 -2
  13. data/lib/rubygems/tasks/build/task.rb +9 -14
  14. data/lib/rubygems/tasks/console.rb +1 -4
  15. data/lib/rubygems/tasks/install.rb +1 -1
  16. data/lib/rubygems/tasks/project.rb +3 -3
  17. data/lib/rubygems/tasks/push.rb +2 -2
  18. data/lib/rubygems/tasks/sign/checksum.rb +3 -2
  19. data/lib/rubygems/tasks/sign/pgp.rb +1 -1
  20. data/lib/rubygems/tasks/sign/task.rb +13 -17
  21. data/lib/rubygems/tasks/task.rb +14 -8
  22. data/lib/rubygems/tasks.rb +140 -2
  23. data/rubygems-tasks.gemspec +39 -87
  24. data/spec/console_spec.rb +43 -20
  25. data/spec/install_spec.rb +5 -1
  26. data/spec/project_spec.rb +30 -27
  27. data/spec/projects/bundler-project/.gitignore +17 -0
  28. data/spec/projects/bundler-project/Gemfile +4 -0
  29. data/spec/projects/bundler-project/LICENSE +22 -0
  30. data/spec/projects/bundler-project/README.md +29 -0
  31. data/spec/projects/bundler-project/Rakefile +2 -0
  32. data/spec/projects/bundler-project/bundler-project.gemspec +19 -0
  33. data/spec/projects/bundler-project/lib/bundler-project/version.rb +5 -0
  34. data/spec/projects/bundler-project/lib/bundler-project.rb +7 -0
  35. data/spec/projects/rubygems-multi-project/.gitignore +17 -0
  36. data/spec/projects/rubygems-multi-project/LICENSE.txt +22 -0
  37. data/spec/projects/rubygems-multi-project/README.md +21 -0
  38. data/spec/projects/rubygems-multi-project/lib/rubygems/project/version.rb +5 -0
  39. data/spec/projects/rubygems-multi-project/rubygems-project-lite.gemspec +19 -0
  40. data/spec/projects/rubygems-multi-project/rubygems-project.gemspec +19 -0
  41. data/spec/projects/rubygems-project/.gitignore +17 -0
  42. data/spec/projects/rubygems-project/LICENSE.txt +22 -0
  43. data/spec/projects/rubygems-project/README.md +21 -0
  44. data/spec/projects/rubygems-project/lib/rubygems/project/version.rb +5 -0
  45. data/spec/projects/rubygems-project/rubygems-project.gemspec +19 -0
  46. data/spec/push_spec.rb +2 -2
  47. data/spec/rake_context.rb +1 -3
  48. data/spec/scm/push_spec.rb +7 -7
  49. data/spec/scm/status_spec.rb +6 -6
  50. data/spec/scm/tag_spec.rb +18 -18
  51. data/spec/sign/pgp_spec.rb +1 -1
  52. data/spec/spec_helper.rb +25 -8
  53. data/spec/tasks_spec.rb +171 -55
  54. metadata +99 -87
  55. data/lib/rubygems/tasks/tasks.rb +0 -147
@@ -2,8 +2,146 @@ require 'rubygems/tasks/console'
2
2
  require 'rubygems/tasks/build'
3
3
  require 'rubygems/tasks/install'
4
4
  require 'rubygems/tasks/scm'
5
- require 'rubygems/tasks/scm'
6
5
  require 'rubygems/tasks/push'
7
6
  require 'rubygems/tasks/release'
8
7
  require 'rubygems/tasks/sign'
9
- require 'rubygems/tasks/tasks'
8
+
9
+ require 'rake/tasklib'
10
+ require 'ostruct'
11
+
12
+ module Gem
13
+ #
14
+ # Defines basic Rake tasks for managing and releasing projects:
15
+ #
16
+ # * {Build::Gem build:gem}
17
+ # * {Build::Tar build:tar}
18
+ # * {Build::Zip build:zip}
19
+ # * {SCM::Status scm:status}
20
+ # * {SCM::Push scm:push}
21
+ # * {SCM::Tag scm:tag}
22
+ # * {Console console}
23
+ # * {Install install}
24
+ # * {Push push}
25
+ # * {Release release}
26
+ # * {Sign::Checksum sign:checksum}
27
+ # * {Sign::PGP sign:pgp}
28
+ #
29
+ class Tasks
30
+
31
+ #
32
+ # The `build` tasks.
33
+ #
34
+ # @return [OpenStruct]
35
+ # The collection of `build` tasks.
36
+ #
37
+ attr_reader :build
38
+
39
+ #
40
+ # The `scm` tasks.
41
+ #
42
+ # @return [OpenStruct]
43
+ # The collection of `scm` tasks.
44
+ #
45
+ attr_reader :scm
46
+
47
+ #
48
+ # The `sign` tasks.
49
+ #
50
+ # @return [OpenStruct]
51
+ # The collection of `sign` tasks.
52
+ #
53
+ attr_reader :sign
54
+
55
+ # The {Console console} task.
56
+ attr_reader :console
57
+
58
+ # The {Install install} task.
59
+ attr_reader :install
60
+
61
+ # The {Push push} task.
62
+ attr_reader :push
63
+
64
+ # The {Release release} task.
65
+ attr_reader :release
66
+
67
+ #
68
+ # Initializes the project tasks.
69
+ #
70
+ # @param [Hash{Symbol => Hash}] options
71
+ # Enables or disables individual tasks.
72
+ #
73
+ # @option options [Hash{Symbol => Boolean}] :build
74
+ # Enables or disables the `build` tasks.
75
+ #
76
+ # @option options [Hash{Symbol => Boolean}] :scm
77
+ # Enables or disables the `scm` tasks.
78
+ #
79
+ # @option options [Boolean] :console (true)
80
+ # Enables or disables the {Console console} task.
81
+ #
82
+ # @option options [Boolean] :install (true)
83
+ # Enables or disables the {Install install} task.
84
+ #
85
+ # @option options [Boolean] :push (true)
86
+ # Enables or disables the {Push push} task.
87
+ #
88
+ # @option options [Boolean] :release (true)
89
+ # Enables or disables the {Release release} task.
90
+ #
91
+ # @option options [Hash{Symbol => Boolean}] :sign
92
+ # Enables or disables the `sign` tasks.
93
+ #
94
+ # @yield [tasks]
95
+ # If a block is given, it will be passed the newly created tasks,
96
+ # before they are fully defined.
97
+ #
98
+ # @yieldparam [Tasks] tasks
99
+ # The newly created tasks.
100
+ #
101
+ # @example Enables building of `.gem` and `.tar.gz` packages:
102
+ # Gem::Tasks.new(build: {gem: true, tar: true})
103
+ #
104
+ # @example Disables pushing `.gem` packages to [rubygems.org](rubygems.org):
105
+ # Gem::Tasks.new(push: false)
106
+ #
107
+ # @example Configures the version tag format:
108
+ # Gem::Tasks.new do |tasks|
109
+ # tasks.scm.tag.format = "release-%s"
110
+ # end
111
+ #
112
+ def initialize(options={})
113
+ build_options = options.fetch(:build,{})
114
+ scm_options = options.fetch(:scm,{})
115
+ sign_options = options.fetch(:sign,{})
116
+
117
+ @scm = OpenStruct.new
118
+ @build = OpenStruct.new
119
+ @sign = OpenStruct.new
120
+
121
+ if build_options
122
+ @build.gem = (Build::Gem.new if build_options.fetch(:gem,true))
123
+ @build.tar = (Build::Tar.new if build_options[:tar])
124
+ @build.zip = (Build::Zip.new if build_options[:zip])
125
+ end
126
+
127
+ if scm_options
128
+ @scm.status = (SCM::Status.new if scm_options.fetch(:status,true))
129
+ @scm.tag = (SCM::Tag.new if scm_options.fetch(:tag,true))
130
+ @scm.push = (SCM::Push.new if scm_options.fetch(:push,true))
131
+ end
132
+
133
+ if sign_options
134
+ @sign.checksum = (Sign::Checksum.new if sign_options[:checksum])
135
+ @sign.pgp = (Sign::PGP.new if sign_options[:pgp])
136
+ end
137
+
138
+ @console = (Console.new if options.fetch(:console,true))
139
+ @install = (Install.new if options.fetch(:install,true))
140
+ @push = (Push.new if options.fetch(:push,true))
141
+ @release = (Release.new if options.fetch(:release,true))
142
+
143
+ yield self if block_given?
144
+ end
145
+
146
+ end
147
+ end
@@ -2,108 +2,60 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- Gem::Specification.new do |gemspec|
6
- files = if File.directory?('.git')
7
- `git ls-files`.split($/)
8
- elsif File.directory?('.hg')
9
- `hg manifest`.split($/)
10
- elsif File.directory?('.svn')
11
- `svn ls -R`.split($/).select { |path| File.file?(path) }
12
- else
13
- Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
14
- end
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
15
7
 
16
- filter_files = lambda { |paths|
17
- case paths
18
- when Array
19
- (files & paths)
20
- when String
21
- (files & Dir[paths])
22
- end
23
- }
24
-
25
- version = {
26
- :file => 'lib/rubygems/tasks/version.rb',
27
- :constant => 'Gem::Tasks::VERSION'
28
- }
29
-
30
- defaults = {
31
- 'name' => File.basename(File.dirname(__FILE__)),
32
- 'files' => files,
33
- 'require_paths' => ['ext', 'lib'].select { |dir| File.directory?(dir) },
34
- 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
35
- 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
36
- 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}']
37
- }
38
-
39
- metadata = defaults.merge(YAML.load_file('gemspec.yml'))
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
40
12
 
41
- gemspec.name = metadata['name']
42
- gemspec.version = if metadata['version']
43
- metadata['version']
44
- else
45
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
13
+ require 'rubygems/tasks/version'
14
+ Gem::Tasks::VERSION
15
+ end
46
16
 
47
- require version[:file]
48
- eval(version[:constant])
49
- end
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
23
+ gem.metadata = gemspec['metadata'] if gemspec['metadata']
50
24
 
51
- gemspec.summary = metadata.fetch('summary',metadata['description'])
52
- gemspec.description = metadata.fetch('description',metadata['summary'])
25
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
53
26
 
54
- gemspec.licenses = Array(metadata['license'])
55
- gemspec.authors = Array(metadata['authors'])
27
+ gem.files = `git ls-files`.split($/)
28
+ gem.files = glob[gemspec['files']] if gemspec['files']
56
29
 
57
- gemspec.email = metadata['email']
58
- gemspec.homepage = metadata['homepage']
59
-
60
- gemspec.require_paths = Array(metadata['require_paths'])
61
- gemspec.files = filter_files[metadata['files']]
62
- gemspec.executables = metadata['executables']
63
- gemspec.extensions = metadata['extensions']
64
-
65
- if Gem::VERSION < '1.7.'
66
- gemspec.default_executable = gemspec.executables.first
30
+ gem.executables = gemspec.fetch('executables') do
31
+ glob['bin/*'].map { |path| File.basename(path) }
67
32
  end
33
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
68
34
 
69
- gemspec.test_files = filter_files[metadata['test_files']]
70
- gemspec.extra_rdoc_files = Array(metadata['extra_doc_files'])
35
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
36
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
37
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
71
38
 
72
- gemspec.post_install_message = metadata['post_install_message']
73
- gemspec.requirements = metadata['requirements']
39
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
40
+ %w[ext lib].select { |dir| File.directory?(dir) }
41
+ })
74
42
 
75
- if gemspec.respond_to?(:required_ruby_version=)
76
- gemspec.required_ruby_version = metadata['required_ruby_version']
77
- end
43
+ gem.requirements = gemspec['requirements']
44
+ gem.required_ruby_version = gemspec['required_ruby_version']
45
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
46
+ gem.post_install_message = gemspec['post_install_message']
78
47
 
79
- if gemspec.respond_to?(:required_rubygems_version=)
80
- gemspec.required_rubygems_version = metadata['required_ruby_version']
81
- end
82
-
83
- parse_versions = lambda { |versions|
84
- case versions
85
- when Array
86
- versions.map { |v| v.to_s }
87
- when String
88
- versions.split(/,\s*/)
89
- end
90
- }
91
-
92
- if metadata['dependencies']
93
- metadata['dependencies'].each do |name,versions|
94
- gemspec.add_dependency(name,parse_versions[versions])
95
- end
96
- end
48
+ split = lambda { |string| string.split(/,\s*/) }
97
49
 
98
- if metadata['runtime_dependencies']
99
- metadata['runtime_dependencies'].each do |name,versions|
100
- gemspec.add_runtime_dependency(name,parse_versions[versions])
50
+ if gemspec['dependencies']
51
+ gemspec['dependencies'].each do |name,versions|
52
+ gem.add_dependency(name,split[versions])
101
53
  end
102
54
  end
103
55
 
104
- if metadata['development_dependencies']
105
- metadata['development_dependencies'].each do |name,versions|
106
- gemspec.add_development_dependency(name,parse_versions[versions])
56
+ if gemspec['development_dependencies']
57
+ gemspec['development_dependencies'].each do |name,versions|
58
+ gem.add_development_dependency(name,split[versions])
107
59
  end
108
60
  end
109
61
  end
data/spec/console_spec.rb CHANGED
@@ -7,26 +7,31 @@ describe Gem::Tasks::Console do
7
7
  describe "#console" do
8
8
  include_context "rake"
9
9
 
10
- if RUBY_VERSION < '1.9'
11
- let(:default_options) { %w[-Ilib -rrubygems -rrubygems/tasks] }
12
- else
13
- let(:default_options) { %w[-Ilib -rrubygems/tasks] }
14
- end
10
+ let(:default_options) { %w[-Ilib -rrubygems/tasks] }
15
11
 
16
12
  let(:custom_command) { 'ripl' }
17
13
  let(:custom_options) { %w[-Ivendor -rfoo] }
18
14
 
19
15
  context "defaults" do
20
- it "should run `irb`" do
21
- subject.should_receive(:run).with('irb',*default_options)
16
+ context "when project.bundler? == false" do
17
+ before do
18
+ allow(subject.project).to receive(:bundler?).and_return(false)
19
+ end
20
+
21
+ it "should run `irb`" do
22
+ expect(subject).to receive(:run).with('irb',*default_options)
22
23
 
23
- subject.console
24
+ subject.console
25
+ end
24
26
  end
25
27
 
26
28
  context "when project.bundler? == true" do
29
+ before do
30
+ allow(subject.project).to receive(:bundler?).and_return(true)
31
+ end
32
+
27
33
  it "should use `bundle exec`" do
28
- subject.project.stub!(:bundler?).and_return(true)
29
- subject.should_receive(:run).with(
34
+ expect(subject).to receive(:run).with(
30
35
  'bundle', 'exec', 'irb', *default_options
31
36
  )
32
37
 
@@ -38,16 +43,25 @@ describe Gem::Tasks::Console do
38
43
  context "with custom command" do
39
44
  subject { described_class.new(:command => custom_command) }
40
45
 
41
- it "should run the custom console" do
42
- subject.should_receive(:run).with(custom_command,*default_options)
46
+ context "when project.bundler? == false" do
47
+ before do
48
+ allow(subject.project).to receive(:bundler?).and_return(false)
49
+ end
43
50
 
44
- subject.console
51
+ it "should run the custom console" do
52
+ expect(subject).to receive(:run).with(custom_command,*default_options)
53
+
54
+ subject.console
55
+ end
45
56
  end
46
57
 
47
58
  context "when project.bundler? == true" do
59
+ before do
60
+ allow(subject.project).to receive(:bundler?).and_return(true)
61
+ end
62
+
48
63
  it "should use `bundle exec`" do
49
- subject.project.stub!(:bundler?).and_return(true)
50
- subject.should_receive(:run).with(
64
+ expect(subject).to receive(:run).with(
51
65
  'bundle', 'exec', custom_command, *default_options
52
66
  )
53
67
 
@@ -59,16 +73,25 @@ describe Gem::Tasks::Console do
59
73
  context "with custom options" do
60
74
  subject { described_class.new(:options => custom_options) }
61
75
 
62
- it "should pass custom options to `irb`" do
63
- subject.should_receive(:run).with('irb', *(default_options + custom_options))
76
+ context "when project.bundler? == false" do
77
+ before do
78
+ allow(subject.project).to receive(:bundler?).and_return(false)
79
+ end
80
+
81
+ it "should pass custom options to `irb`" do
82
+ expect(subject).to receive(:run).with('irb', *(default_options + custom_options))
64
83
 
65
- subject.console
84
+ subject.console
85
+ end
66
86
  end
67
87
 
68
88
  context "when project.bundler? == true" do
89
+ before do
90
+ allow(subject.project).to receive(:bundler?).and_return(true)
91
+ end
92
+
69
93
  it "should use `bundle exec ...`" do
70
- subject.project.stub!(:bundler?).and_return(true)
71
- subject.should_receive(:run).with('bundle', 'exec', 'irb', *(default_options + custom_options))
94
+ expect(subject).to receive(:run).with('bundle', 'exec', 'irb', *(default_options + custom_options))
72
95
 
73
96
  subject.console
74
97
  end
data/spec/install_spec.rb CHANGED
@@ -8,7 +8,11 @@ describe Gem::Tasks::Install do
8
8
  let(:path) { 'pkg/foo-1.2.3.gem' }
9
9
 
10
10
  it "should use `gem install -q`" do
11
- subject.should_receive(:run).with('gem', 'install', '-q', path)
11
+ if defined?(Bundler)
12
+ expect(Bundler).to receive(:with_original_env).and_yield()
13
+ end
14
+
15
+ expect(subject).to receive(:run).with('gem', 'install', '-q', path)
12
16
 
13
17
  subject.install(path)
14
18
  end
data/spec/project_spec.rb CHANGED
@@ -2,24 +2,27 @@ require 'spec_helper'
2
2
  require 'rubygems/tasks/project'
3
3
 
4
4
  describe Gem::Tasks::Project do
5
- let(:rubygems_project) do
6
- described_class.new(PROJECT_DIRS['rubygems-project'])
5
+ let(:rubygems_project_dir) { File.join(PROJECTS_DIR,'rubygems-project') }
6
+ let(:rubygems_project) { described_class.new(rubygems_project_dir) }
7
+
8
+ let(:rubygems_multi_project_dir) do
9
+ File.join(PROJECTS_DIR,'rubygems-multi-project')
7
10
  end
8
11
 
9
12
  let(:rubygems_multi_project) do
10
- described_class.new(PROJECT_DIRS['rubygems-multi-project'])
13
+ described_class.new(rubygems_multi_project_dir)
11
14
  end
12
15
 
13
- let(:bundler_project) do
14
- described_class.new(PROJECT_DIRS['bundler-project'])
15
- end
16
+ let(:bundler_project_dir) { File.join(PROJECTS_DIR,'bundler-project') }
17
+ let(:bundler_project) { described_class.new(bundler_project_dir) }
16
18
 
17
19
  describe "directories" do
20
+ let(:directory) { rubygems_project_dir }
21
+
18
22
  it "should map paths to #{described_class} instances" do
19
- directory = PROJECT_DIRS['rubygems-project']
20
- project = described_class.directories[directory]
23
+ project = described_class.directories[directory]
21
24
 
22
- project.root.should == directory
25
+ expect(project.root).to eq(directory)
23
26
  end
24
27
  end
25
28
 
@@ -27,7 +30,7 @@ describe Gem::Tasks::Project do
27
30
  subject { rubygems_project }
28
31
 
29
32
  it "should use the name of the directory" do
30
- subject.name.should == 'rubygems-project'
33
+ expect(subject.name).to eq('rubygems-project')
31
34
  end
32
35
  end
33
36
 
@@ -35,7 +38,7 @@ describe Gem::Tasks::Project do
35
38
  subject { bundler_project }
36
39
 
37
40
  it "should detect the SCM used" do
38
- subject.scm.should == :git
41
+ expect(subject.scm).to eq(:git)
39
42
  end
40
43
  end
41
44
 
@@ -44,7 +47,7 @@ describe Gem::Tasks::Project do
44
47
  subject { rubygems_project }
45
48
 
46
49
  it "should load the single-gemspec" do
47
- subject.gemspecs.values.map(&:name).should == %w[rubygems-project]
50
+ expect(subject.gemspecs.values.map(&:name)).to eq(%w[rubygems-project])
48
51
  end
49
52
  end
50
53
 
@@ -52,10 +55,10 @@ describe Gem::Tasks::Project do
52
55
  subject { rubygems_multi_project }
53
56
 
54
57
  it "should load all gemspecs" do
55
- subject.gemspecs.values.map(&:name).should =~ %w[
58
+ expect(subject.gemspecs.values.map(&:name)).to match_array(%w[
56
59
  rubygems-project
57
60
  rubygems-project-lite
58
- ]
61
+ ])
59
62
  end
60
63
  end
61
64
  end
@@ -65,7 +68,7 @@ describe Gem::Tasks::Project do
65
68
  subject { rubygems_project }
66
69
 
67
70
  it "should match the directory name to the gemspec" do
68
- subject.primary_gemspec.should == subject.name
71
+ expect(subject.primary_gemspec).to eq(subject.name)
69
72
  end
70
73
  end
71
74
 
@@ -73,7 +76,7 @@ describe Gem::Tasks::Project do
73
76
  subject { rubygems_multi_project }
74
77
 
75
78
  it "should pick the first gemspec" do
76
- subject.primary_gemspec.should == 'rubygems-project'
79
+ expect(subject.primary_gemspec).to eq('rubygems-project')
77
80
  end
78
81
  end
79
82
  end
@@ -83,11 +86,11 @@ describe Gem::Tasks::Project do
83
86
  subject { rubygems_project }
84
87
 
85
88
  it "should default the directory name to the gemspec" do
86
- subject.gemspec.name.should == subject.name
89
+ expect(subject.gemspec.name).to eq(subject.name)
87
90
  end
88
91
 
89
92
  it "should raise an ArgumentError for unknown gemspec names" do
90
- lambda { subject.gemspec('foo') }.should raise_error(ArgumentError)
93
+ expect { subject.gemspec('foo') }.to raise_error(ArgumentError)
91
94
  end
92
95
  end
93
96
 
@@ -95,13 +98,13 @@ describe Gem::Tasks::Project do
95
98
  subject { rubygems_multi_project }
96
99
 
97
100
  it "should default the first gemspec" do
98
- subject.gemspec.name.should == 'rubygems-project'
101
+ expect(subject.gemspec.name).to eq('rubygems-project')
99
102
  end
100
103
 
101
104
  it "should allow accessing alternate gemspecs" do
102
105
  alternate = 'rubygems-project-lite'
103
106
 
104
- subject.gemspec(alternate).name.should == alternate
107
+ expect(subject.gemspec(alternate).name).to eq(alternate)
105
108
  end
106
109
  end
107
110
  end
@@ -110,20 +113,20 @@ describe Gem::Tasks::Project do
110
113
  subject { rubygems_multi_project }
111
114
 
112
115
  it "should group builds by gemspec name" do
113
- subject.builds.keys.should =~ subject.gemspecs.keys
116
+ expect(subject.builds.keys).to be == subject.gemspecs.keys
114
117
  end
115
118
 
116
119
  it "should map a package format to a pkg/ path" do
117
120
  packages = subject.builds['rubygems-project']
118
121
 
119
- packages['tar.gz'].should == 'pkg/rubygems-project-1.2.3.tar.gz'
122
+ expect(packages['tar.gz']).to eq('pkg/rubygems-project-1.2.3.tar.gz')
120
123
  end
121
124
 
122
125
  context "with single-gemspec project" do
123
126
  subject { rubygems_project }
124
127
 
125
128
  it "should only have a key for the single-gemspec" do
126
- subject.builds.keys.should == %w[rubygems-project]
129
+ expect(subject.builds.keys).to eq(%w[rubygems-project])
127
130
  end
128
131
  end
129
132
 
@@ -131,10 +134,10 @@ describe Gem::Tasks::Project do
131
134
  subject { rubygems_multi_project }
132
135
 
133
136
  it "should have keys for each gemspec" do
134
- subject.builds.keys.should =~ %w[
137
+ expect(subject.builds.keys).to match_array(%w[
135
138
  rubygems-project
136
139
  rubygems-project-lite
137
- ]
140
+ ])
138
141
  end
139
142
  end
140
143
  end
@@ -144,7 +147,7 @@ describe Gem::Tasks::Project do
144
147
  subject { bundler_project }
145
148
 
146
149
  it "should detect the 'Gemfile' file" do
147
- subject.bundler?.should be_true
150
+ expect(subject.bundler?).to be_truthy
148
151
  end
149
152
  end
150
153
 
@@ -152,7 +155,7 @@ describe Gem::Tasks::Project do
152
155
  subject { rubygems_project }
153
156
 
154
157
  it "should be false" do
155
- subject.bundler?.should be_false
158
+ expect(subject.bundler?).to be_falsey
156
159
  end
157
160
  end
158
161
  end
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bundler-project.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Postmodern
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Bundler::Project
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'bundler-project'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install bundler-project
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"