semvergen 1.1.0 → 1.2.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 +4 -0
- data/Gemfile.lock +49 -22
- data/lib/semvergen/bump.rb +28 -3
- data/lib/semvergen/launcher.rb +31 -3
- data/lib/semvergen/null_notifier.rb +11 -0
- data/lib/semvergen/shell.rb +19 -2
- data/lib/semvergen/slack_notifier.rb +50 -0
- data/lib/semvergen/version.rb +1 -1
- data/lib/semvergen/version_file.rb +1 -1
- data/lib/semvergen.rb +2 -0
- data/semvergen.gemspec +6 -0
- metadata +74 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8c261bd75260cff24e44263032e7c82fd737630
|
4
|
+
data.tar.gz: 9be85711ee737bc09177a2aab242516eed974d48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1d516039ea09de2bc06c3d72863a836ff8154c6acce51fd3bb6b41177c046090286120621f458730b8c1338317ec1868cd511d68a2c25a152b573c83a171dfe
|
7
|
+
data.tar.gz: 1a1167667dcd659fa2dadcd1a035b0b27a1ba84188861abe438da6362106c1d12ae3ed7122a84131b19e8f2b55dd667e798c0e5e08ecf4b14c2f704bb4be50fd
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
semvergen (1.
|
4
|
+
semvergen (1.2.0)
|
5
5
|
geminabox
|
6
6
|
highline (~> 1.6)
|
7
|
+
slack-notifier
|
7
8
|
thor (~> 0.14)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
13
|
+
binding_of_caller (0.7.2)
|
14
|
+
debug_inspector (>= 0.0.1)
|
12
15
|
builder (3.2.2)
|
13
|
-
|
14
|
-
|
16
|
+
byebug (3.5.1)
|
17
|
+
columnize (~> 0.8)
|
18
|
+
debugger-linecache (~> 1.2)
|
19
|
+
slop (~> 3.6)
|
20
|
+
celluloid (0.16.0)
|
21
|
+
timers (~> 4.0.0)
|
15
22
|
coderay (1.1.0)
|
23
|
+
columnize (0.8.9)
|
24
|
+
debug_inspector (0.0.2)
|
25
|
+
debugger-linecache (1.2.0)
|
16
26
|
diff-lcs (1.2.5)
|
17
27
|
faraday (0.9.0)
|
18
28
|
multipart-post (>= 1.2, < 3)
|
19
|
-
ffi (1.9.
|
29
|
+
ffi (1.9.6)
|
20
30
|
formatador (0.2.5)
|
21
31
|
geminabox (0.12.4)
|
22
32
|
builder
|
@@ -24,18 +34,20 @@ GEM
|
|
24
34
|
httpclient (>= 2.2.7)
|
25
35
|
nesty
|
26
36
|
sinatra (>= 1.2.7)
|
27
|
-
guard (2.
|
37
|
+
guard (2.8.0)
|
28
38
|
formatador (>= 0.2.4)
|
29
39
|
listen (~> 2.7)
|
30
40
|
lumberjack (~> 1.0)
|
31
41
|
pry (>= 0.9.12)
|
32
42
|
thor (>= 0.18.1)
|
33
|
-
guard-rspec (4.
|
43
|
+
guard-rspec (4.3.1)
|
34
44
|
guard (~> 2.1)
|
35
45
|
rspec (>= 2.14, < 4.0)
|
36
46
|
highline (1.6.21)
|
37
|
-
|
38
|
-
|
47
|
+
hitimes (1.2.2)
|
48
|
+
httpclient (2.5.3.1)
|
49
|
+
interception (0.5)
|
50
|
+
listen (2.7.11)
|
39
51
|
celluloid (>= 0.15.2)
|
40
52
|
rb-fsevent (>= 0.9.3)
|
41
53
|
rb-inotify (>= 0.9)
|
@@ -43,10 +55,19 @@ GEM
|
|
43
55
|
method_source (0.8.2)
|
44
56
|
multipart-post (2.0.0)
|
45
57
|
nesty (1.0.2)
|
46
|
-
pry (0.10.
|
58
|
+
pry (0.10.1)
|
47
59
|
coderay (~> 1.1.0)
|
48
60
|
method_source (~> 0.8.1)
|
49
61
|
slop (~> 3.4)
|
62
|
+
pry-byebug (2.0.0)
|
63
|
+
byebug (~> 3.4)
|
64
|
+
pry (~> 0.10)
|
65
|
+
pry-rescue (1.4.1)
|
66
|
+
interception (>= 0.5)
|
67
|
+
pry
|
68
|
+
pry-stack_explorer (0.4.9.1)
|
69
|
+
binding_of_caller (>= 0.7)
|
70
|
+
pry (>= 0.9.11)
|
50
71
|
rack (1.5.2)
|
51
72
|
rack-protection (1.5.3)
|
52
73
|
rack
|
@@ -54,26 +75,28 @@ GEM
|
|
54
75
|
rb-fsevent (0.9.4)
|
55
76
|
rb-inotify (0.9.5)
|
56
77
|
ffi (>= 0.5.0)
|
57
|
-
rspec (3.
|
58
|
-
rspec-core (~> 3.
|
59
|
-
rspec-expectations (~> 3.
|
60
|
-
rspec-mocks (~> 3.
|
61
|
-
rspec-core (3.
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-expectations (3.
|
78
|
+
rspec (3.1.0)
|
79
|
+
rspec-core (~> 3.1.0)
|
80
|
+
rspec-expectations (~> 3.1.0)
|
81
|
+
rspec-mocks (~> 3.1.0)
|
82
|
+
rspec-core (3.1.7)
|
83
|
+
rspec-support (~> 3.1.0)
|
84
|
+
rspec-expectations (3.1.2)
|
64
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-mocks (3.
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-support (3.
|
86
|
+
rspec-support (~> 3.1.0)
|
87
|
+
rspec-mocks (3.1.3)
|
88
|
+
rspec-support (~> 3.1.0)
|
89
|
+
rspec-support (3.1.2)
|
69
90
|
sinatra (1.4.5)
|
70
91
|
rack (~> 1.4)
|
71
92
|
rack-protection (~> 1.4)
|
72
93
|
tilt (~> 1.3, >= 1.3.4)
|
73
|
-
|
94
|
+
slack-notifier (1.0.0)
|
95
|
+
slop (3.6.0)
|
74
96
|
thor (0.19.1)
|
75
97
|
tilt (1.4.1)
|
76
|
-
timers (
|
98
|
+
timers (4.0.1)
|
99
|
+
hitimes
|
77
100
|
|
78
101
|
PLATFORMS
|
79
102
|
ruby
|
@@ -81,6 +104,10 @@ PLATFORMS
|
|
81
104
|
DEPENDENCIES
|
82
105
|
bundler (~> 1.6)
|
83
106
|
guard-rspec (~> 4.0)
|
107
|
+
pry
|
108
|
+
pry-byebug
|
109
|
+
pry-rescue
|
110
|
+
pry-stack_explorer
|
84
111
|
rake (~> 10.1)
|
85
112
|
rspec (~> 3.0)
|
86
113
|
semvergen!
|
data/lib/semvergen/bump.rb
CHANGED
@@ -16,20 +16,43 @@ 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)
|
19
|
+
def initialize(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier)
|
20
20
|
@interface = interface
|
21
21
|
@version_file = version_file
|
22
22
|
@change_log_file = change_log_file
|
23
23
|
@shell = shell
|
24
24
|
@gem_name = gem_name
|
25
25
|
@gem_server = gem_server
|
26
|
+
@notifier = notifier
|
26
27
|
end
|
27
28
|
|
28
29
|
def run!(options)
|
30
|
+
unless @shell.current_branch == "master"
|
31
|
+
say color("You are not on master. It is not recommended to create releases from a branch", :red)
|
32
|
+
newline
|
33
|
+
return unless agree("Proceed anyway? ")
|
34
|
+
newline
|
35
|
+
end
|
36
|
+
|
37
|
+
unless @shell.git_branch_is_tracking?
|
38
|
+
@interface.fail_exit color("This branch is not tracking a remote branch. Aborting...", :red)
|
39
|
+
end
|
40
|
+
|
41
|
+
say "Checking for upstream changes..."
|
42
|
+
@shell.git_fetch
|
43
|
+
newline
|
44
|
+
|
45
|
+
unless @shell.git_up_to_date?
|
46
|
+
@interface.fail_exit color("This branch is not up to date with upstream", :red)
|
47
|
+
end
|
48
|
+
|
49
|
+
say "Git status: #{color("Up to date", :green)}"
|
50
|
+
newline
|
51
|
+
|
29
52
|
if @shell.git_index_dirty? && !options[:ignore_dirty]
|
30
53
|
say color("Git index dirty. Commit changes before continuing", :red, :bold)
|
31
54
|
else
|
32
|
-
say color("Cut new
|
55
|
+
say color("Cut new #{@gem_name} Release", :white, :underline, :bold)
|
33
56
|
|
34
57
|
newline
|
35
58
|
|
@@ -110,7 +133,7 @@ module Semvergen
|
|
110
133
|
|
111
134
|
@shell.commit(@version_file.path, new_version, commit_message, features)
|
112
135
|
|
113
|
-
@shell.push
|
136
|
+
@shell.push(new_version)
|
114
137
|
|
115
138
|
newline
|
116
139
|
end
|
@@ -126,6 +149,8 @@ module Semvergen
|
|
126
149
|
say color("Publishing: ")
|
127
150
|
@shell.publish(@gem_name, @version_file.version, @gem_server)
|
128
151
|
say color("OK", :green, :bold)
|
152
|
+
|
153
|
+
@notifier.gem_published(@gem_name, new_version, change_log_message)
|
129
154
|
end
|
130
155
|
|
131
156
|
end
|
data/lib/semvergen/launcher.rb
CHANGED
@@ -3,13 +3,17 @@ 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).run!(options)
|
6
|
+
Semvergen::Bump.new(interface, version_file, change_log_file, shell, gem_name, gem_server, notifier).run!(options)
|
7
7
|
end
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
11
|
def version_file
|
12
|
-
|
12
|
+
if File.exist? version_path
|
13
|
+
VersionFile.new(File.open(version_path, "r+"))
|
14
|
+
else
|
15
|
+
interface.fail_exit "A bundler style version file should be found at #{version_path}"
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def change_log_file
|
@@ -43,6 +47,8 @@ module Semvergen
|
|
43
47
|
def gem_server
|
44
48
|
if File.exists?(gem_server_file)
|
45
49
|
File.read(gem_server_file)
|
50
|
+
elsif (gem_server = config["gemserver"])
|
51
|
+
gem_server
|
46
52
|
else
|
47
53
|
interface.fail_exit "To publish, place the url (with optional username and pass) in a .gem_server file"
|
48
54
|
end
|
@@ -52,6 +58,28 @@ module Semvergen
|
|
52
58
|
File.join(".gem_server")
|
53
59
|
end
|
54
60
|
|
61
|
+
def config
|
62
|
+
@config ||= if File.exist?(config_path)
|
63
|
+
YAML.load_file(config_path)
|
64
|
+
else
|
65
|
+
{}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def config_path
|
70
|
+
File.join(".semvergen")
|
71
|
+
end
|
72
|
+
|
73
|
+
def notifier
|
74
|
+
if config["slack"]
|
75
|
+
require 'semvergen/slack_notifier'
|
76
|
+
SlackNotifier.new config["slack"]
|
77
|
+
else
|
78
|
+
require 'semvergen/null_notifier'
|
79
|
+
NullNotifier.new
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
55
83
|
end
|
56
84
|
|
57
|
-
end
|
85
|
+
end
|
data/lib/semvergen/shell.rb
CHANGED
@@ -10,16 +10,33 @@ module Semvergen
|
|
10
10
|
execute("git status --porcelain") =~ /^\s*(D|M|A|R|C)\s/
|
11
11
|
end
|
12
12
|
|
13
|
+
def current_branch
|
14
|
+
execute("git symbolic-ref --short HEAD").strip
|
15
|
+
end
|
16
|
+
|
17
|
+
def git_fetch
|
18
|
+
`git fetch -q`
|
19
|
+
end
|
20
|
+
|
21
|
+
def git_branch_is_tracking?
|
22
|
+
`git rev-list HEAD..@{u} --count` and return $?.exitstatus == 0
|
23
|
+
end
|
24
|
+
|
25
|
+
def git_up_to_date?
|
26
|
+
`git rev-list HEAD..@{u} --count`.strip.to_i == 0
|
27
|
+
end
|
28
|
+
|
13
29
|
def commit(version_path, new_version, commit_subject, features)
|
14
30
|
commit_body = COMMIT_MESSAGE % [new_version, commit_subject, features.join("\n")]
|
15
31
|
|
16
32
|
execute "git add CHANGELOG.md"
|
17
33
|
execute "git add #{version_path}"
|
18
34
|
execute %Q[git commit -m "#{commit_body}"]
|
35
|
+
execute %Q[git tag #{new_version} -m "Version: #{new_version} - #{commit_subject}"]
|
19
36
|
end
|
20
37
|
|
21
|
-
def push(remote_name="origin", branch_name="master")
|
22
|
-
execute "git push #{remote_name} #{branch_name}"
|
38
|
+
def push(new_version, remote_name="origin", branch_name="master")
|
39
|
+
execute "git push -q #{remote_name} #{branch_name} #{new_version}"
|
23
40
|
end
|
24
41
|
|
25
42
|
def build_gem(gem_name)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'slack-notifier'
|
2
|
+
|
3
|
+
module Semvergen
|
4
|
+
|
5
|
+
class SlackNotifier
|
6
|
+
|
7
|
+
def initialize(opts)
|
8
|
+
@webhook_url = opts["webhook_url"]
|
9
|
+
@username = opts["username"]
|
10
|
+
@icons = opts["icons"]
|
11
|
+
end
|
12
|
+
|
13
|
+
def gem_published(gem_name, new_version, change_log_message)
|
14
|
+
options = {}
|
15
|
+
options[:icon_url] = @icons.sample if @icons
|
16
|
+
options[:attachments] = [attachment(gem_name, new_version, change_log_message)]
|
17
|
+
notifier.ping "Semvergen: release #{gem_name}", options
|
18
|
+
end
|
19
|
+
|
20
|
+
def notifier
|
21
|
+
@notifier ||= Slack::Notifier.new(
|
22
|
+
@webhook_url,
|
23
|
+
username: @username
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def user
|
28
|
+
[
|
29
|
+
ENV["USER"],
|
30
|
+
`whoami`
|
31
|
+
].compact.detect { |u| !u.nil? }
|
32
|
+
end
|
33
|
+
|
34
|
+
def attachment(gem_name, new_version, change_log_message)
|
35
|
+
{
|
36
|
+
title: "#{user} has published a new version of '#{gem_name}'",
|
37
|
+
fallback: change_log_message,
|
38
|
+
fields: [
|
39
|
+
{title: "Version", value: new_version},
|
40
|
+
{title: "Change Log", value: change_log_message}
|
41
|
+
|
42
|
+
],
|
43
|
+
color: "good",
|
44
|
+
mrkdwn_in: ["text", "title", "fallback", "fields"]
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/lib/semvergen/version.rb
CHANGED
data/lib/semvergen.rb
CHANGED
data/semvergen.gemspec
CHANGED
@@ -20,9 +20,15 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_runtime_dependency "highline", "~> 1.6"
|
21
21
|
spec.add_runtime_dependency "thor", "~> 0.14"
|
22
22
|
spec.add_runtime_dependency "geminabox"
|
23
|
+
spec.add_runtime_dependency "slack-notifier"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.6"
|
25
26
|
spec.add_development_dependency "rake", "~> 10.1"
|
26
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
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
|
+
|
28
34
|
end
|
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.2.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: 2014-
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: slack-notifier
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,62 @@ dependencies:
|
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '4.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry-byebug
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry-stack_explorer
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: pry-rescue
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
111
181
|
description:
|
112
182
|
email:
|
113
183
|
- brendon@intellectionsoftware.com
|
@@ -133,7 +203,9 @@ files:
|
|
133
203
|
- lib/semvergen/change_log_file.rb
|
134
204
|
- lib/semvergen/interface.rb
|
135
205
|
- lib/semvergen/launcher.rb
|
206
|
+
- lib/semvergen/null_notifier.rb
|
136
207
|
- lib/semvergen/shell.rb
|
208
|
+
- lib/semvergen/slack_notifier.rb
|
137
209
|
- lib/semvergen/version.rb
|
138
210
|
- lib/semvergen/version_file.rb
|
139
211
|
- semvergen.gemspec
|