omroep_auth 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/omroep_auth.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{omroep_auth}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bart Zonneveld"]
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "lib/omroep_auth.rb",
27
27
  "omroep_auth.gemspec",
28
+ "rails_generators/lib/insert_commands.rb",
28
29
  "rails_generators/omroep_auth_generator.rb",
29
30
  "rails_generators/templates/config/initializers/omroep_auth.rb",
30
31
  "rails_generators/templates/controllers/omroep_auth_controller.rb",
@@ -0,0 +1,24 @@
1
+ Rails::Generator::Commands::Create.class_eval do
2
+ def route_name(name, path, route_options = {})
3
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
4
+
5
+ logger.route "map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
6
+ unless options[:pretend]
7
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
8
+ "#{match}\n map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ Rails::Generator::Commands::Destroy.class_eval do
15
+ def route_name(name, path, route_options = {})
16
+ look_for = "\n map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
17
+ logger.route "map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
18
+ unless options[:pretend]
19
+ gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
20
+ end
21
+ end
22
+ end
23
+
24
+ puts "INcluded"
@@ -1,3 +1,5 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
2
+
1
3
  class OmroepAuthGenerator < Rails::Generator::Base
2
4
  def manifest
3
5
  record do |m|
@@ -20,9 +22,11 @@ class OmroepAuthGenerator < Rails::Generator::Base
20
22
 
21
23
  m.file "lib/omroep_auth_system.rb", "lib/omroep_auth_system.rb"
22
24
 
23
- m.migration_template "migrate/create_users.rb", "db/migrate"
25
+ m.route_name :omroep_login, '/login', :controller => 'omroep_auth', :action => 'new'
26
+ m.route_name :omroep_remote_login, '/do_login', :controller => 'omroep_auth', :action => 'create'
27
+ m.route_name :omroep_logout_path, '/logout', :controller => 'omroep_auth', :action => 'destroy'
24
28
 
25
- m.readme "INSTALL"
29
+ m.migration_template "migrate/create_omroep_users.rb", "db/migrate"
26
30
  end
27
31
  end
28
32
 
@@ -4,7 +4,7 @@ require RAILS_ROOT+'/lib/omroep_auth_system'
4
4
 
5
5
  describe "OmroepAuthSystem" do
6
6
  class DummyController < ActionController::Base
7
- include OmroepAuthHelper
7
+ include OmroepAuthSystem
8
8
 
9
9
  def test_current_user
10
10
  current_user
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omroep_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Zonneveld
@@ -31,6 +31,7 @@ files:
31
31
  - VERSION
32
32
  - lib/omroep_auth.rb
33
33
  - omroep_auth.gemspec
34
+ - rails_generators/lib/insert_commands.rb
34
35
  - rails_generators/omroep_auth_generator.rb
35
36
  - rails_generators/templates/config/initializers/omroep_auth.rb
36
37
  - rails_generators/templates/controllers/omroep_auth_controller.rb