Sha256: f18d2b5e79f21333a39891e0b1ce56b51fb3ef54f506dca998c224307fb74eb8
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
require "rails" module Thincloud module Generators class AuthGenerator < ::Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) desc "Generates an authentication system for Rails3 Thincloud app." def auth copy_file "sessions_controller.rb", "app/controllers/sessions_controller.rb" copy_file "sessions_controller_test.rb", "test/controllers/sessions_controller_test.rb" copy_file "users_controller.rb", "app/controllers/users_controller.rb" copy_file "users_controller_test.rb", "test/controllers/users_controller_test.rb" empty_directory "app/views/sessions" copy_file "login.html.erb", "app/views/sessions/new.html.erb" empty_directory "app/views/users" copy_file "signup.html.erb", "app/views/users/new.html.erb" user_test_path = Rails.root.join("test/models/user_test.rb") test_existed = File.exist?(user_test_path) generate "model", "user email password_digest --skip-test" File.unlink user_test_path unless test_existed inject_into_class("app/models/user.rb", User) do " attr_accessible :password, :password_confirmation\n" end copy_file "user_authentication_test.rb", "test/models/user_authentication_test.rb" route 'get "signup", to: "users#new", as: "signup"' route 'get "login", to: "sessions#new", as: "login"' route 'get "logout", to: "sessions#destroy", as: "logout"' route 'resources :sessions' route 'resources :users' copy_file "initializer.rb", "config/initializers/thincloud_auth.rb" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thincloud-auth-0.1.2 | lib/generators/thincloud/auth/auth_generator.rb |
thincloud-auth-0.1.1 | lib/generators/thincloud/auth/auth_generator.rb |