Module: Escualo::Remote
- Defined in:
- lib/escualo/remote.rb
Class Method Summary collapse
- .attach(dir, name) ⇒ Object
- .clone(dir, repo, options) ⇒ Object
- .push(dir) ⇒ Object
- .remotes(dir) ⇒ Object
Class Method Details
.attach(dir, name) ⇒ Object
3 4 5 6 7 |
# File 'lib/escualo/remote.rb', line 3 def self.attach(dir, name) remote_name = "escualo-#{name}-#{$hostname}" remote_url = "ssh://#{$username}@#{$hostname}:#{$ssh_port}/var/repo/#{name}.git" %x{cd #{dir} && git remote add #{remote_name} #{remote_url}} end |
.clone(dir, repo, options) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/escualo/remote.rb', line 9 def self.clone(dir, repo, ) repo_url = "https://github.com/#{repo}" %x{git clone #{repo_url} #{dir}} if .tag %x{cd #{dir} && git checkout #{.tag}} end end |
.push(dir) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/escualo/remote.rb', line 23 def self.push(dir) remotes(dir) .each do |remote| %x{cd #{dir} && git push #{remote} HEAD} end end |
.remotes(dir) ⇒ Object
17 18 19 20 21 |
# File 'lib/escualo/remote.rb', line 17 def self.remotes(dir) %x{cd #{dir} && git remote show} .split .select {|it| it.start_with? 'escualo-'} end |