lib/flydata/helpers.rb in flydata-0.0.5.6 vs lib/flydata/helpers.rb in flydata-0.1.0

- old
+ new

@@ -1,7 +1,8 @@ module Flydata module Helpers + @@development_mode = nil module_function def parse_command(cmd) klass = Flydata::Command::Base method = cmd if cmd.include?(':') @@ -17,10 +18,12 @@ Usage: flydata COMMAND setup # setup initially start # start flydata process stop # stop flydata process restart # restart flydata process + conf # show configuration + sync # initial sync(only for mysql database) If you encountered login or any other errors during setup, please setup flydata again by following commands. source ~/.bashrc flydata setup @@ -34,10 +37,19 @@ def to_command_class(class_name) eval("Flydata::Command::#{class_name.camelcase}") end def development? - File.open(flydata_conf_file).first.strip.end_with?('dev') + return @@development_mode unless @@development_mode.nil? + @@development_mode = !!(File.open(flydata_conf_file).first.strip.end_with?('dev')) + end + + def env_mode + development? ? 'dev' : '' + end + + def env_suffix + development? ? '_dev' : '' end # format text def format_menu_list(menu_list) max_length_list = menu_list.inject(Array.new(menu_list.first.size, 0)) do |ml, menu|