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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33e0efa2d15e88b158e5f5602bd48b89e7f3c183
4
- data.tar.gz: 737cc5a8fd427ce9044cf9eff905f71d6261ebf0
3
+ metadata.gz: e578b37b3df394a808f5c107e7da0c74aef146ad
4
+ data.tar.gz: 66ce38c8b3eafb07997ac9657f18dfce607e02cf
5
5
  SHA512:
6
- metadata.gz: ba69295e2a5f6ba6654db55ddc89f74ce1cb0260dc26e906db9ea1e8403aa296192dd1f30eb0cf153a42b394a02f06f3c40691515a194481cdeef015a1fb72bb
7
- data.tar.gz: 2b839174fd0a5a4efbb1c9f3cbf2402bb564e7e6895c7cb7e044fbc2489d11a7e008cbdff6309e0d40e318a4d5aeb004c5ea5a4783bf8ed03b55c1b619776287
6
+ metadata.gz: 4524b7d8f0b7c07a4127bd5737f06911d57ec7c27abf01bce5d663dcff0b59256fd60c40a7da1fda86fab2510f01c010ae66a71471c5c873d529c6a20d8a2f34
7
+ data.tar.gz: e5d8fd03abee1b7674859dc485d559e8edc19a4cd771e2ce7a3c61dd4b04823c2a7e2d01073315743b672984d0978015185ef12ebd2d37e4ccd06f2f8077ba5c
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  /InstalledFiles
6
6
  /pkg/
7
7
  /spec/reports/
8
+ /vendor/bundle/
8
9
  /test/tmp/
9
10
  /test/version_tmp/
10
11
  /tmp/
@@ -36,4 +37,4 @@ build/
36
37
 
37
38
  .gem_server
38
39
  .semvergen
39
- Gemfile.lock
40
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ # 1.6.0
4
+ * Make this gem work again
5
+
6
+
7
+ # 1.5.0
8
+ * Hardcode git commit subject line
9
+
10
+
3
11
  # 1.4.3
4
12
  * Bugfix
5
13
 
data/bin/semvergen CHANGED
@@ -12,6 +12,11 @@ class SemvergenCLI < Thor
12
12
  def bump
13
13
  Semvergen.bump!(options)
14
14
  end
15
+
16
+ desc "release", "Release the current version of this gem"
17
+ def release
18
+ Semvergen.release!(options)
19
+ end
15
20
 
16
21
  end
17
22
 
@@ -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 = ask("Git commit subject line: ") do |q|
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("* lib/quattro/version.rb", :green)
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
- if agree("Release? ")
142
- say "Found gemspec: #{color(@gem_name, :green)}"
143
- newline
144
-
145
- say color("Building gem: ")
146
- @shell.build_gem(@gem_name)
147
- say color("OK", :green, :bold)
148
-
149
- say color("Publishing: ")
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?(change_log_file) ? File.read(change_log_file) : ""
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(change_log_file, "w") { |f| f.write new_change_log }
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 change_log_file
14
- File.join("CHANGELOG.md")
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Semvergen
2
- VERSION = "1.4.3"
2
+ VERSION = "1.6.0"
3
3
  end
data/lib/semvergen.rb CHANGED
@@ -3,6 +3,7 @@ require "semvergen/version"
3
3
  require "semvergen/launcher"
4
4
  require "semvergen/interface"
5
5
  require "semvergen/bump"
6
+ require "semvergen/release"
6
7
  require "semvergen/change_log_file"
7
8
  require "semvergen/shell"
8
9
  require "semvergen/version_file"
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
@@ -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
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
- # file to always be loaded, without a need to explicitly require it in any files.
5
- #
6
- # Given that it is always loaded, you are encouraged to keep this file as
7
- # light-weight as possible. Requiring heavyweight dependencies from this file
8
- # will add to the boot time of your test suite on EVERY test run, even for an
9
- # individual file that may not need all of that loaded. Instead, make a
10
- # separate helper file that requires this one and then use it only in the specs
11
- # that actually need it.
12
- #
13
- # The `.rspec` file also contains a few flags that are not defaults but that
14
- # users commonly want.
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
 
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ # 1.1.4
4
+ * Feature 1
5
+ * Feature 2
6
+ * Feature 3
7
+
8
+ # 1.1.3
9
+ * feature
10
+ * another feature
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.3
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-03-03 00:00:00.000000000 Z
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: '0'
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