rake-release 0.4.0 → 0.5.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 +1 -1
- data/lib/rake/release/spec.rb +28 -12
- data/lib/rake/release/task.rb +24 -25
- data/rake-release.gemspec +3 -3
- data/scripts/console +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d71af4dc22e9d24faa21d2c014075e491f9b704
|
4
|
+
data.tar.gz: b74cab41e7cba25aea3ef6a1a04d2a42dd79d66e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc2b0a6c8f89dbb0a04d61da0f261e8d0e2b4745b127c6536e38b46ced6534edf5c0782c2933e7eb1a6f7191406b44b4382e1ac9ce91437936e01e87ad958a90
|
7
|
+
data.tar.gz: 5f423e6a51c53cf189550aeaa7918f68dfdddba4a172d3db201b4e84428c171099aec131f31782db84d76ed29ea0b16af512ec0517f4f87983768082c1226c61
|
data/lib/rake/release.rb
CHANGED
data/lib/rake/release/spec.rb
CHANGED
@@ -16,7 +16,7 @@ module Rake
|
|
16
16
|
attr_reader :gemspec_path
|
17
17
|
|
18
18
|
attr_accessor :namespace
|
19
|
-
attr_accessor :
|
19
|
+
attr_accessor :version_tag
|
20
20
|
|
21
21
|
def initialize(path, namespace: nil)
|
22
22
|
path = Task.pwd.join(path.to_s).expand_path
|
@@ -26,9 +26,7 @@ module Rake
|
|
26
26
|
|
27
27
|
gemspecs = Dir[@base.join('*.gemspec')]
|
28
28
|
|
29
|
-
if gemspecs.size != 1
|
30
|
-
raise 'Unable to determine gemspec file.'
|
31
|
-
end
|
29
|
+
raise 'Unable to determine gemspec file.' if gemspecs.size != 1
|
32
30
|
|
33
31
|
@gemspec_path = Pathname.new gemspecs.first
|
34
32
|
else
|
@@ -40,10 +38,18 @@ module Rake
|
|
40
38
|
|
41
39
|
raise RuntimeError.new 'Cannot load gemspec' unless @gemspec
|
42
40
|
|
43
|
-
@
|
41
|
+
if @gemspec.metadata.fetch('allowed_push_host', nil)
|
42
|
+
@allowed_push_host = URI @gemspec.metadata['allowed_push_host']
|
43
|
+
end
|
44
|
+
|
45
|
+
@version_tag = true
|
46
|
+
end
|
44
47
|
|
45
|
-
|
46
|
-
|
48
|
+
def push_host
|
49
|
+
if @allowed_push_host
|
50
|
+
@allowed_push_host
|
51
|
+
else
|
52
|
+
@push_host ||= URI 'https://rubygems.org'
|
47
53
|
end
|
48
54
|
end
|
49
55
|
|
@@ -51,8 +57,8 @@ module Rake
|
|
51
57
|
@push_host = URI value
|
52
58
|
end
|
53
59
|
|
54
|
-
|
55
|
-
|
60
|
+
alias host push_host
|
61
|
+
alias host= push_host=
|
56
62
|
|
57
63
|
def push_host_name
|
58
64
|
push_host.host.to_s
|
@@ -70,8 +76,18 @@ module Rake
|
|
70
76
|
@pkg_file_path ||= pkg_path.join pkg_file_name
|
71
77
|
end
|
72
78
|
|
79
|
+
def version_tag?
|
80
|
+
@version_tag ? true : false
|
81
|
+
end
|
82
|
+
|
73
83
|
def version_tag
|
74
|
-
|
84
|
+
if @version_tag.respond_to? :call
|
85
|
+
@version_tag.call(self).to_s
|
86
|
+
elsif @version_tag.respond_to? :to_str
|
87
|
+
@version_tag.to_str
|
88
|
+
else
|
89
|
+
"v#{version}"
|
90
|
+
end
|
75
91
|
end
|
76
92
|
|
77
93
|
class << self
|
@@ -84,8 +100,8 @@ module Rake
|
|
84
100
|
def scan(path = Task.pwd.join('*.gemspec'))
|
85
101
|
Pathname
|
86
102
|
.glob(path)
|
87
|
-
.map {|path| Rake::Release::Spec.load path }
|
88
|
-
.reject
|
103
|
+
.map { |path| Rake::Release::Spec.load path }
|
104
|
+
.reject(&:nil?)
|
89
105
|
end
|
90
106
|
end
|
91
107
|
end
|
data/lib/rake/release/task.rb
CHANGED
@@ -42,9 +42,15 @@ module Rake
|
|
42
42
|
EOF
|
43
43
|
task('install:local' => [:build]) { install local: true }
|
44
44
|
|
45
|
-
desc
|
46
|
-
|
47
|
-
|
45
|
+
desc ''.tap { |str|
|
46
|
+
str << if @spec.version_tag?
|
47
|
+
"Create and push tag #{@spec.version_tag}, build"
|
48
|
+
else
|
49
|
+
'Build'
|
50
|
+
end
|
51
|
+
|
52
|
+
str << "and publish to #{@spec.push_host_name}."
|
53
|
+
}
|
48
54
|
task :release, [:remote] => %w(build release:push release:publish)
|
49
55
|
|
50
56
|
task 'release:guard:clean' do
|
@@ -52,11 +58,13 @@ module Rake
|
|
52
58
|
end
|
53
59
|
|
54
60
|
task 'release:guard:tag' do
|
55
|
-
guard_tag
|
61
|
+
guard_tag if @spec.version_tag?
|
56
62
|
end
|
57
63
|
|
58
64
|
task 'release:push', [:remote] => %w(release:guard:clean) do |_, args|
|
59
|
-
|
65
|
+
if @spec.version_tag? && !already_tagged?
|
66
|
+
tag_version { git_push(args[:remote]) }
|
67
|
+
end
|
60
68
|
end
|
61
69
|
|
62
70
|
task 'release:publish' => %w(release:guard:tag) do
|
@@ -72,7 +80,7 @@ module Rake
|
|
72
80
|
def guard_tag
|
73
81
|
out, ret = sh! 'git', 'tag', '--points-at', 'HEAD'
|
74
82
|
|
75
|
-
|
83
|
+
unless out.split("\n").include? @spec.version_tag
|
76
84
|
raise "Tag #{@spec.version_tag} does not point to current HEAD. Cannot release wrong code."
|
77
85
|
end
|
78
86
|
end
|
@@ -109,7 +117,7 @@ module Rake
|
|
109
117
|
end
|
110
118
|
|
111
119
|
def git_clean
|
112
|
-
clean? && committed? || raise(
|
120
|
+
clean? && committed? || raise('There are files that need to be committed first.')
|
113
121
|
end
|
114
122
|
|
115
123
|
def clean?
|
@@ -141,9 +149,7 @@ module Rake
|
|
141
149
|
def already_tagged?
|
142
150
|
out, ret = sh 'git', 'tag'
|
143
151
|
|
144
|
-
unless out.split(/\n/).include? @spec.version_tag
|
145
|
-
return false
|
146
|
-
end
|
152
|
+
return false unless out.split(/\n/).include? @spec.version_tag
|
147
153
|
|
148
154
|
Task.ui.confirm "Tag #{@spec.version_tag} has already been created."
|
149
155
|
|
@@ -153,9 +159,7 @@ module Rake
|
|
153
159
|
def git_push(remote)
|
154
160
|
cmd = %w(git push --quiet)
|
155
161
|
|
156
|
-
|
157
|
-
cmd << remote
|
158
|
-
end
|
162
|
+
cmd << remote unless remote.to_s.empty?
|
159
163
|
|
160
164
|
sh! *cmd
|
161
165
|
sh! *cmd, '--tags'
|
@@ -164,7 +168,7 @@ module Rake
|
|
164
168
|
end
|
165
169
|
|
166
170
|
def publish?
|
167
|
-
! %w(n no nil false off 0).include?(ENV[
|
171
|
+
! %w(n no nil false off 0).include?(ENV['gem_push'].to_s.downcase)
|
168
172
|
end
|
169
173
|
|
170
174
|
def sh!(*cmd, **kwargs, &block)
|
@@ -182,7 +186,7 @@ module Rake
|
|
182
186
|
[out, ret]
|
183
187
|
end
|
184
188
|
|
185
|
-
def sh(*cmd, chdir: @spec.base, raise_error: true
|
189
|
+
def sh(*cmd, chdir: @spec.base, raise_error: true)
|
186
190
|
cmd = cmd.flatten.map(&:to_s)
|
187
191
|
|
188
192
|
Task.ui.debug cmd
|
@@ -197,22 +201,17 @@ module Rake
|
|
197
201
|
end
|
198
202
|
|
199
203
|
class << self
|
200
|
-
def load_all(dir =
|
204
|
+
def load_all(dir = pwd)
|
201
205
|
specs = Spec.scan dir.join('**/*.gemspec')
|
202
206
|
|
203
|
-
if specs.size > 1
|
204
|
-
|
205
|
-
end
|
206
|
-
|
207
|
-
if block_given?
|
208
|
-
specs.each(&Proc.new)
|
209
|
-
end
|
207
|
+
specs.each { |spec| spec.namespace = spec.name } if specs.size > 1
|
208
|
+
specs.each(&Proc.new) if block_given?
|
210
209
|
|
211
|
-
if specs.uniq {|s| s.namespace.to_s.strip }.size != specs.size
|
210
|
+
if specs.uniq { |s| s.namespace.to_s.strip }.size != specs.size
|
212
211
|
raise RuntimeError.new 'Non distinct release task namespaces'
|
213
212
|
end
|
214
213
|
|
215
|
-
specs.each {|spec| Task.new spec }
|
214
|
+
specs.each { |spec| Task.new spec }
|
216
215
|
end
|
217
216
|
|
218
217
|
def pwd
|
data/rake-release.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'rake-release'
|
5
|
-
spec.version = '0.
|
5
|
+
spec.version = '0.5.0'
|
6
6
|
spec.authors = ['Jan Graichen']
|
7
7
|
spec.email = ['jgraichen@altimos.de']
|
8
8
|
spec.licenses = ['MIT']
|
9
9
|
|
10
|
-
spec.summary =
|
11
|
-
spec.description =
|
10
|
+
spec.summary = 'Configurable fork of bundlers release tasks.'
|
11
|
+
spec.description = 'Configurable fork of bundlers release tasks.'
|
12
12
|
spec.homepage = 'https://github.com/jgraichen/rake-release'
|
13
13
|
|
14
14
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
data/scripts/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rake/release'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "rake/release"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
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.5.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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.6.4
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Configurable fork of bundlers release tasks.
|