module Smartdict
The very basic translator middleware.
Constants
- ENVIRONMENTS
- VERSION
Public Instance Methods
env()
click to toggle source
# File lib/smartdict.rb, line 83 def env @env || raise("No env setted for Smartdict") end
env=(environment)
click to toggle source
# File lib/smartdict.rb, line 78 def env=(environment) @env = environment.to_sym raise "env must be one of #{ENVIRONMENTS.inspect}" unless ENVIRONMENTS.include?(@env) end
home_dir()
click to toggle source
# File lib/smartdict.rb, line 74 def home_dir ENV['HOME'] end
info()
click to toggle source
# File lib/smartdict.rb, line 99 def info Info.instance end
init_config()
click to toggle source
# File lib/smartdict.rb, line 53 def init_config default_config_file = File.join(root_dir, 'config', 'default_config.yml') configatron.configure_from_hash YAML.load_file(default_config_file) config_file = File.join(user_dir, 'configuration.yml') if File.exists?(config_file) configatron.configure_from_hash YAML.load_file(config_file) else FileUtils.cp default_config_file, config_file end end
load_plugins()
click to toggle source
# File lib/smartdict.rb, line 43 def load_plugins Core::PluginManager.load_plugins end
log_path()
click to toggle source
# File lib/smartdict.rb, line 87 def log_path File.join(user_dir, 'smartdict.log') end
plugins_dir()
click to toggle source
# File lib/smartdict.rb, line 95 def plugins_dir ENV['SMARTDICT_PLUGINS_DIR'] or File.join(root_dir, 'plugins') end
root_dir()
click to toggle source
# File lib/smartdict.rb, line 91 def root_dir File.join(File.dirname(__FILE__), '..') end
run()
click to toggle source
# File lib/smartdict.rb, line 47 def run Dir.mkdir user_dir unless File.exists?(user_dir) init_config Storage.prepare! end
user_dir()
click to toggle source
# File lib/smartdict.rb, line 66 def user_dir dirname = { :user => '.smartdict', :test => '.smartdict_test', :cucumber => '.smartdict_test' }[env] File.join(home_dir, dirname) end