Class: Remotes
- Inherits:
-
Object
- Object
- Remotes
- Defined in:
- lib/leap/support/remotes.rb
Instance Attribute Summary collapse
-
#remotes ⇒ Object
readonly
Returns the value of attribute remotes.
Instance Method Summary collapse
- #add_remote(name, remote_url, project_name = nil) ⇒ Object
- #add_specified_remotes ⇒ Object
-
#initialize(thor, config, project_name = nil) ⇒ Remotes
constructor
A new instance of Remotes.
Constructor Details
#initialize(thor, config, project_name = nil) ⇒ Remotes
Returns a new instance of Remotes.
4 5 6 7 8 |
# 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 |
Instance Attribute Details
#remotes ⇒ Object (readonly)
Returns the value of attribute remotes.
2 3 4 |
# File 'lib/leap/support/remotes.rb', line 2 def remotes @remotes end |
Instance Method Details
#add_remote(name, remote_url, project_name = nil) ⇒ Object
20 21 22 23 24 25 26 27 |
# 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 ⇒ Object
10 11 12 13 14 15 16 17 18 |
# 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 |