orange 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/orange-core/application.rb +5 -3
- data/lib/orange-core/middleware/globals.rb +1 -1
- data/lib/orange-core/resources/parser.rb +2 -1
- data/lib/orange-core/stack.rb +2 -1
- data/lib/orange-more/administration/plugin.rb +1 -0
- data/lib/orange-more/cloud/resources/cloud_resource.rb +1 -1
- data/lib/orange-more/debugger/middleware/debugger.rb +1 -1
- data/lib/orange-more/debugger/views/debug_bar.haml +6 -6
- data/spec/orange-core/stack_spec.rb +2 -14
- metadata +40 -21
@@ -107,10 +107,11 @@ module Orange
|
|
107
107
|
#
|
108
108
|
# Usually, you'll call this in the rackup file: `run MyApplication.app`
|
109
109
|
def self.app
|
110
|
+
@core ||= Orange::Core.new
|
110
111
|
if @app.instance_of?(Proc)
|
111
|
-
Orange::Stack.new &@app # turn saved proc into a block arg
|
112
|
+
Orange::Stack.new self, @core, &@app # turn saved proc into a block arg
|
112
113
|
else
|
113
|
-
Orange::Stack.new self
|
114
|
+
Orange::Stack.new self, @core
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
@@ -118,7 +119,8 @@ module Orange
|
|
118
119
|
# is called
|
119
120
|
#
|
120
121
|
# Each call to stack overrides the previous one.
|
121
|
-
def self.stack(&block)
|
122
|
+
def self.stack(core = false, &block)
|
123
|
+
@core = core
|
122
124
|
@app = Proc.new # pulls in the block and makes it a proc
|
123
125
|
end
|
124
126
|
end
|
@@ -5,7 +5,7 @@ module Orange::Middleware
|
|
5
5
|
def init(*args)
|
6
6
|
opts = args.extract_options!.with_defaults(:file => "__ORANGE__/config.yml")
|
7
7
|
@file = opts[:file].gsub('__ORANGE__', orange.app_dir)
|
8
|
-
@globals = orange[:parser].yaml(@file)
|
8
|
+
@globals = orange[:parser].yaml(@file) || {}
|
9
9
|
@globals.each{|k,v| orange.options[k] = v }
|
10
10
|
end
|
11
11
|
def packet_call(packet)
|
data/lib/orange-core/stack.rb
CHANGED
@@ -24,8 +24,9 @@ module Orange
|
|
24
24
|
# other stacks that can be used.
|
25
25
|
#
|
26
26
|
# @param [Orange::Application] app_class the class of the main application
|
27
|
+
# @param [Orange::Core] core the orange core
|
27
28
|
# @param [Symbol] prebuilt the optional prebuilt stack, if one isn't passed as block
|
28
|
-
def initialize(app_class = nil, prebuilt = :none, &block)
|
29
|
+
def initialize(app_class = nil, core = false, prebuilt = :none, &block)
|
29
30
|
@build = Rack::Builder.new
|
30
31
|
@core = Orange::Core.new
|
31
32
|
@auto_reload = false
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require (File.join(File.dirname(__FILE__), 'cartons', 'site.rb'))
|
1
2
|
Dir.glob(File.join(File.dirname(__FILE__), 'cartons', '*.rb')).each {|f| require f }
|
2
3
|
Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
|
3
4
|
Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
|
@@ -33,9 +33,9 @@
|
|
33
33
|
- packet.env.sort_by { |k, v| k.to_s }.each do |key, val|
|
34
34
|
- unless key =~ /^orange\./
|
35
35
|
%tr
|
36
|
-
%td #{
|
36
|
+
%td #{h_debug key}
|
37
37
|
%td.code
|
38
|
-
%div #{
|
38
|
+
%div #{h_debug val}
|
39
39
|
%h3#orange-info Orange ENV
|
40
40
|
%table.req
|
41
41
|
%thead
|
@@ -46,9 +46,9 @@
|
|
46
46
|
- packet.env['orange.env'].sort_by { |k, v| k.to_s }.each do |key, val|
|
47
47
|
- if(![:request, :headers, :content].include?(key))
|
48
48
|
%tr
|
49
|
-
%td #{
|
49
|
+
%td #{h_debug key}
|
50
50
|
%td.code
|
51
|
-
%div #{
|
51
|
+
%div #{h_debug val}
|
52
52
|
%h3#orange-info= 'Orange<br /> Response'
|
53
53
|
%table.req
|
54
54
|
%thead
|
@@ -59,6 +59,6 @@
|
|
59
59
|
- packet.env['orange.env'].sort_by { |k, v| k.to_s }.each do |key, val|
|
60
60
|
- if([:headers, :content].include?(key))
|
61
61
|
%tr
|
62
|
-
%td #{
|
62
|
+
%td #{h_debug key}
|
63
63
|
%td.code
|
64
|
-
%div #{
|
64
|
+
%div #{h_debug val}
|
@@ -128,7 +128,7 @@ describe Orange::Stack do
|
|
128
128
|
end
|
129
129
|
x.middlewarez.should have(1).middlewares
|
130
130
|
x.prerouting
|
131
|
-
x.middlewarez.should have(
|
131
|
+
x.middlewarez.should have(9).middlewares
|
132
132
|
x.middlewarez.select{|y| y.instance_of?(Rack::AbstractFormat)}.should_not be_empty
|
133
133
|
x.middlewarez.select{|y| y.instance_of?(Orange::Middleware::RouteSite)}.should_not be_empty
|
134
134
|
end
|
@@ -140,23 +140,11 @@ describe Orange::Stack do
|
|
140
140
|
end
|
141
141
|
x.middlewarez.should have(1).middlewares
|
142
142
|
x.prerouting(:no_abstract_format => true)
|
143
|
-
x.middlewarez.should have(
|
143
|
+
x.middlewarez.should have(8).middlewares
|
144
144
|
x.middlewarez.select{|y| y.instance_of?(Rack::AbstractFormat)}.should be_empty
|
145
145
|
x.middlewarez.select{|y| y.instance_of?(Orange::Middleware::RouteSite)}.should_not be_empty
|
146
146
|
end
|
147
147
|
|
148
|
-
it "should add middleware when calling restful_routing" do
|
149
|
-
x= Orange::Stack.new do
|
150
|
-
no_recapture
|
151
|
-
run MockExitware.new
|
152
|
-
end
|
153
|
-
x.middlewarez.should have(1).middlewares
|
154
|
-
x.restful_routing
|
155
|
-
x.middlewarez.should have(2).middlewares
|
156
|
-
restfuls = x.middlewarez.select{|y| y.instance_of?(Orange::Middleware::RestfulRouter)}
|
157
|
-
restfuls.should_not be_empty
|
158
|
-
restfuls.should have(1).items
|
159
|
-
end
|
160
148
|
|
161
149
|
it "should have not have extra middleware for a default stack" do
|
162
150
|
x= Orange::Stack.new MockApplication
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orange
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- David Haslem
|
@@ -9,49 +14,61 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-09 00:00:00 -05:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rack
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 0
|
30
|
+
- 1
|
23
31
|
version: 1.0.1
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: haml
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 2
|
44
|
+
- 13
|
33
45
|
version: 2.2.13
|
34
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
35
48
|
- !ruby/object:Gem::Dependency
|
36
49
|
name: rspec
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
52
|
requirements:
|
41
53
|
- - ">="
|
42
54
|
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
43
57
|
version: "0"
|
44
|
-
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id003
|
45
60
|
- !ruby/object:Gem::Dependency
|
46
61
|
name: rack-test
|
47
|
-
|
48
|
-
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
64
|
requirements:
|
51
65
|
- - ">="
|
52
66
|
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
53
69
|
version: "0"
|
54
|
-
|
70
|
+
type: :development
|
71
|
+
version_requirements: *id004
|
55
72
|
description: Orange is a Ruby framework for building managed websites with code as simple as Sinatra
|
56
73
|
email: therabidbanana@gmail.com
|
57
74
|
executables: []
|
@@ -210,18 +227,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
227
|
requirements:
|
211
228
|
- - ">="
|
212
229
|
- !ruby/object:Gem::Version
|
230
|
+
segments:
|
231
|
+
- 0
|
213
232
|
version: "0"
|
214
|
-
version:
|
215
233
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
234
|
requirements:
|
217
235
|
- - ">="
|
218
236
|
- !ruby/object:Gem::Version
|
237
|
+
segments:
|
238
|
+
- 0
|
219
239
|
version: "0"
|
220
|
-
version:
|
221
240
|
requirements: []
|
222
241
|
|
223
242
|
rubyforge_project:
|
224
|
-
rubygems_version: 1.3.
|
243
|
+
rubygems_version: 1.3.6
|
225
244
|
signing_key:
|
226
245
|
specification_version: 3
|
227
246
|
summary: Middle ground between Sinatra and Rails
|