Class: Trellodon::CLI::Config
- Inherits:
-
Trellodon::Config
- Object
- Anyway::Config
- Trellodon::Config
- Trellodon::CLI::Config
- Defined in:
- lib/trellodon/cli.rb
Instance Method Summary collapse
- #api_key ⇒ Object
- #api_token ⇒ Object
- #board ⇒ Object
- #config_path ⇒ Object
- #out ⇒ Object
- #resolve_config_path(_, _) ⇒ Object
- #update_config_file! ⇒ Object
Methods inherited from Trellodon::Config
Instance Method Details
#api_key ⇒ Object
87 88 89 |
# File 'lib/trellodon/cli.rb', line 87 def api_key super || (self.api_key = prompt.ask_api_key) end |
#api_token ⇒ Object
91 92 93 |
# File 'lib/trellodon/cli.rb', line 91 def api_token super || (self.api_token = prompt.ask_api_token) end |
#board ⇒ Object
95 96 97 |
# File 'lib/trellodon/cli.rb', line 95 def board super || (self.board = prompt.ask_board) end |
#config_path ⇒ Object
70 71 72 |
# File 'lib/trellodon/cli.rb', line 70 def config_path File.join(Dir.home, ".config", "#{config_name}.yml") end |
#out ⇒ Object
99 100 101 |
# File 'lib/trellodon/cli.rb', line 99 def out super || (self.out = prompt.ask_folder) end |
#resolve_config_path(_, _) ⇒ Object
66 67 68 |
# File 'lib/trellodon/cli.rb', line 66 def resolve_config_path(_, _) config_path end |
#update_config_file! ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/trellodon/cli.rb', line 74 def update_config_file! dir = File.dirname(config_path) FileUtils.mkdir_p(dir) unless File.exist?(dir) yml = "api_token: #{api_token}\n"\ "api_key: #{api_key}" File.write(config_path, yml) end |