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/model.rb', line 30
def create_model
if in_app_root?
valid_constant?(options[:model] || name)
@model_name = (options[:model] || name).gsub(/\W/, "_").downcase
@class_name = (options[:model] || name).gsub(/\W/, "_").capitalize
@developer = "#{`whoami`.strip}"
@created_on = Date.today.to_s
self.destination_root = options[:root]
self.behavior = :revoke if options[: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 [#{@model_name.capitalize}] Model 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
|