class Fab::Api
Constants
- ERROR_MASSEGE
Public Instance Methods
create_apifile(apikey)
click to toggle source
# File lib/generate.rb, line 35 def create_apifile(apikey) if file_empty? write_file(path(),apikey) true else puts ERROR_MASSEGE false end end
delete()
click to toggle source
# File lib/generate.rb, line 51 def delete() path() File.open(path() , "w") do | file | file = nil end end
remake_apifile(apikey)
click to toggle source
# File lib/generate.rb, line 45 def remake_apifile(apikey) delete() write_file(path(),apikey) true end
Private Instance Methods
file_empty?()
click to toggle source
# File lib/generate.rb, line 81 def file_empty?() File.open(path(), "r") do | file | if file.read == "" true else false end end end
path()
click to toggle source
# File lib/generate.rb, line 60 def path() api_path = File.expand_path('../../lib',__FILE__) api_path << "/apikey.rb" api_path end
write_file(path,apikey)
click to toggle source
# File lib/generate.rb, line 66 def write_file(path,apikey) File.open(path(),"w") do | file | file.puts(<<"EOS") #!/usr/local/env ruby #codinf:utf-8 module Fab class Apikey APIKEY = \"#{apikey}\" end end EOS end end