Class: LifxDash::Configuration
- Inherits:
-
Object
- Object
- LifxDash::Configuration
- Defined in:
- lib/lifx_dash/configuration.rb
Constant Summary collapse
- CONFIG_FILE_NAME =
".lifx_dash.rc.yml"
- OPTION_PROMPTS =
{ "iface" => "Network interface identifier e.g. en0 (choose from ifconfig -l)", "token" => "LIFX API token (get a free personal token at cloud.lifx.com)", "mac-address" => "Dash button MAC address (use lifx_dash snoop to find it)", "selector" => "LIFX bulb selector e.g. all or a LIFX bulb ID", "log-file" => "Log file location (when running as a daemon)" }
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/lifx_dash/configuration.rb', line 16 def [](key) [key] end |
#configure ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lifx_dash/configuration.rb', line 30 def configure puts "Configuring lifx_dash ...\n\n" = if .values.all?(&:nil?) puts "\nNo options set, configuration is unchanged" else File.open(config_file, "w") do |file| YAML::dump(, file) end puts "\nConfiguration saved to #{config_file}" end end |
#show ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/lifx_dash/configuration.rb', line 20 def show if File.exist?(config_file) puts "Configuration file at #{config_file} ...\n\n" puts File.read(config_file) puts "\nChange these options with `lifx_dash config`" else puts "No configuration file exists at #{config_file}" end end |