lib/generators/zoo/authentication/authentication_generator.rb in zoo-generators-0.1.0 vs lib/generators/zoo/authentication/authentication_generator.rb in zoo-generators-0.1.1
- old
+ new
@@ -4,21 +4,21 @@
module Zoo
module Generators
class AuthenticationGenerator < Base
include Rails::Generators::Migration
- argument :user_name, :type => :string, :default => 'user', :banner => 'user_name'
- argument :session_name, :type => :string, :default => 'session', :banner => 'sessions_controller_name'
+ argument :user_name, type: :string, default: 'user', banner: 'user_name'
+ argument :session_name, type: :string, default: 'session', banner: 'sessions_controller_name'
- class_option :testunit, :desc => 'Use test/unit for test files.', :group => 'Test framework', :type => :boolean
- class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
- class_option :shoulda, :desc => 'Use shoulda for test files.', :group => 'Test framework', :type => :boolean
+ class_option :testunit, desc: 'Use test/unit for test files.', group: 'Test framework', type: :boolean
+ class_option :rspec, desc: 'Use RSpec for test files.', group: 'Test framework', type: :boolean
+ class_option :shoulda, desc: 'Use shoulda for test files.', group: 'Test framework', type: :boolean
def add_gems
add_gem "haml-rails"
- add_gem "bcrypt-ruby", :require => "bcrypt"
- add_gem "mocha", :group => :test
+ add_gem "bcrypt-ruby", require: "bcrypt"
+ add_gem "mocha", group: :test
end
def create_model_files
template 'user.rb', "app/models/#{user_singular_name}.rb"
end
@@ -45,14 +45,14 @@
end
def create_routes
route "resources #{user_plural_name.to_sym.inspect}"
route "resources #{session_plural_name.to_sym.inspect}"
- route "match 'login' => '#{session_plural_name}#new', :as => :login"
- route "match 'logout' => '#{session_plural_name}#destroy', :as => :logout"
- route "match 'signup' => '#{user_plural_name}#new', :as => :signup"
- route "match '#{user_singular_name}/edit' => '#{user_plural_name}#edit', :as => :edit_current_#{user_singular_name}"
+ route "match 'login' => '#{session_plural_name}#new', as : :login"
+ route "match 'logout' => '#{session_plural_name}#destroy', as : :logout"
+ route "match 'signup' => '#{user_plural_name}#new', as : :signup"
+ route "match '#{user_singular_name}/edit' => '#{user_plural_name}#edit', as : :edit_current_#{user_singular_name}"
end
def create_migration
migration_template 'migration.rb', "db/migrate/create_#{user_plural_name}.rb"
end
@@ -127,10 +127,10 @@
elsif options.rspec?
return @test_framework = :rspec
elsif options.shoulda?
return @test_framework = :shoulda
else
- return @test_framework = File.exist?(destination_path('spec')) ? :rspec : :testunit
+ return @test_framework = File.exist?(destination_path('spec')) ? rspec: :testunit
end
end
def destination_path(path)
File.join(destination_root, path)