semvergen 1.7.1 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +16 -0
- data/lib/semvergen/bump.rb +10 -2
- data/lib/semvergen/change_log_file.rb +1 -1
- data/lib/semvergen/extensions/node_module/version_file.rb +29 -0
- data/lib/semvergen/launcher.rb +17 -3
- data/lib/semvergen/release.rb +13 -2
- data/lib/semvergen/shell.rb +26 -9
- data/lib/semvergen/version.rb +1 -1
- data/lib/semvergen.rb +2 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8abff57e89ab5b7e430653b7dad3434a059568
|
4
|
+
data.tar.gz: 1e93190c4ed92b2a258694fd4be9952000bfbacf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71c79b8294db32f84a6c0e8fdd83f594746b161a97fefb8b91c7500d9df0e641f98286a06e101c54452ba20521b6659057661212930f51ca00e995f480d032e4
|
7
|
+
data.tar.gz: be1cf9fe8fdc1fc60e306ed4a15d0b8baf77e677b9c7ce79f5436606ec03a588d13b90f135b98035986aa507519fdd8d17f6006e0f04018fc04471a6640f6ac7
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.3.3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
# 1.9.1
|
4
|
+
* Stage node module's package.json for commit if the file is available
|
5
|
+
|
6
|
+
|
7
|
+
# 1.9.0
|
8
|
+
* Extend gem to support optional node module bumping
|
9
|
+
|
10
|
+
|
11
|
+
# 1.8.1
|
12
|
+
* Enforce UTF-8 encoding on changelog file read
|
13
|
+
|
14
|
+
|
15
|
+
# 1.8.0
|
16
|
+
* Semvergen can release on rubygems.org
|
17
|
+
|
18
|
+
|
3
19
|
# 1.7.1
|
4
20
|
* Bug fix branch push
|
5
21
|
|
data/lib/semvergen/bump.rb
CHANGED
@@ -16,9 +16,10 @@ module Semvergen
|
|
16
16
|
|
17
17
|
def_delegators :@interface, :say, :ask, :color, :choose, :newline, :agree
|
18
18
|
|
19
|
-
def initialize(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier)
|
19
|
+
def initialize(interface, version_file, node_version_file, change_log_file, shell, gem_name, gem_server, notifier)
|
20
20
|
@interface = interface
|
21
21
|
@version_file = version_file
|
22
|
+
@node_version_file = node_version_file
|
22
23
|
@change_log_file = change_log_file
|
23
24
|
@shell = shell
|
24
25
|
@gem_name = gem_name
|
@@ -125,9 +126,15 @@ module Semvergen
|
|
125
126
|
if agree("Proceed? ")
|
126
127
|
@version_file.version = new_version
|
127
128
|
|
129
|
+
node_version_file_path = nil
|
130
|
+
if @node_version_file
|
131
|
+
@node_version_file.version = new_version
|
132
|
+
node_version_file_path = @node_version_file.path
|
133
|
+
end
|
134
|
+
|
128
135
|
@change_log_file << change_log_message
|
129
136
|
|
130
|
-
@shell.commit(@version_file.path, new_version, commit_message, features)
|
137
|
+
@shell.commit(@version_file.path, node_version_file_path, new_version, commit_message, features)
|
131
138
|
|
132
139
|
@shell.push(new_version)
|
133
140
|
|
@@ -137,6 +144,7 @@ module Semvergen
|
|
137
144
|
Semvergen::Release.new(
|
138
145
|
@interface,
|
139
146
|
@version_file,
|
147
|
+
@node_version_file,
|
140
148
|
@change_log_file,
|
141
149
|
@shell,
|
142
150
|
@gem_name,
|
@@ -7,7 +7,7 @@ module Semvergen
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def <<(message)
|
10
|
-
current_change_log = File.exist?(@change_log_filename) ? File.read(@change_log_filename) : ""
|
10
|
+
current_change_log = File.exist?(@change_log_filename) ? File.read(@change_log_filename, :encoding => "UTF-8") : ""
|
11
11
|
new_change_log = "# Changelog\n\n#{message}" + current_change_log.gsub("# Changelog\n", "")
|
12
12
|
File.open(@change_log_filename, "w") { |f| f.write new_change_log }
|
13
13
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Semvergen
|
2
|
+
module Extensions
|
3
|
+
module NodeModule
|
4
|
+
class VersionFile
|
5
|
+
|
6
|
+
def initialize(file)
|
7
|
+
@file = file
|
8
|
+
end
|
9
|
+
|
10
|
+
def version=(new_version)
|
11
|
+
content = file.read.gsub(/"version".*$/, %Q["version": "#{new_version}",])
|
12
|
+
file.truncate(0)
|
13
|
+
file.write content
|
14
|
+
file.flush
|
15
|
+
end
|
16
|
+
|
17
|
+
def file
|
18
|
+
@file.rewind
|
19
|
+
@file
|
20
|
+
end
|
21
|
+
|
22
|
+
def path
|
23
|
+
@file.path
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/semvergen/launcher.rb
CHANGED
@@ -3,11 +3,11 @@ module Semvergen
|
|
3
3
|
class Launcher
|
4
4
|
|
5
5
|
def bump!(options={})
|
6
|
-
Semvergen::Bump.new(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
6
|
+
Semvergen::Bump.new(interface, version_file, node_version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
7
7
|
end
|
8
8
|
|
9
9
|
def release!(options={})
|
10
|
-
Semvergen::Release.new(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
10
|
+
Semvergen::Release.new(interface, version_file, node_version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
@@ -20,6 +20,16 @@ module Semvergen
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def node_version_file
|
24
|
+
if config["node_module"]
|
25
|
+
if File.exist? node_version_path
|
26
|
+
Extensions::NodeModule::VersionFile.new(File.open(node_version_path, "r+"))
|
27
|
+
else
|
28
|
+
interface.fail_exit "A npm style version file should be found at #{node_version_path}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
def change_log_file
|
24
34
|
ChangeLogFile.new
|
25
35
|
end
|
@@ -32,6 +42,10 @@ module Semvergen
|
|
32
42
|
File.join("lib", gem_name, "version.rb")
|
33
43
|
end
|
34
44
|
|
45
|
+
def node_version_path
|
46
|
+
File.join("package.json")
|
47
|
+
end
|
48
|
+
|
35
49
|
def gem_name
|
36
50
|
File.basename(gem_spec).gsub(".gemspec", "")
|
37
51
|
end
|
@@ -64,7 +78,7 @@ module Semvergen
|
|
64
78
|
|
65
79
|
def config
|
66
80
|
@config ||= if File.exist?(config_path)
|
67
|
-
YAML.load_file(config_path)
|
81
|
+
YAML.load_file(config_path) || {}
|
68
82
|
else
|
69
83
|
{}
|
70
84
|
end
|
data/lib/semvergen/release.rb
CHANGED
@@ -6,9 +6,10 @@ module Semvergen
|
|
6
6
|
|
7
7
|
def_delegators :@interface, :say, :ask, :color, :choose, :newline, :agree
|
8
8
|
|
9
|
-
def initialize(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier)
|
9
|
+
def initialize(interface, version_file, node_version_file, change_log_file, shell, gem_name, gem_server, notifier)
|
10
10
|
@interface = interface
|
11
11
|
@version_file = version_file
|
12
|
+
@node_version_file = node_version_file
|
12
13
|
@change_log_file = change_log_file
|
13
14
|
@shell = shell
|
14
15
|
@gem_name = gem_name
|
@@ -18,6 +19,9 @@ module Semvergen
|
|
18
19
|
|
19
20
|
def run!(options={})
|
20
21
|
if agree("Release? ")
|
22
|
+
if @gem_server == "rubygems.org" && !File.exist?(File.expand_path("~/.gem/credentials"))
|
23
|
+
@interface.fail_exit("Could not find rubygems.org credentials file at ~/.gem/credentials. Please make sure this file exists and that it has the correct credentials before continuing.")
|
24
|
+
end
|
21
25
|
say "Found gemspec: #{color(@gem_name, :green)}"
|
22
26
|
newline
|
23
27
|
|
@@ -29,6 +33,13 @@ module Semvergen
|
|
29
33
|
@shell.publish(@gem_name, @version_file.version, @gem_server)
|
30
34
|
say color("OK", :green, :bold)
|
31
35
|
|
36
|
+
if @node_version_file
|
37
|
+
say color("Publishing to NPM: ")
|
38
|
+
if @shell.publish_node_module.nil?
|
39
|
+
say color("Error: npm CLI not found! Please ensure that 'npm publish' runs successfully", :underline, :red)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
32
43
|
features = options[:features] || gem_features
|
33
44
|
@notifier.gem_published(@gem_name, gem_version, features.join("\n"))
|
34
45
|
|
@@ -49,4 +60,4 @@ module Semvergen
|
|
49
60
|
|
50
61
|
end
|
51
62
|
|
52
|
-
end
|
63
|
+
end
|
data/lib/semvergen/shell.rb
CHANGED
@@ -26,11 +26,14 @@ module Semvergen
|
|
26
26
|
`git rev-list HEAD..@{u} --count`.strip.to_i == 0
|
27
27
|
end
|
28
28
|
|
29
|
-
def commit(version_path, new_version, commit_subject, features)
|
30
|
-
commit_body =
|
29
|
+
def commit(version_path, node_version_path, new_version, commit_subject, features)
|
30
|
+
commit_body = commit_message(new_version, commit_subject, features.join("\n"))
|
31
31
|
|
32
32
|
execute "git add CHANGELOG.md"
|
33
33
|
execute "git add #{version_path}"
|
34
|
+
if node_version_path
|
35
|
+
execute "git add #{node_version_path}"
|
36
|
+
end
|
34
37
|
execute %Q[git commit -m "#{commit_body}"]
|
35
38
|
execute %Q[git tag #{new_version} -a -m "Version: #{new_version} - #{commit_subject}"]
|
36
39
|
end
|
@@ -44,7 +47,15 @@ module Semvergen
|
|
44
47
|
end
|
45
48
|
|
46
49
|
def publish(gem_name, version, gem_server)
|
47
|
-
|
50
|
+
if gem_server == "rubygems.org"
|
51
|
+
publish_to_rubygems(gem_name, version)
|
52
|
+
else
|
53
|
+
publish_to_gemserver(gem_name, version, gem_server)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def publish_node_module
|
58
|
+
execute "npm publish" rescue nil
|
48
59
|
end
|
49
60
|
|
50
61
|
def cleanup(gem_name, version)
|
@@ -53,6 +64,14 @@ module Semvergen
|
|
53
64
|
|
54
65
|
private
|
55
66
|
|
67
|
+
def publish_to_gemserver(gem_name, version, gem_server)
|
68
|
+
execute "gem inabox #{gem_name}-#{version}.gem --host #{gem_server}"
|
69
|
+
end
|
70
|
+
|
71
|
+
def publish_to_rubygems(gem_name, version)
|
72
|
+
execute "gem push #{gem_name}-#{version}.gem"
|
73
|
+
end
|
74
|
+
|
56
75
|
def execute(command)
|
57
76
|
@execute_function[command]
|
58
77
|
end
|
@@ -63,12 +82,10 @@ module Semvergen
|
|
63
82
|
result
|
64
83
|
end
|
65
84
|
|
66
|
-
|
67
|
-
Version
|
68
|
-
|
69
|
-
%s
|
70
|
-
STR
|
85
|
+
def commit_message(new_version, commit_subject, features)
|
86
|
+
"Version #{new_version}: #{commit_subject}\n\n#{features}"
|
87
|
+
end
|
71
88
|
|
72
89
|
end
|
73
90
|
|
74
|
-
end
|
91
|
+
end
|
data/lib/semvergen/version.rb
CHANGED
data/lib/semvergen.rb
CHANGED
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.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendon McLean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- lib/semvergen.rb
|
215
215
|
- lib/semvergen/bump.rb
|
216
216
|
- lib/semvergen/change_log_file.rb
|
217
|
+
- lib/semvergen/extensions/node_module/version_file.rb
|
217
218
|
- lib/semvergen/interface.rb
|
218
219
|
- lib/semvergen/launcher.rb
|
219
220
|
- lib/semvergen/null_notifier.rb
|
@@ -248,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
249
|
version: '0'
|
249
250
|
requirements: []
|
250
251
|
rubyforge_project:
|
251
|
-
rubygems_version: 2.
|
252
|
+
rubygems_version: 2.6.10
|
252
253
|
signing_key:
|
253
254
|
specification_version: 4
|
254
255
|
summary: Interactive semantic version and gem publishing
|