gem-release 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -69,5 +69,9 @@ module GemRelease
69
69
  yield
70
70
  end
71
71
  end
72
+
73
+ def run_cmd(command)
74
+ abort unless send(command)
75
+ end
72
76
  end
73
77
  end
@@ -1,3 +1,3 @@
1
1
  module GemRelease
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -35,21 +35,22 @@ class Gem::Commands::BumpCommand < Gem::Command
35
35
  def execute
36
36
  @new_version_number = nil
37
37
 
38
+ tasks = [:commit, :push, :tag, :release]
39
+
38
40
  # enforce option dependencies
39
41
  options[:push] = false if options[:tag] # push is performed as part of tag
40
42
  options[:commit] = options[:commit] || options[:push] || options[:tag] || options[:release]
41
43
 
42
44
  in_gemspec_dirs do
43
- bump
45
+ run_cmd(:bump)
44
46
  end
45
47
 
46
48
  if @new_version_number == nil
47
49
  say "No version files could be found, so no actions were performed." unless quiet?
48
50
  else
49
- commit if options[:commit]
50
- push if options[:push]
51
- tag if options[:tag]
52
- release if options[:release]
51
+ tasks.each do |task|
52
+ run_cmd(task) if options[task]
53
+ end
53
54
  end
54
55
  end
55
56
 
@@ -61,20 +62,21 @@ class Gem::Commands::BumpCommand < Gem::Command
61
62
  @new_version_number ||= version.new_number
62
63
  say "Bumping #{gem_name} from #{version.old_number} to version #{version.new_number}" unless quiet?
63
64
  version.bump!
64
- `git add #{version.filename}` if options[:commit]
65
+ return system("git add #{version.filename}") if options[:commit]
65
66
  else
66
67
  say "Ignoring #{gem_name}. Version file #{version.filename} not found" unless quiet?
67
68
  end
69
+ true
68
70
  end
69
71
 
70
72
  def commit
71
73
  say "Creating commit" unless quiet?
72
- `git commit -m "Bump to #{@new_version_number}"`
74
+ system("git commit -m \"Bump to #{@new_version_number}\"")
73
75
  end
74
76
 
75
77
  def push
76
78
  say "Pushing to the origin git repository" unless quiet?
77
- `git push origin`
79
+ system('git push origin')
78
80
  end
79
81
 
80
82
  def release
@@ -28,12 +28,13 @@ class Gem::Commands::ReleaseCommand < Gem::Command
28
28
  end
29
29
 
30
30
  def execute
31
- tag if options[:tag]
31
+ tasks = [:build, :push, :remove]
32
+ tasks.unshift(:tag) if options[:tag]
32
33
 
33
34
  in_gemspec_dirs do
34
- build
35
- push
36
- remove
35
+ tasks.each do |task|
36
+ run_cmd(task)
37
+ end
37
38
  end
38
39
 
39
40
  say "All is good, thanks my friend.\n"
@@ -43,6 +44,7 @@ class Gem::Commands::ReleaseCommand < Gem::Command
43
44
 
44
45
  def build
45
46
  BuildCommand.new.invoke(gemspec_filename)
47
+ true
46
48
  end
47
49
 
48
50
  def push
@@ -53,11 +55,12 @@ class Gem::Commands::ReleaseCommand < Gem::Command
53
55
  args += "--quiet" if quiet?
54
56
 
55
57
  PushCommand.new.invoke(gem_filename, *args)
58
+ true
56
59
  end
57
60
 
58
61
  def remove
59
62
  say "Deleting left over gem file #{gem_filename}" unless quiet?
60
- `rm #{gem_filename}`
63
+ system('rm #{gem_filename}')
61
64
  end
62
65
 
63
66
  def tag
@@ -15,23 +15,24 @@ class Gem::Commands::TagCommand < Gem::Command
15
15
  end
16
16
 
17
17
  def execute
18
- tag
19
- push
18
+ [:tag, :push].each do |task|
19
+ run_cmd(task)
20
+ end
20
21
  end
21
22
 
22
23
  protected
23
24
 
24
25
  def tag
25
26
  say "Creating git tag #{tag_name}" unless quiet?
26
- `git tag -am 'tag #{tag_name}' #{tag_name}`
27
+ system("git tag -am 'tag #{tag_name}' #{tag_name}")
27
28
  end
28
29
 
29
30
  def push
30
31
  say "Pushing to the origin git repository" unless quiet?
31
- `git push origin`
32
+ return false unless system('git push origin')
32
33
 
33
34
  say "Pushing --tags to the origin git repository" unless quiet?
34
- `git push --tags origin`
35
+ system('git push --tags origin')
35
36
  end
36
37
 
37
38
  def tag_name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-13 00:00:00.000000000 Z
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test_declarative
@@ -99,3 +99,4 @@ signing_key:
99
99
  specification_version: 3
100
100
  summary: Release your ruby gems with ease
101
101
  test_files: []
102
+ has_rdoc: