knife-tar 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +165 -36
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e8511e64a86e613d01c98e287f7abb5a2284ab7
|
4
|
+
data.tar.gz: 8cfaaf1f41493c2a32d6b41dbc25598ae54b9610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e13aa6fc497ba20dbee01b94a03b58fe77c5124fc678c4a4d018b44ba29bee4c434559ba1efde221726ef89ded8ca4348f6bc77f06e1185d3b84eb5abfa98570
|
7
|
+
data.tar.gz: 5d462a08ebb757e0a10afbd1cbd002464f1b1429e0582ebbb6e2750f0e26ab442a02b976c472274434a5de66dd5d8d0af7aaa386ee936bdf714fd89b2d4a65ed
|
data/Rakefile
CHANGED
@@ -1,60 +1,189 @@
|
|
1
1
|
# coding: UTF-8
|
2
|
+
require 'octokit'
|
3
|
+
|
4
|
+
REPO = "cerner/knife-tar"
|
2
5
|
|
3
6
|
task :default => [:build]
|
4
7
|
|
5
8
|
task :build do
|
6
|
-
|
7
|
-
runCommand "gem build knife-tar.gemspec"
|
8
|
-
end
|
9
|
-
|
10
|
-
task :release => [:build] do
|
11
|
-
deployGem
|
12
|
-
release
|
9
|
+
build_gem
|
13
10
|
end
|
14
11
|
|
15
|
-
|
12
|
+
task :build_change_log do
|
13
|
+
closed_milestones = Octokit.milestones REPO, {:state => "closed"}
|
14
|
+
|
15
|
+
version_to_milestone = Hash.new
|
16
|
+
versions = Array.new
|
17
|
+
|
18
|
+
closed_milestones.each do |milestone|
|
19
|
+
version = Gem::Version.new(milestone.title)
|
20
|
+
version_to_milestone.store version, milestone
|
21
|
+
versions.push version
|
22
|
+
end
|
23
|
+
|
24
|
+
versions = versions.sort.reverse
|
25
|
+
|
26
|
+
change_log = File.open('CHANGELOG.md', 'w')
|
27
|
+
|
16
28
|
begin
|
17
|
-
|
18
|
-
|
29
|
+
change_log.write "Change Log\n"
|
30
|
+
change_log.write "==========\n"
|
31
|
+
change_log.write "\n"
|
32
|
+
|
33
|
+
versions.each do |version|
|
34
|
+
milestone = version_to_milestone[version]
|
35
|
+
change_log.write generate_milestone_markdown(milestone)
|
36
|
+
change_log.write "\n"
|
37
|
+
end
|
19
38
|
ensure
|
20
|
-
|
39
|
+
change_log.close
|
21
40
|
end
|
22
41
|
end
|
23
42
|
|
24
|
-
|
43
|
+
task :release do
|
44
|
+
|
45
|
+
# Get current version
|
46
|
+
version = IO.read(File.join(File.dirname(__FILE__), 'VERSION')).chomp
|
47
|
+
|
48
|
+
# Update change log
|
49
|
+
puts "Updating change log ..."
|
50
|
+
update_change_log version
|
51
|
+
puts "Change log updated!"
|
52
|
+
|
25
53
|
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
54
|
+
# Publish the gem
|
55
|
+
deploy
|
56
|
+
|
57
|
+
# Tag the release
|
58
|
+
puts "Tagging the #{version} release ..."
|
59
|
+
run_command "git tag -a #{version} -m 'Released #{version}'"
|
60
|
+
run_command "git push origin #{version}"
|
61
|
+
puts "Release tagged!"
|
30
62
|
|
31
|
-
#
|
32
|
-
|
33
|
-
versions = rawVersion.split "."
|
63
|
+
# Bump VERSION file
|
64
|
+
versions = version.split "."
|
34
65
|
versions[1] = versions[1].to_i + 1
|
35
|
-
newVersion = versions.join "."
|
36
66
|
|
37
|
-
|
67
|
+
# Reset bug number if available
|
68
|
+
if versions.size == 3
|
69
|
+
versions[2] = 0
|
70
|
+
end
|
38
71
|
|
39
|
-
|
72
|
+
new_version = versions.join "."
|
40
73
|
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
runCommand "git commit -m 'Released #{rawVersions} and bumped version to #{newVersion}'"
|
45
|
-
runCommand "git push origin master"
|
74
|
+
puts "Updating version from #{version} to #{new_version} ..."
|
75
|
+
File.open('VERSION', 'w') { |file| file.write(new_version) }
|
76
|
+
puts "Version updated!"
|
46
77
|
|
78
|
+
# Commit the updated VERSION file
|
79
|
+
puts "Commiting the new version ..."
|
80
|
+
run_command "git add VERSION"
|
81
|
+
run_command "git commit -m 'Released #{version} and bumped version to #{new_version}'"
|
82
|
+
run_command "git push origin HEAD"
|
83
|
+
puts "Version commited!"
|
84
|
+
end
|
85
|
+
|
86
|
+
def build_gem
|
87
|
+
puts "Building the gem ..."
|
88
|
+
run_command "gem build knife-tar.gemspec"
|
89
|
+
puts "Gem built!"
|
90
|
+
end
|
91
|
+
|
92
|
+
def deploy
|
93
|
+
begin
|
94
|
+
build_gem
|
95
|
+
|
96
|
+
puts "Publishing the gem ..."
|
97
|
+
run_command "gem push knife-tar*.gem"
|
98
|
+
puts "Gem published!"
|
99
|
+
ensure
|
100
|
+
system "rm -f knife-tar*.gem"
|
101
|
+
end
|
47
102
|
end
|
48
103
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
104
|
+
def update_change_log version
|
105
|
+
change_log_lines = IO.read(File.join(File.dirname(__FILE__), 'CHANGELOG.md')).split("\n")
|
106
|
+
|
107
|
+
change_log = File.open('CHANGELOG.md', 'w')
|
108
|
+
|
109
|
+
begin
|
110
|
+
|
111
|
+
# Keep change log title
|
112
|
+
change_log.write change_log_lines.shift
|
113
|
+
change_log.write "\n"
|
114
|
+
change_log.write change_log_lines.shift
|
115
|
+
change_log.write "\n"
|
116
|
+
change_log.write "\n"
|
54
117
|
|
55
|
-
#
|
56
|
-
|
118
|
+
# Write new milestone info
|
119
|
+
change_log.write generate_milestone_markdown(milestone(version))
|
57
120
|
|
58
|
-
|
121
|
+
# Add previous change log info
|
122
|
+
change_log_lines.each do |line|
|
123
|
+
change_log.write line
|
124
|
+
change_log.write "\n"
|
125
|
+
end
|
126
|
+
|
127
|
+
ensure
|
128
|
+
change_log.close
|
129
|
+
end
|
130
|
+
|
131
|
+
run_command "git add CHANGELOG.md"
|
132
|
+
run_command "git commit -m 'Added #{version} to change log'"
|
133
|
+
run_command "git push origin HEAD"
|
134
|
+
end
|
135
|
+
|
136
|
+
def generate_milestone_markdown milestone
|
137
|
+
strings = Array.new
|
138
|
+
|
139
|
+
title = "[#{milestone.title}](https://github.com/#{REPO}/issues?milestone=#{milestone.number}&state=closed)"
|
140
|
+
|
141
|
+
strings.push "#{title}"
|
142
|
+
strings.push "-" * title.length
|
143
|
+
strings.push ""
|
144
|
+
|
145
|
+
issues = Octokit.issues REPO, {:milestone => milestone.number, :state => "closed"}
|
146
|
+
|
147
|
+
issues.each do |issue|
|
148
|
+
strings.push " * [#{issue_type issue}] [Issue-#{issue.number}](https://github.com/#{REPO}/issues/#{issue.number}) : #{issue.title}"
|
59
149
|
end
|
60
|
-
|
150
|
+
|
151
|
+
strings.push ""
|
152
|
+
|
153
|
+
strings.join "\n"
|
154
|
+
end
|
155
|
+
|
156
|
+
def milestone version
|
157
|
+
closedMilestones = Octokit.milestones REPO, {:state => "closed"}
|
158
|
+
|
159
|
+
closedMilestones.each do |milestone|
|
160
|
+
if milestone["title"] == version
|
161
|
+
return milestone
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
openMilestones = Octokit.milestones REPO
|
166
|
+
|
167
|
+
openMilestones.each do |milestone|
|
168
|
+
if milestone["title"] == version
|
169
|
+
return milestone
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
raise "Unable to find milestone with title [#{version}]"
|
174
|
+
end
|
175
|
+
|
176
|
+
def issue_type issue
|
177
|
+
labels = Array.new
|
178
|
+
issue.labels.each do |label|
|
179
|
+
labels.push label.name.capitalize
|
180
|
+
end
|
181
|
+
labels.join "/"
|
182
|
+
end
|
183
|
+
|
184
|
+
def run_command command
|
185
|
+
output = `#{command}`
|
186
|
+
unless $?.success?
|
187
|
+
raise "Command : [#{command}] failed.\nOutput : \n#{output}"
|
188
|
+
end
|
189
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-tar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Baugher
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '10.12'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: '10.12'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubyforge_project:
|
89
|
+
rubyforge_project: nowarning
|
90
90
|
rubygems_version: 2.0.3
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|