Module: CultomePlayer::Environment

Included in:
CultomePlayer
Defined in:
lib/cultome_player/environment.rb

Instance Method Summary collapse

Instance Method Details

#config_fileString

Get the config_file environment configuration value.

Returns:

  • (String)

    The config_file value for teh selected environment.



38
39
40
# File 'lib/cultome_player/environment.rb', line 38

def config_file
  env_config['config_file'] || raise('environment problem:environment information not loaded')
end

#current_envSymbol

Get the current environment name.

Returns:

  • (Symbol)

    The current environment name.



73
74
75
# File 'lib/cultome_player/environment.rb', line 73

def current_env
  @current_env
end

#db_adapterString

Get the db_adapter environment configuration value.

Returns:

  • (String)

    The db_adapter value for teh selected environment.



10
11
12
# File 'lib/cultome_player/environment.rb', line 10

def db_adapter
  env_config['db_adapter'] || raise('environment problem:environment information not loaded')
end

#db_fileString

Get the db_file environment configuration value.

Returns:

  • (String)

    The db_file value for teh selected environment.



17
18
19
# File 'lib/cultome_player/environment.rb', line 17

def db_file
  env_config['db_file'] || raise('environment problem:environment information not loaded')
end

#db_log_fileString

Get the db_log_file environment configuration value.

Returns:

  • (String)

    The db_log_file value for teh selected environment.



24
25
26
# File 'lib/cultome_player/environment.rb', line 24

def db_log_file
  env_config['db_log_file'] || raise('environment problem:environment information not loaded')
end

#env_configHash

Gets the environment configurations.

Returns:

  • (Hash)

    Environment configuration.



66
67
68
# File 'lib/cultome_player/environment.rb', line 66

def env_config
  @env_config ||= {}
end

#file_typesString

Get the file_types environment configuration value.

Returns:

  • (String)

    The file_types value for teh selected environment.



31
32
33
# File 'lib/cultome_player/environment.rb', line 31

def file_types
  env_config['file_types'] || raise('environment problem:environment information not loaded')
end

#mplayer_pipeString

Get the mplayer_pipe environment configuration value.

Returns:

  • (String)

    The mplayer_pipe value for teh selected environment.



45
46
47
# File 'lib/cultome_player/environment.rb', line 45

def mplayer_pipe
  env_config['mplayer_pipe'] || raise('environment problem:environment information not loaded')
end

#player_configHash

Gets the player configurations.

Returns:

  • (Hash)

    Player configuration.



59
60
61
# File 'lib/cultome_player/environment.rb', line 59

def player_config
  @player_config ||= {}
end

#prepare_environment(env, check_db = true) ⇒ Object

Extract the configuration for the environment and setup valriables.

Parameters:

  • env (Symbol)

    The name of the environment to load.

  • check_db (Boolean) (defaults to: true)

    Flag to decide if the database schema should be checked.



81
82
83
84
85
86
87
88
89
90
# File 'lib/cultome_player/environment.rb', line 81

def prepare_environment(env, check_db=true)
  env_config = YAML.load_file File.expand_path('config/environment.yml')
  @env_config = env_config[env.to_s]
  @current_env = env.to_sym
  raise 'environment problem:environment not found' if @env_config.nil?
  expand_paths @env_config
  create_required_files @env_config
  load_master_config @env_config['config_file']
  check_db_schema if check_db
end

#stdoutIO

Get the stdout (not STDOUT) for the player.

Returns:

  • (IO)

    The stdout for the player.



52
53
54
# File 'lib/cultome_player/environment.rb', line 52

def stdout
  STDOUT
end