semvergen 1.4.3 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +8 -0
- data/bin/semvergen +5 -0
- data/lib/semvergen/bump.rb +11 -22
- data/lib/semvergen/change_log_file.rb +22 -5
- data/lib/semvergen/launcher.rb +4 -0
- data/lib/semvergen/release.rb +52 -0
- data/lib/semvergen/version.rb +1 -1
- data/lib/semvergen.rb +1 -0
- data/semvergen.gemspec +7 -7
- data/spec/semvergen/bump_spec.rb +2 -2
- data/spec/semvergen/change_log_file_spec.rb +36 -0
- data/spec/spec_helper.rb +15 -16
- data/spec/support/CHANGELOG.md +10 -0
- metadata +45 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e578b37b3df394a808f5c107e7da0c74aef146ad
|
4
|
+
data.tar.gz: 66ce38c8b3eafb07997ac9657f18dfce607e02cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4524b7d8f0b7c07a4127bd5737f06911d57ec7c27abf01bce5d663dcff0b59256fd60c40a7da1fda86fab2510f01c010ae66a71471c5c873d529c6a20d8a2f34
|
7
|
+
data.tar.gz: e5d8fd03abee1b7674859dc485d559e8edc19a4cd771e2ce7a3c61dd4b04823c2a7e2d01073315743b672984d0978015185ef12ebd2d37e4ccd06f2f8077ba5c
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/bin/semvergen
CHANGED
data/lib/semvergen/bump.rb
CHANGED
@@ -101,11 +101,7 @@ module Semvergen
|
|
101
101
|
say color("Will add the following to CHANGELOG.md", :underline)
|
102
102
|
say color(diff_change_log)
|
103
103
|
|
104
|
-
commit_message =
|
105
|
-
q.validate = /.{10,}/
|
106
|
-
q.responses[:not_valid] = color("Message must be more than 10 chars", :red)
|
107
|
-
q.responses[:invalid_type] = color("Message must be more than 10 chars", :red)
|
108
|
-
end
|
104
|
+
commit_message = "Version bump: #{new_version}"
|
109
105
|
|
110
106
|
newline
|
111
107
|
|
@@ -119,7 +115,7 @@ module Semvergen
|
|
119
115
|
say color(diff_change_log, :green)
|
120
116
|
|
121
117
|
say "Staging files for commit:"
|
122
|
-
say color("*
|
118
|
+
say color("* #{@version_file.path}", :green)
|
123
119
|
say color("* CHANGELOG.md", :green)
|
124
120
|
newline
|
125
121
|
|
@@ -138,22 +134,15 @@ module Semvergen
|
|
138
134
|
newline
|
139
135
|
end
|
140
136
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
@
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
@shell.publish(@gem_name, @version_file.version, @gem_server)
|
151
|
-
say color("OK", :green, :bold)
|
152
|
-
|
153
|
-
@notifier.gem_published(@gem_name, new_version, features.join("\n"))
|
154
|
-
|
155
|
-
@shell.cleanup(@gem_name, new_version) rescue say color("Unable to cleanup", :red)
|
156
|
-
end
|
137
|
+
Semvergen::Release.new(
|
138
|
+
@interface,
|
139
|
+
@version_file,
|
140
|
+
@change_log_file,
|
141
|
+
@shell,
|
142
|
+
@gem_name,
|
143
|
+
@gem_server,
|
144
|
+
@notifier
|
145
|
+
).run!(features: features)
|
157
146
|
|
158
147
|
end
|
159
148
|
end
|
@@ -2,18 +2,35 @@ module Semvergen
|
|
2
2
|
|
3
3
|
class ChangeLogFile
|
4
4
|
|
5
|
+
def initialize(change_log_filename=nil)
|
6
|
+
@change_log_filename = change_log_filename || "CHANGELOG.md"
|
7
|
+
end
|
8
|
+
|
5
9
|
def <<(message)
|
6
|
-
current_change_log = File.exist?(
|
10
|
+
current_change_log = File.exist?(@change_log_filename) ? File.read(@change_log_filename) : ""
|
7
11
|
new_change_log = "# Changelog\n\n#{message}" + current_change_log.gsub("# Changelog\n", "")
|
8
|
-
File.open(
|
12
|
+
File.open(@change_log_filename, "w") { |f| f.write new_change_log }
|
13
|
+
end
|
14
|
+
|
15
|
+
def features(version=nil)
|
16
|
+
features_for_version(version || latest_version)
|
9
17
|
end
|
10
18
|
|
11
19
|
private
|
12
20
|
|
13
|
-
def
|
14
|
-
File.
|
21
|
+
def latest_version
|
22
|
+
lines = File.readlines(@change_log_filename).map { |l| l.chomp }
|
23
|
+
Array(lines.slice_before(/^#/))[1][0].gsub("# ", "")
|
24
|
+
end
|
25
|
+
|
26
|
+
def features_for_version(version)
|
27
|
+
lines = File.readlines(@change_log_filename).map { |l| l.chomp }
|
28
|
+
features = lines.slice_before(/^#/).select { |a| a.first == "# #{version}" }.first[1..-1]
|
29
|
+
features.select do |feature|
|
30
|
+
!feature.empty?
|
31
|
+
end.compact
|
15
32
|
end
|
16
33
|
|
17
34
|
end
|
18
35
|
|
19
|
-
end
|
36
|
+
end
|
data/lib/semvergen/launcher.rb
CHANGED
@@ -6,6 +6,10 @@ module Semvergen
|
|
6
6
|
Semvergen::Bump.new(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
7
7
|
end
|
8
8
|
|
9
|
+
def release!(options={})
|
10
|
+
Semvergen::Release.new(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
11
|
+
end
|
12
|
+
|
9
13
|
private
|
10
14
|
|
11
15
|
def version_file
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Semvergen
|
2
|
+
|
3
|
+
class Release
|
4
|
+
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
def_delegators :@interface, :say, :ask, :color, :choose, :newline, :agree
|
8
|
+
|
9
|
+
def initialize(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier)
|
10
|
+
@interface = interface
|
11
|
+
@version_file = version_file
|
12
|
+
@change_log_file = change_log_file
|
13
|
+
@shell = shell
|
14
|
+
@gem_name = gem_name
|
15
|
+
@gem_server = gem_server
|
16
|
+
@notifier = notifier
|
17
|
+
end
|
18
|
+
|
19
|
+
def run!(options={})
|
20
|
+
if agree("Release? ")
|
21
|
+
say "Found gemspec: #{color(@gem_name, :green)}"
|
22
|
+
newline
|
23
|
+
|
24
|
+
say color("Building gem: ")
|
25
|
+
@shell.build_gem(@gem_name)
|
26
|
+
say color("OK", :green, :bold)
|
27
|
+
|
28
|
+
say color("Publishing: ")
|
29
|
+
@shell.publish(@gem_name, @version_file.version, @gem_server)
|
30
|
+
say color("OK", :green, :bold)
|
31
|
+
|
32
|
+
features = options[:features] || gem_features
|
33
|
+
@notifier.gem_published(@gem_name, gem_version, features.join("\n"))
|
34
|
+
|
35
|
+
@shell.cleanup(@gem_name, gem_version) rescue say color("Unable to cleanup", :red)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def gem_version
|
42
|
+
@version_file.version
|
43
|
+
end
|
44
|
+
|
45
|
+
def gem_features
|
46
|
+
@change_log_file.features
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
data/lib/semvergen/version.rb
CHANGED
data/lib/semvergen.rb
CHANGED
data/semvergen.gemspec
CHANGED
@@ -19,16 +19,16 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_runtime_dependency "highline", "~> 1.6"
|
21
21
|
spec.add_runtime_dependency "thor", "~> 0.14"
|
22
|
-
spec.add_runtime_dependency "geminabox"
|
23
|
-
spec.add_runtime_dependency "slack-notifier"
|
22
|
+
spec.add_runtime_dependency "geminabox", "~> 0.12"
|
23
|
+
spec.add_runtime_dependency "slack-notifier", "~> 1.0"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.6"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.1"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
28
|
spec.add_development_dependency "guard-rspec", "~> 4.0"
|
29
|
-
spec.add_development_dependency "pry"
|
30
|
-
spec.add_development_dependency 'pry-byebug'
|
31
|
-
spec.add_development_dependency 'pry-stack_explorer'
|
32
|
-
spec.add_development_dependency 'pry-rescue'
|
33
|
-
|
29
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
30
|
+
spec.add_development_dependency 'pry-byebug', "~> 2.0"
|
31
|
+
spec.add_development_dependency 'pry-stack_explorer', "~> 0.4"
|
32
|
+
spec.add_development_dependency 'pry-rescue', "~> 1.4"
|
33
|
+
spec.add_development_dependency "simplecov", "~> 0.9"
|
34
34
|
end
|
data/spec/semvergen/bump_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
describe Semvergen::Bump do
|
2
|
-
let(:semvergen) { Semvergen::Bump.new nil, nil, nil, nil }
|
2
|
+
let(:semvergen) { Semvergen::Bump.new nil, nil, nil, nil, nil, nil, nil }
|
3
3
|
|
4
4
|
describe :next_version do
|
5
5
|
let(:next_version) { semvergen.next_version current_version, release_type }
|
@@ -22,4 +22,4 @@ describe Semvergen::Bump do
|
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
|
-
end
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
describe Semvergen::ChangeLogFile do
|
2
|
+
|
3
|
+
let(:changelog_filename) { "spec/support/CHANGELOG.md" }
|
4
|
+
let(:changelog_file) { Semvergen::ChangeLogFile.new(changelog_filename) }
|
5
|
+
|
6
|
+
describe :features do
|
7
|
+
|
8
|
+
context "latest version" do
|
9
|
+
|
10
|
+
it "returns the correct features" do
|
11
|
+
expect(changelog_file.features).to include("* Feature 1", "* Feature 2", "* Feature 3")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "does not include extra features" do
|
15
|
+
expect(changelog_file.features.count).to eq(3)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
context "specified version" do
|
21
|
+
let(:version) { "1.1.3" }
|
22
|
+
let(:features) { changelog_file.features(version) }
|
23
|
+
|
24
|
+
it "returns the correct features" do
|
25
|
+
expect(features).to include("* feature", "* another feature")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "does not include extra features" do
|
29
|
+
expect(features.count).to eq(2)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
1
|
+
require "simplecov"
|
2
|
+
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
4
|
+
SimpleCov::Formatter::HTMLFormatter
|
5
|
+
]
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter "/spec/"
|
9
|
+
add_filter "/vendor/bundle"
|
10
|
+
end
|
11
|
+
|
12
|
+
if ENV['CIRCLE_ARTIFACTS']
|
13
|
+
dir = File.join("..", "..", "..", ENV['CIRCLE_ARTIFACTS'], "coverage")
|
14
|
+
SimpleCov.coverage_dir(dir)
|
15
|
+
end
|
17
16
|
|
18
17
|
require 'semvergen'
|
19
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semvergen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendon McLean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -42,30 +42,30 @@ dependencies:
|
|
42
42
|
name: geminabox
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.12'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: slack-notifier
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '1.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,58 +126,72 @@ dependencies:
|
|
126
126
|
name: pry
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '0.10'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
138
|
+
version: '0.10'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: pry-byebug
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
145
|
+
version: '2.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
152
|
+
version: '2.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pry-stack_explorer
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
159
|
+
version: '0.4'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
166
|
+
version: '0.4'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: pry-rescue
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '1.4'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1.4'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: simplecov
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.9'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
194
|
+
version: '0.9'
|
181
195
|
description:
|
182
196
|
email:
|
183
197
|
- brendon@intellectionsoftware.com
|
@@ -203,14 +217,17 @@ files:
|
|
203
217
|
- lib/semvergen/interface.rb
|
204
218
|
- lib/semvergen/launcher.rb
|
205
219
|
- lib/semvergen/null_notifier.rb
|
220
|
+
- lib/semvergen/release.rb
|
206
221
|
- lib/semvergen/shell.rb
|
207
222
|
- lib/semvergen/slack_notifier.rb
|
208
223
|
- lib/semvergen/version.rb
|
209
224
|
- lib/semvergen/version_file.rb
|
210
225
|
- semvergen.gemspec
|
211
226
|
- spec/semvergen/bump_spec.rb
|
227
|
+
- spec/semvergen/change_log_file_spec.rb
|
212
228
|
- spec/semvergen/shell_spec.rb
|
213
229
|
- spec/spec_helper.rb
|
230
|
+
- spec/support/CHANGELOG.md
|
214
231
|
homepage: https://github.com/brendon9x/semvergen
|
215
232
|
licenses:
|
216
233
|
- MIT
|
@@ -237,5 +254,7 @@ specification_version: 4
|
|
237
254
|
summary: Interactive semantic version and gem publishing
|
238
255
|
test_files:
|
239
256
|
- spec/semvergen/bump_spec.rb
|
257
|
+
- spec/semvergen/change_log_file_spec.rb
|
240
258
|
- spec/semvergen/shell_spec.rb
|
241
259
|
- spec/spec_helper.rb
|
260
|
+
- spec/support/CHANGELOG.md
|