pakyow-core 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/pakyow-core/CHANGES +6 -0
- data/pakyow-core/lib/core/application.rb +28 -7
- metadata +61 -34
data/pakyow-core/CHANGES
CHANGED
@@ -21,7 +21,10 @@ module Pakyow
|
|
21
21
|
return if running?
|
22
22
|
@running = true
|
23
23
|
self.builder.run(self.prepare(args))
|
24
|
-
detect_handler.run(builder, :Host => Pakyow::Configuration::Base.server.host, :Port => Pakyow::Configuration::Base.server.port)
|
24
|
+
detect_handler.run(builder, :Host => Pakyow::Configuration::Base.server.host, :Port => Pakyow::Configuration::Base.server.port) do |server|
|
25
|
+
trap(:INT) { stop(server) }
|
26
|
+
trap(:TERM) { stop(server) }
|
27
|
+
end
|
25
28
|
end
|
26
29
|
|
27
30
|
# Stages the application. Everything is loaded but the application is
|
@@ -133,6 +136,17 @@ module Pakyow
|
|
133
136
|
end
|
134
137
|
end
|
135
138
|
end
|
139
|
+
|
140
|
+
def stop(server)
|
141
|
+
if server.respond_to?('stop!')
|
142
|
+
server.stop!
|
143
|
+
elsif server.respond_to?('stop')
|
144
|
+
server.stop
|
145
|
+
else
|
146
|
+
# exit ungracefully if necessary...
|
147
|
+
Process.exit!
|
148
|
+
end
|
149
|
+
end
|
136
150
|
end
|
137
151
|
|
138
152
|
include Helpers
|
@@ -161,7 +175,8 @@ module Pakyow
|
|
161
175
|
end
|
162
176
|
|
163
177
|
def invoke_route!(route, method=nil)
|
164
|
-
|
178
|
+
base_route, ignore_format = StringUtils.split_at_last_dot(route)
|
179
|
+
self.request.working_path = base_route
|
165
180
|
self.request.working_method = method if method
|
166
181
|
block = prepare_route_block(route, self.request.working_method)
|
167
182
|
throw :new_block, block
|
@@ -192,7 +207,8 @@ module Pakyow
|
|
192
207
|
def call(env)
|
193
208
|
self.request = Request.new(env)
|
194
209
|
self.response = Rack::Response.new
|
195
|
-
|
210
|
+
base_route, ignore_format = StringUtils.split_at_last_dot(self.request.path)
|
211
|
+
self.request.working_path = base_route
|
196
212
|
self.request.working_method = self.request.method
|
197
213
|
|
198
214
|
has_route = false
|
@@ -204,7 +220,7 @@ module Pakyow
|
|
204
220
|
self.presenter.prepare_for_request(self.request)
|
205
221
|
end
|
206
222
|
|
207
|
-
has_route = trampoline(route_block)
|
223
|
+
has_route = trampoline(route_block)
|
208
224
|
|
209
225
|
if self.presenter
|
210
226
|
self.response.body = [self.presenter.content]
|
@@ -408,11 +424,16 @@ module Pakyow
|
|
408
424
|
|
409
425
|
def prepare_route_block(route, method)
|
410
426
|
set_request_format_from_route(route)
|
411
|
-
|
412
|
-
|
427
|
+
base_route, ignore_format = StringUtils.split_at_last_dot(route)
|
428
|
+
|
429
|
+
if Pakyow::Configuration::App.ignore_routes
|
430
|
+
controller_block, packet = nil, {:vars=>{}, :data=>nil}
|
431
|
+
else
|
432
|
+
controller_block, packet = @route_store.get_block(base_route, method)
|
433
|
+
end
|
413
434
|
|
414
435
|
self.request.params.merge!(HashUtils.strhash(packet[:vars]))
|
415
|
-
self.request.route_spec = packet[:data][:route_spec] if packet[:data]
|
436
|
+
self.request.route_spec = packet[:data][:route_spec] if packet[:data]
|
416
437
|
self.request.restful = packet[:data][:restful] if packet[:data]
|
417
438
|
|
418
439
|
controller_block
|
metadata
CHANGED
@@ -1,46 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pakyow-core
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 2
|
10
|
+
version: 0.7.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Bryan Powell
|
9
14
|
- Bret Young
|
10
15
|
autorequire:
|
11
16
|
bindir: pakyow-core/bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2012-02-29 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: rack
|
17
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
25
|
none: false
|
19
|
-
requirements:
|
26
|
+
requirements:
|
20
27
|
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 9
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
version: "1.3"
|
23
34
|
type: :runtime
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
27
37
|
name: shoulda
|
28
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
40
|
none: false
|
30
|
-
requirements:
|
41
|
+
requirements:
|
31
42
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 21
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 11
|
48
|
+
version: "2.11"
|
34
49
|
type: :development
|
35
|
-
|
36
|
-
version_requirements: *70284532261660
|
50
|
+
version_requirements: *id002
|
37
51
|
description: pakyow-core
|
38
52
|
email: bryan@metabahn.com
|
39
|
-
executables:
|
53
|
+
executables:
|
40
54
|
- pakyow
|
41
55
|
extensions: []
|
56
|
+
|
42
57
|
extra_rdoc_files: []
|
43
|
-
|
58
|
+
|
59
|
+
files:
|
44
60
|
- pakyow-core/CHANGES
|
45
61
|
- pakyow-core/README
|
46
62
|
- pakyow-core/MIT-LICENSE
|
@@ -82,27 +98,38 @@ files:
|
|
82
98
|
- pakyow-core/bin/pakyow
|
83
99
|
homepage: http://pakyow.com
|
84
100
|
licenses: []
|
101
|
+
|
85
102
|
post_install_message:
|
86
103
|
rdoc_options: []
|
87
|
-
|
104
|
+
|
105
|
+
require_paths:
|
88
106
|
- pakyow-core/lib
|
89
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
108
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 57
|
113
|
+
segments:
|
114
|
+
- 1
|
115
|
+
- 8
|
116
|
+
- 7
|
94
117
|
version: 1.8.7
|
95
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
119
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
version: "0"
|
101
127
|
requirements: []
|
128
|
+
|
102
129
|
rubyforge_project: pakyow-core
|
103
|
-
rubygems_version: 1.8.
|
130
|
+
rubygems_version: 1.8.11
|
104
131
|
signing_key:
|
105
132
|
specification_version: 3
|
106
133
|
summary: pakyow-core
|
107
134
|
test_files: []
|
108
|
-
|
135
|
+
|