Class: Puer::Generators::Controller
- Includes:
- CLIColorize
- Defined in:
- lib/puer/generators/controller.rb
Instance Method Summary collapse
Methods inherited from Jam
attr_rw, banner, #create_jam, #in_app_root?, init_generator, parseTemplate, source_root
Instance Method Details
#create_controller ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/puer/generators/controller.rb', line 30 def create_controller if in_app_root? valid_constant?([:model] || name) @controller_name = ([:model] || name).gsub(/\W/, "_").downcase @class_name = ([:model] || name).gsub(/\W/, "_").capitalize @developer = "#{`whoami`.strip}" @created_on = Date.today.to_s self.destination_root = [:root] self.behavior = :revoke if [:destroy] puts colorize( "Puer Version: #{Puer::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } ) puts eval(File.read(__FILE__) =~ /^__END__\n/ && $' || '') say (<<-TEXT).gsub(/ {10}/,'') ================================================================= Your [#{@controller_name.capitalize}] Controller has been generated. Build and Run ================================================================= TEXT else puts puts '-'*70 puts "You are not in a titanium project folder" puts '-'*70 puts end end |