class Dinomischus::Menu
Public Class Methods
check_and_make_dir(file_path)
click to toggle source
# File lib/dinomischus/menu.rb, line 136 def self.check_and_make_dir(file_path) p = File.expand_path('..', file_path ) FileUtils.mkdir_p( p ) unless Dir.exist?( p ) end
list_config(specify = false)
click to toggle source
# File lib/dinomischus/menu.rb, line 97 def self.list_config(specify = false) puts "****** List Configs #{specify ? "Specify" : "Simple"} ******" conf_path = "" loop { print " Input Your Config Path : " conf_path = STDIN.gets.chomp if !File.exist?(conf_path) puts "Error. No Exists Config Path : [#{conf_path}]" else break end } yml = list_config_file( conf_path, specify ) puts " " pp yml puts " " end
Private Class Methods
add_crypted_value(conf_path, key, value, desc)
click to toggle source
# File lib/dinomischus/menu.rb, line 128 def self.add_crypted_value(conf_path, key, value, desc) Dinomischus.set_config(conf_path, key, value, desc, true) end
command_help()
click to toggle source
# File lib/dinomischus/menu.rb, line 141 def self.command_help() puts "require 'dinomischus'" puts " " puts "# ex1 " puts "hash = Dinomischus.load_file('project_name_config_index.yml') # also project_name_config.yml " puts "p hash[:key] # => decrypted-value " puts "p hash[:key] # => raw-description " puts " " puts "# ex2 " puts "hash = Dinomischus.load_file('project_name_config_index.yml', true) # also project_name_config.yml " puts "p hash[:key][:value] # => decrypted-value " puts "p hash[:key][:desc] # => raw-description " puts " " end
list_config_file(path, specify)
click to toggle source
# File lib/dinomischus/menu.rb, line 132 def self.list_config_file(path, specify) Dinomischus.load_file(path, specify) end
make_template( key_path, conf_path, def_path)
click to toggle source
class private method —————————–
# File lib/dinomischus/menu.rb, line 117 def self.make_template( key_path, conf_path, def_path) check_and_make_dir(key_path) check_and_make_dir(def_path) check_and_make_dir(conf_path) Dinomischus.create_key_file(key_path) rescue p "Exist Already. Skip Create. [#{key_path}]" Dinomischus.create_def_file(def_path, conf_path) rescue p "Exist Already. Skip Create. [#{def_path}]" Dinomischus.create_conf_file(conf_path, key_path) rescue p "Exist Already. Skip Create. [#{conf_path}]" end