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
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bundler-project/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.authors = ["Postmodern"]
8
+ gem.email = ["postmodern.mod3@gmail.com"]
9
+ gem.description = %q{An example Ruby project using Bundler}
10
+ gem.summary = %q{Example Bundler project}
11
+ gem.homepage = ""
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.name = "bundler-project"
17
+ gem.require_paths = ["lib"]
18
+ gem.version = Bundler::Project::VERSION
19
+ end
@@ -0,0 +1,5 @@
1
+ module Bundler
2
+ module Project
3
+ VERSION = "1.2.3"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "bundler-project/version"
2
+
3
+ module Bundler
4
+ module Project
5
+ # Your code goes here...
6
+ end
7
+ 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,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,21 @@
1
+ # Rubygems::Project
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ $ gem install rubygems-project
8
+
9
+ ## Examples
10
+
11
+ ## Contributing
12
+
13
+ 1. Fork it
14
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
15
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
16
+ 4. Push to the branch (`git push origin my-new-feature`)
17
+ 5. Create new Pull Request
18
+
19
+ ## License
20
+
21
+ See `LICENSE.txt`.
@@ -0,0 +1,5 @@
1
+ module Rubygems
2
+ module Project
3
+ VERSION = '1.2.3'
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubygems/project/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "rubygems-project-lite"
8
+ gem.version = Rubygems::Project::VERSION
9
+ gem.authors = ["Postmodern"]
10
+ gem.email = ["postmodern.mod3@gmail.com"]
11
+ gem.description = %q{An example of a RubyGems project (lite edition)}
12
+ gem.summary = %q{Example RubyGems project}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($\)
16
+ gem.executables = []
17
+ gem.test_files = []
18
+ gem.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubygems/project/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "rubygems-project"
8
+ gem.version = Rubygems::Project::VERSION
9
+ gem.authors = ["Postmodern"]
10
+ gem.email = ["postmodern.mod3@gmail.com"]
11
+ gem.description = %q{An example of a RubyGems project}
12
+ gem.summary = %q{Example RubyGems project}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($\)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ 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,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,21 @@
1
+ # Rubygems::Project
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ $ gem install rubygems-project
8
+
9
+ ## Examples
10
+
11
+ ## Contributing
12
+
13
+ 1. Fork it
14
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
15
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
16
+ 4. Push to the branch (`git push origin my-new-feature`)
17
+ 5. Create new Pull Request
18
+
19
+ ## License
20
+
21
+ See `LICENSE.txt`.
@@ -0,0 +1,5 @@
1
+ module Rubygems
2
+ module Project
3
+ VERSION = '1.2.3'
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rubygems/project/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "rubygems-project"
8
+ gem.version = Rubygems::Project::VERSION
9
+ gem.authors = ["Postmodern"]
10
+ gem.email = ["postmodern.mod3@gmail.com"]
11
+ gem.description = %q{An example of a RubyGems project}
12
+ gem.summary = %q{Example RubyGems project}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($\)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
data/spec/push_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe Gem::Tasks::Push do
11
11
 
12
12
  context "defaults" do
13
13
  it "should use `gem push`" do
14
- subject.should_receive(:run).with('gem', 'push', path)
14
+ expect(subject).to receive(:run).with('gem', 'push', path)
15
15
 
16
16
  subject.push(path)
17
17
  end
@@ -23,7 +23,7 @@ describe Gem::Tasks::Push do
23
23
  subject { described_class.new(:host => host) }
24
24
 
25
25
  it "should include the --host option" do
26
- subject.should_receive(:run).with('gem', 'push', path, '--host', host)
26
+ expect(subject).to receive(:run).with('gem', 'push', path, '--host', host)
27
27
 
28
28
  subject.push(path)
29
29
  end
data/spec/rake_context.rb CHANGED
@@ -1,10 +1,8 @@
1
1
  require 'rake'
2
2
 
3
3
  shared_context "rake" do
4
- let(:rake) { Rake::Application.new }
5
-
6
4
  before(:all) do
7
5
  Rake.verbose(false)
8
- Rake.application = rake
6
+ Rake.application = Rake::Application.new
9
7
  end
10
8
  end
@@ -7,9 +7,9 @@ describe Gem::Tasks::SCM::Push do
7
7
  describe "#push!" do
8
8
  context "git" do
9
9
  it "should run `git push --tags`" do
10
- subject.project.stub!(:scm).and_return(:git)
11
- subject.should_receive(:run).with('git', 'push')
12
- subject.should_receive(:run).with('git', 'push', '--tags')
10
+ allow(subject.project).to receive(:scm).and_return(:git)
11
+ expect(subject).to receive(:run).with('git', 'push')
12
+ expect(subject).to receive(:run).with('git', 'push', '--tags')
13
13
 
14
14
  subject.push!
15
15
  end
@@ -17,8 +17,8 @@ describe Gem::Tasks::SCM::Push do
17
17
 
18
18
  context "hg" do
19
19
  it "should run `hg push`" do
20
- subject.project.stub!(:scm).and_return(:hg)
21
- subject.should_receive(:run).with('hg', 'push')
20
+ allow(subject.project).to receive(:scm).and_return(:hg)
21
+ expect(subject).to receive(:run).with('hg', 'push')
22
22
 
23
23
  subject.push!
24
24
  end
@@ -26,9 +26,9 @@ describe Gem::Tasks::SCM::Push do
26
26
 
27
27
  context "otherwise" do
28
28
  it "should return true" do
29
- subject.project.stub!(:scm).and_return(:svn)
29
+ allow(subject.project).to receive(:scm).and_return(:svn)
30
30
 
31
- subject.push!.should == true
31
+ expect(subject.push!).to eq(true)
32
32
  end
33
33
  end
34
34
  end
@@ -9,9 +9,9 @@ describe Gem::Tasks::SCM::Status do
9
9
  include_context "rake"
10
10
 
11
11
  it "should run `git status --untracked-files=no`" do
12
- subject.project.stub!(:scm).and_return(:git)
12
+ allow(subject.project).to receive(:scm).and_return(:git)
13
13
 
14
- subject.should_receive(:run).with(
14
+ expect(subject).to receive(:run).with(
15
15
  'git', 'status', '--untracked-files=no'
16
16
  )
17
17
 
@@ -23,9 +23,9 @@ describe Gem::Tasks::SCM::Status do
23
23
  include_context "rake"
24
24
 
25
25
  it "should run `hg status --quiet`" do
26
- subject.project.stub!(:scm).and_return(:hg)
26
+ allow(subject.project).to receive(:scm).and_return(:hg)
27
27
 
28
- subject.should_receive(:run).with(
28
+ expect(subject).to receive(:run).with(
29
29
  'hg', 'status', '--quiet'
30
30
  )
31
31
 
@@ -37,9 +37,9 @@ describe Gem::Tasks::SCM::Status do
37
37
  include_context "rake"
38
38
 
39
39
  it "should run `svn status --quiet`" do
40
- subject.project.stub!(:scm).and_return(:svn)
40
+ allow(subject.project).to receive(:scm).and_return(:svn)
41
41
 
42
- subject.should_receive(:run).with(
42
+ expect(subject).to receive(:run).with(
43
43
  'svn', 'status', '--quiet'
44
44
  )
45
45
 
data/spec/scm/tag_spec.rb CHANGED
@@ -11,7 +11,7 @@ describe Gem::Tasks::SCM::Tag do
11
11
  include_context "rake"
12
12
 
13
13
  it "should have a 'v' prefix" do
14
- subject.version_tag(version).should == "v#{version}"
14
+ expect(subject.version_tag(version)).to eq("v#{version}")
15
15
  end
16
16
  end
17
17
 
@@ -20,20 +20,20 @@ describe Gem::Tasks::SCM::Tag do
20
20
 
21
21
  let(:format) { 'release-%s' }
22
22
 
23
- subject { described_class.new(:format => format) }
23
+ subject { described_class.new(format: format) }
24
24
 
25
25
  it "should apply the format String to the version" do
26
- subject.version_tag(version).should == "release-#{version}"
26
+ expect(subject.version_tag(version)).to eq("release-#{version}")
27
27
  end
28
28
  end
29
29
 
30
30
  context "with format Proc" do
31
31
  let(:format) { proc { |ver| "REL_" + ver.tr('.','_') } }
32
32
 
33
- subject { described_class.new(:format => format) }
33
+ subject { described_class.new(format: format) }
34
34
 
35
35
  it "should call the format Proc with the version" do
36
- subject.version_tag(version).should == "REL_1_2_3"
36
+ expect(subject.version_tag(version)).to eq("REL_1_2_3")
37
37
  end
38
38
  end
39
39
  end
@@ -46,12 +46,12 @@ describe Gem::Tasks::SCM::Tag do
46
46
  context "without signing" do
47
47
  include_context "rake"
48
48
 
49
- subject { described_class.new(:sign => false) }
49
+ subject { described_class.new(sign: false) }
50
50
 
51
51
  it "should run `git tag`" do
52
- subject.project.stub!(:scm).and_return(:git)
52
+ allow(subject.project).to receive(:scm).and_return(:git)
53
53
 
54
- subject.should_receive(:run).with(
54
+ expect(subject).to receive(:run).with(
55
55
  'git', 'tag', '-m', message, name
56
56
  )
57
57
 
@@ -62,12 +62,12 @@ describe Gem::Tasks::SCM::Tag do
62
62
  context "signing" do
63
63
  include_context "rake"
64
64
 
65
- subject { described_class.new(:sign => true) }
65
+ subject { described_class.new(sign: true) }
66
66
 
67
67
  it "should run `git tag -s`" do
68
- subject.project.stub!(:scm).and_return(:git)
68
+ allow(subject.project).to receive(:scm).and_return(:git)
69
69
 
70
- subject.should_receive(:run).with(
70
+ expect(subject).to receive(:run).with(
71
71
  'git', 'tag', '-m', message, '-s', name
72
72
  )
73
73
 
@@ -80,12 +80,12 @@ describe Gem::Tasks::SCM::Tag do
80
80
  context "without signing" do
81
81
  include_context "rake"
82
82
 
83
- subject { described_class.new(:sign => false) }
83
+ subject { described_class.new(sign: false) }
84
84
 
85
85
  it "should run `hg tag`" do
86
- subject.project.stub!(:scm).and_return(:hg)
86
+ allow(subject.project).to receive(:scm).and_return(:hg)
87
87
 
88
- subject.should_receive(:run).with(
88
+ expect(subject).to receive(:run).with(
89
89
  'hg', 'tag', '-m', message, name
90
90
  )
91
91
 
@@ -96,15 +96,15 @@ describe Gem::Tasks::SCM::Tag do
96
96
  context "with signing" do
97
97
  include_context "rake"
98
98
 
99
- subject { described_class.new(:sign => true) }
99
+ subject { described_class.new(sign: true) }
100
100
 
101
101
  it "should run `hg sign` then `hg tag`" do
102
- subject.project.stub!(:scm).and_return(:hg)
102
+ allow(subject.project).to receive(:scm).and_return(:hg)
103
103
 
104
- subject.should_receive(:run).with(
104
+ expect(subject).to receive(:run).with(
105
105
  'hg', 'sign', '-m', "Signing #{name}"
106
106
  )
107
- subject.should_receive(:run).with(
107
+ expect(subject).to receive(:run).with(
108
108
  'hg', 'tag', '-m', message, name
109
109
  )
110
110
 
@@ -10,7 +10,7 @@ describe Gem::Tasks::Sign::PGP do
10
10
  let(:path) { File.join('pkg','foo-1.2.3.gem') }
11
11
 
12
12
  it "should run `gpg --sign --detach-sign --armor ...`" do
13
- subject.should_receive(:run).with(
13
+ expect(subject).to receive(:run).with(
14
14
  'gpg', '--sign', '--detach-sign', '--armor', path
15
15
  )
16
16
 
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,29 @@
1
- gem 'rspec', '~> 2.4'
2
1
  require 'rspec'
2
+ require 'fileutils'
3
+ require 'tmpdir'
3
4
 
4
- PROJECTS_DIR = File.join('data','projects')
5
- PROJECT_DIRS = lambda { |name| File.join(PROJECTS_DIR,name) }
5
+ # clear the $RUBYCONSOLE env variable
6
+ ENV.delete('RUBYCONSOLE')
6
7
 
7
- unless File.directory?(PROJECTS_DIR)
8
- abort "Please run `rake data:projects` before running the specs!"
9
- end
8
+ RSpec.configure do |rspec|
9
+ rspec.before(:suite) do
10
+ PROJECTS_DIR = Dir.mktmpdir('rubygems-tasks')
10
11
 
11
- # clear the $RUBYCONSOLE env variable
12
- ENV['RUBYCONSOLE'] = nil
12
+ Dir[File.join(File.dirname(__FILE__),'projects','*')].each do |src|
13
+ dest = File.join(PROJECTS_DIR,File.basename(src))
14
+
15
+ FileUtils.cp_r(src,dest)
16
+ Dir.chdir(dest) do
17
+ system 'git init -q'
18
+ system 'git config --local user.email test@example.com'
19
+ system 'git config --local user.name Test'
20
+ system 'git add .'
21
+ system 'git commit -q -a -m "Initial commit"'
22
+ end
23
+ end
24
+ end
25
+
26
+ rspec.after(:suite) do
27
+ FileUtils.rm_rf(PROJECTS_DIR)
28
+ end
29
+ end