Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (29 sloc) 1.598 kb
# This installs Authlogic stuff at the moment but could support others too
gem 'authlogic'
rake "gems:install", :sudo => use_sudo?
rake "gems:install", :sudo => use_sudo?
generate 'session', 'user_session'
# require in [test|spec]_helper.rb
test_or_spec = (File.exists?('spec') ? "spec" : "test")
File.open(File.join(test_or_spec,"#{test_or_spec}_helper.rb"), "a") do |file|
file << "\nrequire 'authlogic/test_case'\n"
end
user_model = ENV['USER_MODEL'] || ask("What should be the name of the user model? (leave it empty to skip)")
unless user_model.blank?
user_ident = ENV['USER_IDENT'] || ask("What is the identifier of a user? (e.g. login, email)")
migration = "#{user_ident}:string crypted_password:string password_salt:string persistence_token:string single_access_token:string perishable_token:string login_count:integer failed_login_count:integer last_request_at:datetime"
#for acts_as_authenticated "login_count:integer failed_login_count:integer last_request_at:datetime current_login_at:datetime last_login_at:datetime current_login_ip:string last_login_ip:string"
if File.exists?('rspec')
generate 'rspec_model', user_model, migration
else
generate 'model', user_model, migration
end
file "app/models/#{user_model.underscore}.rb", <<-RB
class #{user_model.classify} < ActiveRecord::Base
acts_as_authentic # for options see documentation: Authlogic::ORMAdapters::ActiveRecordAdapter::ActsAsAuthentic::Config
end
RB
rake "db:migrate"
end
git :add => "."
git :commit => "-a -m 'Added AuthLogic#{" and #{user_model} model" unless user_model.blank?}'"
Jump to Line
Something went wrong with that request. Please try again.