Class: Alphonse::Config

Inherits:
Hash
  • Object
show all
Includes:
Alphonse::Configs::Operation, Alphonse::Configs::Setting
Defined in:
lib/alphonse/config.rb

Constant Summary collapse

FONZFILE =
"./Fonzfile"

Instance Attribute Summary collapse

Attributes included from Alphonse::Configs::Operation

#command, #description

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Alphonse::Configs::Operation

#operation, #tasks

Methods included from Alphonse::Configs::Setting

#app_name, #branch, #env_path, #git_repo, #hosts, #path, #restart_command, #ruby_bin_path, #start_command, #user

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



27
28
29
30
31
# File 'lib/alphonse/config.rb', line 27

def initialize(options = {})
  @loaded = false
  self.merge! options
  run_fonzfile
end

Instance Attribute Details

#loadedObject (readonly)

Returns the value of attribute loaded.



11
12
13
# File 'lib/alphonse/config.rb', line 11

def loaded
  @loaded
end

Class Method Details

.initObject

Initialise the Fonzfile



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/alphonse/config.rb', line 14

def self.init
  puts "Fonzie Initialise!"

  pwd = File.dirname(__FILE__)
  if RUBY_VERSION == /1.8/
    require 'ftools'
    File.copy("#{pwd}/default/fonzfile.rb", FONZFILE)
  else
    require 'fileutils'
    ::FileUtils.copy("#{pwd}/default/fonzfile.rb", FONZFILE)
  end
end

Instance Method Details

#configObject



42
43
44
# File 'lib/alphonse/config.rb', line 42

def config
  self
end

#config_loaded?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/alphonse/config.rb', line 46

def config_loaded?
  loaded
end

#operatorObject



33
34
35
# File 'lib/alphonse/config.rb', line 33

def operator
  Operator.new(self)
end

#set_attr(hash) ⇒ Object



38
39
40
# File 'lib/alphonse/config.rb', line 38

def set_attr(hash)
  config.merge! hash
end