active_template.rb in active_leonardo-0.0.3 vs active_template.rb in active_leonardo-0.0.4
- old
+ new
@@ -46,22 +46,34 @@
authentication = yes?("Authentication ?")
model_name = authorization = nil
if authentication
default_model_name = "User"
- model_name = ask(" Insert model name: [#{default_model_name}] (Other names are not tested yet)")
- model_name = default_model_name if model_name.empty?
+ model_name = ask(" Insert model name: [#{default_model_name}]")
+ if model_name.empty? || model_name == 'y'
+ model_name = default_model_name
+ else
+ model_name = model_name.classify
+ stdout = <<-REMEM.gsub(/^ /, '')
+ *************************************************************************
+ Remember to add your auth class when you use active leonardo's generator.
+ For example:
+ rails g leosca Product name price:decimal --auth_class=#{model_name}
+ *************************************************************************
+ REMEM
+ p stdout
+ end
authorization = yes?("Authorization ?")
gem 'cancan' if authorization
end
dashboard_root = yes?("Would you use dashboard as root ? (recommended)")
home = yes?("Ok. Would you create home controller as root ?") unless dashboard_root
if yes?("Bundle install ?")
dir = ask(" Insert folder name to install locally: [blank=default gems path]")
- run "bundle install #{"--path=#{dir}" unless dir.empty?}"
+ run "bundle install #{"--path=#{dir}" unless dir.empty? || dir=='y'}"
end
generate "active_admin:install #{authentication ? model_name : "--skip-users"}"
if authorization