gem-release 0.2.2 → 0.3.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.
data/lib/gem_release/version.rb
CHANGED
@@ -15,7 +15,7 @@ module GemRelease
|
|
15
15
|
|
16
16
|
def bump!
|
17
17
|
File.open(filename, 'w+') { |f| f.write(bumped_content) }
|
18
|
-
|
18
|
+
reload_version
|
19
19
|
end
|
20
20
|
|
21
21
|
def new_number
|
@@ -42,8 +42,8 @@ module GemRelease
|
|
42
42
|
"lib/#{path}/version.rb"
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
|
45
|
+
def reload_version
|
46
|
+
silently { load(filename) }
|
47
47
|
end
|
48
48
|
|
49
49
|
def major(major, minor, patch)
|
@@ -65,5 +65,16 @@ module GemRelease
|
|
65
65
|
def bumped_content
|
66
66
|
content.sub(VERSION_PATTERN) { "#{$1}#{new_number}#{$3}" }
|
67
67
|
end
|
68
|
+
|
69
|
+
def silently(&block)
|
70
|
+
warn_level = $VERBOSE
|
71
|
+
$VERBOSE = nil
|
72
|
+
begin
|
73
|
+
result = block.call
|
74
|
+
ensure
|
75
|
+
$VERBOSE = warn_level
|
76
|
+
end
|
77
|
+
result
|
78
|
+
end
|
68
79
|
end
|
69
80
|
end
|
@@ -12,6 +12,10 @@ class Gem::Commands::BumpCommand < Gem::Command
|
|
12
12
|
:version => 'patch',
|
13
13
|
:commit => true,
|
14
14
|
:push => false,
|
15
|
+
:tag => false,
|
16
|
+
:release => false,
|
17
|
+
:key => '',
|
18
|
+
:host => '',
|
15
19
|
:quiet => false
|
16
20
|
}
|
17
21
|
|
@@ -21,6 +25,10 @@ class Gem::Commands::BumpCommand < Gem::Command
|
|
21
25
|
option :version, '-v', 'Target version: next [major|minor|patch] or a given version number [x.x.x]'
|
22
26
|
option :commit, '-c', 'Perform a commit after incrementing gem version'
|
23
27
|
option :push, '-p', 'Push to the origin git repository'
|
28
|
+
option :tag, '-t', 'Create a git tag and push --tags to origin'
|
29
|
+
option :release, '-r', 'Build gem from a gemspec and push to rubygems.org'
|
30
|
+
option :key, '-k', 'When releasing: Use the given API key from ~/.gem/credentials'
|
31
|
+
option :host, '-h', 'When releasing: Push to a gemcutter-compatible host other than rubygems.org'
|
24
32
|
option :quiet, '-q', 'Do not output status messages'
|
25
33
|
end
|
26
34
|
|
@@ -28,7 +36,8 @@ class Gem::Commands::BumpCommand < Gem::Command
|
|
28
36
|
@new_version_number = nil
|
29
37
|
|
30
38
|
# enforce option dependencies
|
31
|
-
options[:
|
39
|
+
options[:push] = false if options[:tag] # push is performed as part of tag
|
40
|
+
options[:commit] = options[:commit] || options[:push] || options[:tag] || options[:release]
|
32
41
|
|
33
42
|
in_gemspec_dirs do
|
34
43
|
bump
|
@@ -39,6 +48,8 @@ class Gem::Commands::BumpCommand < Gem::Command
|
|
39
48
|
else
|
40
49
|
commit if options[:commit]
|
41
50
|
push if options[:push]
|
51
|
+
tag if options[:tag]
|
52
|
+
release if options[:release]
|
42
53
|
end
|
43
54
|
end
|
44
55
|
|
@@ -65,4 +76,19 @@ class Gem::Commands::BumpCommand < Gem::Command
|
|
65
76
|
say "Pushing to the origin git repository" unless quiet?
|
66
77
|
`git push origin`
|
67
78
|
end
|
79
|
+
|
80
|
+
def release
|
81
|
+
cmd = ReleaseCommand.new
|
82
|
+
[:key, :host].each do |option|
|
83
|
+
cmd.options[option] = options[option]
|
84
|
+
end
|
85
|
+
cmd.options[:quiet] = options[:quiet]
|
86
|
+
cmd.execute
|
87
|
+
end
|
88
|
+
|
89
|
+
def tag
|
90
|
+
cmd = TagCommand.new
|
91
|
+
cmd.options[:quiet] = options[:quiet]
|
92
|
+
cmd.execute
|
93
|
+
end
|
68
94
|
end
|
@@ -28,13 +28,14 @@ class Gem::Commands::ReleaseCommand < Gem::Command
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def execute
|
31
|
+
tag if options[:tag]
|
32
|
+
|
31
33
|
in_gemspec_dirs do
|
32
34
|
build
|
33
35
|
push
|
34
36
|
remove
|
35
37
|
end
|
36
38
|
|
37
|
-
tag if options[:tag]
|
38
39
|
say "All is good, thanks my friend.\n"
|
39
40
|
end
|
40
41
|
|
@@ -60,6 +61,6 @@ class Gem::Commands::ReleaseCommand < Gem::Command
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def tag
|
63
|
-
TagCommand.new.invoke
|
64
|
+
TagCommand.new(:quiet => quiet?).invoke
|
64
65
|
end
|
65
66
|
end
|
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
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test_declarative
|
16
|
-
requirement: &
|
16
|
+
requirement: &70094017679920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.0.2
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70094017679920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mocha
|
27
|
-
requirement: &
|
27
|
+
requirement: &70094017711600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.9.8
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70094017711600
|
36
36
|
description: Release your ruby gems with ease. (What a bold statement for such a tiny
|
37
37
|
plugin ...)
|
38
38
|
email: svenfuchs@artweb-design.de
|