Class: GemPolisher::Task
- Inherits:
-
Object
- Object
- GemPolisher::Task
- Extended by:
- Forwardable
- Includes:
- Rake::DSL
- Defined in:
- lib/gem_polisher/task.rb
Overview
Parent class that handles Rake tasks creation
Direct Known Subclasses
Constant Summary collapse
- ANSI_RESET =
"\e[0m"
- ANSI_ATTR_BRIGHT =
"\e[1m"
- ANSI_FG_GREEN =
"\e[32m"
- ANSI_FG_RED =
"\e[31m"
Instance Attribute Summary collapse
-
#gem_polisher ⇒ Object
readonly
GemPolisher instance.
Instance Method Summary collapse
-
#create_task ⇒ Object
Creates Rake task (abstract method).
-
#initialize(gem_polisher) ⇒ Task
constructor
Receive a GemPolisher instance.
-
#step(name) ⇒ Object
Log and execute block.
Constructor Details
#initialize(gem_polisher) ⇒ Task
Receive a GemPolisher instance
18 19 20 21 |
# File 'lib/gem_polisher/task.rb', line 18 def initialize gem_polisher @gem_polisher = gem_polisher create_task end |
Instance Attribute Details
#gem_polisher ⇒ Object (readonly)
GemPolisher instance
10 11 12 |
# File 'lib/gem_polisher/task.rb', line 10 def gem_polisher @gem_polisher end |
Instance Method Details
#create_task ⇒ Object
Creates Rake task (abstract method)
24 25 26 |
# File 'lib/gem_polisher/task.rb', line 24 def create_task raise "Not implemented!" end |
#step(name) ⇒ Object
Log and execute block
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gem_polisher/task.rb', line 34 def step name print "#{ANSI_RESET}#{ANSI_ATTR_BRIGHT}#{name}...#{ANSI_RESET} " begin yield rescue puts "#{ANSI_RESET}#{ANSI_FG_RED}[FAIL]#{ANSI_RESET}" raise $! else puts "#{ANSI_RESET}#{ANSI_FG_GREEN}[OK]#{ANSI_RESET}" end end |