Class: Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/needy-git/dependency.rb

Instance Method Summary collapse

Constructor Details

#initialize(author, git = 'git') ⇒ Dependency



5
6
7
8
# File 'lib/needy-git/dependency.rb', line 5

def initialize(author, git='git')
  @git = git
  @author = author
end

Instance Method Details

#update(folder) ⇒ Object



10
11
12
13
14
15
# File 'lib/needy-git/dependency.rb', line 10

def update(folder)
  sh "#{@git} pull"
  sh "#{@git} add #{folder}"
  
  commit_and_push(folder)  unless nothing_to_commit(folder)
end

#update_submodule(folder) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/needy-git/dependency.rb', line 17

def update_submodule(folder)
  sh "#{@git} submodule update --init"
  sh "#{@git} submodule update"
  root_dir = Dir.pwd
  
  Dir.chdir(folder)
  sh "#{@git} pull origin master"    
  Dir.chdir(root_dir)  
  
  sh "#{@git} pull"
  commit_and_push(folder) unless nothing_to_commit(folder)
end