Created
January 9, 2021 14:06
-
-
Save masoo/7eff954b440bc012573ccd6a737dec8e to your computer and use it in GitHub Desktop.
proposal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require "erb" | |
require "optparse" | |
proposal_file = nil | |
requester = nil | |
request_title = nil | |
crowdsourcing_site_name = nil | |
options = OptionParser.new | |
options.on('--proposal_file file_name') {|v| proposal_file = v } # 提案テンプレート | |
options.on('--requester requester') {|v| requester = v.encode(Encoding::UTF_8) } # 依頼者名 | |
options.on('--request_title title') {|v| request_title = v.encode(Encoding::UTF_8) } # 依頼タイトル | |
options.on('--crowdsourcing name') {|v| crowdsourcing_site_name = v.encode(Encoding::UTF_8) } # クラウドソーシング名 | |
options.parse!(ARGV) | |
# ファイル読み込み | |
proposal_text = File.read(proposal_file, encoding: Encoding::UTF_8) | |
# 提案文生成 | |
erb = ERB.new(proposal_text) | |
puts erb.result(binding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requester = "株式会社ABC" | |
request_title = "案件タイトル" | |
crowdsourcing = "クラウドソーシング名" | |
script = "ruby proposal.rb --proposal_file proposal_template.txt --requester \"#{requester}\" --request_title \"#{request_title}\" --crowdsourcing \"#{crowdsourcing}\" > C:\\Users\\xxxx\\Downloads\\proposal_output.txt" | |
system(script) | |
puts "C:\\Users\\xxxx\\Downloads\\proposal_output.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment