RubyApp 0.6.31 → 0.6.32
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.
- data/lib/ruby_app/configuration.yml +7 -0
- data/lib/ruby_app/elements/mobile/buttons/git_hub_button.css.haml +5 -0
- data/lib/ruby_app/elements/mobile/buttons/git_hub_button.rb +27 -0
- data/lib/ruby_app/elements/mobile/default/features/authentications/default_page.css.haml +1 -0
- data/lib/ruby_app/elements/mobile/default/features/authentications/default_page.html.haml +2 -0
- data/lib/ruby_app/elements/mobile/default/features/authentications/default_page.js.haml +1 -0
- data/lib/ruby_app/elements/mobile/default/features/authentications/default_page.rb +8 -0
- data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb +68 -0
- data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/git_hub_authentication_document.rb +41 -0
- data/lib/ruby_app/resources/elements/mobile/buttons/git_hub_button.ico +0 -0
- data/lib/ruby_app/resources/elements/mobile/buttons/git_hub_button.png +0 -0
- data/lib/ruby_app/scripts/all_once.rb +1 -0
- data/lib/ruby_app/scripts/common/features/authentications.rb +6 -0
- data/lib/ruby_app/scripts/elements/authentications/o_auth/git_hub.rb +8 -0
- data/lib/ruby_app/version.rb +1 -1
- data/ruby_app.gemspec +1 -0
- metadata +36 -14
@@ -14,6 +14,13 @@ default:
|
|
14
14
|
authentication_document:
|
15
15
|
access_key: 'ABC'
|
16
16
|
secret_key: '123'
|
17
|
+
o_auth:
|
18
|
+
git_hub_authentication_document:
|
19
|
+
access_key: 'ABC'
|
20
|
+
secret_key: '123'
|
21
|
+
url: 'https://api.github.com'
|
22
|
+
authorize_url: 'https://github.com/login/oauth/authorize'
|
23
|
+
access_token_url: 'https://github.com/login/oauth/access_token'
|
17
24
|
open_id:
|
18
25
|
ax_authentication_document:
|
19
26
|
attributes:
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RubyApp
|
2
|
+
|
3
|
+
module Elements
|
4
|
+
|
5
|
+
module Mobile
|
6
|
+
|
7
|
+
module Buttons
|
8
|
+
require 'ruby_app/elements/mobile/button'
|
9
|
+
|
10
|
+
class GitHubButton < RubyApp::Elements::Mobile::Button
|
11
|
+
|
12
|
+
template_path(:all, File.dirname(__FILE__))
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
super
|
16
|
+
self.attributes.merge!('data-icon' => 'git-hub')
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
= RubyApp::Elements::Mobile::Buttons::FacebookButton.render(:css)
|
2
|
+
= RubyApp::Elements::Mobile::Buttons::GitHubButton.render(:css)
|
2
3
|
= RubyApp::Elements::Mobile::Buttons::GoogleButton.render(:css)
|
3
4
|
= RubyApp::Elements::Mobile::Buttons::MyOpenIDButton.render(:css)
|
4
5
|
= RubyApp::Elements::Mobile::Buttons::YahooButton.render(:css)
|
@@ -12,6 +12,8 @@
|
|
12
12
|
- else
|
13
13
|
You are not logged in.
|
14
14
|
%div{'data-role' => 'controlgroup'}
|
15
|
+
= @github_authentication_link.render(:html) do |element|
|
16
|
+
- element.content_for(:html, :link, 'GitHub')
|
15
17
|
= @facebook_authentication_link.render(:html) do |element|
|
16
18
|
- element.content_for(:html, :link, 'Facebook')
|
17
19
|
= @google_authentication_link.render(:html) do |element|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
= RubyApp::Elements::Mobile::Buttons::FacebookButton.render(:js)
|
2
|
+
= RubyApp::Elements::Mobile::Buttons::GitHubButton.render(:js)
|
2
3
|
= RubyApp::Elements::Mobile::Buttons::GoogleButton.render(:js)
|
3
4
|
= RubyApp::Elements::Mobile::Buttons::MyOpenIDButton.render(:js)
|
4
5
|
= RubyApp::Elements::Mobile::Buttons::YahooButton.render(:js)
|
@@ -11,10 +11,12 @@ module RubyApp
|
|
11
11
|
module Authentications
|
12
12
|
require 'ruby_app'
|
13
13
|
require 'ruby_app/elements/mobile/buttons/facebook_button'
|
14
|
+
require 'ruby_app/elements/mobile/buttons/git_hub_button'
|
14
15
|
require 'ruby_app/elements/mobile/buttons/google_button'
|
15
16
|
require 'ruby_app/elements/mobile/buttons/my_open_id_button'
|
16
17
|
require 'ruby_app/elements/mobile/buttons/yahoo_button'
|
17
18
|
require 'ruby_app/elements/mobile/documents/authentication/facebook/email_authentication_document'
|
19
|
+
require 'ruby_app/elements/mobile/documents/authentication/o_auth/git_hub_authentication_document'
|
18
20
|
require 'ruby_app/elements/mobile/documents/authentication/open_id/google_authentication_document'
|
19
21
|
require 'ruby_app/elements/mobile/documents/authentication/open_id/my_open_id_authentication_document'
|
20
22
|
require 'ruby_app/elements/mobile/documents/authentication/open_id/yahoo_authentication_document'
|
@@ -30,6 +32,12 @@ module RubyApp
|
|
30
32
|
|
31
33
|
@back_button = RubyApp::Elements::Mobile::Navigation::BackButton.new
|
32
34
|
|
35
|
+
@github_authentication_link = RubyApp::Elements::Mobile::Buttons::GitHubButton.new
|
36
|
+
@github_authentication_link.clicked do |element, event|
|
37
|
+
RubyApp::Session.documents.push(RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.new)
|
38
|
+
event.refresh_browser
|
39
|
+
end
|
40
|
+
|
33
41
|
@facebook_authentication_link = RubyApp::Elements::Mobile::Buttons::FacebookButton.new
|
34
42
|
@facebook_authentication_link.clicked do |element, event|
|
35
43
|
RubyApp::Session.documents.push(RubyApp::Elements::Mobile::Documents::Authentication::Facebook::EmailAuthenticationDocument.new)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'oauth2'
|
5
|
+
|
6
|
+
module RubyApp
|
7
|
+
|
8
|
+
module Elements
|
9
|
+
|
10
|
+
module Mobile
|
11
|
+
|
12
|
+
module Documents
|
13
|
+
|
14
|
+
module Authentication
|
15
|
+
|
16
|
+
module OAuth
|
17
|
+
require 'ruby_app'
|
18
|
+
require 'ruby_app/elements/mobile/document'
|
19
|
+
|
20
|
+
class AuthenticationDocument < RubyApp::Elements::Mobile::Document
|
21
|
+
|
22
|
+
template_path(:all, File.dirname(__FILE__))
|
23
|
+
|
24
|
+
def initialize(access_key, secret_key, scope, options)
|
25
|
+
super()
|
26
|
+
|
27
|
+
self.loaded do |element, event|
|
28
|
+
|
29
|
+
unless @client
|
30
|
+
RubyApp::Log.debug("OAUTH scope=#{scope.inspect}")
|
31
|
+
RubyApp::Log.debug("OAUTH options=#{options.inspect}")
|
32
|
+
@client = ::OAuth2::Client.new(access_key, secret_key, options)
|
33
|
+
url = @client.auth_code.authorize_url(:redirect_uri => RubyApp::Request.url,
|
34
|
+
:scope => scope.join(','))
|
35
|
+
RubyApp::Log.debug("OAUTH --> #{url.inspect}")
|
36
|
+
event.go(url)
|
37
|
+
else
|
38
|
+
RubyApp::Log.debug("OAUTH <-- #{RubyApp::Request.url.inspect}")
|
39
|
+
code = RubyApp::Request.query['code']
|
40
|
+
access_token = @client.auth_code.get_token(code, :redirect_uri => RubyApp::Request.url)
|
41
|
+
RubyApp::Log.debug("OAUTH token=#{access_token.token.inspect}")
|
42
|
+
user = JSON.parse(access_token.get('/user').body)
|
43
|
+
RubyApp::Log.debug("OAUTH user=#{user.inspect}")
|
44
|
+
RubyApp::Session.identity = self.create_identity_from_user(user)
|
45
|
+
RubyApp::Session.documents.pop
|
46
|
+
event.go('/')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def create_identity_from_user(user)
|
53
|
+
RubyApp::Session::Identity.new(user['email'])
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/git_hub_authentication_document.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
module RubyApp
|
2
|
+
|
3
|
+
module Elements
|
4
|
+
|
5
|
+
module Mobile
|
6
|
+
|
7
|
+
module Documents
|
8
|
+
|
9
|
+
module Authentication
|
10
|
+
|
11
|
+
module OAuth
|
12
|
+
require 'ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document'
|
13
|
+
|
14
|
+
class GitHubAuthenticationDocument < RubyApp::Elements::Mobile::Documents::Authentication::OAuth::AuthenticationDocument
|
15
|
+
|
16
|
+
template_path(:all, File.dirname(__FILE__))
|
17
|
+
|
18
|
+
def initialize(access_key = ENV['GITHUB_ACCESS_KEY'] || RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.configuration.access_key,
|
19
|
+
secret_key = ENV['GITHUB_SECRET_KEY'] || RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.configuration.secret_key,
|
20
|
+
scope = [],
|
21
|
+
options = {})
|
22
|
+
_scope = ['user'] + scope
|
23
|
+
_options = {:site => RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.configuration.url,
|
24
|
+
:authorize_url => RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.configuration.authorize_url,
|
25
|
+
:token_url => RubyApp::Elements::Mobile::Documents::Authentication::OAuth::GitHubAuthenticationDocument.configuration.access_token_url}.merge(options)
|
26
|
+
super(access_key, secret_key, _scope, _options)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,6 @@
|
|
1
|
+
load_script! 'common/features'
|
2
|
+
|
3
|
+
add_step! (RubyApp::Element::Event) { |event| event.assert_exists_link('Authentications') }
|
4
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('Authentications') }
|
5
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_exists_text('Authentications') }
|
6
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.execute {} }
|
@@ -0,0 +1,8 @@
|
|
1
|
+
load_script! 'common/features/authentications'
|
2
|
+
|
3
|
+
add_step! (RubyApp::Element::Event) { |event| event.assert_exists_link('GitHub') }
|
4
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('GitHub') }
|
5
|
+
add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent) { |event| event.assert_exists_text('You are logged in as') }
|
6
|
+
add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('Back') }
|
7
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.click_link('Back') }
|
8
|
+
add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.execute {} }
|
data/lib/ruby_app/version.rb
CHANGED
data/ruby_app.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RubyApp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 71
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 32
|
10
|
+
version: 0.6.32
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Frank G. Ficnar
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-10-
|
18
|
+
date: 2012-10-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -155,7 +155,7 @@ dependencies:
|
|
155
155
|
version: "0"
|
156
156
|
prerelease: false
|
157
157
|
type: :runtime
|
158
|
-
name:
|
158
|
+
name: oauth2
|
159
159
|
requirement: *id010
|
160
160
|
- !ruby/object:Gem::Dependency
|
161
161
|
version_requirements: &id011 !ruby/object:Gem::Requirement
|
@@ -169,7 +169,7 @@ dependencies:
|
|
169
169
|
version: "0"
|
170
170
|
prerelease: false
|
171
171
|
type: :runtime
|
172
|
-
name:
|
172
|
+
name: r18n-core
|
173
173
|
requirement: *id011
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
version_requirements: &id012 !ruby/object:Gem::Requirement
|
@@ -183,7 +183,7 @@ dependencies:
|
|
183
183
|
version: "0"
|
184
184
|
prerelease: false
|
185
185
|
type: :runtime
|
186
|
-
name:
|
186
|
+
name: rack
|
187
187
|
requirement: *id012
|
188
188
|
- !ruby/object:Gem::Dependency
|
189
189
|
version_requirements: &id013 !ruby/object:Gem::Requirement
|
@@ -197,7 +197,7 @@ dependencies:
|
|
197
197
|
version: "0"
|
198
198
|
prerelease: false
|
199
199
|
type: :runtime
|
200
|
-
name: ruby-
|
200
|
+
name: ruby-event
|
201
201
|
requirement: *id013
|
202
202
|
- !ruby/object:Gem::Dependency
|
203
203
|
version_requirements: &id014 !ruby/object:Gem::Requirement
|
@@ -211,7 +211,7 @@ dependencies:
|
|
211
211
|
version: "0"
|
212
212
|
prerelease: false
|
213
213
|
type: :runtime
|
214
|
-
name:
|
214
|
+
name: ruby-openid
|
215
215
|
requirement: *id014
|
216
216
|
- !ruby/object:Gem::Dependency
|
217
217
|
version_requirements: &id015 !ruby/object:Gem::Requirement
|
@@ -225,7 +225,7 @@ dependencies:
|
|
225
225
|
version: "0"
|
226
226
|
prerelease: false
|
227
227
|
type: :runtime
|
228
|
-
name:
|
228
|
+
name: sass
|
229
229
|
requirement: *id015
|
230
230
|
- !ruby/object:Gem::Dependency
|
231
231
|
version_requirements: &id016 !ruby/object:Gem::Requirement
|
@@ -239,7 +239,7 @@ dependencies:
|
|
239
239
|
version: "0"
|
240
240
|
prerelease: false
|
241
241
|
type: :runtime
|
242
|
-
name:
|
242
|
+
name: system_timer
|
243
243
|
requirement: *id016
|
244
244
|
- !ruby/object:Gem::Dependency
|
245
245
|
version_requirements: &id017 !ruby/object:Gem::Requirement
|
@@ -253,7 +253,7 @@ dependencies:
|
|
253
253
|
version: "0"
|
254
254
|
prerelease: false
|
255
255
|
type: :runtime
|
256
|
-
name:
|
256
|
+
name: term-ansicolor
|
257
257
|
requirement: *id017
|
258
258
|
- !ruby/object:Gem::Dependency
|
259
259
|
version_requirements: &id018 !ruby/object:Gem::Requirement
|
@@ -267,7 +267,7 @@ dependencies:
|
|
267
267
|
version: "0"
|
268
268
|
prerelease: false
|
269
269
|
type: :runtime
|
270
|
-
name:
|
270
|
+
name: terminal-table
|
271
271
|
requirement: *id018
|
272
272
|
- !ruby/object:Gem::Dependency
|
273
273
|
version_requirements: &id019 !ruby/object:Gem::Requirement
|
@@ -280,9 +280,23 @@ dependencies:
|
|
280
280
|
- 0
|
281
281
|
version: "0"
|
282
282
|
prerelease: false
|
283
|
+
type: :runtime
|
284
|
+
name: yajl-ruby
|
285
|
+
requirement: *id019
|
286
|
+
- !ruby/object:Gem::Dependency
|
287
|
+
version_requirements: &id020 !ruby/object:Gem::Requirement
|
288
|
+
none: false
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
hash: 3
|
293
|
+
segments:
|
294
|
+
- 0
|
295
|
+
version: "0"
|
296
|
+
prerelease: false
|
283
297
|
type: :development
|
284
298
|
name: rake
|
285
|
-
requirement: *
|
299
|
+
requirement: *id020
|
286
300
|
description: A mobile web application framework in Ruby
|
287
301
|
email:
|
288
302
|
- frank.ficnar@gmail.com
|
@@ -312,6 +326,8 @@ files:
|
|
312
326
|
- lib/ruby_app/elements/mobile/button.rb
|
313
327
|
- lib/ruby_app/elements/mobile/buttons/facebook_button.css.haml
|
314
328
|
- lib/ruby_app/elements/mobile/buttons/facebook_button.rb
|
329
|
+
- lib/ruby_app/elements/mobile/buttons/git_hub_button.css.haml
|
330
|
+
- lib/ruby_app/elements/mobile/buttons/git_hub_button.rb
|
315
331
|
- lib/ruby_app/elements/mobile/buttons/google_button.css.haml
|
316
332
|
- lib/ruby_app/elements/mobile/buttons/google_button.rb
|
317
333
|
- lib/ruby_app/elements/mobile/buttons/my_open_id_button.css.haml
|
@@ -411,6 +427,8 @@ files:
|
|
411
427
|
- lib/ruby_app/elements/mobile/document.rb
|
412
428
|
- lib/ruby_app/elements/mobile/documents/authentication/facebook/authentication_document.rb
|
413
429
|
- lib/ruby_app/elements/mobile/documents/authentication/facebook/email_authentication_document.rb
|
430
|
+
- lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb
|
431
|
+
- lib/ruby_app/elements/mobile/documents/authentication/o_auth/git_hub_authentication_document.rb
|
414
432
|
- lib/ruby_app/elements/mobile/documents/authentication/open_id/authentication_document.rb
|
415
433
|
- lib/ruby_app/elements/mobile/documents/authentication/open_id/ax_authentication_document.rb
|
416
434
|
- lib/ruby_app/elements/mobile/documents/authentication/open_id/email_authentication_document.rb
|
@@ -545,6 +563,8 @@ files:
|
|
545
563
|
- lib/ruby_app/request.rb
|
546
564
|
- lib/ruby_app/resources/elements/mobile/buttons/facebook_button.ico
|
547
565
|
- lib/ruby_app/resources/elements/mobile/buttons/facebook_button.png
|
566
|
+
- lib/ruby_app/resources/elements/mobile/buttons/git_hub_button.ico
|
567
|
+
- lib/ruby_app/resources/elements/mobile/buttons/git_hub_button.png
|
548
568
|
- lib/ruby_app/resources/elements/mobile/buttons/google_button.ico
|
549
569
|
- lib/ruby_app/resources/elements/mobile/buttons/google_button.png
|
550
570
|
- lib/ruby_app/resources/elements/mobile/buttons/my_open_id_button.ico
|
@@ -562,8 +582,10 @@ files:
|
|
562
582
|
- lib/ruby_app/scripts/all_continuous.rb
|
563
583
|
- lib/ruby_app/scripts/all_once.rb
|
564
584
|
- lib/ruby_app/scripts/common/features.rb
|
585
|
+
- lib/ruby_app/scripts/common/features/authentications.rb
|
565
586
|
- lib/ruby_app/scripts/common/reset.rb
|
566
587
|
- lib/ruby_app/scripts/default.rb
|
588
|
+
- lib/ruby_app/scripts/elements/authentications/o_auth/git_hub.rb
|
567
589
|
- lib/ruby_app/scripts/elements/buttons.rb
|
568
590
|
- lib/ruby_app/scripts/elements/calendars/month.rb
|
569
591
|
- lib/ruby_app/scripts/elements/dialogs.rb
|