Module: BrighterPlanet::Deploy::ReadsFromLocalFilesystem

Included in:
Server
Defined in:
lib/brighter_planet_deploy/reads_from_local_filesystem.rb

Defined Under Namespace

Classes: NotLocal

Instance Method Summary collapse

Instance Method Details

#from_private_dir(k) ⇒ Object



8
9
10
# File 'lib/brighter_planet_deploy/reads_from_local_filesystem.rb', line 8

def from_private_dir(k)
  from_file private_brighter_planet_deploy_path(k)
end

#from_public_dir(k) ⇒ Object



12
13
14
# File 'lib/brighter_planet_deploy/reads_from_local_filesystem.rb', line 12

def from_public_dir(k)
  from_file public_brighter_planet_deploy_path(k)
end

#saveObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/brighter_planet_deploy/reads_from_local_filesystem.rb', line 26

def save
  public = {}
  private = {}
  instance_variables.each do |k|
    k1 = k.to_s.sub('@', '').to_sym
    next if not_saved? k1
    if v = instance_variable_get(k)
      if public? k1
        public[k1] = v
      else
        private[k1] = v
      end
    end
  end
  write :public => public, :private => private
end

#write(config = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/brighter_planet_deploy/reads_from_local_filesystem.rb', line 16

def write(config = {})
  [ :public, :private ].each do |loc|
    config[loc].each do |k, v|
      path = send("#{loc}_brighter_planet_deploy_path", k)
      $stderr.puts "[brighter_planet_deploy] Writing #{k}=#{v} to #{path}"
      ::File.open(path, 'w') { |f| f.write v.to_s }
    end
  end
end