Class: Cejo::Floss::Grab
- Inherits:
-
Object
- Object
- Cejo::Floss::Grab
- Defined in:
- lib/cejo/floss/grab.rb
Overview
Grab FLOSS Projects
Instance Attribute Summary collapse
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
- #do_clone ⇒ Object
- #do_pull ⇒ Object
-
#initialize(utils, folder, url, info) ⇒ Grab
constructor
A new instance of Grab.
-
#run ⇒ Object
Cloning/Pulling FLOSS Project.
Constructor Details
#initialize(utils, folder, url, info) ⇒ Grab
Returns a new instance of Grab.
11 12 13 14 15 16 |
# File 'lib/cejo/floss/grab.rb', line 11 def initialize(utils, folder, url, info) @utils = utils @folder = folder @url = url @info = info end |
Instance Attribute Details
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
9 10 11 |
# File 'lib/cejo/floss/grab.rb', line 9 def folder @folder end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
9 10 11 |
# File 'lib/cejo/floss/grab.rb', line 9 def info @info end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/cejo/floss/grab.rb', line 9 def url @url end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
9 10 11 |
# File 'lib/cejo/floss/grab.rb', line 9 def utils @utils end |
Instance Method Details
#do_clone ⇒ Object
25 26 27 28 29 |
# File 'lib/cejo/floss/grab.rb', line 25 def do_clone utils.spin('Cloning') do Git.clone url, folder end end |
#do_pull ⇒ Object
18 19 20 21 22 23 |
# File 'lib/cejo/floss/grab.rb', line 18 def do_pull utils.spin('Pulling') do repo = Git.open folder repo.pull 'origin', repo.current_branch end end |
#run ⇒ Object
Cloning/Pulling FLOSS Project
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cejo/floss/grab.rb', line 32 def run puts info.to_s if folder.exist? do_pull else do_clone end puts end |