Class: Rotation::CLI
- Inherits:
-
Thor
- Object
- Thor
- Rotation::CLI
- Defined in:
- lib/rotation/cli.rb
Constant Summary collapse
- CONFIG_PATH =
File.("~/.rotation")
Instance Method Summary collapse
Instance Method Details
#init(topic_name) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/rotation/cli.rb', line 8 def init(topic_name) config = File.exists?(CONFIG_PATH) ? YAML.load_file(CONFIG_PATH) : {} config[topic_name] = { "duration" => 1, "start_date" => Date.today, "first" => "Huey", "candidates" => ["Huey", "Dewey", "Louie"] } File.open(CONFIG_PATH, "w") do |out| YAML.dump(config, out) end end |
#responsible(topic_name) ⇒ Object
25 26 27 28 29 |
# File 'lib/rotation/cli.rb', line 25 def responsible(topic_name) load_settings topic = Configuration.fetch(topic_name) say_status(topic_name, topic.responsible) end |
#responsibles ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rotation/cli.rb', line 17 def responsibles load_settings Configuration.config_store.each do |name, topic| say_status(name, topic.responsible) end end |