class Agile::Remotes
Public Instance Methods
add(remote)
click to toggle source
# File lib/agile/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()
click to toggle source
# File lib/agile/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)
click to toggle source
# File lib/agile/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
Private Instance Methods
error_checking_remotes()
click to toggle source
# File lib/agile/commands/remotes.rb, line 37 def error_checking_remotes abort "You haven't done init yet!" unless CONFIG["current_remote"] abort "Please, log in!" unless CONFIG["current_user"] abort "You have no remotes. Try to init!" unless CONFIG["remotes"] end