simple-auth 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ fakeweb (1.3.0)
5
+ git (1.2.5)
6
+ jeweler (1.5.1)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ mime-types (1.16)
11
+ rake (0.8.7)
12
+ rest-client (1.6.1)
13
+ mime-types (>= 1.16)
14
+ rspec (1.3.0)
15
+ yajl-ruby (0.7.8)
16
+ yard (0.6.3)
17
+
18
+ PLATFORMS
19
+ ruby
20
+
21
+ DEPENDENCIES
22
+ fakeweb
23
+ jeweler
24
+ rake
25
+ rest-client
26
+ rspec
27
+ yajl-ruby
28
+ yard
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.name = "simple-auth"
8
8
  gem.summary = %Q{Simple shared authentication API}
9
9
  gem.description = %Q{Provides a simple API to authenticate with a rails application}
10
- gem.email = "uchouhan@optimiscorp.com"
10
+ gem.email = ["uchouhan@optimiscorp.com", "joshsmoore@gmail.com"]
11
11
  gem.homepage = "http://github.com/uchouhan/simple-auth"
12
12
  gem.authors = ["Umang Chouhan"]
13
13
  gem.add_development_dependency "rspec"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
@@ -6,7 +6,7 @@ module SimpleAuth
6
6
 
7
7
  def self.method_missing(name, value)
8
8
  if name.to_s == RAILS_ENV
9
- absolute_path = 'http://' + value
9
+ absolute_path = value =~ /https?:\/\// ? value : 'http://' + value
10
10
  path_getter = lambda { absolute_path }
11
11
 
12
12
  SimpleAuth::Api.api_host = absolute_path
@@ -39,4 +39,19 @@ module SimpleAuth
39
39
  PathConfiguration.instance_eval(&block)
40
40
  end
41
41
  module_function :paths
42
+
43
+ def configure_from_yml(yml_hash)
44
+ yml_hash['host'].keys.each do |env_name|
45
+ host do
46
+ send(env_name, yml_hash['host'][env_name])
47
+ end
48
+
49
+ yml_hash['paths'].keys.each do |path_name|
50
+ paths do
51
+ send(path_name, yml_hash['paths'][path_name])
52
+ end
53
+ end
54
+ end
55
+ end
56
+ module_function :configure_from_yml
42
57
  end
@@ -1,53 +1,52 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simple-auth}
8
- s.version = "0.4.0"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Umang Chouhan"]
12
- s.date = %q{2010-08-31}
12
+ s.date = %q{2010-12-27}
13
13
  s.description = %q{Provides a simple API to authenticate with a rails application}
14
- s.email = %q{uchouhan@optimiscorp.com}
14
+ s.email = ["uchouhan@optimiscorp.com", "joshsmoore@gmail.com"]
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.md"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "Gemfile",
23
- "LICENSE",
24
- "README.md",
25
- "Rakefile",
26
- "VERSION",
27
- "configuration.rb.example",
28
- "lib/simple_auth.rb",
29
- "lib/simple_auth/api.rb",
30
- "lib/simple_auth/configuration_helper.rb",
31
- "simple-auth.gemspec",
32
- "spec/lib/simple_auth/api_spec.rb",
33
- "spec/lib/simple_auth/configuration_helper_spec.rb",
34
- "spec/spec_helper.rb",
35
- "spec/support/configuration.rb",
36
- "spec/support/mock_requests.rb",
37
- "spec/support/stubs.rb"
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "configuration.rb.example",
28
+ "lib/simple_auth.rb",
29
+ "lib/simple_auth/api.rb",
30
+ "lib/simple_auth/configuration_helper.rb",
31
+ "simple-auth.gemspec",
32
+ "spec/lib/simple_auth/api_spec.rb",
33
+ "spec/lib/simple_auth/configuration_helper_spec.rb",
34
+ "spec/spec_helper.rb",
35
+ "spec/support/configuration.rb",
36
+ "spec/support/mock_requests.rb",
37
+ "spec/support/stubs.rb"
38
38
  ]
39
39
  s.homepage = %q{http://github.com/uchouhan/simple-auth}
40
- s.rdoc_options = ["--charset=UTF-8"]
41
40
  s.require_paths = ["lib"]
42
41
  s.rubygems_version = %q{1.3.7}
43
42
  s.summary = %q{Simple shared authentication API}
44
43
  s.test_files = [
45
44
  "spec/lib/simple_auth/api_spec.rb",
46
- "spec/lib/simple_auth/configuration_helper_spec.rb",
47
- "spec/spec_helper.rb",
48
- "spec/support/configuration.rb",
49
- "spec/support/mock_requests.rb",
50
- "spec/support/stubs.rb"
45
+ "spec/lib/simple_auth/configuration_helper_spec.rb",
46
+ "spec/spec_helper.rb",
47
+ "spec/support/configuration.rb",
48
+ "spec/support/mock_requests.rb",
49
+ "spec/support/stubs.rb"
51
50
  ]
52
51
 
53
52
  if s.respond_to? :specification_version then
@@ -55,17 +54,32 @@ Gem::Specification.new do |s|
55
54
  s.specification_version = 3
56
55
 
57
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ s.add_runtime_dependency(%q<rest-client>, [">= 0"])
58
+ s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
59
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
60
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
61
+ s.add_runtime_dependency(%q<yard>, [">= 0"])
58
62
  s.add_development_dependency(%q<rspec>, [">= 0"])
59
63
  s.add_development_dependency(%q<yard>, [">= 0"])
60
64
  s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
61
65
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
62
66
  else
67
+ s.add_dependency(%q<rest-client>, [">= 0"])
68
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
69
+ s.add_dependency(%q<rake>, [">= 0"])
70
+ s.add_dependency(%q<jeweler>, [">= 0"])
71
+ s.add_dependency(%q<yard>, [">= 0"])
63
72
  s.add_dependency(%q<rspec>, [">= 0"])
64
73
  s.add_dependency(%q<yard>, [">= 0"])
65
74
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
66
75
  s.add_dependency(%q<rest-client>, [">= 0"])
67
76
  end
68
77
  else
78
+ s.add_dependency(%q<rest-client>, [">= 0"])
79
+ s.add_dependency(%q<yajl-ruby>, [">= 0"])
80
+ s.add_dependency(%q<rake>, [">= 0"])
81
+ s.add_dependency(%q<jeweler>, [">= 0"])
82
+ s.add_dependency(%q<yard>, [">= 0"])
69
83
  s.add_dependency(%q<rspec>, [">= 0"])
70
84
  s.add_dependency(%q<yard>, [">= 0"])
71
85
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
@@ -1,12 +1,41 @@
1
1
  require 'spec/spec_helper'
2
2
 
3
- class ApplicationController < ActionController::Base; end
3
+ class ApplicationController < ActionController::Base;
4
+ end
4
5
 
5
6
  describe ApplicationController do
6
7
  context '#api' do
8
+ after :each do
9
+ SimpleAuth.configure do
10
+ host do
11
+ test 'test.domain.local'
12
+ end
13
+ end
14
+ end
7
15
  it 'should initialize the api path from the settings' do
8
16
  subject.api_host.should == 'http://test.domain.local'
9
17
  end
18
+
19
+
20
+ it 'should not add the protocol if the http protocol is already added' do
21
+ SimpleAuth.configure do
22
+ host do
23
+ test 'http://test.domain.local'
24
+ end
25
+ end
26
+
27
+ subject.api_host.should == 'http://test.domain.local'
28
+ end
29
+
30
+ it 'should not add the protocol if the https protocol is already added' do
31
+ SimpleAuth.configure do
32
+ host do
33
+ test 'https://test.domain.local'
34
+ end
35
+ end
36
+
37
+ subject.api_host.should == 'https://test.domain.local'
38
+ end
10
39
  end
11
40
 
12
41
  context '#path' do
@@ -20,4 +49,30 @@ describe ApplicationController do
20
49
  subject.login_url.should == 'http://test.domain.local/login'
21
50
  end
22
51
  end
52
+
53
+ context '#configure_from_yml' do
54
+ before :each do
55
+ @yaml = "host :\n test : http://yaml.domain.local\npaths :\n my_path : mypath"
56
+ end
57
+
58
+ after :each do
59
+ SimpleAuth.configure do
60
+ host do
61
+ test 'https://test.domain.local'
62
+ end
63
+ end
64
+ end
65
+
66
+ it 'should load the host configuration from YAML' do
67
+ SimpleAuth.configure_from_yml YAML.load(@yaml)
68
+
69
+ subject.api_host.should == 'http://yaml.domain.local'
70
+ end
71
+
72
+ it 'should load paths from YAML' do
73
+ SimpleAuth.configure_from_yml YAML.load(@yaml)
74
+
75
+ subject.my_path_path.should == 'mypath'
76
+ end
77
+ end
23
78
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-auth
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 0.4.0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Umang Chouhan
@@ -15,13 +15,14 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-31 00:00:00 -07:00
18
+ date: 2010-12-27 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rspec
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ type: :runtime
24
+ name: rest-client
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
28
  - - ">="
@@ -30,12 +31,12 @@ dependencies:
30
31
  segments:
31
32
  - 0
32
33
  version: "0"
33
- type: :development
34
- version_requirements: *id001
34
+ requirement: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: yard
37
36
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
37
+ type: :runtime
38
+ name: yajl-ruby
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - ">="
@@ -44,12 +45,26 @@ dependencies:
44
45
  segments:
45
46
  - 0
46
47
  version: "0"
47
- type: :development
48
- version_requirements: *id002
48
+ requirement: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ prerelease: false
51
+ type: :runtime
52
+ name: rake
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirement: *id003
49
63
  - !ruby/object:Gem::Dependency
50
- name: yajl-ruby
51
64
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
65
+ type: :runtime
66
+ name: jeweler
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
53
68
  none: false
54
69
  requirements:
55
70
  - - ">="
@@ -58,12 +73,26 @@ dependencies:
58
73
  segments:
59
74
  - 0
60
75
  version: "0"
76
+ requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ prerelease: false
61
79
  type: :runtime
62
- version_requirements: *id003
80
+ name: yard
81
+ version_requirements: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ requirement: *id005
63
91
  - !ruby/object:Gem::Dependency
64
- name: rest-client
65
92
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
93
+ type: :development
94
+ name: rspec
95
+ version_requirements: &id006 !ruby/object:Gem::Requirement
67
96
  none: false
68
97
  requirements:
69
98
  - - ">="
@@ -72,10 +101,53 @@ dependencies:
72
101
  segments:
73
102
  - 0
74
103
  version: "0"
104
+ requirement: *id006
105
+ - !ruby/object:Gem::Dependency
106
+ prerelease: false
107
+ type: :development
108
+ name: yard
109
+ version_requirements: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ requirement: *id007
119
+ - !ruby/object:Gem::Dependency
120
+ prerelease: false
75
121
  type: :runtime
76
- version_requirements: *id004
122
+ name: yajl-ruby
123
+ version_requirements: &id008 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ requirement: *id008
133
+ - !ruby/object:Gem::Dependency
134
+ prerelease: false
135
+ type: :runtime
136
+ name: rest-client
137
+ version_requirements: &id009 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ hash: 3
143
+ segments:
144
+ - 0
145
+ version: "0"
146
+ requirement: *id009
77
147
  description: Provides a simple API to authenticate with a rails application
78
- email: uchouhan@optimiscorp.com
148
+ email:
149
+ - uchouhan@optimiscorp.com
150
+ - joshsmoore@gmail.com
79
151
  executables: []
80
152
 
81
153
  extensions: []
@@ -85,8 +157,8 @@ extra_rdoc_files:
85
157
  - README.md
86
158
  files:
87
159
  - .document
88
- - .gitignore
89
160
  - Gemfile
161
+ - Gemfile.lock
90
162
  - LICENSE
91
163
  - README.md
92
164
  - Rakefile
@@ -107,8 +179,8 @@ homepage: http://github.com/uchouhan/simple-auth
107
179
  licenses: []
108
180
 
109
181
  post_install_message:
110
- rdoc_options:
111
- - --charset=UTF-8
182
+ rdoc_options: []
183
+
112
184
  require_paths:
113
185
  - lib
114
186
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,28 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
22
- spec/spec.opts
23
- .bundle
24
- spec/support/test.configuration.rb
25
-
26
- .rvmrc
27
- .rspec
28
- specs.watchr.rb