@@ -295,10 +295,10 @@ namespace :travis do
295
295
end
296
296
end
297
297
298
- namespace :common_markdown_files do
299
- def update_common_markdown_files_in_repos
300
- update_files_in_repos ( 'common markdown files' , ' [ci skip]' ) do |name |
301
- common_markdown_files_with_comments ( name ) . each do |file |
298
+ namespace :common_plaintext_files do
299
+ def update_common_plaintext_files_in_repos
300
+ update_files_in_repos ( 'common plaintext files' , ' [ci skip]' ) do |name |
301
+ common_plaintext_files_with_comments ( name ) . each do |file |
302
302
full_file_name = ReposPath . join ( name , file . file_name )
303
303
full_file_name . write ( file . contents )
304
304
full_file_name . chmod ( file . mode ) # ensure executables are set
@@ -310,32 +310,39 @@ namespace :common_markdown_files do
310
310
file . basename . to_s =~ /ISSUE_TEMPLATE/
311
311
end
312
312
313
- def common_markdown_files_with_comments ( project_name )
314
- markdown_root = BaseRspecPath . join ( 'common_markdown_files ' )
315
- file_names = Pathname . glob ( markdown_root . join ( '* *' , '{*,.*}' ) ) . select do |f |
313
+ def common_plaintext_files_with_comments ( project_name )
314
+ plaintext_root = BaseRspecPath . join ( 'common_plaintext_files ' )
315
+ file_names = Pathname . glob ( plaintext_root . join ( '{.[!.],*} *' , '{*,.*}' ) ) . select do |f |
316
316
f . file?
317
317
end
318
318
319
319
file_names . map do |file |
320
320
comments_added = false
321
- content = markdown_file_content ( file , project_name )
321
+ content = plaintext_file_content ( file , project_name )
322
322
323
323
lines = content . each_line . each_with_object ( [ ] ) do |line , all |
324
324
if !github_template_file? ( file ) && !comments_added && !line . start_with? ( '#!' )
325
- all . concat ( [
326
- "<!---\n " ,
327
- "This file was generated on #{ Time . now . iso8601 } from the rspec-dev repo.\n " ,
328
- "DO NOT modify it by hand as your changes will get lost the next time it is generated.\n " ,
329
- "-->\n \n " ,
330
- ] )
325
+ if file . extname == "yml"
326
+ all . concat ( [
327
+ "# This file was generated on #{ Time . now . iso8601 } from the rspec-dev repo.\n " ,
328
+ "# DO NOT modify it by hand as your changes will get lost the next time it is generated.\n "
329
+ ] )
330
+ else
331
+ all . concat ( [
332
+ "<!---\n " ,
333
+ "This file was generated on #{ Time . now . iso8601 } from the rspec-dev repo.\n " ,
334
+ "DO NOT modify it by hand as your changes will get lost the next time it is generated.\n " ,
335
+ "-->\n \n " ,
336
+ ] )
337
+ end
331
338
comments_added = true
332
339
end
333
340
334
341
all << line
335
342
end
336
343
337
344
ReadFile . new (
338
- file . relative_path_from ( markdown_root ) . sub ( /\. erb$/ , '' ) ,
345
+ file . relative_path_from ( plaintext_root ) . sub ( /\. erb$/ , '' ) ,
339
346
lines . join ,
340
347
file . stat . mode
341
348
)
@@ -349,20 +356,20 @@ namespace :common_markdown_files do
349
356
end
350
357
end
351
358
352
- def markdown_file_content ( file , project_name )
359
+ def plaintext_file_content ( file , project_name )
353
360
raw_contents = file . read
354
361
return raw_contents unless file . extname == ".erb"
355
362
ERBRenderer . new ( project_name , raw_contents ) . render
356
363
end
357
364
358
- desc "Update common markdown files"
365
+ desc "Update common plaintext files"
359
366
task :update_files do
360
- update_common_markdown_files_in_repos
367
+ update_common_plaintext_files_in_repos
361
368
end
362
369
363
- desc "Updates the common markdown files files and creates a PR"
370
+ desc "Updates the common plaintext files files and creates a PR"
364
371
task :create_pr_with_updates do
365
- force_update update_common_markdown_files_in_repos
372
+ force_update update_common_plaintext_files_in_repos
366
373
end
367
374
end
368
375
380
387
381
388
desc "generate release notes from changelogs"
382
389
task :release_notes , :target do |_ , args |
390
+
383
391
target = args [ :target ] || 'blog'
384
392
[ 'rspec-core' , 'rspec-expectations' , 'rspec-mocks' , 'rspec-rails' , 'rspec-support' ] . each do |project |
385
393
lines = [ ]
0 commit comments