Class: IOSBox::Tools::Config

Inherits:
Thor
  • Object
show all
Defined in:
lib/ios-box/tools/config.rb

Instance Method Summary collapse

Instance Method Details

#set(key, value) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ios-box/tools/config.rb', line 10

def set(key, value)
  if ["true", "yes"].include?(value.downcase)
    value = true
  elsif ["false", "no"].include?(value.downcase)
    value = false
  end

  config = IOSBox.new.config
  # Split config
  category, key = key.split(/\./)
  if key.nil?
    config.send("#{category}=", value)
  else
    if !config.send(category).kind_of?(Hash)
      config.send("#{category}=", {})
    end
    config.send(category).send(:[]=, key, value)
  end

  # config.testflight = {}
  # config.testflight['apikey'] = 'XXXX'
  # # config.send("#{key}=", value)
  config.save
end

#showObject



5
6
7
# File 'lib/ios-box/tools/config.rb', line 5

def show
  shell.print_table IOSBox.new.config.to_a
end