Module: CultomePlayer::Environment
- Included in:
- CultomePlayer
- Defined in:
- lib/cultome_player/environment.rb
Instance Method Summary collapse
-
#command_pipe ⇒ String
Get the command_pipe environment configuration value.
-
#config_file ⇒ String
Get the config_file environment configuration value.
-
#current_env ⇒ Symbol
Get the current environment name.
-
#db_adapter ⇒ String
Get the db_adapter environment configuration value.
-
#db_file ⇒ String
Get the db_file environment configuration value.
-
#db_log_file ⇒ String
Get the db_log_file environment configuration value.
-
#env_config ⇒ Hash
Gets the environment configurations.
-
#file_types ⇒ String
Get the file_types environment configuration value.
- #load_environment_properties(env) ⇒ Object
-
#mplayer_pipe ⇒ String
Get the mplayer_pipe environment configuration value.
-
#player_config ⇒ Hash
Gets the player configurations.
-
#prepare_environment(env) ⇒ Object
Extract the configuration for the environment and setup valriables.
- #save_player_configurations ⇒ Object
-
#stdout ⇒ IO
Get the stdout (not STDOUT) for the player.
Instance Method Details
#command_pipe ⇒ String
Get the command_pipe environment configuration value.
44 45 46 |
# File 'lib/cultome_player/environment.rb', line 44 def command_pipe env_config['command_pipe'] || raise('environment problem:environment information not loaded') end |
#config_file ⇒ String
Get the config_file environment configuration value.
37 38 39 |
# File 'lib/cultome_player/environment.rb', line 37 def config_file env_config['config_file'] || raise('environment problem:environment information not loaded') end |
#current_env ⇒ Symbol
Get the current environment name.
79 80 81 |
# File 'lib/cultome_player/environment.rb', line 79 def current_env @current_env end |
#db_adapter ⇒ String
Get the db_adapter environment configuration value.
9 10 11 |
# File 'lib/cultome_player/environment.rb', line 9 def db_adapter env_config['db_adapter'] || raise('environment problem:environment information not loaded') end |
#db_file ⇒ String
Get the db_file environment configuration value.
16 17 18 |
# File 'lib/cultome_player/environment.rb', line 16 def db_file env_config['db_file'] || raise('environment problem:environment information not loaded') end |
#db_log_file ⇒ String
Get the db_log_file environment configuration value.
23 24 25 |
# File 'lib/cultome_player/environment.rb', line 23 def db_log_file env_config['db_log_file'] || raise('environment problem:environment information not loaded') end |
#env_config ⇒ Hash
Gets the environment configurations.
72 73 74 |
# File 'lib/cultome_player/environment.rb', line 72 def env_config @env_config ||= {} end |
#file_types ⇒ String
Get the file_types environment configuration value.
30 31 32 |
# File 'lib/cultome_player/environment.rb', line 30 def file_types env_config['file_types'] || raise('environment problem:environment information not loaded') end |
#load_environment_properties(env) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/cultome_player/environment.rb', line 83 def load_environment_properties(env) env_config = YAML.load_file File.('config/environment.yml', File.join(File.dirname(__FILE__), "../..")) @env_config = env_config[env.to_s] @env_config @current_env = env.to_sym return @env_config end |
#mplayer_pipe ⇒ String
Get the mplayer_pipe environment configuration value.
51 52 53 |
# File 'lib/cultome_player/environment.rb', line 51 def mplayer_pipe env_config['mplayer_pipe'] || raise('environment problem:environment information not loaded') end |
#player_config ⇒ Hash
Gets the player configurations.
65 66 67 |
# File 'lib/cultome_player/environment.rb', line 65 def player_config @player_config ||= {} end |
#prepare_environment(env) ⇒ Object
Extract the configuration for the environment and setup valriables.
95 96 97 98 99 100 |
# File 'lib/cultome_player/environment.rb', line 95 def prepare_environment(env) load_environment_properties(env) raise 'environment problem:environment not found' if @env_config.nil? create_required_files @env_config load_master_config @env_config['config_file'] end |
#save_player_configurations ⇒ Object
102 103 104 |
# File 'lib/cultome_player/environment.rb', line 102 def save_player_configurations open(config_file, 'w'){|f| f.write player_config.to_yaml } end |
#stdout ⇒ IO
Get the stdout (not STDOUT) for the player.
58 59 60 |
# File 'lib/cultome_player/environment.rb', line 58 def stdout STDOUT end |