Class: Rolify::Generators::RolifyGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/rolify/rolify_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(args, config) ⇒ Object



14
15
16
17
18
# File 'lib/generators/rolify/rolify_generator.rb', line 14

def self.start(args, config)
  user_cname = args.size > 1 ? args[1] : "User"
  args.insert(1, user_cname) # 0 being the view name
  super
end

Instance Method Details

#copy_initializer_fileObject



24
25
26
# File 'lib/generators/rolify/rolify_generator.rb', line 24

def copy_initializer_file
  template "initializer.rb", "config/initializers/rolify.rb"
end

#inject_user_classObject



20
21
22
# File 'lib/generators/rolify/rolify_generator.rb', line 20

def inject_user_class
  invoke "rolify:user", [ user_cname, class_name ], :orm => options.orm
end

#show_readmeObject



28
29
30
31
32
# File 'lib/generators/rolify/rolify_generator.rb', line 28

def show_readme
  if behavior == :invoke
    readme "README"
  end
end