Module: Lariat

Defined in:
lib/lariat.rb,
lib/lariat/cli.rb,
lib/lariat/github.rb,
lib/lariat/version.rb,
lib/lariat/issue_writer.rb,
lib/lariat/github/issues.rb,
lib/lariat/sabotage_stats.rb

Defined Under Namespace

Classes: CLI, Github, IssueWriter, SabotageStats

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.get_environmentObject



28
29
30
31
# File 'lib/lariat.rb', line 28

def self.get_environment
  return "development" unless defined?(::Rails)
  ::Rails.env
end

.load_config_from_yaml(relative_config_path) ⇒ Object



11
12
13
14
15
16
# File 'lib/lariat.rb', line 11

def self.load_config_from_yaml(relative_config_path)
  full_config_path = ::File.expand_path(relative_config_path)
  yaml_string = ::ERB.new(::File.read(full_config_path)).result
  config = ::YAML.load(yaml_string, :safe => true)
  config.respond_to?(:with_indifferent_access) ? config.with_indifferent_access : config
end

.load_environment_config_from_yaml(relative_config_path, environment = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/lariat.rb', line 18

def self.load_environment_config_from_yaml(relative_config_path, environment = nil)
  environment ||= ::Lariat.get_environment

  config = load_config_from_yaml(relative_config_path)
  environment_config = config[environment]

  fail "#{environment} environment not found in #{relative_config_path}." unless environment_config
  environment_config
end