RubyApp 0.6.69 → 0.6.70
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/lib/ruby_app/application.rb +3 -1
- data/lib/ruby_app/elements/mobile/documents/authentication/facebook/authentication_document.rb +5 -5
- data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb +3 -3
- data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/git_hub_authentication_document.rb +1 -1
- data/lib/ruby_app/elements/mobile/documents/authentication/open_id/authentication_document.rb +2 -2
- data/lib/ruby_app/rack/route.rb +0 -2
- data/lib/ruby_app/response.rb +2 -2
- data/lib/ruby_app/version.rb +1 -1
- metadata +4 -4
data/Rakefile
CHANGED
@@ -77,7 +77,7 @@ namespace :ruby_app do
|
|
77
77
|
system('find . | grep \'\\.cache\'')
|
78
78
|
end
|
79
79
|
|
80
|
-
desc '
|
80
|
+
desc 'Delete all cached files'
|
81
81
|
task :destroy do
|
82
82
|
puts 'Removing cached files ...'
|
83
83
|
system('find . -name \'.cache\' | xargs rm -rv')
|
@@ -85,4 +85,5 @@ namespace :ruby_app do
|
|
85
85
|
|
86
86
|
end
|
87
87
|
|
88
|
+
|
88
89
|
end
|
data/lib/ruby_app/application.rb
CHANGED
@@ -19,7 +19,9 @@ module RubyApp
|
|
19
19
|
|
20
20
|
@environment = {}
|
21
21
|
|
22
|
-
RubyApp::Log.
|
22
|
+
RubyApp::Log.info("LOG RubyApp::Application.root = #{RubyApp::Application.root.inspect}")
|
23
|
+
RubyApp::Log.info("LOG RubyApp::Response.configuration.cache.read? = #{RubyApp::Response.configuration.cache.read?}")
|
24
|
+
RubyApp::Log.info("LOG RubyApp::Response.configuration.cache.write? = #{RubyApp::Response.configuration.cache.write?}")
|
23
25
|
|
24
26
|
end
|
25
27
|
|
data/lib/ruby_app/elements/mobile/documents/authentication/facebook/authentication_document.rb
CHANGED
@@ -26,19 +26,19 @@ module RubyApp
|
|
26
26
|
|
27
27
|
self.page.loaded do |element, event|
|
28
28
|
unless @authentication
|
29
|
-
RubyApp::Log.debug("FACEBOOK permissions=#{permissions.inspect}")
|
29
|
+
# RubyApp::Log.debug("FACEBOOK permissions=#{permissions.inspect}")
|
30
30
|
@authentication = ::Koala::Facebook::OAuth.new(ENV['FACEBOOK_ACCESS_KEY'] || RubyApp::Elements::Mobile::Documents::Authentication::Facebook::AuthenticationDocument.configuration.access_key,
|
31
31
|
ENV['FACEBOOK_SECRET_KEY'] || RubyApp::Elements::Mobile::Documents::Authentication::Facebook::AuthenticationDocument.configuration.secret_key,
|
32
32
|
RubyApp::Request.environment[RubyApp::Elements::Mobile::Documents::Authentication::AuthenticationDocument.configuration.return_to])
|
33
33
|
url = @authentication.url_for_oauth_code(:display => 'touch',
|
34
34
|
:permissions => permissions.is_a?(Array) ? permissions.join(',') : permissions)
|
35
|
-
RubyApp::Log.
|
35
|
+
RubyApp::Log.info("FACEBOOK --> #{url.inspect}")
|
36
36
|
event.go(url)
|
37
37
|
else
|
38
|
-
RubyApp::Log.
|
38
|
+
RubyApp::Log.info("FACEBOOK <-- #{RubyApp::Request.url.inspect}")
|
39
39
|
code = RubyApp::Request.query['code']
|
40
40
|
token = @authentication.get_access_token(code)
|
41
|
-
RubyApp::Log.debug("FACEBOOK token=#{token.inspect}")
|
41
|
+
# RubyApp::Log.debug("FACEBOOK token=#{token.inspect}")
|
42
42
|
self.process_token(token)
|
43
43
|
self.hide(event)
|
44
44
|
end
|
@@ -49,7 +49,7 @@ module RubyApp
|
|
49
49
|
def process_token(token)
|
50
50
|
graph = ::Koala::Facebook::API.new(token)
|
51
51
|
me = graph.get_object('me')
|
52
|
-
RubyApp::Log.debug("FACEBOOK me=#{me.inspect}")
|
52
|
+
# RubyApp::Log.debug("FACEBOOK me=#{me.inspect}")
|
53
53
|
RubyApp::Session.identity = self.create_identity_from_me(me)
|
54
54
|
end
|
55
55
|
|
data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb
CHANGED
@@ -31,13 +31,13 @@ module RubyApp
|
|
31
31
|
@client = ::OAuth2::Client.new(access_key, secret_key, options)
|
32
32
|
url = @client.auth_code.authorize_url(:redirect_uri => RubyApp::Request.environment[RubyApp::Elements::Mobile::Documents::Authentication::AuthenticationDocument.configuration.return_to],
|
33
33
|
:scope => scopes.is_a?(Array) ? scopes.join(',') : scopes)
|
34
|
-
RubyApp::Log.
|
34
|
+
RubyApp::Log.info("OAUTH --> #{url.inspect}")
|
35
35
|
event.go(url)
|
36
36
|
else
|
37
|
-
RubyApp::Log.
|
37
|
+
RubyApp::Log.info("OAUTH <-- #{RubyApp::Request.url.inspect}")
|
38
38
|
code = RubyApp::Request.query['code']
|
39
39
|
access_token = @client.auth_code.get_token(code, :redirect_uri => RubyApp::Request.url)
|
40
|
-
RubyApp::Log.debug("OAUTH token=#{access_token.token.inspect}")
|
40
|
+
# RubyApp::Log.debug("OAUTH token=#{access_token.token.inspect}")
|
41
41
|
self.process_token(access_token)
|
42
42
|
self.hide(event)
|
43
43
|
end
|
data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/git_hub_authentication_document.rb
CHANGED
@@ -28,7 +28,7 @@ module RubyApp
|
|
28
28
|
|
29
29
|
def create_identity_from_token(token)
|
30
30
|
user = JSON.parse(token.get('/user').body)
|
31
|
-
RubyApp::Log.debug("GITHUB user=#{user.inspect}")
|
31
|
+
# RubyApp::Log.debug("GITHUB user=#{user.inspect}")
|
32
32
|
return self.create_identity_from_email(user['email'])
|
33
33
|
end
|
34
34
|
|
data/lib/ruby_app/elements/mobile/documents/authentication/open_id/authentication_document.rb
CHANGED
@@ -31,10 +31,10 @@ module RubyApp
|
|
31
31
|
self.process_request(request)
|
32
32
|
url = request.redirect_url(RubyApp::Request.environment[RubyApp::Elements::Mobile::Documents::Authentication::AuthenticationDocument.configuration.return_to],
|
33
33
|
RubyApp::Request.environment[RubyApp::Elements::Mobile::Documents::Authentication::AuthenticationDocument.configuration.return_to])
|
34
|
-
RubyApp::Log.
|
34
|
+
RubyApp::Log.info("OPENID --> #{url.inspect}")
|
35
35
|
event.go(url)
|
36
36
|
else
|
37
|
-
RubyApp::Log.
|
37
|
+
RubyApp::Log.info("OPENID <-- #{RubyApp::Request.url.inspect}")
|
38
38
|
response = @consumer.complete(RubyApp::Request.query,
|
39
39
|
RubyApp::Request.environment[RubyApp::Elements::Mobile::Documents::Authentication::AuthenticationDocument.configuration.return_to])
|
40
40
|
case response.status
|
data/lib/ruby_app/rack/route.rb
CHANGED
@@ -36,7 +36,6 @@ module RubyApp
|
|
36
36
|
end
|
37
37
|
|
38
38
|
route(RubyApp::Mixins::RouteMixin::GET, /\/elements\/([^\.]+)\.([^\.\?]+)/) do |method, path, element_id, format|
|
39
|
-
#RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} --> #{method} #{path} #{element_id} #{format}")
|
40
39
|
begin
|
41
40
|
element = RubyApp::Element.get_element(element_id)
|
42
41
|
RubyApp::Log.duration(RubyApp::Log::INFO, "GET #{element.class} #{format}") do
|
@@ -47,7 +46,6 @@ module RubyApp
|
|
47
46
|
RubyApp::Log.exception(RubyApp::Log::ERROR, exception)
|
48
47
|
raise
|
49
48
|
end
|
50
|
-
#RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} <-- #{method} #{path} #{element_id} #{format}")
|
51
49
|
end
|
52
50
|
|
53
51
|
route(RubyApp::Mixins::RouteMixin::GET, /\.([^\.\?]+)/) do |method, path, format|
|
data/lib/ruby_app/response.rb
CHANGED
@@ -34,13 +34,13 @@ module RubyApp
|
|
34
34
|
if RubyApp::Response.configuration.cache.formats.include?(format)
|
35
35
|
cache = element.get_cache(format)
|
36
36
|
if RubyApp::Response.configuration.cache.read? && File.exists?(cache)
|
37
|
-
|
37
|
+
RubyApp::Log.info("READ #{cache.inspect}")
|
38
38
|
self.write(File.read(cache))
|
39
39
|
else
|
40
40
|
content = element.render(format)
|
41
41
|
if RubyApp::Response.configuration.cache.write? && !File.exists?(cache)
|
42
42
|
FileUtils.mkdir_p(File.dirname(cache))
|
43
|
-
|
43
|
+
RubyApp::Log.info("WRITE #{cache.inspect}")
|
44
44
|
File.open(cache, 'w') do |file|
|
45
45
|
file.write(content)
|
46
46
|
file.flush
|
data/lib/ruby_app/version.rb
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: 139
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 70
|
10
|
+
version: 0.6.70
|
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: 2013-02-
|
18
|
+
date: 2013-02-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|