RubyApp 0.0.91 → 0.2.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.
- data/.gitignore +0 -1
- data/.rvmrc +56 -1
- data/Gemfile.lock +22 -22
- data/bin/console.rb +9 -1
- data/bin/ruby_app +2 -24
- data/features/default.feature +1 -0
- data/features/elements/input.feature +2 -0
- data/features/elements/page.feature +0 -9
- data/features/step_definitions/default_macros.rb +1 -4
- data/features/step_definitions/default_steps.rb +1 -1
- data/lib/ruby_app.rb +8 -1
- data/lib/ruby_app/application.rb +5 -67
- data/lib/ruby_app/configuration.rb +2 -3
- data/lib/ruby_app/configuration.ru +32 -0
- data/lib/ruby_app/configuration.yml +28 -0
- data/lib/ruby_app/element.rb +12 -6
- data/lib/ruby_app/elements.rb +50 -0
- data/lib/ruby_app/elements/base/base_mail.rb +2 -2
- data/lib/ruby_app/elements/base/base_page.html.haml +1 -1
- data/lib/ruby_app/elements/base/base_page.js.haml +3 -3
- data/lib/ruby_app/elements/base/base_page.rb +2 -2
- data/lib/ruby_app/elements/dialogs/base/base_ok_dialog.rb +0 -1
- data/lib/ruby_app/elements/dialogs/blank_dialog.rb +1 -1
- data/lib/ruby_app/elements/dialogs/exception_dialog.rb +1 -2
- data/lib/ruby_app/elements/navigation/back_button.rb +1 -1
- data/lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb +1 -0
- data/lib/ruby_app/elements/navigation/page_link.rb +1 -0
- data/lib/ruby_app/elements/pages/authentication/open_id/ax_authentication_page.rb +1 -1
- data/lib/ruby_app/elements/pages/authentication/open_id/base/base_authentication_page.rb +1 -3
- data/lib/ruby_app/elements/pages/authentication/open_id/email_authentication_page.rb +1 -1
- data/lib/ruby_app/elements/pages/authentication/open_id/sreg_authentication_page.rb +1 -1
- data/lib/ruby_app/elements/pages/base/base_blank_page.rb +0 -1
- data/lib/ruby_app/elements/pages/default_page.rb +2 -1
- data/lib/ruby_app/elements/pages/quit_page.html.haml +0 -3
- data/lib/ruby_app/elements/pages/quit_page.rb +0 -2
- data/lib/ruby_app/elements/pages/settings_page.rb +2 -1
- data/lib/ruby_app/elements/pages/test_pages.rb +9 -0
- data/lib/ruby_app/elements/pages/test_pages/button_test_page.rb +3 -5
- data/lib/ruby_app/elements/pages/test_pages/default_test_page.rb +10 -15
- data/lib/ruby_app/elements/pages/test_pages/dialog_test_page.rb +2 -8
- data/lib/ruby_app/elements/pages/test_pages/input_test_page.rb +2 -9
- data/lib/ruby_app/elements/pages/test_pages/link_test_page.rb +3 -5
- data/lib/ruby_app/elements/pages/test_pages/linked_test_page.rb +1 -2
- data/lib/ruby_app/elements/pages/test_pages/list_test_page.rb +4 -8
- data/lib/ruby_app/elements/pages/test_pages/markdown_test_page.rb +3 -4
- data/lib/ruby_app/elements/pages/test_pages/test_page.rb +3 -8
- data/lib/ruby_app/exceptions.rb +2 -0
- data/lib/ruby_app/exceptions/base/base_exception.rb +1 -1
- data/lib/ruby_app/language.rb +9 -15
- data/lib/ruby_app/log.rb +32 -28
- data/lib/ruby_app/mixins.rb +7 -0
- data/lib/ruby_app/mixins/configuration_mixin.rb +1 -1
- data/lib/ruby_app/mixins/delegate_mixin.rb +1 -1
- data/lib/ruby_app/mixins/hash_mixin.rb +1 -1
- data/lib/ruby_app/mixins/render_mixin.rb +37 -39
- data/lib/ruby_app/mixins/route_mixin.rb +1 -5
- data/lib/ruby_app/mixins/template_mixin.rb +4 -12
- data/lib/ruby_app/mixins/translate_mixin.rb +2 -2
- data/lib/ruby_app/rack.rb +8 -0
- data/lib/ruby_app/rack/application.rb +9 -5
- data/lib/ruby_app/rack/duration.rb +22 -0
- data/lib/ruby_app/rack/language.rb +26 -0
- data/lib/ruby_app/rack/memory.rb +22 -0
- data/lib/ruby_app/rack/request.rb +27 -0
- data/lib/ruby_app/rack/response.rb +26 -0
- data/lib/ruby_app/rack/route.rb +24 -87
- data/lib/ruby_app/rack/session.rb +31 -0
- data/lib/ruby_app/request.rb +4 -55
- data/lib/ruby_app/response.rb +58 -0
- data/lib/ruby_app/session.rb +102 -35
- data/lib/ruby_app/templates/application/Rakefile +1 -1
- data/lib/ruby_app/templates/application/configuration.ru +41 -0
- data/lib/ruby_app/templates/application/configuration.yml +16 -0
- data/lib/ruby_app/templates/application/console.rb +15 -10
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_.rb +3 -0
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/application.rb +3 -3
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/elements/pages/default_page.rb +1 -1
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/session.rb +3 -3
- data/lib/ruby_app/templates/application/spec/application_spec.rb +17 -0
- data/lib/ruby_app/templates/application/spec/request_spec.rb +18 -0
- data/lib/ruby_app/templates/application/spec/support/shared.rb +34 -9
- data/lib/ruby_app/themes/mobile.rb +1 -17
- data/lib/ruby_app/themes/mobile/base/base_page.html.haml +1 -1
- data/lib/ruby_app/translations/en.yml +133 -144
- data/lib/ruby_app/version.rb +1 -1
- data/rakefile +1 -16
- data/spec/application_spec.rb +5 -13
- data/spec/elements/base_element.html.haml +5 -0
- data/spec/elements/container_element.html.haml +6 -0
- data/spec/elements/derived_element.html.haml +5 -0
- data/spec/elements/element_spec.rb +101 -0
- data/spec/request_spec.rb +6 -13
- data/spec/support/shared.rb +14 -6
- metadata +95 -125
- data/features/elements/pages/quit_page.feature +0 -8
- data/lib/ruby_app/config.ru +0 -25
- data/lib/ruby_app/config.yml +0 -16
- data/lib/ruby_app/elements/pages/test_pages/select_test_page.rb +0 -44
- data/lib/ruby_app/templates/application/config.ru +0 -40
- data/lib/ruby_app/templates/application/config.yml +0 -1
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.css.haml +0 -3
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.html.haml +0 -4
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.js.haml +0 -3
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.rb +0 -14
- data/spec/configuration_spec.rb +0 -25
- data/spec/element_spec.rb +0 -72
- data/spec/elements/navigation/breadcrumbs_spec.rb +0 -62
- data/spec/elements/page_spec.rb +0 -20
- data/spec/language_spec.rb +0 -25
- data/spec/log_spec.rb +0 -25
- data/spec/mixins/configuration_mixin_spec.rb +0 -24
- data/spec/mixins/delegate_mixin_spec.rb +0 -28
- data/spec/mixins/hash_mixin_spec.rb +0 -39
- data/spec/mixins/render_mixin_spec.rb +0 -127
- data/spec/mixins/route_mixin_spec.rb +0 -60
- data/spec/mixins/template_mixin_spec.rb +0 -78
- data/spec/mixins/test_a.css.haml +0 -4
- data/spec/mixins/test_a.html.haml +0 -2
- data/spec/mixins/test_a.js.haml +0 -4
- data/spec/mixins/test_b.css.haml +0 -4
- data/spec/mixins/test_b.html.haml +0 -3
- data/spec/mixins/test_b.js.haml +0 -4
- data/spec/mixins/test_c.css.haml +0 -4
- data/spec/mixins/test_c.html.haml +0 -2
- data/spec/mixins/test_c.js.haml +0 -4
- data/spec/mixins/translate_mixin_spec.rb +0 -25
- data/spec/session_spec.rb +0 -39
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
require 'facets/string/interpolate'
|
|
5
|
+
require 'rack'
|
|
6
|
+
|
|
7
|
+
module RubyApp
|
|
8
|
+
require 'ruby_app/mixins'
|
|
9
|
+
|
|
10
|
+
class Response < ::Rack::Response
|
|
11
|
+
extend RubyApp::Mixins::DelegateMixin
|
|
12
|
+
|
|
13
|
+
def rendered?(template)
|
|
14
|
+
return @rendered.key?(template)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def rendered(template)
|
|
18
|
+
@rendered[template] = true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def content_for(element, name, value = nil, &block)
|
|
22
|
+
@content[element] ||= {}
|
|
23
|
+
@content[element][name] = block_given? ? block : String.interpolate { value }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get_content(element, name)
|
|
27
|
+
@content[element] ||= {}
|
|
28
|
+
return @content[element][name]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def clear_content(element)
|
|
32
|
+
@content[element] = {}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.get
|
|
36
|
+
return Thread.current[:_response]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.create!
|
|
40
|
+
Thread.current[:_response] = RubyApp::Response.new
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.destroy!
|
|
44
|
+
Thread.current[:_response] = nil
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def initialize
|
|
50
|
+
super
|
|
51
|
+
self['Cache-Control'] = 'no-cache'
|
|
52
|
+
@rendered = {}
|
|
53
|
+
@content = {}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
data/lib/ruby_app/session.rb
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
+
require 'securerandom'
|
|
2
|
+
|
|
1
3
|
module RubyApp
|
|
2
|
-
require 'ruby_app/
|
|
3
|
-
require 'ruby_app/log'
|
|
4
|
-
require 'ruby_app/mixins/configuration_mixin'
|
|
5
|
-
require 'ruby_app/mixins/delegate_mixin'
|
|
6
|
-
require 'ruby_app/mixins/hash_mixin'
|
|
7
|
-
require 'ruby_app/mixins/translate_mixin'
|
|
8
|
-
require 'ruby_app/request'
|
|
4
|
+
require 'ruby_app/mixins'
|
|
9
5
|
|
|
10
6
|
class Session
|
|
7
|
+
extend RubyApp::Mixins::ConfigurationMixin
|
|
11
8
|
extend RubyApp::Mixins::DelegateMixin
|
|
12
|
-
include RubyApp::Mixins::HashMixin
|
|
13
|
-
include RubyApp::Mixins::ConfigurationMixin
|
|
14
9
|
extend RubyApp::Mixins::TranslateMixin
|
|
15
10
|
|
|
16
11
|
class Identity
|
|
@@ -23,29 +18,20 @@ module RubyApp
|
|
|
23
18
|
|
|
24
19
|
end
|
|
25
20
|
|
|
26
|
-
attr_reader :session_id, :pages, :data
|
|
21
|
+
attr_reader :session_id, :expires, :pages, :data
|
|
27
22
|
attr_accessor :identity
|
|
28
23
|
|
|
29
|
-
def initialize(
|
|
30
|
-
@session_id =
|
|
24
|
+
def initialize(page = nil)
|
|
25
|
+
@session_id = RubyApp::Session.generate_session_id(self)
|
|
26
|
+
@expires = Time.now + RubyApp::Session.configuration.expires
|
|
31
27
|
@pages = []
|
|
32
28
|
@dialogs = []
|
|
33
|
-
@data =
|
|
29
|
+
@data = {}
|
|
34
30
|
@identity = nil
|
|
35
31
|
|
|
36
32
|
require 'ruby_app/elements/pages/default_page'
|
|
37
33
|
@pages.push(page || RubyApp::Elements::Pages::DefaultPage.new)
|
|
38
34
|
|
|
39
|
-
RubyApp::Log.memory("#{self.class}##{__method__}")
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def [](key)
|
|
44
|
-
@data[key]
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def []=(key, value)
|
|
48
|
-
@data[key] = value
|
|
49
35
|
end
|
|
50
36
|
|
|
51
37
|
def show_dialog(event, dialog, &block)
|
|
@@ -69,28 +55,109 @@ module RubyApp
|
|
|
69
55
|
|
|
70
56
|
end
|
|
71
57
|
|
|
72
|
-
def
|
|
73
|
-
|
|
58
|
+
def reset!
|
|
59
|
+
@expires = Time.now + RubyApp::Session.configuration.expires
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def expired?
|
|
63
|
+
return @expires <= Time.now
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def quit!
|
|
67
|
+
RubyApp::Session.lock_sessions do
|
|
68
|
+
RubyApp::Session.sessions.delete(self.session_id)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def self.sessions
|
|
73
|
+
return @@_sessions ||= {}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.lock_sessions
|
|
77
|
+
( @@_lock ||= Mutex.new ).synchronize do
|
|
78
|
+
yield
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.get_session(session_id)
|
|
83
|
+
session = RubyApp::Session.sessions[session_id]
|
|
84
|
+
if session
|
|
85
|
+
unless session.expired?
|
|
86
|
+
session.reset!
|
|
87
|
+
return session
|
|
88
|
+
else
|
|
89
|
+
session.quit!
|
|
90
|
+
return nil
|
|
91
|
+
end
|
|
92
|
+
else
|
|
93
|
+
return nil
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def self.generate_session_id(session)
|
|
98
|
+
session_id = SecureRandom.hex
|
|
99
|
+
RubyApp::Session.lock_sessions do
|
|
100
|
+
while RubyApp::Session.get_session(session_id)
|
|
101
|
+
session_id = SecureRandom.hex
|
|
102
|
+
end
|
|
103
|
+
RubyApp::Session.sessions.store(session_id, session)
|
|
104
|
+
return session_id
|
|
105
|
+
end
|
|
74
106
|
end
|
|
75
107
|
|
|
76
108
|
def self.get
|
|
77
109
|
Thread.current[:_session]
|
|
78
110
|
end
|
|
79
111
|
|
|
80
|
-
def self.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
def self.load!(session_id = nil)
|
|
113
|
+
Thread.current[:_session] = RubyApp::Session.get_session(session_id) || Kernel.eval(RubyApp::Session.configuration._class).new
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def self.unload!
|
|
117
|
+
Thread.current[:_session] = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def self.start_thread!
|
|
121
|
+
unless @@_thread ||= nil
|
|
122
|
+
@@_thread = Thread.new do
|
|
123
|
+
begin
|
|
124
|
+
while true
|
|
125
|
+
#RubyApp::Log.duration(RubyApp::Log.prefix(self, __method__)) do
|
|
126
|
+
RubyApp::Session.sessions.values.each do |session|
|
|
127
|
+
if session.expired?
|
|
128
|
+
#RubyApp::Log.memory(RubyApp::Log.prefix(self, __method__)) do
|
|
129
|
+
RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} session.quit! #{session.session_id.inspect}")
|
|
130
|
+
session.quit!
|
|
131
|
+
#end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
#end
|
|
135
|
+
sleep(RubyApp::Session.configuration.interval)
|
|
136
|
+
end
|
|
137
|
+
rescue Exception => exception
|
|
138
|
+
RubyApp::Log.exception(exception)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
at_exit do
|
|
143
|
+
begin
|
|
144
|
+
RubyApp::Session.stop_thread!
|
|
145
|
+
rescue Exception => exception
|
|
146
|
+
RubyApp::Log.exception(exception)
|
|
147
|
+
end
|
|
88
148
|
end
|
|
149
|
+
|
|
150
|
+
RubyApp::Log.debug(RubyApp::Log.prefix(self, __method__))
|
|
151
|
+
|
|
89
152
|
end
|
|
90
153
|
end
|
|
91
154
|
|
|
92
|
-
def self.
|
|
93
|
-
|
|
155
|
+
def self.stop_thread!
|
|
156
|
+
if @@_thread ||= nil
|
|
157
|
+
RubyApp::Log.debug(RubyApp::Log.prefix(self, __method__))
|
|
158
|
+
@@_thread.exit
|
|
159
|
+
@@_thread = nil
|
|
160
|
+
end
|
|
94
161
|
end
|
|
95
162
|
|
|
96
163
|
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#\ --warn --port 8008 --pid ./rack.pid
|
|
2
|
+
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[lib]))
|
|
3
|
+
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'bundler/setup'
|
|
6
|
+
|
|
7
|
+
require 'rack'
|
|
8
|
+
|
|
9
|
+
require 'ruby_app'
|
|
10
|
+
require 'ruby_app/rack'
|
|
11
|
+
|
|
12
|
+
require '_APPLICATION_DOWNCODE_'
|
|
13
|
+
|
|
14
|
+
use Rack::ShowExceptions
|
|
15
|
+
use Rack::Reloader
|
|
16
|
+
|
|
17
|
+
#use RubyApp::Rack::Duration
|
|
18
|
+
#use RubyApp::Rack::Memory
|
|
19
|
+
|
|
20
|
+
use RubyApp::Rack::Application, :configuration_paths => [ File.join(RubyApp::ROOT, %w[configuration.yml]),
|
|
21
|
+
File.join(_APPLICATION_UPCODE_::ROOT, %w[configuration.yml])]
|
|
22
|
+
|
|
23
|
+
map '/ruby_app/resources' do
|
|
24
|
+
run Rack::File.new(File.join(RubyApp::ROOT, %w[resources]))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
map '/_APPLICATION_DOWNCODE_/resources' do
|
|
28
|
+
run Rack::File.new(File.join(_APPLICATION_UPCODE_::ROOT, %w[resources]))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
map '/favicon.ico' do
|
|
32
|
+
run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico]))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
map '/' do
|
|
36
|
+
use RubyApp::Rack::Request
|
|
37
|
+
use RubyApp::Rack::Response
|
|
38
|
+
use RubyApp::Rack::Language
|
|
39
|
+
use RubyApp::Rack::Session
|
|
40
|
+
run RubyApp::Rack::Route.new
|
|
41
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
default:
|
|
2
|
+
ruby_app:
|
|
3
|
+
application:
|
|
4
|
+
_class: "_APPLICATION_UPCODE_::Application"
|
|
5
|
+
language:
|
|
6
|
+
default: "en"
|
|
7
|
+
paths:
|
|
8
|
+
- "#{RubyApp::ROOT}/translations"
|
|
9
|
+
- "#{_APPLICATION_UPCODE_::ROOT}/translations"
|
|
10
|
+
log:
|
|
11
|
+
path: "#{_APPLICATION_UPCODE_::ROOT}/process/log/application.log"
|
|
12
|
+
session:
|
|
13
|
+
_class: "_APPLICATION_UPCODE_::Session"
|
|
14
|
+
expires: 900
|
|
15
|
+
interval: 15
|
|
16
|
+
_APPLICATION_DOWNCODE_:
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
require 'ruby_app'
|
|
5
|
+
|
|
1
6
|
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[lib]))
|
|
2
7
|
|
|
3
|
-
require '_APPLICATION_DOWNCODE_
|
|
4
|
-
require '_APPLICATION_DOWNCODE_/session'
|
|
5
|
-
require '_APPLICATION_DOWNCODE_/version'
|
|
8
|
+
require '_APPLICATION_DOWNCODE_'
|
|
6
9
|
|
|
7
10
|
puts "Running #{__FILE__.inspect}"
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:default_language => :en,
|
|
14
|
-
:translations_paths => File.join(_APPLICATION_UPCODE_::ROOT, %w[translations]) }
|
|
12
|
+
RubyApp::Configuration.load!([ File.join(RubyApp::ROOT, %w[configuration.yml]),
|
|
13
|
+
File.join(_APPLICATION_UPCODE_::ROOT, %w[configuration.yml])])
|
|
14
|
+
RubyApp::Log.open!
|
|
15
|
+
RubyApp::Application.create!
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
at_exit do
|
|
18
|
+
RubyApp::Application.destroy!
|
|
19
|
+
RubyApp::Log.close!
|
|
20
|
+
RubyApp::Configuration.unload!
|
|
21
|
+
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
|
3
3
|
|
|
4
|
-
require 'ruby_app
|
|
4
|
+
require 'ruby_app'
|
|
5
5
|
|
|
6
6
|
module _APPLICATION_UPCODE_
|
|
7
7
|
|
|
8
8
|
class Application < RubyApp::Application
|
|
9
9
|
|
|
10
|
-
def initialize
|
|
11
|
-
super
|
|
10
|
+
def initialize
|
|
11
|
+
super
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
|
3
3
|
|
|
4
|
-
require 'ruby_app
|
|
4
|
+
require 'ruby_app'
|
|
5
5
|
|
|
6
6
|
module _APPLICATION_UPCODE_
|
|
7
7
|
|
|
8
8
|
class Session < RubyApp::Session
|
|
9
9
|
|
|
10
|
-
def initialize
|
|
10
|
+
def initialize
|
|
11
11
|
require '_APPLICATION_DOWNCODE_/elements/pages/default_page'
|
|
12
|
-
super(
|
|
12
|
+
super(_APPLICATION_UPCODE_::Elements::Pages::DefaultPage.new)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'application' do
|
|
4
|
+
include_context 'application'
|
|
5
|
+
|
|
6
|
+
describe 'positive' do
|
|
7
|
+
|
|
8
|
+
specify { RubyApp::Configuration.get.should_not be_nil }
|
|
9
|
+
specify { RubyApp::Log.get.should_not be_nil }
|
|
10
|
+
specify { RubyApp::Application.get.should_not be_nil }
|
|
11
|
+
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'negative' do
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'request' do
|
|
4
|
+
include_context 'request'
|
|
5
|
+
|
|
6
|
+
describe 'positive' do
|
|
7
|
+
|
|
8
|
+
specify { RubyApp::Request.get.should_not be_nil }
|
|
9
|
+
specify { RubyApp::Response.get.should_not be_nil }
|
|
10
|
+
specify { RubyApp::Language.get.should_not be_nil }
|
|
11
|
+
specify { RubyApp::Session.get.should_not be_nil }
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe 'negative' do
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
require 'ruby_app'
|
|
5
|
+
|
|
6
|
+
require '_APPLICATION_DOWNCODE_'
|
|
7
|
+
|
|
8
|
+
shared_context 'application' do
|
|
5
9
|
|
|
6
10
|
before(:all) do
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_APPLICATION_UPCODE_::Application.create(options)
|
|
11
|
+
RubyApp::Configuration.load!([ File.join(RubyApp::ROOT, %w[configuration.yml]),
|
|
12
|
+
File.join(_APPLICATION_UPCODE_::ROOT, %w[configuration.yml])])
|
|
13
|
+
RubyApp::Log.open!
|
|
14
|
+
RubyApp::Application.create!
|
|
12
15
|
end
|
|
13
16
|
|
|
14
17
|
after(:all) do
|
|
15
|
-
|
|
18
|
+
RubyApp::Application.destroy!
|
|
19
|
+
RubyApp::Log.close!
|
|
20
|
+
RubyApp::Configuration.unload!
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
shared_context 'request' do
|
|
26
|
+
include_context 'application'
|
|
27
|
+
|
|
28
|
+
before(:each) do
|
|
29
|
+
RubyApp::Request.create!
|
|
30
|
+
RubyApp::Response.create!
|
|
31
|
+
RubyApp::Language.load!
|
|
32
|
+
RubyApp::Session.load!
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
after(:each) do
|
|
36
|
+
RubyApp::Session.unload!
|
|
37
|
+
RubyApp::Language.unload!
|
|
38
|
+
RubyApp::Response.destroy!
|
|
39
|
+
RubyApp::Request.destroy!
|
|
16
40
|
end
|
|
17
41
|
|
|
18
42
|
end
|
|
43
|
+
|