lib/generators/cream/config/modules/helper.rb in cream-0.6.1 vs lib/generators/cream/config/modules/helper.rb in cream-0.6.3

- old
+ new

@@ -6,10 +6,15 @@ :data_mapper => 'dm-devise', :mongo_mapper => 'mm-devise', :mongoid => 'rails3-mongoid-devise' } + # rails generate ... + def rgen command + execute "rails g #{command}" + end + def execute command logger.debug command run command end @@ -19,19 +24,36 @@ def logfile options[:logfile] end - def default_roles - options[:default_roles] ? '--default-roles' : '--no-default-roles' + def users + extra_users = admin_user? ? :admin : nil + @users ||= ([:user] + extra_users).compact end def roles - options[:roles].join(' ') + @roles ||= options[:roles].join(' ') end + def roles_generator + "#{orm}:roles" + end + + def user_generator + active_record? ? "#{orm}:devise" : 'devise' + end + + def active_record? + orm == 'active_record' + end + def orm options[:orm] + end + + def default_roles? + options[:default_roles] end def roles_config? options[:roles_config] end \ No newline at end of file