mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	gen-release-note.rb: Avoid to depend release metadata
Because it doesn't have metadata when I edit draft.
This commit is contained in:
		
							parent
							
								
									6a6daf3803
								
							
						
					
					
						commit
						a89932799c
					
				
					 1 changed files with 5 additions and 14 deletions
				
			
		| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
#!/usr/bin/env ruby
 | 
					#!/usr/bin/env ruby
 | 
				
			||||||
require "open-uri"
 | 
					require 'open-uri'
 | 
				
			||||||
require "yaml"
 | 
					require 'time'
 | 
				
			||||||
 | 
					require 'yaml'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Confirm current directory is www.ruby-lang.org's working directory
 | 
					# Confirm current directory is www.ruby-lang.org's working directory
 | 
				
			||||||
def confirm_w_r_l_o_wd
 | 
					def confirm_w_r_l_o_wd
 | 
				
			||||||
| 
						 | 
					@ -11,8 +12,6 @@ def confirm_w_r_l_o_wd
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
confirm_w_r_l_o_wd
 | 
					confirm_w_r_l_o_wd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
releases = YAML.load_file('_data/releases.yml')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
%w[
 | 
					%w[
 | 
				
			||||||
    https://hackmd.io/@naruse/ruby-relnote-en/download
 | 
					    https://hackmd.io/@naruse/ruby-relnote-en/download
 | 
				
			||||||
    https://hackmd.io/@naruse/ruby-relnote-ja/download
 | 
					    https://hackmd.io/@naruse/ruby-relnote-ja/download
 | 
				
			||||||
| 
						 | 
					@ -28,18 +27,10 @@ releases = YAML.load_file('_data/releases.yml')
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  puts "#{url} -> #{version}"
 | 
					  puts "#{url} -> #{version}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  release = releases.find{|rel|rel['version'] == version}
 | 
					 | 
				
			||||||
  unless release
 | 
					 | 
				
			||||||
   abort "#{version} is not found in '_data/releases.yml'"
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Write release note article
 | 
					  # Write release note article
 | 
				
			||||||
  lang = url[/ja|en/]
 | 
					  path = Time.parse(src[/^date: (.*)/, 1]).
 | 
				
			||||||
  if %r<\A/en/news/(\d+/\d+/\d+/ruby-[\w\-]+-released)> =~ release['post']
 | 
					    strftime("./#{src[/^lang: (\w+)/, 1]}/news/_posts/%Y-%m-%d-ruby-#{version}-released.md")
 | 
				
			||||||
    path = "#{lang}/news/_posts/#{$1.tr('/', '-')}.md"
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    abort "unexpected path pattern '#{release['post']}'"
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
  puts path
 | 
					  puts path
 | 
				
			||||||
  File.write(path, src)
 | 
					  File.write(path, src)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue