Class: Willpower::Remotes
- Inherits:
-
Thor
- Object
- Thor
- Willpower::Remotes
- Defined in:
- lib/willpower/commands/remotes.rb
Instance Method Summary collapse
Instance Method Details
#add(remote) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/willpower/commands/remotes.rb', line 16 def add(remote) error_checking_remotes CONFIG["remotes"].push(remote) File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG)) say "Successfully added new remote!" end |
#list ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/willpower/commands/remotes.rb', line 24 def list error_checking_remotes CONFIG["remotes"].each do |name| if name == CONFIG["current_remote"] say "* #{name}" else say name end end end |
#use(remote) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/willpower/commands/remotes.rb', line 4 def use(remote) error_checking_remotes if CONFIG["remotes"].include?(remote) CONFIG["current_remote"] = remote File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG)) say "Successfully changed current remote!" else say "Try again" end end |