Class: Qas::Grab

Inherits:
Object
  • Object
show all
Defined in:
lib/qas/grab.rb

Overview

Grab FLOSS Projects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Grab

Returns a new instance of Grab.



10
11
12
# File 'lib/qas/grab.rb', line 10

def initialize(project)
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



8
9
10
# File 'lib/qas/grab.rb', line 8

def project
  @project
end

Instance Method Details

#cloneObject



21
22
23
24
25
# File 'lib/qas/grab.rb', line 21

def clone
  Utils.spin(project.name) do
    Git.clone project.url, project.folder
  end
end

#pullObject



14
15
16
17
18
19
# File 'lib/qas/grab.rb', line 14

def pull
  Utils.spin(project.name) do
    repo = Git.open project.folder
    repo.pull 'origin', repo.current_branch
  end
end

#runObject

Cloning/Pulling FLOSS Project



28
29
30
# File 'lib/qas/grab.rb', line 28

def run
  project.folder.join('.git').exist? ? pull : clone
end