hypothesis-specs 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Rakefile +83 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa268fe756074b2622cb193ad22cc5862068c61d
|
4
|
+
data.tar.gz: a16536f49521a9e909a3d64c74f0edbdc5b1c161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eca55bbb7bc8a60ad2d1cbe1d528ab2c823e35d1a06050397b9acf7a170d0acb10686942c5adab3765174074683eef3d9d7f39669cbe304df6e751f7c557f7a
|
7
|
+
data.tar.gz: ef2b80252827b23949abde23e32e78a61ae96eed2273b168f5a14e6dbe7ab7debb5f19025a23f5ab42172b389d7884defe2c229cc2c5c6f2a1751aa726f1171d
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'helix_runtime/build_task'
|
5
|
+
require 'date'
|
5
6
|
|
6
7
|
begin
|
7
8
|
require 'rspec/core/rake_task'
|
@@ -32,11 +33,19 @@ end
|
|
32
33
|
|
33
34
|
HelixRuntime::BuildTask.new
|
34
35
|
|
35
|
-
|
36
|
-
sh
|
36
|
+
def rubocop(fix:)
|
37
|
+
sh "bundle exec rubocop #{'-a' if fix} lib spec minitests " \
|
37
38
|
'Rakefile hypothesis-specs.gemspec'
|
38
39
|
end
|
39
40
|
|
41
|
+
task :checkformat do
|
42
|
+
rubocop(fix: false)
|
43
|
+
end
|
44
|
+
|
45
|
+
task :format do
|
46
|
+
rubocop(fix: true)
|
47
|
+
end
|
48
|
+
|
40
49
|
begin
|
41
50
|
require 'yard'
|
42
51
|
|
@@ -74,6 +83,11 @@ begin
|
|
74
83
|
rescue LoadError
|
75
84
|
end
|
76
85
|
|
86
|
+
GEMSPEC = 'hypothesis-specs.gemspec'
|
87
|
+
|
88
|
+
RELEASE_FILE = 'RELEASE.md'
|
89
|
+
CHANGELOG = 'CHANGELOG.md'
|
90
|
+
|
77
91
|
task :gem do
|
78
92
|
uncommitted = `git ls-files lib/ --others --exclude-standard`.split
|
79
93
|
uncommitted_ruby = uncommitted.grep(/\.rb$/)
|
@@ -82,6 +96,72 @@ task :gem do
|
|
82
96
|
abort 'Cannot build gem with uncomitted Ruby '\
|
83
97
|
"files #{uncommitted_ruby.join(', ')}"
|
84
98
|
end
|
99
|
+
spec = Gem::Specification.load(GEMSPEC)
|
100
|
+
|
101
|
+
unless system 'git', 'diff', '--exit-code', *spec.files
|
102
|
+
abort 'Cannot build gem from uncommited files'
|
103
|
+
end
|
104
|
+
|
105
|
+
has_changes = system 'git diff --exit-code origin/master -- src/ lib/'
|
106
|
+
if File.exist?(RELEASE_FILE)
|
107
|
+
release_contents = IO.read(RELEASE_FILE).strip
|
108
|
+
release_type, release_contents = release_contents.split("\n", 2)
|
109
|
+
|
110
|
+
match = /RELEASE_TYPE: +(major|minor|patch)/.match(release_type)
|
111
|
+
if match
|
112
|
+
release_type = match[1]
|
113
|
+
release_contents = release_contents.strip
|
114
|
+
else
|
115
|
+
abort "Invalid release type line #{release_type.inspect}"
|
116
|
+
end
|
117
|
+
|
118
|
+
components = spec.version.segments.to_a
|
119
|
+
if release_type == 'major'
|
120
|
+
components[0] += 1
|
121
|
+
elsif release_type == 'minor'
|
122
|
+
components[1] += 1
|
123
|
+
else
|
124
|
+
if release_type != 'patch'
|
125
|
+
raise "Unexpected release type #{release_type.inspect}"
|
126
|
+
end
|
127
|
+
components[2] += 1
|
128
|
+
end
|
129
|
+
|
130
|
+
new_version = components.join('.')
|
131
|
+
new_date = Date.today.strftime
|
132
|
+
|
133
|
+
lines = File.readlines(GEMSPEC).map do |l|
|
134
|
+
l.sub(/(s.version += +)'.+$/, "\\1'#{new_version}'").sub(
|
135
|
+
/(s.date += +)'.+$/, "\\1'#{new_date}'"
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
out = File.new(GEMSPEC, 'w')
|
140
|
+
lines.each do |l|
|
141
|
+
out.write(l)
|
142
|
+
end
|
143
|
+
out.close
|
144
|
+
|
145
|
+
git 'checkout', 'HEAD', CHANGELOG
|
146
|
+
previous_changelog = IO.read(CHANGELOG)
|
147
|
+
|
148
|
+
out = File.new(CHANGELOG, 'w')
|
149
|
+
|
150
|
+
out.write(
|
151
|
+
"## Hypothesis for Ruby #{new_version} (#{new_date})\n\n"
|
152
|
+
)
|
153
|
+
out.write(release_contents.strip)
|
154
|
+
out.write("\n\n")
|
155
|
+
out.write(previous_changelog)
|
156
|
+
out.close
|
157
|
+
|
158
|
+
git 'reset'
|
159
|
+
git 'add', CHANGELOG, GEMSPEC
|
160
|
+
git 'rm', RELEASE_FILE
|
161
|
+
git 'commit', '-m', "Bump version to #{new_version} and update changelog"
|
162
|
+
elsif has_changes
|
163
|
+
abort! 'Source changes found but no release file exists'
|
164
|
+
end
|
85
165
|
|
86
166
|
sh 'rm -rf hypothesis-specs*.gem'
|
87
167
|
sh 'git clean -fdx lib'
|
@@ -99,13 +179,6 @@ file 'secrets.tar.enc' => 'secrets' do
|
|
99
179
|
end
|
100
180
|
|
101
181
|
task deploy: :gem do
|
102
|
-
on_master = system("git merge-base --is-ancestor HEAD origin/master")
|
103
|
-
|
104
|
-
unless on_master
|
105
|
-
puts 'Not on master, so no deploy'
|
106
|
-
next
|
107
|
-
end
|
108
|
-
|
109
182
|
spec = Gem::Specification.load('hypothesis-specs.gemspec')
|
110
183
|
|
111
184
|
succeeded = system('git', 'tag', spec.version.to_s)
|
@@ -134,7 +207,7 @@ task deploy: :gem do
|
|
134
207
|
sh(
|
135
208
|
'ssh-agent', 'sh', '-c',
|
136
209
|
'chmod 0600 secrets/deploy_key && ssh-add secrets/deploy_key && ' \
|
137
|
-
'git push ssh-origin --tags'
|
210
|
+
'git push ssh-origin HEAD:master && git push ssh-origin --tags'
|
138
211
|
)
|
139
212
|
|
140
213
|
sh 'rm -f ~/.gem/credentials'
|