Class: RGitFlow::Tasks::SCM::Task
- Defined in:
- lib/rgitflow/tasks/scm/task.rb
Constant Summary
Constants included from Printing
Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::INPUT_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary
Attributes inherited from Task
#after, #before, #dependencies, #description, #name, #namespaces
Instance Method Summary collapse
- #dirty? ⇒ Boolean
-
#initialize(git, name, description, namespaces = ['rgitflow', 'scm'], dependencies = []) ⇒ Task
constructor
A new instance of Task.
- #print_status ⇒ Object
Methods inherited from Task
Methods included from Console
#execute, #invoke, #multi_task, #task?
Methods included from Printing
#debug, #error, #prompt, #status
Constructor Details
#initialize(git, name, description, namespaces = ['rgitflow', 'scm'], dependencies = []) ⇒ Task
Returns a new instance of Task.
7 8 9 10 |
# File 'lib/rgitflow/tasks/scm/task.rb', line 7 def initialize(git, name, description, namespaces=['rgitflow', 'scm'], dependencies=[]) super(git, name, description, namespaces, dependencies) end |
Instance Method Details
#dirty? ⇒ Boolean
12 13 14 |
# File 'lib/rgitflow/tasks/scm/task.rb', line 12 def dirty? @git.diff.size > 0 end |
#print_status ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rgitflow/tasks/scm/task.rb', line 16 def print_status added = [] modified = [] deleted = [] @git.diff.each { |f| if f.type == 'new' added << f elsif f.type == 'modified' modified << f elsif f.type == 'deleted' deleted << f end } debug 'added' added.each { |f| debug " #{ANSI::Constants::GREEN}#{ANSI::Constants::BRIGHT}"\ "#{f.path}#{ANSI::Constants::CLEAR}" } debug 'modified' modified.each { |f| debug " #{ANSI::Constants::YELLOW}#{ANSI::Constants::BRIGHT}"\ "#{f.path}#{ANSI::Constants::CLEAR}" } debug 'deleted' deleted.each { |f| debug " #{ANSI::Constants::RED}#{ANSI::Constants::BRIGHT}"\ "#{f.path}#{ANSI::Constants::CLEAR}" } end |