lib/cryptum/bot_conf.rb in cryptum-0.0.321 vs lib/cryptum/bot_conf.rb in cryptum-0.0.322
- old
+ new
@@ -8,14 +8,16 @@
# Deserialize Cryptum Bot Conf
public_class_method def self.read(opts = {})
option_choice = opts[:option_choice]
event_history = opts[:event_history]
- bot_conf_file = "#{option_choice.repo_root}/etc/bot_confs/#{option_choice.symbol}_bot_conf.yaml"
+ session_root = option_choice.session_root
+ symbol = option_choice.symbol
+ bot_conf_file = "#{session_root}/etc/bot_confs/#{symbol}_bot_conf.yaml"
unless File.exist?(bot_conf_file)
FileUtils.cp(
- "#{option_choice.repo_root}/etc/bot_confs/BOT_CONF.TEMPLATE",
+ "#{session_root}/etc/bot_confs/BOT_CONF.TEMPLATE",
bot_conf_file
)
end
bot_conf = YAML.load_file(
@@ -159,10 +161,12 @@
option_choice = opts[:option_choice]
bot_conf = opts[:bot_conf]
key = opts[:key].to_s.to_sym
value = opts[:value]
- bot_conf_file = "#{option_choice.repo_root}/etc/bot_confs/#{option_choice.symbol}_bot_conf.yaml"
+ session_root = option_choice.session_root
+ symbol = option_choice.symbol
+ bot_conf_file = "#{session_root}/etc/bot_confs/#{symbol}_bot_conf.yaml"
bot_conf[key] = value
File.write(bot_conf_file, bot_conf.to_yaml)
rescue Errno::ENOENT, NoMethodError => e
File.open('/tmp/cryptum-errors.txt', 'a') do |f|