Permalink
Browse files

gemspec fix, generator from gem now working

  • Loading branch information...
1 parent 2597aff commit b726e329774b4c3a2bc8519204c2083f2c440ba3 aledalgrande committed Aug 31, 2009
@@ -2,16 +2,18 @@
Gem::Specification.new do |s|
s.name = %q{authlogic_generator}
- s.version = "0.5.1"
+ s.version = "0.5.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alessandro Dal Grande", "Marco Sanson"]
s.date = %q{2009-08-31}
s.description = %q{A gem to help you generate all the basic structure to use authlogic in your project.}
s.email = %q{lab@develon.com}
+ s.files = ["generators/authlogic_generator/authlogic_generator_generator.rb", "lib/authlogic_generator.rb", "generators/authlogic_generator/lib/insert_routes.rb", "generators/authlogic_generator/templates/controllers/activations_controller.rb", "generators/authlogic_generator/templates/controllers/password_resets_controller.rb", "generators/authlogic_generator/templates/controllers/user_sessions_controller.rb", "generators/authlogic_generator/templates/controllers/users_controller.rb", "generators/authlogic_generator/templates/lib/authlogic_user.rb", "generators/authlogic_generator/templates/migrate/create_users_and_sessions.rb", "generators/authlogic_generator/templates/models/notifier.rb", "generators/authlogic_generator/templates/models/user.rb", "generators/authlogic_generator/templates/models/user_session.rb", "generators/authlogic_generator/templates/views/activations/new.html.erb", "generators/authlogic_generator/templates/views/layouts/_usernav.html.erb", "generators/authlogic_generator/templates/views/notifier/activation_confirmation.text.html.erb", "generators/authlogic_generator/templates/views/notifier/activation_instructions.text.html.erb", "generators/authlogic_generator/templates/views/notifier/password_reset_instructions.text.html.erb", "generators/authlogic_generator/templates/views/notifier/activation_confirmation.text.plain.erb", "generators/authlogic_generator/templates/views/notifier/activation_instructions.text.plain.erb", "generators/authlogic_generator/templates/views/notifier/password_reset_instructions.text.plain.erb", "generators/authlogic_generator/templates/views/password_resets/activate.html.erb", "generators/authlogic_generator/templates/views/password_resets/index.html.erb", "generators/authlogic_generator/templates/views/password_resets/show.html.erb", "generators/authlogic_generator/templates/views/user_sessions/new.html.erb", "generators/authlogic_generator/templates/views/users/_form.html.erb", "generators/authlogic_generator/templates/views/users/edit.html.erb", "generators/authlogic_generator/templates/views/users/new.html.erb", "generators/authlogic_generator/templates/views/users/private.html.erb", "generators/authlogic_generator/templates/views/users/public.html.erb"]
s.has_rdoc = true
s.homepage = %q{http://github.com/develon/authlogic_generator}
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
+ s.require_paths = ["lib"]
s.rubyforge_project = %q{authlogic_generator}
s.rubygems_version = %q{1.3.5}
s.summary = %q{This generator for authlogic creates models, controllers and view for authentication, user activation and password resetting.}
@@ -1 +0,0 @@
-./script/generate authlogic
@@ -1,82 +0,0 @@
-require File.expand_path(File.dirname(__FILE__) + "/lib/insert_routes.rb")
-
-class AuthlogicGenerator < Rails::Generator::Base
- default_options :skip_activation => false,
- :skip_password_reset => false,
- :skip_migration => false,
- :skip_routes => false
-
- def manifest
- recorded_session = record do |m|
-
- m.directory 'app/views/layouts'
- m.directory 'app/views/notifier'
- m.directory 'app/views/user_sessions'
- m.directory 'app/views/users'
-
- m.file 'controllers/user_sessions_controller.rb', 'app/controllers/user_sessions_controller.rb'
- m.template 'controllers/users_controller.rb', 'app/controllers/users_controller.rb'
- m.template 'models/notifier.rb', 'app/models/notifier.rb'
- m.template 'models/user.rb', 'app/models/user.rb'
- m.file 'models/user_session.rb', 'app/models/user_session.rb'
- m.template 'views/layouts/_usernav.html.erb', 'app/views/layouts/_usernav.html.erb'
- m.file 'views/notifier/activation_confirmation.text.html.erb', 'app/views/notifier/activation_confirmation.text.html.erb'
- m.file 'views/notifier/activation_confirmation.text.plain.erb', 'app/views/notifier/activation_confirmation.text.plain.erb'
- m.file 'views/user_sessions/new.html.erb', 'app/views/user_sessions/new.html.erb'
- m.file 'views/users/_form.html.erb', 'app/views/users/_form.html.erb'
- m.file 'views/users/edit.html.erb', 'app/views/users/edit.html.erb'
- m.file 'views/users/new.html.erb', 'app/views/users/new.html.erb'
- m.file 'views/users/private.html.erb', 'app/views/users/private.html.erb'
- m.file 'views/users/public.html.erb', 'app/views/users/public.html.erb'
- m.file 'lib/authlogic_user.rb', 'lib/authlogic_user.rb'
-
- unless options[:skip_password_reset]
- m.directory 'app/views/password_resets'
- m.template 'controllers/password_resets_controller.rb', 'app/controllers/password_resets_controller.rb'
- m.file 'views/notifier/password_reset_instructions.text.html.erb', 'app/views/notifier/password_reset_instructions.text.html.erb'
- m.file 'views/notifier/password_reset_instructions.text.plain.erb', 'app/views/notifier/password_reset_instructions.text.plain.erb'
- m.file 'views/password_resets/index.html.erb', 'app/views/password_resets/index.html.erb'
- m.file 'views/password_resets/show.html.erb', 'app/views/password_resets/show.html.erb'
- end
-
- unless options[:skip_activation]
- m.directory 'app/views/activations'
- m.file 'controllers/activations_controller.rb', 'app/controllers/activations_controller.rb'
- m.file 'views/activations/new.html.erb', 'app/views/activations/new.html.erb'
- m.file 'views/notifier/activation_instructions.text.html.erb', 'app/views/notifier/activation_instructions.text.html.erb'
- m.file 'views/notifier/activation_instructions.text.plain.erb', 'app/views/notifier/activation_instructions.text.plain.erb'
- m.file 'views/password_resets/activate.html.erb', 'app/views/password_resets/activate.html.erb' unless options[:skip_password_reset]
- end
-
- unless options[:skip_routes]
- m.route_resources :users
- m.route_resources :password_resets unless options[:skip_password_reset]
- m.route_resource :user_session
- m.route_name('login', '/login', { :controller => 'user_sessions', :action => 'new' })
- m.route_name('logout', '/logout', { :controller => 'user_sessions', :action => 'destroy' })
- m.route_name('register', '/register/:activation_code', { :controller => 'activations', :action => 'new' }) unless options[:skip_activation]
- end
-
- unless options[:skip_migration]
- m.migration_template "migrate/create_users_and_sessions.rb", "db/migrate", :migration_file_name => "create_users_and_sessions" unless options[:skip_migration]
- end
-
- end
-
- puts "\n1) Please add these lines to your ApplicationController\n\ninclude AuthlogicUser\nfilter_parameter_logging :password, :password_confirmation\nhelper_method :current_user_session, :current_user\n\n"
- puts "2) Please add these lines to your environment and launch rake gems:install\n\nconfig.gem 'binarylogic-authlogic', :lib => 'authlogic', :source => 'http://gems.github.com'\n\n"
- puts "3) Please remember to launch rake db:migrate\n\n" unless options[:skip_migration]
-
- recorded_session
- end
-
- protected
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on("--skip-activation", "Don't generate activation views and controller.") { |v| options[:skip_activation] = true }
- opt.on("--skip-password-reset", "Don't generate controller and views for password resetting.") { |v| options[:skip_password_reset] = true }
- opt.on("--skip-migration", "Don't generate a migration file for this model.") { |v| options[:skip_migration] = true }
- opt.on("--skip-routes", "Don't add lines to the route file.") { |v| options[:skip_routes] = true }
- end
-end
@@ -1,45 +0,0 @@
-Rails::Generator::Commands::Create.class_eval do
- def route_resources(*resources)
- write_route 'resources', resources
- end
-
- def route_resource(*resources)
- write_route 'resource', resources
- end
-
- def route_name(name, path, options={})
- write_route nil, nil, name, path, options
- end
-end
-
-Rails::Generator::Commands::Destroy.class_eval do
- def route_resource(*resources)
- remove_route look_for, 'resource', resource_list
- end
-
- def route_resource(*resources)
- remove_route look_for, 'resource', resource_list
- end
-
- def route_name(name, path, options = {})
- remove_route look_for, nil, nil, name, path, options
- end
-end
-
-def write_route(type=nil, resources=nil, name=nil, path=nil, options={})
- resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') if name.nil?
- sentinel = 'ActionController::Routing::Routes.draw do |map|'
- logger.route name.nil? ? "map.#{type} #{resource_list}" : "map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
- unless options[:pretend]
- gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
- name.nil? ? "#{match}\n map.#{type} #{resource_list}" : "#{match}\n map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
- end
- end
-end
-
-def remove_route(look_for, type=nil, resource_list=nil, name=nil, path=nil, options={})
- resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') if name.nil?
- look_for = name.nil? ? "\n map.resources #{resource_list}\n" : "\n map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
- logger.route name.nil? ? "map.#{type} #{resource_list}" : "map.#{name} '#{path}', :controller => '#{options[:controller]}', :action => '#{options[:action]}'"
- gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
-end

0 comments on commit b726e32

Please sign in to comment.