@@ -54,12 +54,13 @@ task :default do
5454 system 'rake --tasks'
5555end
5656
57+ desc 'Show subprojects information'
5758task :subprojects do
58- puts '-' * 80
59+ puts '-' * 80
5960 subprojects . each do |project |
6061 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 ] } ..."
6364 end
6465end
6566
@@ -87,7 +88,7 @@ namespace :bundle do
8788end
8889
8990namespace :test do
90- task : bundle => 'bundle:install'
91+ task bundle : 'bundle:install'
9192
9293 desc "Run unit tests in all subprojects"
9394 task :unit do
@@ -114,7 +115,7 @@ namespace :test do
114115 end
115116
116117 desc "Run integration tests in all subprojects"
117- task : integration => :setup_elasticsearch do
118+ task integration : :setup_elasticsearch do
118119 # 1/ elasticsearch-model
119120 #
120121 puts '-' *80
@@ -139,7 +140,7 @@ namespace :test do
139140 end
140141
141142 desc "Run all tests in all subprojects"
142- task : all => :wait_for_green do
143+ task all : :wait_for_green do
143144 subprojects . each do |project |
144145 puts '-' *80
145146 sh "cd #{ project } && " +
@@ -150,7 +151,6 @@ namespace :test do
150151 end
151152end
152153
153-
154154desc "Wait for elasticsearch cluster to be in green state"
155155task :wait_for_green do
156156 require 'elasticsearch'
@@ -176,19 +176,19 @@ task :wait_for_green do
176176 end
177177end
178178
179- desc " Generate documentation for all subprojects"
179+ desc ' Generate documentation for all subprojects'
180180task :doc do
181181 subprojects . each do |project |
182182 sh "cd #{ __current__ . join ( project ) } && rake doc"
183183 puts '-' *80
184184 end
185185end
186186
187- desc " Release all subprojects to Rubygems"
187+ desc ' Release all subprojects to Rubygems'
188188task :release do
189189 subprojects . each do |project |
190190 sh "cd #{ __current__ . join ( project ) } && rake release"
191- puts '-' * 80
191+ puts '-' * 80
192192 end
193193end
194194
@@ -199,25 +199,25 @@ desc <<-DESC
199199
200200 $ rake update_version[5.0.0,5.0.1]
201201DESC
202- task :update_version , :old , :new do |task , args |
202+ task :update_version , :old , :new do |_ , args |
203203 require 'ansi'
204204
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 ]
207207
208- files = Dir [ '**/**/version.rb' , '**/**/*.gemspec' ]
208+ files = Dir [ '**/**/version.rb' , '**/**/*.gemspec' ]
209209
210- longest_line = files . map { | f | f . size } . max
210+ longest_line = files . map ( & : size) . max
211211
212- puts "\n " , " = FILES " . ansi ( :faint ) + ( '=' * 92 ) . ansi ( :faint ) , "\n "
212+ puts "\n " , ' = FILES ' . ansi ( :faint ) + ( '=' * 92 ) . ansi ( :faint ) , "\n "
213213
214214 files . each do |file |
215215 begin
216216 File . open ( file , 'r+' ) do |f |
217217 content = f . read
218218 if content . match Regexp . new ( args [ :old ] )
219219 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 )
221221 f . rewind
222222 f . write content
223223 else
@@ -300,8 +300,8 @@ task :update_version, :old, :new do |task, args|
300300
301301 puts "\n \n " , "= COMMIT " . ansi ( :faint ) + ( '=' *91 ) . ansi ( :faint ) , "\n "
302302
303- puts " git add CHANGELOG.md elasticsearch-*" ,
303+ puts ' git add CHANGELOG.md elasticsearch-*' ,
304304 "git commit --verbose --message='Release #{ args [ :new ] } ' --edit" ,
305- " rake release"
305+ ' rake release'
306306 "\n "
307307end
0 commit comments