Class: GlobalConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/yesman/global_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGlobalConfig

Returns a new instance of GlobalConfig.



8
9
10
11
# File 'lib/yesman/global_config.rb', line 8

def initialize
  @pre_existing = false
  @global_config_path =  "#{Dir.home}/.yesman"
end

Instance Attribute Details

#global_config_pathObject (readonly)

Returns the value of attribute global_config_path.



6
7
8
# File 'lib/yesman/global_config.rb', line 6

def global_config_path
  @global_config_path
end

#pre_existingObject (readonly)

Returns the value of attribute pre_existing.



5
6
7
# File 'lib/yesman/global_config.rb', line 5

def pre_existing
  @pre_existing
end

Instance Method Details

#loadObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/yesman/global_config.rb', line 13

def load
  ensure_config_dir

  if !pre_existing
    puts "Copying file templates to #{global_config_path}" 
    copy_all
  elsif old_version?
    FileUtil.clear_directory global_config_path
    copy_all
  end
end