RubyApp 0.5.40 → 0.5.41

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- RubyApp (0.5.40)
4
+ RubyApp (0.5.41)
5
5
  BlueCloth
6
6
  chronic
7
7
  chronic_duration
@@ -29,8 +29,8 @@ GEM
29
29
  facets (2.9.3)
30
30
  fileutils (0.7)
31
31
  rmagick (>= 2.13.1)
32
- haml (3.1.4)
33
- json (1.6.6)
32
+ haml (3.1.6)
33
+ json (1.7.3)
34
34
  mime-types (1.18)
35
35
  numerizer (0.1.1)
36
36
  r18n-core (0.4.14)
@@ -39,7 +39,7 @@ GEM
39
39
  rmagick (2.13.1)
40
40
  ruby-event (1.0.0)
41
41
  ruby-openid (2.1.8)
42
- sass (3.1.15)
42
+ sass (3.1.19)
43
43
  term-ansicolor (1.0.7)
44
44
  terminal-table (1.4.5)
45
45
  yajl-ruby (1.1.0)
@@ -23,6 +23,10 @@ module RubyApp
23
23
  @@_application ||= nil
24
24
  end
25
25
 
26
+ def self.exists?
27
+ return @@_application
28
+ end
29
+
26
30
  def self.create!
27
31
  @@_application = ( Kernel.eval(RubyApp::Application.configuration._class) ).new
28
32
  end
@@ -32,15 +36,17 @@ module RubyApp
32
36
  end
33
37
 
34
38
  def self.create_context!(configuration_paths = [File.join(RubyApp::ROOT, %w[configuration.yml])])
35
- RubyApp::Configuration.load!(configuration_paths)
36
- RubyApp::Log.open!
37
- RubyApp::Application.create!
38
- begin
39
- yield
40
- ensure
41
- RubyApp::Application.destroy!
42
- RubyApp::Log.close!
43
- RubyApp::Configuration.unload!
39
+ unless RubyApp::Application.exists?
40
+ RubyApp::Configuration.load!(configuration_paths)
41
+ RubyApp::Log.open!
42
+ RubyApp::Application.create!
43
+ begin
44
+ yield
45
+ ensure
46
+ RubyApp::Application.destroy!
47
+ RubyApp::Log.close!
48
+ RubyApp::Configuration.unload!
49
+ end
44
50
  end
45
51
  end
46
52
 
@@ -17,6 +17,12 @@ module RubyApp
17
17
  super
18
18
  end
19
19
 
20
+ def render(format)
21
+ RubyApp::Request.create_context! do
22
+ return super(format)
23
+ end
24
+ end
25
+
20
26
  end
21
27
 
22
28
  end
@@ -28,6 +28,10 @@ module RubyApp
28
28
  Thread.current[:_request]
29
29
  end
30
30
 
31
+ def self.exists?
32
+ return Thread.current[:_request]
33
+ end
34
+
31
35
  def self.create!(environment = RubyApp::Application.environment)
32
36
  Thread.current[:_request] = RubyApp::Request.new(environment)
33
37
  end
@@ -37,17 +41,19 @@ module RubyApp
37
41
  end
38
42
 
39
43
  def self.create_context!
40
- RubyApp::Request.create!
41
- RubyApp::Response.create!
42
- RubyApp::Language.load!
43
- RubyApp::Session.load!
44
- begin
45
- yield
46
- ensure
47
- RubyApp::Session.unload!
48
- RubyApp::Language.unload!
49
- RubyApp::Response.destroy!
50
- RubyApp::Request.destroy!
44
+ unless RubyApp::Request.exists?
45
+ RubyApp::Request.create!
46
+ RubyApp::Response.create!
47
+ RubyApp::Language.load!
48
+ RubyApp::Session.load!
49
+ begin
50
+ yield
51
+ ensure
52
+ RubyApp::Session.unload!
53
+ RubyApp::Language.unload!
54
+ RubyApp::Response.destroy!
55
+ RubyApp::Request.destroy!
56
+ end
51
57
  end
52
58
  end
53
59
 
@@ -1,4 +1,4 @@
1
1
  module RubyApp
2
- VERSION = "0.5.40"
2
+ VERSION = "0.5.41"
3
3
  ROOT = File.expand_path(File.dirname(__FILE__))
4
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: 91
4
+ hash: 89
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 40
10
- version: 0.5.40
9
+ - 41
10
+ version: 0.5.41
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: 2012-05-31 00:00:00 Z
18
+ date: 2012-06-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement