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.
Files changed (127) hide show
  1. data/.gitignore +0 -1
  2. data/.rvmrc +56 -1
  3. data/Gemfile.lock +22 -22
  4. data/bin/console.rb +9 -1
  5. data/bin/ruby_app +2 -24
  6. data/features/default.feature +1 -0
  7. data/features/elements/input.feature +2 -0
  8. data/features/elements/page.feature +0 -9
  9. data/features/step_definitions/default_macros.rb +1 -4
  10. data/features/step_definitions/default_steps.rb +1 -1
  11. data/lib/ruby_app.rb +8 -1
  12. data/lib/ruby_app/application.rb +5 -67
  13. data/lib/ruby_app/configuration.rb +2 -3
  14. data/lib/ruby_app/configuration.ru +32 -0
  15. data/lib/ruby_app/configuration.yml +28 -0
  16. data/lib/ruby_app/element.rb +12 -6
  17. data/lib/ruby_app/elements.rb +50 -0
  18. data/lib/ruby_app/elements/base/base_mail.rb +2 -2
  19. data/lib/ruby_app/elements/base/base_page.html.haml +1 -1
  20. data/lib/ruby_app/elements/base/base_page.js.haml +3 -3
  21. data/lib/ruby_app/elements/base/base_page.rb +2 -2
  22. data/lib/ruby_app/elements/dialogs/base/base_ok_dialog.rb +0 -1
  23. data/lib/ruby_app/elements/dialogs/blank_dialog.rb +1 -1
  24. data/lib/ruby_app/elements/dialogs/exception_dialog.rb +1 -2
  25. data/lib/ruby_app/elements/navigation/back_button.rb +1 -1
  26. data/lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb +1 -0
  27. data/lib/ruby_app/elements/navigation/page_link.rb +1 -0
  28. data/lib/ruby_app/elements/pages/authentication/open_id/ax_authentication_page.rb +1 -1
  29. data/lib/ruby_app/elements/pages/authentication/open_id/base/base_authentication_page.rb +1 -3
  30. data/lib/ruby_app/elements/pages/authentication/open_id/email_authentication_page.rb +1 -1
  31. data/lib/ruby_app/elements/pages/authentication/open_id/sreg_authentication_page.rb +1 -1
  32. data/lib/ruby_app/elements/pages/base/base_blank_page.rb +0 -1
  33. data/lib/ruby_app/elements/pages/default_page.rb +2 -1
  34. data/lib/ruby_app/elements/pages/quit_page.html.haml +0 -3
  35. data/lib/ruby_app/elements/pages/quit_page.rb +0 -2
  36. data/lib/ruby_app/elements/pages/settings_page.rb +2 -1
  37. data/lib/ruby_app/elements/pages/test_pages.rb +9 -0
  38. data/lib/ruby_app/elements/pages/test_pages/button_test_page.rb +3 -5
  39. data/lib/ruby_app/elements/pages/test_pages/default_test_page.rb +10 -15
  40. data/lib/ruby_app/elements/pages/test_pages/dialog_test_page.rb +2 -8
  41. data/lib/ruby_app/elements/pages/test_pages/input_test_page.rb +2 -9
  42. data/lib/ruby_app/elements/pages/test_pages/link_test_page.rb +3 -5
  43. data/lib/ruby_app/elements/pages/test_pages/linked_test_page.rb +1 -2
  44. data/lib/ruby_app/elements/pages/test_pages/list_test_page.rb +4 -8
  45. data/lib/ruby_app/elements/pages/test_pages/markdown_test_page.rb +3 -4
  46. data/lib/ruby_app/elements/pages/test_pages/test_page.rb +3 -8
  47. data/lib/ruby_app/exceptions.rb +2 -0
  48. data/lib/ruby_app/exceptions/base/base_exception.rb +1 -1
  49. data/lib/ruby_app/language.rb +9 -15
  50. data/lib/ruby_app/log.rb +32 -28
  51. data/lib/ruby_app/mixins.rb +7 -0
  52. data/lib/ruby_app/mixins/configuration_mixin.rb +1 -1
  53. data/lib/ruby_app/mixins/delegate_mixin.rb +1 -1
  54. data/lib/ruby_app/mixins/hash_mixin.rb +1 -1
  55. data/lib/ruby_app/mixins/render_mixin.rb +37 -39
  56. data/lib/ruby_app/mixins/route_mixin.rb +1 -5
  57. data/lib/ruby_app/mixins/template_mixin.rb +4 -12
  58. data/lib/ruby_app/mixins/translate_mixin.rb +2 -2
  59. data/lib/ruby_app/rack.rb +8 -0
  60. data/lib/ruby_app/rack/application.rb +9 -5
  61. data/lib/ruby_app/rack/duration.rb +22 -0
  62. data/lib/ruby_app/rack/language.rb +26 -0
  63. data/lib/ruby_app/rack/memory.rb +22 -0
  64. data/lib/ruby_app/rack/request.rb +27 -0
  65. data/lib/ruby_app/rack/response.rb +26 -0
  66. data/lib/ruby_app/rack/route.rb +24 -87
  67. data/lib/ruby_app/rack/session.rb +31 -0
  68. data/lib/ruby_app/request.rb +4 -55
  69. data/lib/ruby_app/response.rb +58 -0
  70. data/lib/ruby_app/session.rb +102 -35
  71. data/lib/ruby_app/templates/application/Rakefile +1 -1
  72. data/lib/ruby_app/templates/application/configuration.ru +41 -0
  73. data/lib/ruby_app/templates/application/configuration.yml +16 -0
  74. data/lib/ruby_app/templates/application/console.rb +15 -10
  75. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_.rb +3 -0
  76. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/application.rb +3 -3
  77. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/elements/pages/default_page.rb +1 -1
  78. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/session.rb +3 -3
  79. data/lib/ruby_app/templates/application/spec/application_spec.rb +17 -0
  80. data/lib/ruby_app/templates/application/spec/request_spec.rb +18 -0
  81. data/lib/ruby_app/templates/application/spec/support/shared.rb +34 -9
  82. data/lib/ruby_app/themes/mobile.rb +1 -17
  83. data/lib/ruby_app/themes/mobile/base/base_page.html.haml +1 -1
  84. data/lib/ruby_app/translations/en.yml +133 -144
  85. data/lib/ruby_app/version.rb +1 -1
  86. data/rakefile +1 -16
  87. data/spec/application_spec.rb +5 -13
  88. data/spec/elements/base_element.html.haml +5 -0
  89. data/spec/elements/container_element.html.haml +6 -0
  90. data/spec/elements/derived_element.html.haml +5 -0
  91. data/spec/elements/element_spec.rb +101 -0
  92. data/spec/request_spec.rb +6 -13
  93. data/spec/support/shared.rb +14 -6
  94. metadata +95 -125
  95. data/features/elements/pages/quit_page.feature +0 -8
  96. data/lib/ruby_app/config.ru +0 -25
  97. data/lib/ruby_app/config.yml +0 -16
  98. data/lib/ruby_app/elements/pages/test_pages/select_test_page.rb +0 -44
  99. data/lib/ruby_app/templates/application/config.ru +0 -40
  100. data/lib/ruby_app/templates/application/config.yml +0 -1
  101. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.css.haml +0 -3
  102. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.html.haml +0 -4
  103. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.js.haml +0 -3
  104. data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.rb +0 -14
  105. data/spec/configuration_spec.rb +0 -25
  106. data/spec/element_spec.rb +0 -72
  107. data/spec/elements/navigation/breadcrumbs_spec.rb +0 -62
  108. data/spec/elements/page_spec.rb +0 -20
  109. data/spec/language_spec.rb +0 -25
  110. data/spec/log_spec.rb +0 -25
  111. data/spec/mixins/configuration_mixin_spec.rb +0 -24
  112. data/spec/mixins/delegate_mixin_spec.rb +0 -28
  113. data/spec/mixins/hash_mixin_spec.rb +0 -39
  114. data/spec/mixins/render_mixin_spec.rb +0 -127
  115. data/spec/mixins/route_mixin_spec.rb +0 -60
  116. data/spec/mixins/template_mixin_spec.rb +0 -78
  117. data/spec/mixins/test_a.css.haml +0 -4
  118. data/spec/mixins/test_a.html.haml +0 -2
  119. data/spec/mixins/test_a.js.haml +0 -4
  120. data/spec/mixins/test_b.css.haml +0 -4
  121. data/spec/mixins/test_b.html.haml +0 -3
  122. data/spec/mixins/test_b.js.haml +0 -4
  123. data/spec/mixins/test_c.css.haml +0 -4
  124. data/spec/mixins/test_c.html.haml +0 -2
  125. data/spec/mixins/test_c.js.haml +0 -4
  126. data/spec/mixins/translate_mixin_spec.rb +0 -25
  127. 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
@@ -1,16 +1,11 @@
1
+ require 'securerandom'
2
+
1
3
  module RubyApp
2
- require 'ruby_app/application'
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(session_id, page = nil, data = {})
30
- @session_id = 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 = 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 quit
73
- RubyApp::Request.env['rack.session.options'][:drop] = true if RubyApp::Request.env['rack.session.options']
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.create!
81
- RubyApp::Request.session[:_initialize] = true
82
- Thread.current[:_session] = RubyApp::Request.session[:_session] ||= RubyApp::Application.options.session_class.new(RubyApp::Request.env['rack.session.options'] ? RubyApp::Request.env['rack.session.options'][:id] : nil)
83
- if block_given?
84
- begin
85
- yield
86
- ensure
87
- self.destroy!
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.destroy!
93
- Thread.current[:_session] = nil
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
@@ -5,7 +5,7 @@ require 'rake'
5
5
 
6
6
  $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[lib]))
7
7
 
8
- require '_APPLICATION_DOWNCODE_/application'
8
+ require '_APPLICATION_DOWNCODE_'
9
9
 
10
10
  namespace :_APPLICATION_DOWNCODE_ do
11
11
 
@@ -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_/application'
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
- options = { :application_class => _APPLICATION_UPCODE_::Application,
10
- :session_class => _APPLICATION_UPCODE_::Session,
11
- :log_path => File.join(_APPLICATION_UPCODE_::ROOT, %w[log application.log]),
12
- :configuration_paths => File.join(_APPLICATION_UPCODE_::ROOT, %w[config.yml]),
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
- _APPLICATION_UPCODE_::Application.create! options
17
+ at_exit do
18
+ RubyApp::Application.destroy!
19
+ RubyApp::Log.close!
20
+ RubyApp::Configuration.unload!
21
+ end
@@ -0,0 +1,3 @@
1
+ require '_APPLICATION_DOWNCODE_/application'
2
+ require '_APPLICATION_DOWNCODE_/session'
3
+ require '_APPLICATION_DOWNCODE_/version'
@@ -1,14 +1,14 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- require 'ruby_app/application'
4
+ require 'ruby_app'
5
5
 
6
6
  module _APPLICATION_UPCODE_
7
7
 
8
8
  class Application < RubyApp::Application
9
9
 
10
- def initialize(options)
11
- super(options)
10
+ def initialize
11
+ super
12
12
  end
13
13
 
14
14
  end
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- require 'ruby_app/elements/page'
4
+ require 'ruby_app/elements'
5
5
 
6
6
  module _APPLICATION_UPCODE_
7
7
 
@@ -1,15 +1,15 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- require 'ruby_app/session'
4
+ require 'ruby_app'
5
5
 
6
6
  module _APPLICATION_UPCODE_
7
7
 
8
8
  class Session < RubyApp::Session
9
9
 
10
- def initialize(session_id, page = nil, data = {})
10
+ def initialize
11
11
  require '_APPLICATION_DOWNCODE_/elements/pages/default_page'
12
- super(session_id, page || _APPLICATION_UPCODE_::Elements::Pages::DefaultPage.new, data)
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 File.join(File.dirname(__FILE__), %w[.. .. application])
2
- require File.join(File.dirname(__FILE__), %w[.. .. session])
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
3
 
4
- shared_context '_APPLICATION_UPCODE_::Application' do
4
+ require 'ruby_app'
5
+
6
+ require '_APPLICATION_DOWNCODE_'
7
+
8
+ shared_context 'application' do
5
9
 
6
10
  before(:all) do
7
- options = {:application_class => _APPLICATION_UPCODE_::Application,
8
- :session_class => _APPLICATION_UPCODE_::Session,
9
- :log_path => File.join(File.dirname(__FILE__), %w[.. .. log application.log]),
10
- :configuration_paths => File.join(File.dirname(__FILE__), %w[.. .. config.yml])}
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
- Pike::Application.destroy
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
+