Class: Qas::Main
- Inherits:
-
Object
- Object
- Qas::Main
- Defined in:
- lib/qas/main.rb
Overview
Main start point
Defined Under Namespace
Classes: GitMustBeAvailable
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#folders ⇒ Object
readonly
Returns the value of attribute folders.
-
#projects ⇒ Object
readonly
Returns the value of attribute projects.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
- #actions ⇒ Object
- #current_project ⇒ Object
-
#initialize(command, names = nil) ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
Constructor Details
#initialize(command, names = nil) ⇒ Main
Returns a new instance of Main.
10 11 12 13 |
# File 'lib/qas/main.rb', line 10 def initialize(command, names = nil) @command = command @names = names end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
8 9 10 |
# File 'lib/qas/main.rb', line 8 def command @command end |
#folders ⇒ Object (readonly)
Returns the value of attribute folders.
8 9 10 |
# File 'lib/qas/main.rb', line 8 def folders @folders end |
#projects ⇒ Object (readonly)
Returns the value of attribute projects.
8 9 10 |
# File 'lib/qas/main.rb', line 8 def projects @projects end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
8 9 10 |
# File 'lib/qas/main.rb', line 8 def utils @utils end |
Instance Method Details
#actions ⇒ Object
28 29 30 31 32 33 |
# File 'lib/qas/main.rb', line 28 def actions { grab: ->(project) { Grab.new(project) }.curry, archive: ->(project) { Archive.new(project, @names) }.curry } end |
#current_project ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/qas/main.rb', line 20 def current_project projects.each do |_, repos| repos.each do |project| yield project if block_given? end end end |
#run ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/qas/main.rb', line 35 def run raise GitMustBeAvailable, 'Git was not found!' unless Utils.which?('git').any? current_project do |project| actions[command].call(project).run end end |