29
29
30
30
require 'rake_compiler_dock'
31
31
namespace :repackage do
32
- desc '- with Windows fat distributions'
32
+ desc '* with Windows fat distributions'
33
33
task :all do
34
34
Dir . chdir ( __dir__ ) do
35
35
sh 'bundle package'
36
+ # needed only if the jar is built outside of docker
37
+ Rake ::Task [ 'lib/concurrent/concurrent_ruby.jar' ] . invoke
36
38
RakeCompilerDock . exec 'support/cross_building.sh'
37
39
end
38
40
end
@@ -60,19 +62,19 @@ begin
60
62
--tag ~notravis ]
61
63
62
64
namespace :spec do
63
- desc '- Configured for ci'
65
+ desc '* Configured for ci'
64
66
RSpec ::Core ::RakeTask . new ( :ci ) do |t |
65
67
t . rspec_opts = [ *options ] . join ( ' ' )
66
68
end
67
69
68
- desc '- test packaged and installed gems instead of local files'
69
- task :installed => :repackage do
70
+ desc '* test packaged and installed gems instead of local files'
71
+ task :installed do
70
72
Dir . chdir ( __dir__ ) do
71
73
sh 'gem install pkg/concurrent-ruby-1.1.0.pre1.gem'
72
74
sh 'gem install pkg/concurrent-ruby-ext-1.1.0.pre1.gem' if Concurrent . on_cruby?
73
75
sh 'gem install pkg/concurrent-ruby-edge-0.4.0.pre1.gem'
74
76
ENV [ 'NO_PATH' ] = 'true'
75
- sh 'bundle install '
77
+ sh 'bundle update '
76
78
sh 'bundle exec rake spec:ci'
77
79
end
78
80
end
@@ -86,6 +88,8 @@ rescue LoadError => e
86
88
puts 'RSpec is not installed, skipping test task definitions: ' + e . message
87
89
end
88
90
91
+ current_yard_version_name = Concurrent ::VERSION . split ( '.' ) [ 0 ..2 ] . join ( '.' )
92
+
89
93
begin
90
94
require 'yard'
91
95
require 'md_ruby_eval'
@@ -99,79 +103,122 @@ begin
99
103
'--title' , 'Concurrent Ruby' ,
100
104
'--template' , 'default' ,
101
105
'--template-path' , 'yard-template' ,
102
- '--default-return' , 'undocumented' , ]
106
+ '--default-return' , 'undocumented' ]
103
107
104
108
desc 'Generate YARD Documentation (signpost, master)'
105
109
task :yard => [ 'yard:signpost' , 'yard:master' ]
106
110
107
111
namespace :yard do
108
112
109
- desc '- eval markdown files'
113
+ desc '* eval markdown files'
110
114
task :eval_md do
111
115
Dir . chdir File . join ( __dir__ , 'docs-source' ) do
112
116
sh 'bundle exec md-ruby-eval --auto'
113
117
end
114
118
end
115
119
120
+ task :update_readme do
121
+ Dir . chdir __dir__ do
122
+ content = File . read ( File . join ( 'README.md' ) ) .
123
+ gsub ( /\[ ([\w ]+)\] \( http:\/ \/ ruby-concurrency\. github\. io\/ concurrent-ruby\/ master\/ .*\) / ) do |_ |
124
+ case $1
125
+ when 'LockFreeLinkedSet'
126
+ "{Concurrent::Edge::#{ $1} #{ $1} }"
127
+ when '.dataflow'
128
+ '{Concurrent.dataflow Concurrent.dataflow}'
129
+ when 'thread pool'
130
+ '{file:thread_pools.md thread pool}'
131
+ else
132
+ "{Concurrent::#{ $1} #{ $1} }"
133
+ end
134
+ end
135
+ File . write 'tmp/README.md' , content
136
+ end
137
+ end
138
+
116
139
define_yard_task = -> name do
117
- desc "- of #{ name } into subdir #{ name } "
140
+ desc "* of #{ name } into subdir #{ name } "
118
141
YARD ::Rake ::YardocTask . new ( name ) do |yard |
119
142
yard . options . push (
120
143
'--output-dir' , "docs/#{ name } " ,
144
+ '--main' , 'tmp/README.md' ,
121
145
*common_yard_options )
122
146
yard . files = [ './lib/**/*.rb' ,
123
147
'./lib-edge/**/*.rb' ,
124
148
'./ext/concurrent_ruby_ext/**/*.c' ,
125
149
'-' ,
126
150
'docs-source/thread_pools.md' ,
127
151
'docs-source/promises.out.md' ,
128
- 'README.md' ,
129
- 'LICENSE.txt' ,
152
+ 'LICENSE.md' ,
130
153
'CHANGELOG.md' ]
131
154
end
132
- Rake ::Task [ name ] . prerequisites . push 'yard:eval_md'
155
+ Rake ::Task [ name ] . prerequisites . push 'yard:eval_md' , 'yard:update_readme'
133
156
end
134
157
135
- define_yard_task . call ( Concurrent :: VERSION . split ( '.' ) [ 0 .. 2 ] . join ( '.' ) )
136
- define_yard_task . call ( 'master' )
158
+ define_yard_task . call current_yard_version_name
159
+ define_yard_task . call 'master'
137
160
138
- desc "- signpost for versions"
161
+ desc "* signpost for versions"
139
162
YARD ::Rake ::YardocTask . new ( :signpost ) do |yard |
140
163
yard . options . push (
141
164
'--output-dir' , 'docs' ,
142
165
'--main' , 'docs-source/signpost.md' ,
143
166
*common_yard_options )
144
167
yard . files = [ 'no-lib' ]
145
168
end
146
- end
147
169
148
- namespace :spec do
149
- desc '- ensure that generated documentation is matching the source code'
150
- task :docs_uptodate do
151
- Dir . chdir ( __dir__ ) do
152
- begin
153
- FileUtils . cp_r 'docs' , 'docs-copy' , verbose : true
154
- Rake ::Task [ :yard ] . invoke
155
- sh 'diff -r docs/ docs-copy/'
156
- ensure
157
- FileUtils . rm_rf 'docs-copy' , verbose : true
170
+ define_uptodate_task = -> name do
171
+ namespace name do
172
+ desc "** ensure that #{ name } generated documentation is matching the source code"
173
+ task :uptodate do
174
+ Dir . chdir ( __dir__ ) do
175
+ begin
176
+ FileUtils . cp_r 'docs' , 'docs-copy' , verbose : true
177
+ Rake ::Task [ "yard:#{ name } " ] . invoke
178
+ sh 'diff -r docs/ docs-copy/'
179
+ ensure
180
+ FileUtils . rm_rf 'docs-copy' , verbose : true
181
+ end
182
+ end
158
183
end
159
184
end
160
185
end
186
+
187
+ define_uptodate_task . call current_yard_version_name
188
+ define_uptodate_task . call 'master'
161
189
end
162
190
163
191
rescue LoadError => e
164
192
puts 'YARD is not installed, skipping documentation task definitions: ' + e . message
165
193
end
166
194
195
+ desc 'build, test, and publish the gem'
196
+ task :release => [ 'release:checks' , 'release:build' , 'release:test' , 'release:publish' ]
197
+
167
198
namespace :release do
168
199
# Depends on environment of @pitr-ch
169
200
170
- mri_version = '2.4.3 '
201
+ mri_version = '2.5.1 '
171
202
jruby_version = 'jruby-9.1.17.0'
172
203
204
+ task :checks => "yard:#{ current_yard_version_name } :uptodate" do
205
+ Dir . chdir ( __dir__ ) do
206
+ begin
207
+ STDOUT . puts "Is this a final release build? (Do git checks?) (y/n)"
208
+ input = STDIN . gets . strip . downcase
209
+ end until %w( y n ) . include? ( input )
210
+ if input == 'y'
211
+ sh 'test -z "$(git status --porcelain)"'
212
+ sh 'git fetch'
213
+ sh 'test $(git show-ref --verify --hash refs/heads/master) = $(git show-ref --verify --hash refs/remotes/github/master)'
214
+ end
215
+ end
216
+ end
217
+
218
+ desc '* build all *.gem files necessary for release'
173
219
task :build => 'repackage:all'
174
220
221
+ desc '* test actual installed gems instead of cloned repository on MRI and JRuby'
175
222
task :test do
176
223
Dir . chdir ( __dir__ ) do
177
224
old = ENV [ 'RBENV_VERSION' ]
@@ -190,27 +237,43 @@ namespace :release do
190
237
end
191
238
end
192
239
193
- task :push do
194
- Dir . chdir ( __dir__ ) do
195
- sh 'git fetch'
196
- sh 'test $(git show-ref --verify --hash refs/heads/master) = $(git show-ref --verify --hash refs/remotes/github/master)'
197
-
198
- sh "git tag v#{ Concurrent ::VERSION } "
199
- sh "git tag edge-v#{ Concurrent ::EDGE_VERSION } "
200
- sh "git push github v#{ Concurrent ::VERSION } edge-v#{ Concurrent ::EDGE_VERSION } "
201
-
202
- sh "gem push pkg/concurrent-ruby-#{ Concurrent ::VERSION } .gem"
203
- sh "gem push pkg/concurrent-ruby-edge-#{ Concurrent ::EDGE_VERSION } .gem"
204
- sh "gem push pkg/concurrent-ruby-ext-#{ Concurrent ::VERSION } .gem"
205
- sh "gem push pkg/concurrent-ruby-ext-#{ Concurrent ::VERSION } -x64-mingw32.gem"
206
- sh "gem push pkg/concurrent-ruby-ext-#{ Concurrent ::VERSION } -x86-mingw32.gem"
240
+ desc '* do all nested steps'
241
+ task :publish => [ 'publish:ask' , 'publish:tag' , 'publish:rubygems' , 'publish:post_steps' ]
242
+
243
+ namespace :publish do
244
+ task :ask do
245
+ begin
246
+ STDOUT . puts "Do you want to publish? (y/n)"
247
+ input = STDIN . gets . strip . downcase
248
+ end until %w( y n ) . include? ( input )
249
+ raise 'reconsidered' if input == 'n'
207
250
end
208
- end
209
251
210
- task :notify do
211
- puts 'Manually: create a release on GitHub with relevant changelog part'
212
- puts 'Manually: send email same as release with relevant changelog part'
213
- puts 'Manually: update documentation'
214
- puts ' $ bundle exec rake yard:push'
252
+ desc '** tag HEAD with current version and push to github'
253
+ task :tag do
254
+ Dir . chdir ( __dir__ ) do
255
+ sh "git tag v#{ Concurrent ::VERSION } "
256
+ sh "git tag edge-v#{ Concurrent ::EDGE_VERSION } "
257
+ sh "git push github v#{ Concurrent ::VERSION } edge-v#{ Concurrent ::EDGE_VERSION } "
258
+ end
259
+ end
260
+
261
+ desc '** push all *.gem files to rubygems'
262
+ task :rubygems do
263
+ Dir . chdir ( __dir__ ) do
264
+ sh "gem push pkg/concurrent-ruby-#{ Concurrent ::VERSION } .gem"
265
+ sh "gem push pkg/concurrent-ruby-edge-#{ Concurrent ::EDGE_VERSION } .gem"
266
+ sh "gem push pkg/concurrent-ruby-ext-#{ Concurrent ::VERSION } .gem"
267
+ sh "gem push pkg/concurrent-ruby-ext-#{ Concurrent ::VERSION } -x64-mingw32.gem"
268
+ sh "gem push pkg/concurrent-ruby-ext-#{ Concurrent ::VERSION } -x86-mingw32.gem"
269
+ end
270
+ end
271
+
272
+ desc '** print post release steps'
273
+ task :post_steps do
274
+ puts 'Manually: create a release on GitHub with relevant changelog part'
275
+ puts 'Manually: send email same as release with relevant changelog part'
276
+ puts 'Manually: tweet'
277
+ end
215
278
end
216
279
end
0 commit comments