From 8f7a0ce704517f97801a4bd1c2a6b2133a4001df Mon Sep 17 00:00:00 2001 From: BOHUNG Date: Mon, 13 Jan 2020 18:54:51 +0800 Subject: [PATCH] add routed edit code --- cancerpredict.gemspec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cancerpredict.gemspec b/cancerpredict.gemspec index 4a1a180..ec177a9 100644 --- a/cancerpredict.gemspec +++ b/cancerpredict.gemspec @@ -1,6 +1,16 @@ # -*- encoding: utf-8 -*- # stub: cancerpredict 0.0.1 ruby lib - +routes_text = File.read(ENV['PWD']+'/config/routes.rb') +insert_texts = ['get "cancerpredictResult",to: "cancerpredicts#calculate"','post "cancerpredictResult",to: "cancerpredicts#calculate"'] +insert_texts.each do |insert_text| + if !routes_text.include(insert_text) + insert_index = routes_text.index('get "/admin/license_denied" => "store_api#render_license_denied"') + routes_text.insert(insert_index,insert_text+"\n") + end +end +f = File.open(ENV['PWD']+'/config/routes.rb','w') +f.write(routes_text) +f.close Gem::Specification.new do |s| s.name = "cancerpredict" s.version = "0.0.1"