Module: Client
- Defined in:
- lib/mist/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
12 13 14 |
# File 'lib/mist/client.rb', line 12 def config @config end |
Class Method Details
.get_config ⇒ Object
42 43 44 |
# File 'lib/mist/client.rb', line 42 def get_config @config end |
.set_config(changes) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/mist/client.rb', line 46 def set_config changes @config.merge(changes) File.open(@config_file_path, "w") do |f| f.write(@config.to_json) end end |
.setup ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mist/client.rb', line 16 def setup home = Dir.home @config_file_path = home+"/.mist" if File.exists? (@config_file_path) @config = JSON.parse(IO.read(@config_file_path), :symbolize_names => true) else @config = Hash.new @config[:profile] = { :global_id => (0...50).map { ('a'..'z').to_a[rand(26)] }.join, :installation => Time.now.to_s, :config_file_version => 1 } @config[:services] = {} File.open(@config_file_path,"w") do |f| f.write(@config.to_json) end end end |