Class: Inkling::Generator
- Inherits:
-
Object
- Object
- Inkling::Generator
- Defined in:
- lib/inkling/commands/generator.rb
Instance Attribute Summary collapse
-
#force ⇒ Object
Returns the value of attribute force.
-
#pretend ⇒ Object
Returns the value of attribute pretend.
-
#quiet ⇒ Object
Returns the value of attribute quiet.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#template_path ⇒ Object
Returns the value of attribute template_path.
Instance Method Summary collapse
Instance Attribute Details
#force ⇒ Object
Returns the value of attribute force.
23 24 25 |
# File 'lib/inkling/commands/generator.rb', line 23 def force @force end |
#pretend ⇒ Object
Returns the value of attribute pretend.
23 24 25 |
# File 'lib/inkling/commands/generator.rb', line 23 def pretend @pretend end |
#quiet ⇒ Object
Returns the value of attribute quiet.
23 24 25 |
# File 'lib/inkling/commands/generator.rb', line 23 def quiet @quiet end |
#skip ⇒ Object
Returns the value of attribute skip.
23 24 25 |
# File 'lib/inkling/commands/generator.rb', line 23 def skip @skip end |
#template_path ⇒ Object
Returns the value of attribute template_path.
23 24 25 |
# File 'lib/inkling/commands/generator.rb', line 23 def template_path @template_path end |
Instance Method Details
#generate ⇒ Object
62 63 64 |
# File 'lib/inkling/commands/generator.rb', line 62 def generate puts "Generating using: #{ARGV*' '} is incomplete" end |
#option(arg) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/inkling/commands/generator.rb', line 40 def option arg case arg when '--help', '-h', '-?' puts USAGE exit(0) when '-m', /^--template=(.*)/ template_path = $1 || ARGV.shift when '-p', '--pretend' pretend = true when '--force' force = true when '-s', '--skip' skip = true when '-q', '--quiet' quiet = true else puts "Inkling: option #{arg} unknown" puts USAGE exit(1) end end |
#start ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/inkling/commands/generator.rb', line 25 def start # Extract and save options: = ARGV.select{|o| o =~ /^-/ } .each{|o| option o } ARGV.delete_if{|o| .include?(o)} # Process the command: case cmd = ARGV.shift when 'generate' generate else puts "Inkling: command #{cmd} unknown" end end |