class Remotes
Attributes
remotes[R]
Public Class Methods
new(thor, config, project_name = nil)
click to toggle source
# File lib/leap/support/remotes.rb, line 4 def initialize(thor, config, project_name = nil) @thor = thor @remotes = extract_remotes(config, project_name) @project_name = project_name end
Public Instance Methods
add_remote(name, remote_url, project_name = nil)
click to toggle source
# File lib/leap/support/remotes.rb, line 20 def add_remote(name, remote_url, project_name = nil) @thor.say "Adding #{name} remote" if project_name.nil? `git remote add #{name} #{remote_url}` else `cd #{project_name} && git remote add #{name} #{remote_url}` end end
add_specified_remotes()
click to toggle source
# File lib/leap/support/remotes.rb, line 10 def add_specified_remotes if @remotes.nil? @thor.say 'No remotes specified', :red else @remotes.each do |name, remote_url| add_remote(name, remote_url, @project_name) end end end
Private Instance Methods
extract_remotes(config, project_name)
click to toggle source
# File lib/leap/support/remotes.rb, line 30 def extract_remotes(config, project_name) config.fetch('remotes') do if File.exists? "./#{project_name}/.leap/config" YAML.load_file("./#{project_name}/.leap/config")['remotes'] end end end