oa-core 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/omniauth/core.rb +20 -20
  2. metadata +4 -4
data/lib/omniauth/core.rb CHANGED
@@ -3,35 +3,35 @@ require 'singleton'
3
3
  require 'omniauth/form'
4
4
 
5
5
  module OmniAuth
6
-
6
+
7
7
  autoload :Builder, 'omniauth/builder'
8
8
  autoload :Strategy, 'omniauth/strategy'
9
9
  autoload :Test, 'omniauth/test'
10
-
10
+
11
11
  module Strategies
12
12
  autoload :Password, 'omniauth/strategies/password'
13
13
  end
14
-
14
+
15
15
  class Configuration
16
16
  include Singleton
17
-
17
+
18
18
  @@defaults = {
19
19
  :path_prefix => '/auth',
20
20
  :on_failure => Proc.new do |env, message_key|
21
21
  new_path = "#{OmniAuth.config.path_prefix}/failure?message=#{message_key}"
22
- [302, {'Location' => "#{new_path}"}, []]
22
+ [302, {'Location' => "#{new_path}", 'Content-Type'=> 'text/html'}, []]
23
23
  end,
24
24
  :form_css => Form::DEFAULT_CSS
25
25
  }
26
-
26
+
27
27
  def self.defaults
28
28
  @@defaults
29
29
  end
30
-
30
+
31
31
  def initialize
32
32
  @@defaults.each_pair{|k,v| self.send("#{k}=",v)}
33
33
  end
34
-
34
+
35
35
  def on_failure(&block)
36
36
  if block_given?
37
37
  @on_failure = block
@@ -39,19 +39,19 @@ module OmniAuth
39
39
  @on_failure
40
40
  end
41
41
  end
42
-
42
+
43
43
  attr_writer :on_failure
44
44
  attr_accessor :path_prefix, :form_css
45
45
  end
46
-
46
+
47
47
  def self.config
48
48
  Configuration.instance
49
49
  end
50
-
50
+
51
51
  def self.configure
52
52
  yield config
53
53
  end
54
-
54
+
55
55
  module Utils
56
56
  CAMELIZE_SPECIAL = {
57
57
  'oauth' => 'OAuth',
@@ -60,31 +60,31 @@ module OmniAuth
60
60
  'open_id' => 'OpenID',
61
61
  'github' => 'GitHub'
62
62
  }
63
-
63
+
64
64
  module_function
65
-
65
+
66
66
  def form_css
67
67
  "<style type='text/css'>#{OmniAuth.config.form_css}</style>"
68
68
  end
69
-
69
+
70
70
  def deep_merge(hash, other_hash)
71
71
  target = hash.dup
72
-
72
+
73
73
  other_hash.keys.each do |key|
74
74
  if other_hash[key].is_a? ::Hash and hash[key].is_a? ::Hash
75
75
  target[key] = deep_merge(target[key],other_hash[key])
76
76
  next
77
77
  end
78
-
78
+
79
79
  target[key] = other_hash[key]
80
80
  end
81
-
81
+
82
82
  target
83
83
  end
84
-
84
+
85
85
  def camelize(word, first_letter_in_uppercase = true)
86
86
  return CAMELIZE_SPECIAL[word.to_s] if CAMELIZE_SPECIAL[word.to_s]
87
-
87
+
88
88
  if first_letter_in_uppercase
89
89
  word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
90
90
  else
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Bleigh
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-11 00:00:00 -05:00
18
+ date: 2010-10-12 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency