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.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.gitignore +4 -3
- data/.travis.yml +9 -0
- data/ChangeLog.md +13 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +1 -1
- data/README.md +23 -12
- data/Rakefile +7 -66
- data/gemspec.yml +16 -4
- data/lib/rubygems/tasks/build/gem.rb +0 -2
- data/lib/rubygems/tasks/build/tar.rb +0 -2
- data/lib/rubygems/tasks/build/task.rb +9 -14
- data/lib/rubygems/tasks/console.rb +1 -4
- data/lib/rubygems/tasks/install.rb +1 -1
- data/lib/rubygems/tasks/project.rb +3 -3
- data/lib/rubygems/tasks/push.rb +2 -2
- data/lib/rubygems/tasks/sign/checksum.rb +3 -2
- data/lib/rubygems/tasks/sign/pgp.rb +1 -1
- data/lib/rubygems/tasks/sign/task.rb +13 -17
- data/lib/rubygems/tasks/task.rb +14 -8
- data/lib/rubygems/tasks.rb +140 -2
- data/rubygems-tasks.gemspec +39 -87
- data/spec/console_spec.rb +43 -20
- data/spec/install_spec.rb +5 -1
- data/spec/project_spec.rb +30 -27
- data/spec/projects/bundler-project/.gitignore +17 -0
- data/spec/projects/bundler-project/Gemfile +4 -0
- data/spec/projects/bundler-project/LICENSE +22 -0
- data/spec/projects/bundler-project/README.md +29 -0
- data/spec/projects/bundler-project/Rakefile +2 -0
- data/spec/projects/bundler-project/bundler-project.gemspec +19 -0
- data/spec/projects/bundler-project/lib/bundler-project/version.rb +5 -0
- data/spec/projects/bundler-project/lib/bundler-project.rb +7 -0
- data/spec/projects/rubygems-multi-project/.gitignore +17 -0
- data/spec/projects/rubygems-multi-project/LICENSE.txt +22 -0
- data/spec/projects/rubygems-multi-project/README.md +21 -0
- data/spec/projects/rubygems-multi-project/lib/rubygems/project/version.rb +5 -0
- data/spec/projects/rubygems-multi-project/rubygems-project-lite.gemspec +19 -0
- data/spec/projects/rubygems-multi-project/rubygems-project.gemspec +19 -0
- data/spec/projects/rubygems-project/.gitignore +17 -0
- data/spec/projects/rubygems-project/LICENSE.txt +22 -0
- data/spec/projects/rubygems-project/README.md +21 -0
- data/spec/projects/rubygems-project/lib/rubygems/project/version.rb +5 -0
- data/spec/projects/rubygems-project/rubygems-project.gemspec +19 -0
- data/spec/push_spec.rb +2 -2
- data/spec/rake_context.rb +1 -3
- data/spec/scm/push_spec.rb +7 -7
- data/spec/scm/status_spec.rb +6 -6
- data/spec/scm/tag_spec.rb +18 -18
- data/spec/sign/pgp_spec.rb +1 -1
- data/spec/spec_helper.rb +25 -8
- data/spec/tasks_spec.rb +171 -55
- metadata +99 -87
- data/lib/rubygems/tasks/tasks.rb +0 -147
data/lib/rubygems/tasks.rb
CHANGED
@@ -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
|
-
|
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
|
data/rubygems-tasks.gemspec
CHANGED
@@ -2,108 +2,60 @@
|
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
52
|
-
gemspec.description = metadata.fetch('description',metadata['summary'])
|
25
|
+
glob = lambda { |patterns| gem.files & Dir[*patterns] }
|
53
26
|
|
54
|
-
|
55
|
-
|
27
|
+
gem.files = `git ls-files`.split($/)
|
28
|
+
gem.files = glob[gemspec['files']] if gemspec['files']
|
56
29
|
|
57
|
-
|
58
|
-
|
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
|
-
|
70
|
-
|
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
|
-
|
73
|
-
|
39
|
+
gem.require_paths = Array(gemspec.fetch('require_paths') {
|
40
|
+
%w[ext lib].select { |dir| File.directory?(dir) }
|
41
|
+
})
|
74
42
|
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
-
|
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
|
99
|
-
|
100
|
-
|
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
|
105
|
-
|
106
|
-
|
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
|
-
|
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
|
-
|
21
|
-
|
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
|
-
|
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.
|
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
|
-
|
42
|
-
|
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
|
-
|
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.
|
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
|
-
|
63
|
-
|
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
|
-
|
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.
|
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
|
-
|
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(:
|
6
|
-
|
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(
|
13
|
+
described_class.new(rubygems_multi_project_dir)
|
11
14
|
end
|
12
15
|
|
13
|
-
let(:
|
14
|
-
|
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
|
-
|
20
|
-
project = described_class.directories[directory]
|
23
|
+
project = described_class.directories[directory]
|
21
24
|
|
22
|
-
project.root.
|
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.
|
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.
|
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).
|
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).
|
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.
|
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.
|
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.
|
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
|
-
|
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.
|
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.
|
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.
|
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'].
|
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.
|
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.
|
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
|
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
|
158
|
+
expect(subject.bundler?).to be_falsey
|
156
159
|
end
|
157
160
|
end
|
158
161
|
end
|
@@ -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
|