RubyApp 0.6.66 → 0.6.67

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -47,16 +47,25 @@ namespace :ruby_app do
47
47
 
48
48
  end
49
49
 
50
- namespace :test do
50
+ namespace :script do
51
51
 
52
- desc 'Run the test script through PhantomJS on a given url'
53
- task :url, :url do |task, arguments|
54
- system("phantomjs lib/ruby_app/scripts/phantom.js #{arguments.url}")
52
+ desc 'Run a given script through PhantomJS on a given url'
53
+ task :run, :url, :script do |task, arguments|
54
+ system("phantomjs --ignore-ssl-errors=true lib/ruby_app/scripts/phantom/phantom.js #{arguments.url} #{arguments.script}")
55
55
  end
56
56
 
57
- desc 'Run the test script on the local environment'
58
- task :local do |task|
59
- Rake::Task['ruby_app:test:url'].invoke("http://localhost:8000/ruby_app")
57
+ namespace :standard_no_logon do
58
+
59
+ desc 'Run the script through PhantomJS on a given url'
60
+ task :run, :url do |task, arguments|
61
+ Rake::Task['ruby_app:script:run'].invoke(arguments.url, 'phantom/standard_no_logon')
62
+ end
63
+
64
+ desc 'Run the script on the local environment'
65
+ task :local do |task|
66
+ Rake::Task['ruby_app:script:standard_no_logon:run'].invoke('http://localhost:8000')
67
+ end
68
+
60
69
  end
61
70
 
62
71
  end
@@ -16,7 +16,23 @@ module RubyApp
16
16
  attr_reader :options, :environment
17
17
 
18
18
  def initialize
19
+
19
20
  @environment = {}
21
+
22
+ RubyApp::Log.debug("LOG RubyApp::Application.root = #{RubyApp::Application.root.inspect}")
23
+
24
+ end
25
+
26
+ def self.root
27
+ @@_root ||= '/'
28
+ end
29
+
30
+ def self.root=(value)
31
+ @@_root = value
32
+ end
33
+
34
+ def self.root_or_nil
35
+ return @@_root.nil_if('/')
20
36
  end
21
37
 
22
38
  def self.get
@@ -11,7 +11,7 @@ require 'ruby_app/rack'
11
11
 
12
12
  # Placeholder for template application require
13
13
 
14
- RubyApp.root = '/ruby_app'
14
+ RubyApp::Application.root = '/'
15
15
 
16
16
  use Rack::ShowExceptions
17
17
  use Rack::Reloader
@@ -22,7 +22,7 @@ use Rack::Reloader
22
22
  use RubyApp::Rack::Application, :configuration_paths => [File.join(RubyApp::ROOT, %w[configuration.yml])]
23
23
  # Placeholder for template application configuration path
24
24
 
25
- map "#{RubyApp.root_or_nil}/ruby_app/resources" do
25
+ map "#{RubyApp::Application.root_or_nil}/ruby_app/resources" do
26
26
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
27
27
  end
28
28
 
@@ -30,11 +30,11 @@ end
30
30
 
31
31
 
32
32
 
33
- map "#{RubyApp.root_or_nil}/favicon.ico" do
33
+ map "#{RubyApp::Application.root_or_nil}/favicon.ico" do
34
34
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
35
35
  end
36
36
 
37
- map "#{RubyApp.root_or_nil}/" do
37
+ map "#{RubyApp::Application.root_or_nil}/" do
38
38
  use RubyApp::Rack::Request
39
39
  use RubyApp::Rack::Response
40
40
  use RubyApp::Rack::Language
@@ -15,13 +15,13 @@
15
15
  %link{'rel' => 'stylesheet',
16
16
  'href' => stylesheet}
17
17
  %link{'rel' => 'stylesheet',
18
- 'href' => "#{RubyApp.root_or_nil}/#{RubyApp::Language.locale.code}/document.css"}
18
+ 'href' => "#{RubyApp::Application.root_or_nil}/#{RubyApp::Language.locale.code}/document.css"}
19
19
  - self.scripts.each do |script|
20
20
  %script{'src' => script}
21
- %script{'src' => "#{RubyApp.root_or_nil}/#{RubyApp::Language.locale.code}/document.js"}
21
+ %script{'src' => "#{RubyApp::Application.root_or_nil}/#{RubyApp::Language.locale.code}/document.js"}
22
22
 
23
23
  %meta{'name' => 'root',
24
- 'content' => RubyApp.root}
24
+ 'content' => RubyApp::Application.root}
25
25
  %meta{'name' => 'session',
26
26
  'content' => RubyApp::Session.session_id}
27
27
  %meta{'name' => 'locale',
@@ -43,14 +43,14 @@ module RubyApp
43
43
 
44
44
  @metadata.merge!('viewport' => 'width=device-width, initial-scale=1')
45
45
 
46
- @stylesheets.push("#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css")
46
+ @stylesheets.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.css")
47
47
 
48
- @scripts.push("#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery-1.8.3.min.js")
49
- @scripts.push("#{RubyApp.root_or_nil}/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_or_nil}/ruby_app/resources/elements/mobile/document/jquery.ui.touch-punch-0.2.2.min.js")
51
- @scripts.push("#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/document/fastclick-0.5.6.js")
52
- @scripts.push("#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/document/document.js")
53
- @scripts.push("#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery.mobile-1.1.0/jquery.mobile-1.1.0.min.js")
48
+ @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery-1.8.3.min.js")
49
+ @scripts.push("#{RubyApp::Application.root_or_nil}/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::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/jquery.ui.touch-punch-0.2.2.min.js")
51
+ @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/fastclick-0.5.6.js")
52
+ @scripts.push("#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/document/document.js")
53
+ @scripts.push("#{RubyApp::Application.root_or_nil}/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 = RubyApp.root)
61
+ def show(event, url = RubyApp::Application.root)
62
62
  RubyApp::Session.documents.push(self)
63
63
  event.go(url)
64
64
  end
65
65
 
66
- def hide(event, url = RubyApp.root)
66
+ def hide(event, url = RubyApp::Application.root)
67
67
  RubyApp::Session.documents.pop
68
68
  event.go(url)
69
69
  end
@@ -6,4 +6,4 @@
6
6
  %meta{'charset' => 'UTF-8'}
7
7
  %script
8
8
  :plain
9
- location.replace('#{RubyApp.root}');
9
+ location.replace('#{RubyApp::Application.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' => "#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-icon.png",
22
- 'apple-touch-startup-image' => "#{RubyApp.root_or_nil}/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-startup-image.png")
21
+ self.links.merge!('apple-touch-icon' => "#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-icon.png",
22
+ 'apple-touch-startup-image' => "#{RubyApp::Application.root_or_nil}/ruby_app/resources/elements/mobile/platforms/ios/document/apple-touch-startup-image.png")
23
23
 
24
24
  end
25
25
 
data/lib/ruby_app/log.rb CHANGED
@@ -14,6 +14,8 @@ module RubyApp
14
14
  extend RubyApp::Mixins::ConfigurationMixin
15
15
  extend RubyApp::Mixins::DelegateMixin
16
16
 
17
+ attr_reader :path
18
+
17
19
  class Formatter < ::Logger::Formatter
18
20
 
19
21
  def call(severity, time, application, message)
@@ -85,7 +87,11 @@ module RubyApp
85
87
 
86
88
  def initialize(path)
87
89
  super(path)
90
+
88
91
  self.formatter = RubyApp::Log::Formatter.new
92
+
93
+ @path = path
94
+
89
95
  end
90
96
 
91
97
  end
@@ -14,8 +14,8 @@ module RubyApp
14
14
  extend RubyApp::Mixins::RouteMixin
15
15
 
16
16
  def call(environment)
17
- # RubyApp::Log.debug("ROUTE #{RubyApp::Request.request_method} #{RubyApp::Request.path.gsub(/^#{RubyApp.root_or_nil}/,'')}")
18
- RubyApp::Rack::Route.do_route(RubyApp::Request.request_method, RubyApp::Request.path.gsub(/^#{RubyApp.root_or_nil}/,''))
17
+ # RubyApp::Log.debug("ROUTE #{RubyApp::Request.request_method} #{RubyApp::Request.path.gsub(/^#{RubyApp::Application.root_or_nil}/,'')}")
18
+ RubyApp::Rack::Route.do_route(RubyApp::Request.request_method, RubyApp::Request.path.gsub(/^#{RubyApp::Application.root_or_nil}/,''))
19
19
  end
20
20
 
21
21
  route(RubyApp::Mixins::RouteMixin::GET, /\/quit/) do |method, path|
@@ -17,7 +17,7 @@ module RubyApp
17
17
  #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} (now)=#{Time.now.inspect}")
18
18
  RubyApp::Response.set_cookie('_session', { :value => RubyApp::Session.session_id,
19
19
  :expires => RubyApp::Session.expires,
20
- :path => RubyApp.root})
20
+ :path => RubyApp::Application.root})
21
21
  return @application.call(environment)
22
22
  ensure
23
23
  RubyApp::Session.unload!
@@ -12,7 +12,7 @@ module RubyApp
12
12
  attr_reader :environment
13
13
 
14
14
  def language
15
- self.path.gsub(/^#{RubyApp.root_or_nil}/,'') =~ /^\/([^\/\?]+)/
15
+ self.path.gsub(/^#{RubyApp::Application.root_or_nil}/,'') =~ /^\/([^\/\?]+)/
16
16
  return $1
17
17
  end
18
18
 
@@ -1,6 +1,6 @@
1
1
  load_script! 'common/features/authentications'
2
2
 
3
- add_step! (RubyApp::Element::Event) { |event| event.go(RubyApp.root) }
3
+ add_step! (RubyApp::Element::Event) { |event| event.go(RubyApp::Application.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)
@@ -2,11 +2,11 @@ load_script! 'common/features'
2
2
 
3
3
  add_step! (RubyApp::Element::Event) { |event| event.assert_exists_link('Language') }
4
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") }
5
+ add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.go("#{RubyApp::Application.root_or_nil}/en") }
6
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") }
7
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.go("#{RubyApp::Application.root_or_nil}/fr") }
8
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) }
9
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.go(RubyApp::Application.root) }
10
10
  add_step! (RubyApp::Elements::Mobile::Page::LoadedEvent) { |event| event.click_link('Back') }
11
11
  add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.click_link('Back') }
12
12
  add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.execute {} }
@@ -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 => "#{RubyApp.root_or_nil}/quit?go=#{CGI.escape("#{RubyApp.root}?script=#{name}")}"})
218
+ :url => "#{RubyApp::Application.root_or_nil}/quit?go=#{CGI.escape("#{RubyApp::Application.root}?script=#{name}")}"})
219
219
  end
220
220
  end
221
221
  end
@@ -11,7 +11,7 @@ require 'ruby_app/rack'
11
11
 
12
12
  require '_APPLICATION_DOWNCODE_'
13
13
 
14
- RubyApp.root = '/'
14
+ RubyApp::Application.root = '/'
15
15
 
16
16
  use Rack::ShowExceptions
17
17
  use Rack::Reloader
@@ -22,19 +22,19 @@ use Rack::Reloader
22
22
  use RubyApp::Rack::Application, :configuration_paths => [ File.join(RubyApp::ROOT, %w[configuration.yml]),
23
23
  File.join(_APPLICATION_UPCODE_::ROOT, %w[configuration.yml])]
24
24
 
25
- map '#{RubyApp.root_or_nil}/ruby_app/resources' do
25
+ map '#{RubyApp::Application.root_or_nil}/ruby_app/resources' do
26
26
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
27
27
  end
28
28
 
29
- map '#{RubyApp.root_or_nil}/_APPLICATION_DOWNCODE_/resources' do
29
+ map '#{RubyApp::Application.root_or_nil}/_APPLICATION_DOWNCODE_/resources' do
30
30
  run Rack::File.new(File.join(_APPLICATION_UPCODE_::ROOT, %w[resources]))
31
31
  end
32
32
 
33
- map '#{RubyApp.root_or_nil}/favicon.ico' do
33
+ map '#{RubyApp::Application.root_or_nil}/favicon.ico' do
34
34
  run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
35
35
  end
36
36
 
37
- map '#{RubyApp.root_or_nil}/' do
37
+ map '#{RubyApp::Application.root_or_nil}/' do
38
38
  use RubyApp::Rack::Request
39
39
  use RubyApp::Rack::Response
40
40
  use RubyApp::Rack::Language
@@ -1,17 +1,4 @@
1
1
  module RubyApp
2
- VERSION = "0.6.66"
2
+ VERSION = "0.6.67"
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
-
13
- def self.root_or_nil
14
- return @@_root.nil_if('/')
15
- end
16
-
17
4
  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: 131
4
+ hash: 129
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 66
10
- version: 0.6.66
9
+ - 67
10
+ version: 0.6.67
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-20 00:00:00 Z
18
+ date: 2013-02-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -1465,8 +1465,6 @@ files:
1465
1465
  - lib/ruby_app/scripts/elements/swipe.rb
1466
1466
  - lib/ruby_app/scripts/elements/trigger.rb
1467
1467
  - lib/ruby_app/scripts/now.rb
1468
- - lib/ruby_app/scripts/phantom.js
1469
- - lib/ruby_app/scripts/phantom.rb
1470
1468
  - lib/ruby_app/scripts/standard_all.rb
1471
1469
  - lib/ruby_app/scripts/standard_continuous.rb
1472
1470
  - lib/ruby_app/scripts/standard_logon.rb
@@ -1,26 +0,0 @@
1
- var system = require('system');
2
-
3
- var arguments = system.args;
4
- var url = arguments[1] + '?script=phantom';
5
-
6
- var page = require('webpage').create();
7
-
8
- page.onLoadStarted = function() {
9
- console.log('MESSAGE Loading ' + url);
10
- };
11
- page.onNavigationRequested = function(url, type, willNavigate, mainFrame) {
12
- console.log('NAVIGATE ' + url);
13
- };
14
- page.onConsoleMessage = function(message) {
15
- console.log('CONSOLE ' + message);
16
- };
17
- page.onConfirm = function(message) {
18
- console.log('FAIL ' + message);
19
- phantom.exit();
20
- };
21
- page.onClosing = function(page) {
22
- console.log('SUCCESS ' + page.url);
23
- phantom.exit();
24
- };
25
-
26
- page.open(url);
@@ -1,3 +0,0 @@
1
- load_script! 'standard_no_logon'
2
-
3
- add_step! (RubyApp::Element::Event) { |event| event.execute('window.close();') }