@@ -54,12 +54,13 @@ task :default do
54
54
system 'rake --tasks'
55
55
end
56
56
57
+ desc 'Show subprojects information'
57
58
task :subprojects do
58
- puts '-' * 80
59
+ puts '-' * 80
59
60
subprojects . each do |project |
60
61
commit = `git log --pretty=format:'%h %ar: %s' -1 #{ project } `
61
- version = Gem ::Specification :: load ( __current__ . join ( project , "#{ project } .gemspec" ) . to_s ) . version . to_s
62
- puts "[#{ version } ] \e [1m#{ project . ljust ( subprojects . map { | s | s . length } . max ) } \e [0m | #{ commit [ 0 ..80 ] } ..."
62
+ version = Gem ::Specification . load ( __current__ . join ( project , "#{ project } .gemspec" ) . to_s ) . version . to_s
63
+ puts "[#{ version } ] \e [1m#{ project . ljust ( subprojects . map ( & : length) . max ) } \e [0m | #{ commit [ 0 ..80 ] } ..."
63
64
end
64
65
end
65
66
@@ -87,7 +88,7 @@ namespace :bundle do
87
88
end
88
89
89
90
namespace :test do
90
- task : bundle => 'bundle:install'
91
+ task bundle : 'bundle:install'
91
92
92
93
desc "Run unit tests in all subprojects"
93
94
task :unit do
@@ -114,7 +115,7 @@ namespace :test do
114
115
end
115
116
116
117
desc "Run integration tests in all subprojects"
117
- task : integration => :setup_elasticsearch do
118
+ task integration : :setup_elasticsearch do
118
119
# 1/ elasticsearch-model
119
120
#
120
121
puts '-' *80
@@ -139,7 +140,7 @@ namespace :test do
139
140
end
140
141
141
142
desc "Run all tests in all subprojects"
142
- task : all => :wait_for_green do
143
+ task all : :wait_for_green do
143
144
subprojects . each do |project |
144
145
puts '-' *80
145
146
sh "cd #{ project } && " +
@@ -150,7 +151,6 @@ namespace :test do
150
151
end
151
152
end
152
153
153
-
154
154
desc "Wait for elasticsearch cluster to be in green state"
155
155
task :wait_for_green do
156
156
require 'elasticsearch'
@@ -176,19 +176,19 @@ task :wait_for_green do
176
176
end
177
177
end
178
178
179
- desc " Generate documentation for all subprojects"
179
+ desc ' Generate documentation for all subprojects'
180
180
task :doc do
181
181
subprojects . each do |project |
182
182
sh "cd #{ __current__ . join ( project ) } && rake doc"
183
183
puts '-' *80
184
184
end
185
185
end
186
186
187
- desc " Release all subprojects to Rubygems"
187
+ desc ' Release all subprojects to Rubygems'
188
188
task :release do
189
189
subprojects . each do |project |
190
190
sh "cd #{ __current__ . join ( project ) } && rake release"
191
- puts '-' * 80
191
+ puts '-' * 80
192
192
end
193
193
end
194
194
@@ -199,25 +199,25 @@ desc <<-DESC
199
199
200
200
$ rake update_version[5.0.0,5.0.1]
201
201
DESC
202
- task :update_version , :old , :new do |task , args |
202
+ task :update_version , :old , :new do |_ , args |
203
203
require 'ansi'
204
204
205
- puts " [!!!] Required argument [old] missing" . ansi ( :red ) unless args [ :old ]
206
- puts " [!!!] Required argument [new] missing" . ansi ( :red ) unless args [ :new ]
205
+ puts ' [!!!] Required argument [old] missing' . ansi ( :red ) unless args [ :old ]
206
+ puts ' [!!!] Required argument [new] missing' . ansi ( :red ) unless args [ :new ]
207
207
208
- files = Dir [ '**/**/version.rb' , '**/**/*.gemspec' ]
208
+ files = Dir [ '**/**/version.rb' , '**/**/*.gemspec' ]
209
209
210
- longest_line = files . map { | f | f . size } . max
210
+ longest_line = files . map ( & : size) . max
211
211
212
- puts "\n " , " = FILES " . ansi ( :faint ) + ( '=' * 92 ) . ansi ( :faint ) , "\n "
212
+ puts "\n " , ' = FILES ' . ansi ( :faint ) + ( '=' * 92 ) . ansi ( :faint ) , "\n "
213
213
214
214
files . each do |file |
215
215
begin
216
216
File . open ( file , 'r+' ) do |f |
217
217
content = f . read
218
218
if content . match Regexp . new ( args [ :old ] )
219
219
content . gsub! Regexp . new ( args [ :old ] ) , args [ :new ]
220
- puts "+ [#{ file } ]" . ansi ( :green ) . ljust ( longest_line + 20 ) + " [#{ args [ :old ] } ] -> [#{ args [ :new ] } ]" . ansi ( :green , :bold )
220
+ puts "+ [#{ file } ]" . ansi ( :green ) . ljust ( longest_line + 20 ) + " [#{ args [ :old ] } ] -> [#{ args [ :new ] } ]" . ansi ( :green , :bold )
221
221
f . rewind
222
222
f . write content
223
223
else
@@ -300,8 +300,8 @@ task :update_version, :old, :new do |task, args|
300
300
301
301
puts "\n \n " , "= COMMIT " . ansi ( :faint ) + ( '=' *91 ) . ansi ( :faint ) , "\n "
302
302
303
- puts " git add CHANGELOG.md elasticsearch-*" ,
303
+ puts ' git add CHANGELOG.md elasticsearch-*' ,
304
304
"git commit --verbose --message='Release #{ args [ :new ] } ' --edit" ,
305
- " rake release"
305
+ ' rake release'
306
306
"\n "
307
307
end
0 commit comments