RubyApp 0.6.60 → 0.6.61

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.
Files changed (38) hide show
  1. data/Rakefile +1 -1
  2. data/bin/console.rb +5 -0
  3. data/lib/ruby_app/configuration.ru +14 -3
  4. data/lib/ruby_app/configuration.yml +2 -0
  5. data/lib/ruby_app/elements/mobile/default/features/default_page.css.haml +1 -0
  6. data/lib/ruby_app/elements/mobile/default/features/default_page.html.haml +2 -0
  7. data/lib/ruby_app/elements/mobile/default/features/default_page.js.haml +1 -0
  8. data/lib/ruby_app/elements/mobile/default/features/default_page.rb +4 -0
  9. data/lib/ruby_app/elements/mobile/default/features/language_page.css.haml +2 -0
  10. data/lib/ruby_app/elements/mobile/default/features/language_page.html.haml +9 -0
  11. data/lib/ruby_app/elements/mobile/default/features/language_page.js.haml +2 -0
  12. data/lib/ruby_app/elements/mobile/default/features/language_page.rb +34 -0
  13. data/lib/ruby_app/elements/mobile/document.html.haml +6 -2
  14. data/lib/ruby_app/elements/mobile/document.js.haml +5 -2
  15. data/lib/ruby_app/elements/mobile/document.rb +9 -9
  16. data/lib/ruby_app/elements/mobile/documents/authentication/o_auth/authentication_document.rb +2 -2
  17. data/lib/ruby_app/elements/mobile/documents/mail_document.html.haml +2 -1
  18. data/lib/ruby_app/elements/mobile/documents/quit_document.html.haml +2 -2
  19. data/lib/ruby_app/elements/mobile/platforms/ios/document.rb +2 -2
  20. data/lib/ruby_app/mixins.rb +1 -0
  21. data/lib/ruby_app/mixins/object_extension.rb +19 -0
  22. data/lib/ruby_app/rack/language.rb +1 -1
  23. data/lib/ruby_app/rack/request.rb +10 -8
  24. data/lib/ruby_app/rack/route.rb +3 -2
  25. data/lib/ruby_app/request.rb +6 -6
  26. data/lib/ruby_app/scripts/elements/authentications/facebook.rb +1 -1
  27. data/lib/ruby_app/scripts/elements/language.rb +12 -0
  28. data/lib/ruby_app/scripts/elements/message.rb +1 -1
  29. data/lib/ruby_app/scripts/phantom.js +1 -1
  30. data/lib/ruby_app/scripts/standard.rb +1 -0
  31. data/lib/ruby_app/session.rb +1 -1
  32. data/lib/ruby_app/templates/application/Gemfile +0 -1
  33. data/lib/ruby_app/templates/application/configuration.ru +7 -5
  34. data/lib/ruby_app/templates/application/configuration.yml +33 -17
  35. data/lib/ruby_app/translations/en.yml +4 -0
  36. data/lib/ruby_app/translations/fr.yml +40 -0
  37. data/lib/ruby_app/version.rb +10 -1
  38. metadata +11 -4
data/Rakefile CHANGED
@@ -56,7 +56,7 @@ namespace :ruby_app do
56
56
 
57
57
  desc 'Run the test script on the local environment'
58
58
  task :local do |task|
59
- Rake::Task['ruby_app:test:url'].invoke('http://localhost:8000')
59
+ Rake::Task['ruby_app:test:url'].invoke('http://localhost:8000/root')
60
60
  end
61
61
 
62
62
  end
data/bin/console.rb CHANGED
@@ -3,9 +3,14 @@ require 'bundler/setup'
3
3
 
4
4
  require 'ruby_app'
5
5
 
6
+ # Placeholder for template application LOAD_PATH.unshift ...
7
+
8
+ # Placeholder for template application require
9
+
6
10
  puts "Running #{__FILE__.inspect}"
7
11
 
8
12
  RubyApp::Configuration.load!([File.join(RubyApp::ROOT, %w[configuration.yml])])
13
+ # Placeholder for template application configuration
9
14
  RubyApp::Log.open!
10
15
  RubyApp::Application.create!
11
16
 
@@ -1,4 +1,6 @@
1
1
  #\ --port 8000 --pid ./rack.pid
2
+ # Placeholder for template application LOAD_PATH.unshift ...
3
+
2
4
  require 'rubygems'
3
5
  require 'bundler/setup'
4
6
 
@@ -7,6 +9,10 @@ require 'rack'
7
9
  require 'ruby_app'
8
10
  require 'ruby_app/rack'
9
11
 
12
+ # Placeholder for template application require
13
+
14
+ RubyApp.root = '/ruby_app'
15
+
10
16
  use Rack::ShowExceptions
11
17
  use Rack::Reloader
12
18
 
@@ -14,16 +20,21 @@ use Rack::Reloader
14
20
  #use RubyApp::Rack::Memory
15
21
 
16
22
  use RubyApp::Rack::Application, :configuration_paths => [File.join(RubyApp::ROOT, %w[configuration.yml])]
23
+ # Placeholder for template application configuration path
17
24
 
18
- map '/ruby_app/resources' do
25
+ map "#{RubyApp.root.nil_if('/')}/ruby_app/resources" do
19
26
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
20
27
  end
21
28
 
22
- map '/favicon.ico' do
29
+ # Placeholder for template application resources
30
+
31
+
32
+
33
+ map "#{RubyApp.root.nil_if('/')}/favicon.ico" do
23
34
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
24
35
  end
25
36
 
26
- map '/' do
37
+ map "#{RubyApp.root.nil_if('/')}/" do
27
38
  use RubyApp::Rack::Request
28
39
  use RubyApp::Rack::Response
29
40
  use RubyApp::Rack::Language
@@ -37,6 +37,7 @@ default:
37
37
  default: 'en'
38
38
  paths:
39
39
  - '#{RubyApp::ROOT}/translations'
40
+
40
41
  log: &default_ruby_app_log
41
42
  path: '#{RubyApp::ROOT}/process/log/application.log'
42
43
  response: &response
@@ -59,3 +60,4 @@ default:
59
60
  scripts:
60
61
  enabled: true
61
62
  path: '#{RubyApp::ROOT}/scripts'
63
+
@@ -3,6 +3,7 @@
3
3
  = RubyApp::Elements::Mobile::Default::Features::Calendars::DefaultPage.render(:css)
4
4
  = RubyApp::Elements::Mobile::Default::Features::DialogsPage.render(:css)
5
5
  = RubyApp::Elements::Mobile::Default::Features::InputsPage.render(:css)
6
+ = RubyApp::Elements::Mobile::Default::Features::LanguagePage.render(:css)
6
7
  = RubyApp::Elements::Mobile::Default::Features::ListsPage.render(:css)
7
8
  = RubyApp::Elements::Mobile::Default::Features::MessagePage.render(:css)
8
9
  = RubyApp::Elements::Mobile::Default::Features::Navigation::DefaultPage.render(:css)
@@ -19,6 +19,8 @@
19
19
  - element.content_for(:html, :link, 'Document')
20
20
  = @inputs_link.render(:html) do |element|
21
21
  - element.content_for(:html, :link, 'Inputs')
22
+ = @language_link.render(:html) do |element|
23
+ - element.content_for(:html, :link, 'Language')
22
24
  = @lists_link.render(:html) do |element|
23
25
  - element.content_for(:html, :link, 'Lists')
24
26
  = @message_link.render(:html) do |element|
@@ -3,6 +3,7 @@
3
3
  = RubyApp::Elements::Mobile::Default::Features::Calendars::DefaultPage.render(:js)
4
4
  = RubyApp::Elements::Mobile::Default::Features::DialogsPage.render(:js)
5
5
  = RubyApp::Elements::Mobile::Default::Features::InputsPage.render(:js)
6
+ = RubyApp::Elements::Mobile::Default::Features::LanguagePage.render(:js)
6
7
  = RubyApp::Elements::Mobile::Default::Features::ListsPage.render(:js)
7
8
  = RubyApp::Elements::Mobile::Default::Features::MessagePage.render(:js)
8
9
  = RubyApp::Elements::Mobile::Default::Features::Navigation::DefaultPage.render(:js)
@@ -13,6 +13,7 @@ module RubyApp
13
13
  require 'ruby_app/elements/mobile/default/features/dialogs_page'
14
14
  require 'ruby_app/elements/mobile/default/features/document_document'
15
15
  require 'ruby_app/elements/mobile/default/features/inputs_page'
16
+ require 'ruby_app/elements/mobile/default/features/language_page'
16
17
  require 'ruby_app/elements/mobile/default/features/lists_page'
17
18
  require 'ruby_app/elements/mobile/default/features/message_page'
18
19
  require 'ruby_app/elements/mobile/default/features/navigation/default_page'
@@ -53,6 +54,9 @@ module RubyApp
53
54
  @inputs_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
54
55
  @inputs_link.page = RubyApp::Elements::Mobile::Default::Features::InputsPage
55
56
 
57
+ @language_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
58
+ @language_link.page = RubyApp::Elements::Mobile::Default::Features::LanguagePage
59
+
56
60
  @lists_link = RubyApp::Elements::Mobile::Navigation::PageButton.new
57
61
  @lists_link.page = RubyApp::Elements::Mobile::Default::Features::ListsPage
58
62
 
@@ -0,0 +1,2 @@
1
+ = RubyApp::Elements::Mobile::Navigation::BackButton.render(:css)
2
+ = yield
@@ -0,0 +1,9 @@
1
+ - self.content_for(:html, :page) do
2
+ /
3
+ #{__FILE__}
4
+ %div{'data-role' => 'header'}
5
+ = @back_button.render(:html)
6
+ %h1
7
+ Language
8
+ %div{'data-role' => 'content'}
9
+ = RubyApp::Elements::Mobile::Default::Features::LanguagePage.translate.content
@@ -0,0 +1,2 @@
1
+ = RubyApp::Elements::Mobile::Navigation::BackButton.render(:js)
2
+ = yield
@@ -0,0 +1,34 @@
1
+ module RubyApp
2
+
3
+ module Elements
4
+
5
+ module Mobile
6
+
7
+ module Default
8
+
9
+ module Features
10
+ require 'ruby_app/elements/mobile/navigation/back_button'
11
+ require 'ruby_app/elements/mobile/page'
12
+
13
+ class LanguagePage < RubyApp::Elements::Mobile::Page
14
+
15
+ template_path(:all, File.dirname(__FILE__))
16
+
17
+ def initialize
18
+ super
19
+
20
+ @back_button = RubyApp::Elements::Mobile::Navigation::BackButton.new
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -3,6 +3,8 @@
3
3
  #{__FILE__}
4
4
  %html{self.attributes}
5
5
  %head
6
+ %meta{'charset' => 'UTF-8'}
7
+
6
8
  - self.metadata.each do |name, value|
7
9
  %meta{'name' => name,
8
10
  'content' => value}
@@ -13,11 +15,13 @@
13
15
  %link{'rel' => 'stylesheet',
14
16
  'href' => stylesheet}
15
17
  %link{'rel' => 'stylesheet',
16
- 'href' => "/#{RubyApp::Language.locale.code}/document.css"}
18
+ 'href' => "#{RubyApp.root.nil_if('/')}/#{RubyApp::Language.locale.code}/document.css"}
17
19
  - self.scripts.each do |script|
18
20
  %script{'src' => script}
19
- %script{'src' => "/#{RubyApp::Language.locale.code}/document.js"}
21
+ %script{'src' => "#{RubyApp.root.nil_if('/')}/#{RubyApp::Language.locale.code}/document.js"}
20
22
 
23
+ %meta{'name' => 'root',
24
+ 'content' => RubyApp.root}
21
25
  %meta{'name' => 'session',
22
26
  'content' => RubyApp::Session.session_id}
23
27
  %meta{'name' => 'locale',
@@ -1,5 +1,8 @@
1
1
  :plain
2
2
  // #{__FILE__}
3
+ String.prototype.blank_if = function(value) {
4
+ return this == value ? '' : this;
5
+ };
3
6
  var RubyApp = new function() {
4
7
  var queue = [];
5
8
  this.enQueue = function(_function) {
@@ -78,7 +81,7 @@
78
81
  RubyApp.enQueue ( function() {
79
82
  RubyApp.showWait();
80
83
  RubyApp.log('DEQUEUE RubyApp.showPage("' + id + '", ...)');
81
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
84
+ request = $.ajax({type:'GET', url:RubyApp.getData('root', '/').blank_if('/') + '/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
82
85
  request
83
86
  .success( function(content) {
84
87
  $('body').prepend(content);
@@ -104,7 +107,7 @@
104
107
  RubyApp.enQueue ( function() {
105
108
  RubyApp.showWait();
106
109
  RubyApp.log('DEQUEUE RubyApp.updateElement("' + id + '")');
107
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
110
+ request = $.ajax({type:'GET', url:RubyApp.getData('root', '/').blank_if('/') + '/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
108
111
  request
109
112
  .success( function(content) {
110
113
  $('#' + id).prev('form.ui-listview-filter').remove();
@@ -43,14 +43,14 @@ module RubyApp
43
43
 
44
44
  @metadata.merge!('viewport' => 'width=device-width, initial-scale=1')
45
45
 
46
- @stylesheets.push('/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css')
46
+ @stylesheets.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css")
47
47
 
48
- @scripts.push('/ruby_app/resources/elements/mobile/document/jquery-1.8.3.min.js')
49
- @scripts.push('/ruby_app/resources/elements/mobile/document/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js')
50
- @scripts.push('/ruby_app/resources/elements/mobile/document/jquery.ui.touch-punch-0.2.2.min.js')
51
- @scripts.push('/ruby_app/resources/elements/mobile/document/fastclick-0.5.6.js')
52
- @scripts.push('/ruby_app/resources/elements/mobile/document/document.js')
53
- @scripts.push('/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js')
48
+ @scripts.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/jquery-1.8.3.min.js")
49
+ @scripts.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js")
50
+ @scripts.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/jquery.ui.touch-punch-0.2.2.min.js")
51
+ @scripts.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/fastclick-0.5.6.js")
52
+ @scripts.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/document.js")
53
+ @scripts.push("#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js")
54
54
 
55
55
  end
56
56
 
@@ -58,12 +58,12 @@ module RubyApp
58
58
  return @pages.last
59
59
  end
60
60
 
61
- def show(event, url = '/')
61
+ def show(event, url = RubyApp.root)
62
62
  RubyApp::Session.documents.push(self)
63
63
  event.go(url)
64
64
  end
65
65
 
66
- def hide(event, url = '/')
66
+ def hide(event, url = RubyApp.root)
67
67
  RubyApp::Session.documents.pop
68
68
  event.go(url)
69
69
  end
@@ -26,8 +26,8 @@ module RubyApp
26
26
 
27
27
  self.page.loaded do |element, event|
28
28
  unless @client
29
- RubyApp::Log.debug("OAUTH scopes=#{scopes.inspect}")
30
- RubyApp::Log.debug("OAUTH options=#{options.inspect}")
29
+ # RubyApp::Log.debug("OAUTH scopes=#{scopes.inspect}")
30
+ # RubyApp::Log.debug("OAUTH options=#{options.inspect}")
31
31
  @client = ::OAuth2::Client.new(access_key, secret_key, options)
32
32
  url = @client.auth_code.authorize_url(:redirect_uri => RubyApp::Request.url,
33
33
  :scope => scopes.is_a?(Array) ? scopes.join(',') : scopes)
@@ -3,7 +3,8 @@
3
3
  #{__FILE__}
4
4
  %html{self.attributes}
5
5
  %head
6
- %style{:type => 'text/css'}
6
+ %meta{'charset' => 'UTF-8'}
7
+ %style{:type => 'text/css'}
7
8
  = self.render(:css)
8
9
  = yield :head
9
10
  %body
@@ -3,7 +3,7 @@
3
3
  #{__FILE__}
4
4
  %html{self.attributes}
5
5
  %head
6
+ %meta{'charset' => 'UTF-8'}
6
7
  %script
7
8
  :plain
8
- // #{__FILE__}
9
- location.assign('/');
9
+ location.replace('#{RubyApp.root}');
@@ -18,8 +18,8 @@ module RubyApp
18
18
 
19
19
  self.metadata.merge!('apple-mobile-web-app-capable' => 'yes',
20
20
  'apple-mobile-web-app-status-bar-style' => 'black')
21
- self.links.merge!('apple-touch-icon' => '/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-icon.png',
22
- 'apple-touch-startup-image' => '/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-startup-image.png')
21
+ self.links.merge!('apple-touch-icon' => "#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-icon.png",
22
+ 'apple-touch-startup-image' => "#{RubyApp.root.nil_if('/')}/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-startup-image.png")
23
23
 
24
24
  end
25
25
 
@@ -1,5 +1,6 @@
1
1
  require 'ruby_app/mixins/array_extension'
2
2
  require 'ruby_app/mixins/class_extension'
3
+ require 'ruby_app/mixins/object_extension'
3
4
  require 'ruby_app/mixins/string_extension'
4
5
 
5
6
  require 'ruby_app/mixins/configuration_mixin'
@@ -0,0 +1,19 @@
1
+ module RubyApp
2
+
3
+ module Mixins
4
+
5
+ module ObjectExtension
6
+
7
+ def nil_if(value)
8
+ return self == value ? nil : self
9
+ end
10
+
11
+ end
12
+
13
+ end
14
+
15
+ end
16
+
17
+ class Object
18
+ include RubyApp::Mixins::ObjectExtension
19
+ end
@@ -12,7 +12,7 @@ module RubyApp
12
12
  def call(environment)
13
13
  RubyApp::Language.load!(RubyApp::Request.language)
14
14
  begin
15
- #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Language.locale.code=#{RubyApp::Language.locale.code.inspect}")
15
+ # RubyApp::Log.debug("LANGUAGE #{RubyApp::Language.locale.code}")
16
16
  return @application.call(environment)
17
17
  ensure
18
18
  RubyApp::Language.unload!
@@ -12,14 +12,16 @@ module RubyApp
12
12
  def call(environment)
13
13
  RubyApp::Request.create!(environment)
14
14
  begin
15
- #RubyApp::Request.environment.each do |name, value|
16
- # RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Request.environment[#{name.inspect}]=#{value.inspect}")
17
- #end
18
- #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Request.request_method=#{RubyApp::Request.request_method.inspect}")
19
- #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Request.path=#{RubyApp::Request.path.inspect}")
20
- #RubyApp::Request.query.each do |name, value|
21
- # RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Request.query[#{name.inspect}]=#{value.inspect}")
22
- #end
15
+ # RubyApp::Request.environment.each do |name, value|
16
+ # RubyApp::Log.debug("REQUEST RubyApp::Request.environment[#{name.inspect}]=#{value.inspect}")
17
+ # end
18
+ # RubyApp::Log.debug("REQUEST RubyApp::Request.path=#{RubyApp::Request.path.inspect}")
19
+ # RubyApp::Log.debug("REQUEST RubyApp::Request.language=#{RubyApp::Request.language.inspect}")
20
+ # RubyApp::Log.debug("REQUEST RubyApp::Request.url=#{RubyApp::Request.url.inspect}")
21
+ # RubyApp::Log.debug("REQUEST RubyApp::Request.query=#{RubyApp::Request.query.inspect}")
22
+ # RubyApp::Request.query.each do |name, value|
23
+ # RubyApp::Log.debug("REQUEST RubyApp::Request.query[#{name.inspect}]=#{value.inspect}")
24
+ # end
23
25
  return @application.call(environment)
24
26
  ensure
25
27
  RubyApp::Request.destroy!
@@ -14,7 +14,8 @@ module RubyApp
14
14
  extend RubyApp::Mixins::RouteMixin
15
15
 
16
16
  def call(environment)
17
- RubyApp::Rack::Route.do_route(RubyApp::Request.request_method, RubyApp::Request.path)
17
+ RubyApp::Log.debug("ROUTE #{RubyApp::Request.request_method} #{RubyApp::Request.path.gsub(/^#{RubyApp.root.nil_if('/')}/,'')}")
18
+ RubyApp::Rack::Route.do_route(RubyApp::Request.request_method, RubyApp::Request.path.gsub(/^#{RubyApp.root.nil_if('/')}/,''))
18
19
  end
19
20
 
20
21
  route(RubyApp::Mixins::RouteMixin::GET, /\/quit/) do |method, path|
@@ -63,7 +64,7 @@ module RubyApp
63
64
  end
64
65
 
65
66
  route(RubyApp::Mixins::RouteMixin::GET, /.*/) do |method, path|
66
- RubyApp::Rack::Route.do_route(RubyApp::Mixins::RouteMixin::GET, '/.html')
67
+ RubyApp::Rack::Route.do_route(RubyApp::Mixins::RouteMixin::GET, "/.html")
67
68
  end
68
69
 
69
70
  route(RubyApp::Mixins::RouteMixin::POST, /.*/) do |method, path|
@@ -12,20 +12,20 @@ module RubyApp
12
12
  attr_reader :environment
13
13
 
14
14
  def language
15
- self.fullpath =~ /^\/([^\/\?]+)/
15
+ self.path.gsub(/^#{RubyApp.root.nil_if('/')}/,'') =~ /^\/([^\/\?]+)/
16
16
  return $1
17
17
  end
18
18
 
19
19
  def query
20
- ::Rack::Utils.parse_query(self.query_string)
20
+ return ::Rack::Utils.parse_query(self.query_string)
21
21
  end
22
22
 
23
23
  def parameters
24
- self.params
24
+ return self.params
25
25
  end
26
26
 
27
27
  def self.get
28
- Thread.current[:_request]
28
+ return Thread.current[:_request]
29
29
  end
30
30
 
31
31
  def self.exists?
@@ -33,11 +33,11 @@ module RubyApp
33
33
  end
34
34
 
35
35
  def self.create!(environment = RubyApp::Application.environment)
36
- Thread.current[:_request] = RubyApp::Request.new(environment)
36
+ return Thread.current[:_request] = RubyApp::Request.new(environment)
37
37
  end
38
38
 
39
39
  def self.destroy!
40
- Thread.current[:_request] = nil
40
+ return Thread.current[:_request] = nil
41
41
  end
42
42
 
43
43
  def self.create_context!
@@ -1,6 +1,6 @@
1
1
  load_script! 'common/features/authentications'
2
2
 
3
- add_step! (RubyApp::Element::Event) { |event| event.go('/') }
3
+ add_step! (RubyApp::Element::Event) { |event| event.go(RubyApp.root) }
4
4
  add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent) { |event| event.assert_exists_link('Facebook') }
5
5
  add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('Facebook') }
6
6
  add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent)
@@ -0,0 +1,12 @@
1
+ load_script! 'common/features'
2
+
3
+ add_step! (RubyApp::Element::Event) { |event| event.assert_exists_link('Language') }
4
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('Language') }
5
+ add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.go("#{RubyApp.root}/en") }
6
+ add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent) { |event| event.assert_exists_link('Back') }
7
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.go("#{RubyApp.root}/fr") }
8
+ add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent) { |event| event.assert_exists_link('Reculer') }
9
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.go(RubyApp.root) }
10
+ add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent) { |event| event.click_link('Back') }
11
+ add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.click_link('Back') }
12
+ add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.execute {} }
@@ -1,6 +1,6 @@
1
1
  load_script! 'common/features'
2
2
 
3
- add_step! (RubyApp::Element::Event) { |event| event.assert_exists_link('Message') }
3
+ add_step! (RubyApp::Element::Event) { |event| event.assert_exists_link('Message') }
4
4
  add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('Message') }
5
5
  add_step! (RubyApp::Element::MessagedEvent) { |event| event.click_link('Back') }
6
6
  add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.click_link('Back') }
@@ -3,7 +3,7 @@ var arguments = system.args;
3
3
  console.log('MESSAGE Running test script on ' + arguments[1] + ' ...');
4
4
 
5
5
  var page = require('webpage').create();
6
- page.open(arguments[1] + '/?script=phantom');
6
+ page.open(arguments[1] + '?script=phantom');
7
7
 
8
8
  page.onConsoleMessage = function(message) {
9
9
  console.log('CONSOLE ' + message);
@@ -3,6 +3,7 @@ load_script! 'elements/buttons'
3
3
  load_script! 'elements/calendars/month'
4
4
  load_script! 'elements/dialogs'
5
5
  load_script! 'elements/inputs'
6
+ load_script! 'elements/language'
6
7
  load_script! 'elements/lists'
7
8
  load_script! 'elements/message'
8
9
  load_script! 'elements/navigation/navigation_list'
@@ -215,7 +215,7 @@ module RubyApp
215
215
  elsif _path =~ /\.rb/
216
216
  name = _path.gsub(String.interpolate { RubyApp::Session.configuration.scripts.path }, '').gsub(/^\//, '').gsub(/\.rb/, '')
217
217
  scripts.push({:name => name,
218
- :url => "/quit?go=#{CGI.escape("/?script=#{name}")}"})
218
+ :url => "#{RubyApp.root.nil_if('/')}/quit?go=#{CGI.escape("#{RubyApp.root}?script=#{name}")}"})
219
219
  end
220
220
  end
221
221
  end
@@ -1,4 +1,3 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- #gem 'RubyApp', :path => File.join(File.dirname(__FILE__), %w[.. gems ruby_app])
4
3
  gem 'RubyApp'
@@ -11,6 +11,8 @@ require 'ruby_app/rack'
11
11
 
12
12
  require '_APPLICATION_DOWNCODE_'
13
13
 
14
+ RubyApp.root = '/'
15
+
14
16
  use Rack::ShowExceptions
15
17
  use Rack::Reloader
16
18
 
@@ -20,19 +22,19 @@ use Rack::Reloader
20
22
  use RubyApp::Rack::Application, :configuration_paths => [ File.join(RubyApp::ROOT, %w[configuration.yml]),
21
23
  File.join(_APPLICATION_UPCODE_::ROOT, %w[configuration.yml])]
22
24
 
23
- map '/ruby_app/resources' do
25
+ map '#{RubyApp.root.nil_if('/')}/ruby_app/resources' do
24
26
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
25
27
  end
26
28
 
27
- map '/_APPLICATION_DOWNCODE_/resources' do
29
+ map '#{RubyApp.root.nil_if('/')}/_APPLICATION_DOWNCODE_/resources' do
28
30
  run Rack::File.new(File.join(_APPLICATION_UPCODE_::ROOT, %w[resources]))
29
31
  end
30
32
 
31
- map '/google_button.ico' do
32
- run Rack::File.new(File.join(RubyApp::ROOT, %w[resources google_button.ico]))
33
+ map '#{RubyApp.root.nil_if('/')}/favicon.ico' do
34
+ run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
33
35
  end
34
36
 
35
- map '/' do
37
+ map '#{RubyApp.root.nil_if('/')}/' do
36
38
  use RubyApp::Rack::Request
37
39
  use RubyApp::Rack::Response
38
40
  use RubyApp::Rack::Language
@@ -6,6 +6,33 @@ default:
6
6
  date:
7
7
  long: '%b %d %H:%M %Z'
8
8
  short: '%a %b %-d'
9
+ elements:
10
+ mobile:
11
+ documents:
12
+ authentication:
13
+ facebook:
14
+ authentication_document:
15
+ access_key: 'ABC'
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'
24
+ open_id:
25
+ ax_authentication_document:
26
+ attributes:
27
+ email: 'http://schema.openid.net/contact/email'
28
+ google_authentication_document:
29
+ identifier: 'https://www.google.com/accounts/o8/id'
30
+ my_open_id_authentication_document:
31
+ identifier: 'http://myopenid.com'
32
+ yahoo_authentication_document:
33
+ attributes:
34
+ email: 'http://axschema.org/contact/email'
35
+ identifier: 'https://www.yahoo.com'
9
36
  language:
10
37
  default: 'en'
11
38
  paths:
@@ -22,26 +49,15 @@ default:
22
49
  write?: false
23
50
  session:
24
51
  _class: '_APPLICATION_UPCODE_::Session'
25
- expires: 900
52
+ expires: 1200
26
53
  interval: 15
27
54
  _length: 10
55
+ log:
56
+ - 'REMOTE_ADDR'
57
+ - 'HTTP_X_FORWARDED_FOR'
58
+ - 'HTTP_REFERER'
59
+ - 'HTTP_USER_AGENT'
28
60
  scripts:
29
61
  enabled: false
30
62
  path: '#{_APPLICATION_UPCODE_::ROOT}/scripts'
31
- elements:
32
- mobile:
33
- documents:
34
- authentication:
35
- open_id:
36
- ax_authentication_document:
37
- attributes:
38
- email: 'http://schema.openid.net/contact/email'
39
- google_authentication_document:
40
- identifier: 'https://www.google.com/accounts/o8/id'
41
- my_open_id_authentication_document:
42
- identifier: 'http://myopenid.com'
43
- yahoo_authentication_document:
44
- attributes:
45
- email: 'http://axschema.org/contact/email'
46
- identifier: 'https://www.yahoo.com'
47
63
  _APPLICATION_DOWNCODE_:
@@ -5,6 +5,10 @@ ruby_app:
5
5
  message: "%1. The page will refresh so you can try again."
6
6
  elements:
7
7
  mobile:
8
+ default:
9
+ features:
10
+ language_page:
11
+ content: This is the page content in English.
8
12
  dialogs:
9
13
  calendars:
10
14
  month_dialog:
@@ -0,0 +1,40 @@
1
+ ---
2
+ ruby_app:
3
+ element:
4
+ exception_event:
5
+ message: "%1. La page sera actualisée afin que vous puissiez essayer de nouveau."
6
+ elements:
7
+ mobile:
8
+ default:
9
+ features:
10
+ language_page:
11
+ content: C'est le contenu de la page en français.
12
+ dialogs:
13
+ calendars:
14
+ month_dialog:
15
+ today: "Aujourd'hui"
16
+ acknowledgement_dialog:
17
+ ok: "OK"
18
+ confirmation_dialog:
19
+ _yes: "Oui"
20
+ _no: "Non"
21
+ exception_dialog:
22
+ ok: "OK"
23
+ document:
24
+ error_message: "Une erreur s'est produite échanger des données avec le serveur. La page sera actualisée afin que vous puissiez essayer de nouveau."
25
+ inputs:
26
+ toggle_input:
27
+ _on: "Actif"
28
+ _off: "Inactif"
29
+ navigation:
30
+ back_button:
31
+ back: "Reculer"
32
+ close_button:
33
+ close: "Fermer"
34
+ exceptions:
35
+ assert_failed_exception:
36
+ message: "Le %1 assertion a échoué"
37
+ element_invalid_exception:
38
+ message: "L'id de l'élément %1 est invalide ou a été recyclé"
39
+ session_invalid_exception:
40
+ message: "L'identifiant de session %1 est invalide ou a expiré"
@@ -1,4 +1,13 @@
1
1
  module RubyApp
2
- VERSION = "0.6.60"
2
+ VERSION = "0.6.61"
3
3
  ROOT = File.expand_path(File.dirname(__FILE__))
4
+
5
+ def self.root
6
+ @@_root ||= '/'
7
+ end
8
+
9
+ def self.root=(value)
10
+ @@_root = value
11
+ end
12
+
4
13
  end
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: 127
4
+ hash: 125
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 60
10
- version: 0.6.60
9
+ - 61
10
+ version: 0.6.61
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-13 00:00:00 Z
18
+ date: 2013-02-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -366,6 +366,10 @@ files:
366
366
  - lib/ruby_app/elements/mobile/default/features/inputs_page.html.haml
367
367
  - lib/ruby_app/elements/mobile/default/features/inputs_page.js.haml
368
368
  - lib/ruby_app/elements/mobile/default/features/inputs_page.rb
369
+ - lib/ruby_app/elements/mobile/default/features/language_page.css.haml
370
+ - lib/ruby_app/elements/mobile/default/features/language_page.html.haml
371
+ - lib/ruby_app/elements/mobile/default/features/language_page.js.haml
372
+ - lib/ruby_app/elements/mobile/default/features/language_page.rb
369
373
  - lib/ruby_app/elements/mobile/default/features/lists_page.css.haml
370
374
  - lib/ruby_app/elements/mobile/default/features/lists_page.html.haml
371
375
  - lib/ruby_app/elements/mobile/default/features/lists_page.js.haml
@@ -550,6 +554,7 @@ files:
550
554
  - lib/ruby_app/mixins/configuration_mixin.rb
551
555
  - lib/ruby_app/mixins/delegate_mixin.rb
552
556
  - lib/ruby_app/mixins/hash_mixin.rb
557
+ - lib/ruby_app/mixins/object_extension.rb
553
558
  - lib/ruby_app/mixins/render_mixin.rb
554
559
  - lib/ruby_app/mixins/route_mixin.rb
555
560
  - lib/ruby_app/mixins/string_extension.rb
@@ -1451,6 +1456,7 @@ files:
1451
1456
  - lib/ruby_app/scripts/elements/calendars/month.rb
1452
1457
  - lib/ruby_app/scripts/elements/dialogs.rb
1453
1458
  - lib/ruby_app/scripts/elements/inputs.rb
1459
+ - lib/ruby_app/scripts/elements/language.rb
1454
1460
  - lib/ruby_app/scripts/elements/lists.rb
1455
1461
  - lib/ruby_app/scripts/elements/message.rb
1456
1462
  - lib/ruby_app/scripts/elements/navigation/navigation_list.rb
@@ -1481,6 +1487,7 @@ files:
1481
1487
  - lib/ruby_app/templates/application/scripts/default.rb
1482
1488
  - lib/ruby_app/templates/application/translations/en.yml
1483
1489
  - lib/ruby_app/translations/en.yml
1490
+ - lib/ruby_app/translations/fr.yml
1484
1491
  - lib/ruby_app/version.rb
1485
1492
  - ruby_app.gemspec
1486
1493
  - ruby_app.sublime-project