Class: Peto::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Peto::RakeTask
- Defined in:
- lib/peto/rake_task.rb
Instance Attribute Summary collapse
-
#contracts ⇒ Object
Returns the value of attribute contracts.
-
#fail_on_error ⇒ Object
Returns the value of attribute fail_on_error.
-
#failure_message ⇒ Object
Returns the value of attribute failure_message.
-
#languages ⇒ Object
Returns the value of attribute languages.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
Instance Method Summary collapse
-
#initialize(*args) {|_self| ... } ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(*args) {|_self| ... } ⇒ RakeTask
Returns a new instance of RakeTask.
15 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/peto/rake_task.rb', line 15 def initialize(*args) @contracts ||= [] @output_dir ||= "./" @languages ||= [] @name ||= :peto @fail_on_error ||= true yield self if block_given? desc("Generate codes by contracts") unless ::Rake.application.last_comment task name do RakeFileUtils.send(:verbose, verbose) do if contracts.empty? puts "No contracts" else begin languages.each do |language| self.contracts = [contracts] if contracts.class == String contracts.each do |contract| peto = Peto::Master.new peto.load(contract) peto.generate(language, output_dir) end end #rescue # puts failure_message if failure_message # raise "peto failed" if fail_on_error end end end end end |
Instance Attribute Details
#contracts ⇒ Object
Returns the value of attribute contracts.
7 8 9 |
# File 'lib/peto/rake_task.rb', line 7 def contracts @contracts end |
#fail_on_error ⇒ Object
Returns the value of attribute fail_on_error.
12 13 14 |
# File 'lib/peto/rake_task.rb', line 12 def fail_on_error @fail_on_error end |
#failure_message ⇒ Object
Returns the value of attribute failure_message.
13 14 15 |
# File 'lib/peto/rake_task.rb', line 13 def @failure_message end |
#languages ⇒ Object
Returns the value of attribute languages.
9 10 11 |
# File 'lib/peto/rake_task.rb', line 9 def languages @languages end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/peto/rake_task.rb', line 11 def name @name end |
#output_dir ⇒ Object
Returns the value of attribute output_dir.
8 9 10 |
# File 'lib/peto/rake_task.rb', line 8 def output_dir @output_dir end |