rake-release 0.3.1 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/rake/release.rb +3 -11
- data/lib/rake/release/spec.rb +15 -11
- data/lib/rake/release/task.rb +27 -11
- data/rake-release.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c15844cf0ddcb1c04e6e96c6e7619549327f389
|
4
|
+
data.tar.gz: 488040f7a8e55d54fcbdd8a02030e6ba5ae83589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31df5bf0235d6a9c58f69b29a79d2d0f37934a016c414932d622b4739405f5a468bed692912bed509b933b4a3edae1f40750f15be188c1b0a7506d76c29fcfaf
|
7
|
+
data.tar.gz: ff35df37fc36b62c1f6aec9ccf1200d544d954f4a5450f567e1e31b75cd9d3448ff4e970840320890bbd8aa32ed5106fa24be5075680f6f22b890c7e9de2af30
|
data/lib/rake/release.rb
CHANGED
@@ -7,23 +7,15 @@ require 'pathname'
|
|
7
7
|
module Rake
|
8
8
|
module Release
|
9
9
|
class << self
|
10
|
-
def pwd
|
11
|
-
@pwd ||= Pathname.new Bundler::SharedHelpers.pwd
|
12
|
-
end
|
13
|
-
|
14
|
-
def ui
|
15
|
-
@ui ||= Bundler::UI::Shell.new
|
16
|
-
end
|
17
|
-
|
18
10
|
def autodetect!
|
19
|
-
specs = Spec.scan pwd.join '{*/*/,*/,}*.gemspec'
|
11
|
+
specs = Spec.scan Task.pwd.join '{*/*/,*/,}*.gemspec'
|
20
12
|
specs.uniq! {|spec| spec.name }
|
21
13
|
|
22
14
|
if specs.size == 1
|
23
|
-
Task.new specs.first
|
15
|
+
Rake::Release::Task.new specs.first
|
24
16
|
else
|
25
17
|
specs.each do |spec|
|
26
|
-
Task.new spec, namespace: spec.name
|
18
|
+
Rake::Release::Task.new spec, namespace: spec.name
|
27
19
|
end
|
28
20
|
end
|
29
21
|
end
|
data/lib/rake/release/spec.rb
CHANGED
@@ -16,9 +16,10 @@ module Rake
|
|
16
16
|
attr_reader :gemspec_path
|
17
17
|
|
18
18
|
attr_accessor :namespace
|
19
|
+
attr_accessor :push_host
|
19
20
|
|
20
21
|
def initialize(path, namespace: nil)
|
21
|
-
path =
|
22
|
+
path = Task.pwd.join(path.to_s).expand_path
|
22
23
|
|
23
24
|
if path.directory?
|
24
25
|
@base = path
|
@@ -38,18 +39,21 @@ module Rake
|
|
38
39
|
@gemspec = Bundler.load_gemspec @gemspec_path
|
39
40
|
|
40
41
|
raise RuntimeError.new 'Cannot load gemspec' unless @gemspec
|
41
|
-
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
else
|
48
|
-
@push_host = URI @gemspec.metadata['allowed_push_host']
|
49
|
-
end
|
43
|
+
@push_host = URI 'https://rubygems.org'
|
44
|
+
|
45
|
+
unless @gemspec.metadata['allowed_push_host'].to_s.empty?
|
46
|
+
@push_host = URI @gemspec.metadata['allowed_push_host']
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
50
|
+
def push_host=(value)
|
51
|
+
@push_host = URI value
|
52
|
+
end
|
53
|
+
|
54
|
+
alias_method :host, :push_host
|
55
|
+
alias_method :host=, :push_host=
|
56
|
+
|
53
57
|
def push_host_name
|
54
58
|
push_host.host.to_s
|
55
59
|
end
|
@@ -73,11 +77,11 @@ module Rake
|
|
73
77
|
class << self
|
74
78
|
def load(*args, &block)
|
75
79
|
new(*args, &block)
|
76
|
-
rescue
|
80
|
+
rescue RuntimeError
|
77
81
|
nil
|
78
82
|
end
|
79
83
|
|
80
|
-
def scan(path =
|
84
|
+
def scan(path = Task.pwd.join('*.gemspec'))
|
81
85
|
Pathname
|
82
86
|
.glob(path)
|
83
87
|
.map {|path| Rake::Release::Spec.load path }
|
data/lib/rake/release/task.rb
CHANGED
@@ -15,7 +15,7 @@ module Rake
|
|
15
15
|
def initialize(spec = nil, **kwargs, &block)
|
16
16
|
@spec = spec || Rake::Release::Spec.new(**kwargs, &block)
|
17
17
|
|
18
|
-
namespace =
|
18
|
+
namespace = kwargs[:namespace] || @spec.namespace
|
19
19
|
|
20
20
|
if namespace
|
21
21
|
send(:namespace, namespace) { setup }
|
@@ -85,7 +85,7 @@ module Rake
|
|
85
85
|
@spec.pkg_path.mkpath
|
86
86
|
FileUtils.mv @spec.pkg_file_name, @spec.pkg_path.join(@spec.pkg_file_name)
|
87
87
|
|
88
|
-
|
88
|
+
Task.ui.confirm "#{@spec.name} #{@spec.version} built to #{@spec.pkg_path}."
|
89
89
|
end
|
90
90
|
|
91
91
|
def install(local: false)
|
@@ -94,7 +94,7 @@ module Rake
|
|
94
94
|
|
95
95
|
sh! *cmd
|
96
96
|
|
97
|
-
|
97
|
+
Task.ui.confirm "#{@spec.name} (#{@spec.version}) installed."
|
98
98
|
end
|
99
99
|
|
100
100
|
def publish
|
@@ -105,7 +105,7 @@ module Rake
|
|
105
105
|
|
106
106
|
sh! *cmd
|
107
107
|
|
108
|
-
|
108
|
+
Task.ui.confirm "Pushed #{@spec.pkg_file_name} to #{@spec.push_host}"
|
109
109
|
end
|
110
110
|
|
111
111
|
def git_clean
|
@@ -127,11 +127,11 @@ module Rake
|
|
127
127
|
def tag_version
|
128
128
|
sh! 'git', 'tag', '-a', '-m', "Version #{@spec.version}", @spec.version_tag
|
129
129
|
|
130
|
-
|
130
|
+
Task.ui.confirm "Tagged #{@spec.version_tag}."
|
131
131
|
|
132
132
|
yield if block_given?
|
133
133
|
rescue
|
134
|
-
|
134
|
+
Task.ui.error "Untagging #{@spec.version_tag} due to error."
|
135
135
|
|
136
136
|
sh! 'git', 'tag', '-d', @spec.version_tag
|
137
137
|
|
@@ -145,7 +145,7 @@ module Rake
|
|
145
145
|
return false
|
146
146
|
end
|
147
147
|
|
148
|
-
|
148
|
+
Task.ui.confirm "Tag #{@spec.version_tag} has already been created."
|
149
149
|
|
150
150
|
true
|
151
151
|
end
|
@@ -160,7 +160,7 @@ module Rake
|
|
160
160
|
sh! *cmd
|
161
161
|
sh! *cmd, '--tags'
|
162
162
|
|
163
|
-
|
163
|
+
Task.ui.confirm 'Pushed git commits and tags.'
|
164
164
|
end
|
165
165
|
|
166
166
|
def publish?
|
@@ -185,7 +185,7 @@ module Rake
|
|
185
185
|
def sh(*cmd, chdir: @spec.base, raise_error: true, &block)
|
186
186
|
cmd = cmd.flatten.map(&:to_s)
|
187
187
|
|
188
|
-
|
188
|
+
Task.ui.debug cmd
|
189
189
|
|
190
190
|
Open3.popen2(*cmd, chdir: chdir) do |stdin, out, t|
|
191
191
|
stdin.close
|
@@ -197,15 +197,31 @@ module Rake
|
|
197
197
|
end
|
198
198
|
|
199
199
|
class << self
|
200
|
-
def load_all(dir =
|
201
|
-
specs = Spec.scan dir
|
200
|
+
def load_all(dir = self.pwd)
|
201
|
+
specs = Spec.scan dir.join('**/*.gemspec')
|
202
|
+
|
203
|
+
if specs.size > 1
|
204
|
+
specs.each {|spec| spec.namespace = spec.name }
|
205
|
+
end
|
202
206
|
|
203
207
|
if block_given?
|
204
208
|
specs.each(&Proc.new)
|
205
209
|
end
|
206
210
|
|
211
|
+
if specs.uniq {|s| s.namespace.to_s.strip }.size != specs.size
|
212
|
+
raise RuntimeError.new 'Non distinct release task namespaces'
|
213
|
+
end
|
214
|
+
|
207
215
|
specs.each {|spec| Task.new spec }
|
208
216
|
end
|
217
|
+
|
218
|
+
def pwd
|
219
|
+
@pwd ||= Pathname.new Bundler::SharedHelpers.pwd
|
220
|
+
end
|
221
|
+
|
222
|
+
def ui
|
223
|
+
@ui ||= Bundler::UI::Shell.new
|
224
|
+
end
|
209
225
|
end
|
210
226
|
end
|
211
227
|
end
|
data/rake-release.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|