strelka 0.0.1.pre.185 → 0.0.1.pre.187
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +52 -23
- data/Rakefile +0 -13
- data/lib/strelka/app/auth.rb +14 -3
- data/lib/strelka/app/errors.rb +7 -0
- data/lib/strelka/app/filters.rb +13 -0
- data/lib/strelka/app/negotiation.rb +8 -0
- data/lib/strelka/app/plugins.rb +1 -6
- data/lib/strelka/app/restresources.rb +17 -5
- data/lib/strelka/app/sessions.rb +8 -0
- data/lib/strelka/app/templating.rb +8 -0
- data/lib/strelka/mixins.rb +1 -0
- data/spec/strelka/app/auth_spec.rb +16 -0
- data/spec/strelka/app/errors_spec.rb +9 -0
- data/spec/strelka/app/filters_spec.rb +12 -0
- data/spec/strelka/app/negotiation_spec.rb +12 -0
- data/spec/strelka/app/parameters_spec.rb +8 -0
- data/spec/strelka/app/restresources_spec.rb +23 -0
- data/spec/strelka/app/sessions_spec.rb +6 -0
- data/spec/strelka/app/templating_spec.rb +11 -0
- data/spec/strelka/mixins_spec.rb +113 -0
- data.tar.gz.sig +0 -0
- metadata +35 -115
- metadata.gz.sig +0 -0
data/ChangeLog
CHANGED
@@ -1,5 +1,30 @@
|
|
1
|
+
2012-04-11 Mahlon E. Smith <mahlon@martini.nu>
|
2
|
+
|
3
|
+
* lib/strelka/app/auth.rb, lib/strelka/app/errors.rb,
|
4
|
+
lib/strelka/app/filters.rb, lib/strelka/app/negotiation.rb,
|
5
|
+
lib/strelka/app/plugins.rb, lib/strelka/app/restresources.rb,
|
6
|
+
lib/strelka/app/sessions.rb, lib/strelka/app/templating.rb,
|
7
|
+
lib/strelka/mixins.rb, spec/strelka/app/auth_spec.rb,
|
8
|
+
spec/strelka/app/errors_spec.rb, spec/strelka/app/filters_spec.rb,
|
9
|
+
spec/strelka/app/negotiation_spec.rb,
|
10
|
+
spec/strelka/app/parameters_spec.rb,
|
11
|
+
spec/strelka/app/restresources_spec.rb,
|
12
|
+
spec/strelka/app/sessions_spec.rb,
|
13
|
+
spec/strelka/app/templating_spec.rb, spec/strelka/mixins_spec.rb:
|
14
|
+
Add inheritance support to plugins.
|
15
|
+
|
16
|
+
Currently, this is done manually by defining an inherited hook in
|
17
|
+
each plugin's ClassMethods, but we'll likely try to find some way to
|
18
|
+
automate it or at least refacter it into a declarative or two.
|
19
|
+
[4217deb1952c] [tip]
|
20
|
+
|
1
21
|
2012-04-11 Michael Granger <ged@FaerieMUD.org>
|
2
22
|
|
23
|
+
* IDEAS.rdoc, Manifest.txt, bin/leash, bin/strelka, lib/strelka.rb,
|
24
|
+
lib/strelka/app.rb, lib/strelka/constants.rb:
|
25
|
+
Rename bin/leash to bin/strelka and allow overriding the DATADIR.
|
26
|
+
[195b7937f42a]
|
27
|
+
|
3
28
|
* Rakefile, lib/strelka/app.rb, lib/strelka/app/auth.rb,
|
4
29
|
lib/strelka/app/errors.rb, lib/strelka/app/filters.rb,
|
5
30
|
lib/strelka/app/negotiation.rb, lib/strelka/app/parameters.rb,
|
@@ -10,21 +35,23 @@
|
|
10
35
|
spec/strelka/app/restresources_spec.rb,
|
11
36
|
spec/strelka/app/routing_spec.rb:
|
12
37
|
Fixing specs broken by the deferred plugins change. Ugh, I suck.
|
13
|
-
[d762ebcce3a6]
|
38
|
+
[d762ebcce3a6]
|
14
39
|
|
15
40
|
* Merging with ssh://hg@deveiate.org/Strelka@8f1c27819e70
|
16
41
|
[5fcd76455aad]
|
17
42
|
|
18
|
-
* Manifest.txt:
|
19
|
-
Updating the manifest
|
20
|
-
[35165b3d01cc]
|
21
|
-
|
22
43
|
2012-04-11 Mahlon E. Smith <mahlon@martini.nu>
|
23
44
|
|
24
45
|
* lib/strelka/session/default.rb:
|
25
46
|
Use the built-in securerandom method for obtaining a hex value.
|
26
47
|
[8f1c27819e70]
|
27
48
|
|
49
|
+
2012-04-11 Michael Granger <ged@FaerieMUD.org>
|
50
|
+
|
51
|
+
* Manifest.txt:
|
52
|
+
Updating the manifest
|
53
|
+
[35165b3d01cc]
|
54
|
+
|
28
55
|
2012-04-10 Michael Granger <ged@FaerieMUD.org>
|
29
56
|
|
30
57
|
* lib/strelka/app/auth.rb, lib/strelka/app/parameters.rb,
|
@@ -35,7 +62,7 @@
|
|
35
62
|
spec/strelka/paramvalidator_spec.rb:
|
36
63
|
Rework the paramvalidator and parameters plugin to allow per-request
|
37
64
|
overrides
|
38
|
-
[e7393474988b]
|
65
|
+
[e7393474988b] [github/master]
|
39
66
|
|
40
67
|
* bin/leash, examples/apps/auth-demo, examples/apps/auth-demo2,
|
41
68
|
examples/apps/sessions-demo, examples/auth-demo.rb, examples/auth-
|
@@ -95,22 +122,6 @@
|
|
95
122
|
Add the ChangeLog to the ignorefile
|
96
123
|
[cc8c30d38652]
|
97
124
|
|
98
|
-
* lib/strelka/app/templating.rb:
|
99
|
-
Add API docs to the :templating plugin module
|
100
|
-
[3c160d996320]
|
101
|
-
|
102
|
-
* README.rdoc:
|
103
|
-
Add more URLs
|
104
|
-
[060962556bd1]
|
105
|
-
|
106
|
-
* Rakefile:
|
107
|
-
Oops. Fix typo
|
108
|
-
[5a8aa207860b]
|
109
|
-
|
110
|
-
* .rvm.gems, Rakefile:
|
111
|
-
Update dependencies
|
112
|
-
[787e523777d1]
|
113
|
-
|
114
125
|
2012-04-06 Mahlon E. Smith <mahlon@martini.nu>
|
115
126
|
|
116
127
|
* lib/strelka/app/sessions.rb, lib/strelka/cookie.rb,
|
@@ -128,6 +139,24 @@
|
|
128
139
|
Add a persistent DB session store, using sequel.
|
129
140
|
[99f3c3f5d6ca]
|
130
141
|
|
142
|
+
2012-04-06 Michael Granger <ged@FaerieMUD.org>
|
143
|
+
|
144
|
+
* lib/strelka/app/templating.rb:
|
145
|
+
Add API docs to the :templating plugin module
|
146
|
+
[3c160d996320]
|
147
|
+
|
148
|
+
* README.rdoc:
|
149
|
+
Add more URLs
|
150
|
+
[060962556bd1]
|
151
|
+
|
152
|
+
* Rakefile:
|
153
|
+
Oops. Fix typo
|
154
|
+
[5a8aa207860b]
|
155
|
+
|
156
|
+
* .rvm.gems, Rakefile:
|
157
|
+
Update dependencies
|
158
|
+
[787e523777d1]
|
159
|
+
|
131
160
|
2012-04-04 Michael Granger <ged@FaerieMUD.org>
|
132
161
|
|
133
162
|
* manual/src/tutorial.page:
|
@@ -183,7 +212,7 @@
|
|
183
212
|
* examples/auth-demo.rb, lib/strelka/app/auth.rb,
|
184
213
|
lib/strelka/authprovider.rb, spec/strelka/app/auth_spec.rb:
|
185
214
|
Merging with accidentally-committed auth patch on Github
|
186
|
-
[3025b5711352]
|
215
|
+
[3025b5711352]
|
187
216
|
|
188
217
|
2012-03-20 Michael Granger <ged@FaerieMUD.org>
|
189
218
|
|
data/Rakefile
CHANGED
@@ -49,19 +49,6 @@ ENV['VERSION'] ||= hoespec.spec.version.to_s
|
|
49
49
|
# Ensure the specs pass before checking in
|
50
50
|
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
51
51
|
|
52
|
-
### Make the ChangeLog update if the repo has changed since it was last built
|
53
|
-
file '.hg/branch'
|
54
|
-
file 'ChangeLog' => '.hg/branch' do |task|
|
55
|
-
$stderr.puts "Updating the changelog..."
|
56
|
-
content = make_changelog()
|
57
|
-
File.open( task.name, 'w', 0644 ) do |fh|
|
58
|
-
fh.print( content )
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# Rebuild the ChangeLog immediately before release
|
63
|
-
task :prerelease => 'ChangeLog'
|
64
|
-
|
65
52
|
|
66
53
|
desc "Build a coverage report"
|
67
54
|
task :coverage do
|
data/lib/strelka/app/auth.rb
CHANGED
@@ -253,7 +253,7 @@ module Strelka::App::Auth
|
|
253
253
|
module ClassMethods
|
254
254
|
|
255
255
|
@auth_provider = nil
|
256
|
-
@authz_callback
|
256
|
+
@authz_callback = nil
|
257
257
|
@positive_auth_criteria = {}
|
258
258
|
@negative_auth_criteria = {}
|
259
259
|
|
@@ -262,14 +262,25 @@ module Strelka::App::Auth
|
|
262
262
|
attr_reader :positive_auth_criteria, :negative_auth_criteria
|
263
263
|
|
264
264
|
|
265
|
+
### Extension callback -- add instance variables to extending objects.
|
266
|
+
def inherited( subclass )
|
267
|
+
super
|
268
|
+
subclass.instance_variable_set( :@auth_provider, @auth_provider )
|
269
|
+
subclass.instance_variable_set( :@authz_callback, @authz_callback.dup ) if @authz_callback
|
270
|
+
subclass.instance_variable_set( :@positive_auth_criteria, @positive_auth_criteria.dup )
|
271
|
+
subclass.instance_variable_set( :@negative_auth_criteria, @negative_auth_criteria.dup )
|
272
|
+
end
|
273
|
+
|
274
|
+
|
265
275
|
### Get/set the authentication type.
|
266
276
|
def auth_provider( type=nil )
|
267
277
|
if type
|
268
278
|
@auth_provider = Strelka::AuthProvider.get_subclass( type )
|
269
|
-
elsif type.nil?
|
270
|
-
@auth_provider ||= Strelka::AuthProvider.get_subclass( DEFAULT_AUTH_PROVIDER )
|
271
279
|
end
|
272
280
|
|
281
|
+
Strelka.log.debug "Auth provider %p" % [ @auth_provider ]
|
282
|
+
@auth_provider ||= Strelka::AuthProvider.get_subclass( DEFAULT_AUTH_PROVIDER )
|
283
|
+
Strelka.log.debug "Auth provider %p" % [ @auth_provider ]
|
273
284
|
return @auth_provider
|
274
285
|
end
|
275
286
|
|
data/lib/strelka/app/errors.rb
CHANGED
@@ -53,6 +53,13 @@ module Strelka::App::Errors
|
|
53
53
|
attr_reader :status_handlers
|
54
54
|
|
55
55
|
|
56
|
+
### Extension callback -- add instance variables to extending objects.
|
57
|
+
def inherited( subclass )
|
58
|
+
super
|
59
|
+
subclass.instance_variable_set( :@status_handlers, @status_handlers.dup )
|
60
|
+
end
|
61
|
+
|
62
|
+
|
56
63
|
### Register a callback for responses whose status code is within the specified
|
57
64
|
### +range+. Range can either be a single integer HTTP status code, or a Range
|
58
65
|
### of the same (e.g., 400..499) for all statuses with that range.
|
data/lib/strelka/app/filters.rb
CHANGED
@@ -23,6 +23,19 @@ module Strelka::App::Filters
|
|
23
23
|
attr_reader :filters
|
24
24
|
|
25
25
|
|
26
|
+
### Extension callback -- add instance variables to extending objects.
|
27
|
+
def inherited( subclass )
|
28
|
+
super
|
29
|
+
|
30
|
+
sub_filters = {
|
31
|
+
:request => self.filters[:request].dup,
|
32
|
+
:response => self.filters[:response].dup,
|
33
|
+
:both => self.filters[:both].dup
|
34
|
+
}
|
35
|
+
subclass.instance_variable_set( :@filters, sub_filters )
|
36
|
+
end
|
37
|
+
|
38
|
+
|
26
39
|
### Get/set the router class to use for mapping requests to handlers to +newclass.
|
27
40
|
def filter( which=:both, &block )
|
28
41
|
which = which.to_sym
|
@@ -58,6 +58,14 @@ module Strelka::App::Negotiation
|
|
58
58
|
attr_reader :transform_names
|
59
59
|
|
60
60
|
|
61
|
+
### Extension callback -- add instance variables to extending objects.
|
62
|
+
def inherited( subclass )
|
63
|
+
super
|
64
|
+
subclass.instance_variable_set( :@content_type_transforms, @content_type_transforms.dup )
|
65
|
+
subclass.instance_variable_set( :@transform_names, @transform_names.dup )
|
66
|
+
end
|
67
|
+
|
68
|
+
|
61
69
|
### Define a new media-type associated with the specified +name+ and +mimetype+. Responses
|
62
70
|
### whose requests accept content of the given +mimetype+ will pass their response to the
|
63
71
|
### specified +transform_block+, which should re-write the response's entity body if it can
|
data/lib/strelka/app/plugins.rb
CHANGED
@@ -203,12 +203,7 @@ class Strelka::App
|
|
203
203
|
ival = cm_mod.instance_variable_get( ivar )
|
204
204
|
|
205
205
|
# Don't duplicate modules/classes or immediates
|
206
|
-
|
207
|
-
when Module, TrueClass, FalseClass, Symbol, Numeric, NilClass
|
208
|
-
instance_variable_set( ivar, ival )
|
209
|
-
else
|
210
|
-
instance_variable_set( ivar, ival.dup )
|
211
|
-
end
|
206
|
+
instance_variable_set( ivar, Strelka::DataUtilities.deep_copy(ival) )
|
212
207
|
end
|
213
208
|
end
|
214
209
|
end
|
@@ -70,13 +70,13 @@ module Strelka::App::RestResources
|
|
70
70
|
@resource_verbs = Hash.new {|h,k| h[k] = Set.new }
|
71
71
|
|
72
72
|
# Global options
|
73
|
-
@
|
73
|
+
@service_options = DEFAULTS.dup
|
74
74
|
|
75
75
|
# The list of REST routes assigned to Sequel::Model objects
|
76
76
|
attr_reader :resource_verbs
|
77
77
|
|
78
|
-
# The global
|
79
|
-
attr_reader :
|
78
|
+
# The global service options hash
|
79
|
+
attr_reader :service_options
|
80
80
|
|
81
81
|
|
82
82
|
### Extension callback -- overridden to also install dependencies.
|
@@ -96,9 +96,21 @@ module Strelka::App::RestResources
|
|
96
96
|
end
|
97
97
|
|
98
98
|
|
99
|
+
### Inheritance callback -- copy plugin data to inheriting subclasses.
|
100
|
+
def inherited( subclass )
|
101
|
+
super
|
102
|
+
|
103
|
+
verbs_copy = Strelka::DataUtilities.deep_copy( self.resource_verbs )
|
104
|
+
subclass.instance_variable_set( :@resource_verbs, verbs_copy )
|
105
|
+
|
106
|
+
opts_copy = Strelka::DataUtilities.deep_copy( self.service_options )
|
107
|
+
subclass.instance_variable_set( :@service_options, opts_copy )
|
108
|
+
end
|
109
|
+
|
110
|
+
|
99
111
|
### Set the prefix for all following resource routes to +route+.
|
100
112
|
def resource_prefix( route )
|
101
|
-
self.
|
113
|
+
self.service_options[ :prefix ] = route
|
102
114
|
end
|
103
115
|
|
104
116
|
|
@@ -106,7 +118,7 @@ module Strelka::App::RestResources
|
|
106
118
|
### and returns a Sequel::Dataset)
|
107
119
|
def resource( rsrcobj, options={} )
|
108
120
|
Strelka.log.debug "Adding REST resource for %p" % [ rsrcobj ]
|
109
|
-
options = self.
|
121
|
+
options = self.service_options.merge( options )
|
110
122
|
|
111
123
|
# Figure out what the resource name is, and make the route from it
|
112
124
|
name = options[:name] || rsrcobj.implicit_table_name
|
data/lib/strelka/app/sessions.rb
CHANGED
@@ -106,6 +106,14 @@ module Strelka::App::Sessions
|
|
106
106
|
# application
|
107
107
|
@session_namespace = nil
|
108
108
|
|
109
|
+
|
110
|
+
### Extension callback -- add instance variables to extending objects.
|
111
|
+
def inherited( subclass )
|
112
|
+
super
|
113
|
+
subclass.instance_variable_set( :@session_namespace, @session_namespace )
|
114
|
+
end
|
115
|
+
|
116
|
+
|
109
117
|
### Get/set the key that will determine which namespace in the session object
|
110
118
|
### the application will see.
|
111
119
|
def session_namespace( new_namespace=nil )
|
@@ -105,6 +105,14 @@ module Strelka::App::Templating
|
|
105
105
|
attr_accessor :layout_template
|
106
106
|
|
107
107
|
|
108
|
+
### Extension callback -- add instance variables to extending objects.
|
109
|
+
def inherited( subclass )
|
110
|
+
super
|
111
|
+
subclass.instance_variable_set( :@template_map, @template_map.dup )
|
112
|
+
subclass.instance_variable_set( :@layout_template, @layout_template.dup )
|
113
|
+
end
|
114
|
+
|
115
|
+
|
108
116
|
### Get/set the templates declared for the App.
|
109
117
|
def templates( newhash=nil )
|
110
118
|
if newhash
|
data/lib/strelka/mixins.rb
CHANGED
@@ -116,6 +116,22 @@ describe Strelka::App::Auth do
|
|
116
116
|
req.authenticated_user.should == 'anonymous'
|
117
117
|
end
|
118
118
|
|
119
|
+
it "has its auth config inherited by subclasses" do
|
120
|
+
@app.class_eval do
|
121
|
+
auth_provider :hostaccess
|
122
|
+
authz_callback { true }
|
123
|
+
end
|
124
|
+
subclass = Class.new( @app )
|
125
|
+
|
126
|
+
subclass.auth_provider.should == @app.auth_provider
|
127
|
+
subclass.authz_callback.should == @app.authz_callback
|
128
|
+
subclass.positive_auth_criteria.should == @app.positive_auth_criteria
|
129
|
+
subclass.positive_auth_criteria.should_not equal( @app.positive_auth_criteria )
|
130
|
+
subclass.negative_auth_criteria.should == @app.negative_auth_criteria
|
131
|
+
subclass.negative_auth_criteria.should_not equal( @app.negative_auth_criteria )
|
132
|
+
end
|
133
|
+
|
134
|
+
|
119
135
|
context "that has negative auth criteria for the root" do
|
120
136
|
|
121
137
|
before( :each ) do
|
@@ -50,6 +50,15 @@ describe Strelka::App::Errors do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
it "has its auth config inherited by subclasses" do
|
54
|
+
@app.on_status HTTP::OK do
|
55
|
+
'blap'
|
56
|
+
end
|
57
|
+
subclass = Class.new( @app )
|
58
|
+
subclass.status_handlers.should == @app.status_handlers
|
59
|
+
subclass.status_handlers.should_not equal( @app.status_handlers )
|
60
|
+
end
|
61
|
+
|
53
62
|
it "doesn't alter normal responses" do
|
54
63
|
@app.class_eval do
|
55
64
|
get do |req|
|
@@ -52,6 +52,18 @@ describe Strelka::App::Filters do
|
|
52
52
|
[ @app, @app.filters.object_id * 2 ]
|
53
53
|
end
|
54
54
|
|
55
|
+
it "has its filters config inherited by subclasses" do
|
56
|
+
@app.filter :request do |req|
|
57
|
+
req.notes['blap'] = true
|
58
|
+
end
|
59
|
+
subclass = Class.new( @app )
|
60
|
+
|
61
|
+
subclass.filters.should == @app.filters
|
62
|
+
subclass.filters.should_not equal( @app.filters )
|
63
|
+
subclass.filters[:request].should_not equal( @app.filters[:request] )
|
64
|
+
subclass.filters[:response].should_not equal( @app.filters[:response] )
|
65
|
+
subclass.filters[:both].should_not equal( @app.filters[:both] )
|
66
|
+
end
|
55
67
|
|
56
68
|
it "has a Hash of filters" do
|
57
69
|
@app.filters.should be_a( Hash )
|
@@ -54,6 +54,18 @@ describe Strelka::App::Negotiation do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
+
it "has its config inherited by subclasses" do
|
58
|
+
@app.add_content_type :text, 'text/plain' do
|
59
|
+
"It's all text now, baby"
|
60
|
+
end
|
61
|
+
subclass = Class.new( @app )
|
62
|
+
|
63
|
+
subclass.transform_names.should == @app.transform_names
|
64
|
+
subclass.transform_names.should_not equal( @app.transform_names )
|
65
|
+
subclass.content_type_transforms.should == @app.content_type_transforms
|
66
|
+
subclass.content_type_transforms.should_not equal( @app.content_type_transforms )
|
67
|
+
end
|
68
|
+
|
57
69
|
it "gets requests that have been extended with content-negotiation" do
|
58
70
|
req = @request_factory.get( '/service/user/estark' )
|
59
71
|
@app.new.handle( req )
|
@@ -52,6 +52,14 @@ describe Strelka::App::Parameters do
|
|
52
52
|
@app = nil
|
53
53
|
end
|
54
54
|
|
55
|
+
it "has its config inherited by subclasses" do
|
56
|
+
@app.param :string
|
57
|
+
subclass = Class.new( @app )
|
58
|
+
|
59
|
+
subclass.paramvalidator.param_names.should == @app.paramvalidator.param_names
|
60
|
+
subclass.paramvalidator.should_not equal( @app.paramvalidator )
|
61
|
+
end
|
62
|
+
|
55
63
|
it "has a ParamValidator" do
|
56
64
|
@app.paramvalidator.should be_a( Strelka::ParamValidator )
|
57
65
|
end
|
@@ -393,6 +393,29 @@ describe Strelka::App::RestResources do
|
|
393
393
|
|
394
394
|
end # route behaviors
|
395
395
|
|
396
|
+
|
397
|
+
describe "supports inheritance" do
|
398
|
+
|
399
|
+
subject do
|
400
|
+
@app.resource( Mongrel2::Config::Server )
|
401
|
+
Class.new( @app )
|
402
|
+
end
|
403
|
+
|
404
|
+
|
405
|
+
it "has its config inherited by subclass" do
|
406
|
+
subject.service_options.should == @app.service_options
|
407
|
+
subject.service_options.should_not be( @app.service_options )
|
408
|
+
end
|
409
|
+
|
410
|
+
it "has its metadata inherited by subclasses" do
|
411
|
+
subject.resource_verbs.should have( 1 ).member
|
412
|
+
subject.resource_verbs.should include( 'servers' )
|
413
|
+
subject.resource_verbs[ 'servers' ].
|
414
|
+
should include( :OPTIONS, :GET, :HEAD, :POST, :PUT, :DELETE )
|
415
|
+
end
|
416
|
+
|
417
|
+
end # supports inheritance
|
418
|
+
|
396
419
|
end
|
397
420
|
|
398
421
|
end
|
@@ -88,6 +88,12 @@ describe Strelka::App::Sessions do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
it "has its config inherited by subclasses" do
|
92
|
+
@app.session_namespace :indian_gurbles
|
93
|
+
subclass = Class.new( @app )
|
94
|
+
|
95
|
+
subclass.session_namespace.should == @app.session_namespace
|
96
|
+
end
|
91
97
|
|
92
98
|
it "has a default session key that's the same as its appid" do
|
93
99
|
@app.session_namespace.should == @app.default_appid
|
@@ -54,6 +54,17 @@ describe Strelka::App::Templating do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
+
it "has its config inherited by subclasses" do
|
58
|
+
@app.templates :text => '/tmp/blorp'
|
59
|
+
@app.layout 'layout.tmpl'
|
60
|
+
subclass = Class.new( @app )
|
61
|
+
|
62
|
+
subclass.template_map.should == @app.template_map
|
63
|
+
subclass.template_map.should_not equal( @app.template_map )
|
64
|
+
subclass.layout_template.should == @app.layout_template
|
65
|
+
subclass.layout_template.should_not equal( @app.layout_template )
|
66
|
+
end
|
67
|
+
|
57
68
|
it "has a Hash of templates" do
|
58
69
|
@app.templates.should be_a( Hash )
|
59
70
|
end
|
data/spec/strelka/mixins_spec.rb
CHANGED
@@ -8,6 +8,7 @@ BEGIN {
|
|
8
8
|
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
9
9
|
}
|
10
10
|
|
11
|
+
require 'set'
|
11
12
|
require 'rspec'
|
12
13
|
require 'spec/lib/helpers'
|
13
14
|
require 'strelka/mixins'
|
@@ -219,5 +220,117 @@ describe Strelka, "mixins" do
|
|
219
220
|
|
220
221
|
end
|
221
222
|
|
223
|
+
|
224
|
+
describe Strelka::DataUtilities do
|
225
|
+
|
226
|
+
it "doesn't try to dup immediate objects" do
|
227
|
+
Strelka::DataUtilities.deep_copy( nil ).should be( nil )
|
228
|
+
Strelka::DataUtilities.deep_copy( 112 ).should be( 112 )
|
229
|
+
Strelka::DataUtilities.deep_copy( true ).should be( true )
|
230
|
+
Strelka::DataUtilities.deep_copy( false ).should be( false )
|
231
|
+
Strelka::DataUtilities.deep_copy( :a_symbol ).should be( :a_symbol )
|
232
|
+
end
|
233
|
+
|
234
|
+
it "makes distinct copies of arrays and their members" do
|
235
|
+
original = [ 'foom', Set.new([ 1,2 ]), :a_symbol ]
|
236
|
+
|
237
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
238
|
+
|
239
|
+
copy.should == original
|
240
|
+
copy.should_not be( original )
|
241
|
+
copy[0].should == original[0]
|
242
|
+
copy[0].should_not be( original[0] )
|
243
|
+
copy[1].should == original[1]
|
244
|
+
copy[1].should_not be( original[1] )
|
245
|
+
copy[2].should == original[2]
|
246
|
+
copy[2].should be( original[2] ) # Immediate
|
247
|
+
end
|
248
|
+
|
249
|
+
it "makes recursive copies of deeply-nested Arrays" do
|
250
|
+
original = [ 1, [ 2, 3, [4], 5], 6, [7, [8, 9], 0] ]
|
251
|
+
|
252
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
253
|
+
|
254
|
+
copy.should == original
|
255
|
+
copy.should_not be( original )
|
256
|
+
copy[1].should_not be( original[1] )
|
257
|
+
copy[1][2].should_not be( original[1][2] )
|
258
|
+
copy[3].should_not be( original[3] )
|
259
|
+
copy[3][1].should_not be( original[3][1] )
|
260
|
+
end
|
261
|
+
|
262
|
+
it "makes distinct copies of Hashes and their members" do
|
263
|
+
original = {
|
264
|
+
:a => 1,
|
265
|
+
'b' => 2,
|
266
|
+
3 => 'c',
|
267
|
+
}
|
268
|
+
|
269
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
270
|
+
|
271
|
+
copy.should == original
|
272
|
+
copy.should_not be( original )
|
273
|
+
copy[:a].should == 1
|
274
|
+
copy.key( 2 ).should == 'b'
|
275
|
+
copy.key( 2 ).should_not be( original.key(2) )
|
276
|
+
copy[3].should == 'c'
|
277
|
+
copy[3].should_not be( original[3] )
|
278
|
+
end
|
279
|
+
|
280
|
+
it "makes distinct copies of deeply-nested Hashes" do
|
281
|
+
original = {
|
282
|
+
:a => {
|
283
|
+
:b => {
|
284
|
+
:c => 'd',
|
285
|
+
:e => 'f',
|
286
|
+
},
|
287
|
+
:g => 'h',
|
288
|
+
},
|
289
|
+
:i => 'j',
|
290
|
+
}
|
291
|
+
|
292
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
293
|
+
|
294
|
+
copy.should == original
|
295
|
+
copy[:a][:b][:c].should == 'd'
|
296
|
+
copy[:a][:b][:c].should_not be( original[:a][:b][:c] )
|
297
|
+
copy[:a][:b][:e].should == 'f'
|
298
|
+
copy[:a][:b][:e].should_not be( original[:a][:b][:e] )
|
299
|
+
copy[:a][:g].should == 'h'
|
300
|
+
copy[:a][:g].should_not be( original[:a][:g] )
|
301
|
+
copy[:i].should == 'j'
|
302
|
+
copy[:i].should_not be( original[:i] )
|
303
|
+
end
|
304
|
+
|
305
|
+
it "copies the default proc of copied Hashes" do
|
306
|
+
original = Hash.new {|h,k| h[ k ] = Set.new }
|
307
|
+
|
308
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
309
|
+
|
310
|
+
copy.default_proc.should == original.default_proc
|
311
|
+
end
|
312
|
+
|
313
|
+
it "preserves taintedness of copied objects" do
|
314
|
+
original = Object.new
|
315
|
+
original.taint
|
316
|
+
|
317
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
318
|
+
|
319
|
+
copy.should_not be( original )
|
320
|
+
copy.should be_tainted()
|
321
|
+
end
|
322
|
+
|
323
|
+
it "preserves frozen-ness of copied objects" do
|
324
|
+
original = Object.new
|
325
|
+
original.freeze
|
326
|
+
|
327
|
+
copy = Strelka::DataUtilities.deep_copy( original )
|
328
|
+
|
329
|
+
copy.should_not be( original )
|
330
|
+
copy.should be_frozen()
|
331
|
+
end
|
332
|
+
|
333
|
+
end
|
334
|
+
|
222
335
|
end
|
223
336
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strelka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.pre.
|
4
|
+
version: 0.0.1.pre.187
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -36,11 +36,11 @@ cert_chain:
|
|
36
36
|
YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
|
37
37
|
Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
|
38
38
|
cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
39
|
-
date: 2012-04-
|
39
|
+
date: 2012-04-12 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: trollop
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirement: &70305412738440 !ruby/object:Gem::Requirement
|
44
44
|
none: false
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
@@ -48,15 +48,10 @@ dependencies:
|
|
48
48
|
version: '1.16'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
|
-
version_requirements:
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '1.16'
|
51
|
+
version_requirements: *70305412738440
|
57
52
|
- !ruby/object:Gem::Dependency
|
58
53
|
name: highline
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
54
|
+
requirement: &70305412737980 !ruby/object:Gem::Requirement
|
60
55
|
none: false
|
61
56
|
requirements:
|
62
57
|
- - ~>
|
@@ -64,15 +59,10 @@ dependencies:
|
|
64
59
|
version: '1.6'
|
65
60
|
type: :runtime
|
66
61
|
prerelease: false
|
67
|
-
version_requirements:
|
68
|
-
none: false
|
69
|
-
requirements:
|
70
|
-
- - ~>
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '1.6'
|
62
|
+
version_requirements: *70305412737980
|
73
63
|
- !ruby/object:Gem::Dependency
|
74
64
|
name: sysexits
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirement: &70305412737520 !ruby/object:Gem::Requirement
|
76
66
|
none: false
|
77
67
|
requirements:
|
78
68
|
- - ~>
|
@@ -80,15 +70,10 @@ dependencies:
|
|
80
70
|
version: '1.0'
|
81
71
|
type: :runtime
|
82
72
|
prerelease: false
|
83
|
-
version_requirements:
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ~>
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '1.0'
|
73
|
+
version_requirements: *70305412737520
|
89
74
|
- !ruby/object:Gem::Dependency
|
90
75
|
name: formvalidator
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirement: &70305412737060 !ruby/object:Gem::Requirement
|
92
77
|
none: false
|
93
78
|
requirements:
|
94
79
|
- - ~>
|
@@ -96,15 +81,10 @@ dependencies:
|
|
96
81
|
version: '0.1'
|
97
82
|
type: :runtime
|
98
83
|
prerelease: false
|
99
|
-
version_requirements:
|
100
|
-
none: false
|
101
|
-
requirements:
|
102
|
-
- - ~>
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0.1'
|
84
|
+
version_requirements: *70305412737060
|
105
85
|
- !ruby/object:Gem::Dependency
|
106
86
|
name: inversion
|
107
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirement: &70305412736540 !ruby/object:Gem::Requirement
|
108
88
|
none: false
|
109
89
|
requirements:
|
110
90
|
- - ~>
|
@@ -112,15 +92,10 @@ dependencies:
|
|
112
92
|
version: '0.8'
|
113
93
|
type: :runtime
|
114
94
|
prerelease: false
|
115
|
-
version_requirements:
|
116
|
-
none: false
|
117
|
-
requirements:
|
118
|
-
- - ~>
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: '0.8'
|
95
|
+
version_requirements: *70305412736540
|
121
96
|
- !ruby/object:Gem::Dependency
|
122
97
|
name: mongrel2
|
123
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirement: &70305412736020 !ruby/object:Gem::Requirement
|
124
99
|
none: false
|
125
100
|
requirements:
|
126
101
|
- - ~>
|
@@ -128,15 +103,10 @@ dependencies:
|
|
128
103
|
version: '0.20'
|
129
104
|
type: :runtime
|
130
105
|
prerelease: false
|
131
|
-
version_requirements:
|
132
|
-
none: false
|
133
|
-
requirements:
|
134
|
-
- - ~>
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '0.20'
|
106
|
+
version_requirements: *70305412736020
|
137
107
|
- !ruby/object:Gem::Dependency
|
138
108
|
name: uuidtools
|
139
|
-
requirement: !ruby/object:Gem::Requirement
|
109
|
+
requirement: &70305412735580 !ruby/object:Gem::Requirement
|
140
110
|
none: false
|
141
111
|
requirements:
|
142
112
|
- - ~>
|
@@ -144,15 +114,10 @@ dependencies:
|
|
144
114
|
version: '2.1'
|
145
115
|
type: :runtime
|
146
116
|
prerelease: false
|
147
|
-
version_requirements:
|
148
|
-
none: false
|
149
|
-
requirements:
|
150
|
-
- - ~>
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '2.1'
|
117
|
+
version_requirements: *70305412735580
|
153
118
|
- !ruby/object:Gem::Dependency
|
154
119
|
name: configurability
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirement: &70305412734980 !ruby/object:Gem::Requirement
|
156
121
|
none: false
|
157
122
|
requirements:
|
158
123
|
- - ~>
|
@@ -160,15 +125,10 @@ dependencies:
|
|
160
125
|
version: '1.0'
|
161
126
|
type: :runtime
|
162
127
|
prerelease: false
|
163
|
-
version_requirements:
|
164
|
-
none: false
|
165
|
-
requirements:
|
166
|
-
- - ~>
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: '1.0'
|
128
|
+
version_requirements: *70305412734980
|
169
129
|
- !ruby/object:Gem::Dependency
|
170
130
|
name: pluginfactory
|
171
|
-
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirement: &70305412734060 !ruby/object:Gem::Requirement
|
172
132
|
none: false
|
173
133
|
requirements:
|
174
134
|
- - ~>
|
@@ -176,15 +136,10 @@ dependencies:
|
|
176
136
|
version: '1.0'
|
177
137
|
type: :runtime
|
178
138
|
prerelease: false
|
179
|
-
version_requirements:
|
180
|
-
none: false
|
181
|
-
requirements:
|
182
|
-
- - ~>
|
183
|
-
- !ruby/object:Gem::Version
|
184
|
-
version: '1.0'
|
139
|
+
version_requirements: *70305412734060
|
185
140
|
- !ruby/object:Gem::Dependency
|
186
141
|
name: hoe-mercurial
|
187
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirement: &70305412733240 !ruby/object:Gem::Requirement
|
188
143
|
none: false
|
189
144
|
requirements:
|
190
145
|
- - ~>
|
@@ -192,15 +147,10 @@ dependencies:
|
|
192
147
|
version: 1.4.0
|
193
148
|
type: :development
|
194
149
|
prerelease: false
|
195
|
-
version_requirements:
|
196
|
-
none: false
|
197
|
-
requirements:
|
198
|
-
- - ~>
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: 1.4.0
|
150
|
+
version_requirements: *70305412733240
|
201
151
|
- !ruby/object:Gem::Dependency
|
202
152
|
name: hoe-manualgen
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
153
|
+
requirement: &70305412732720 !ruby/object:Gem::Requirement
|
204
154
|
none: false
|
205
155
|
requirements:
|
206
156
|
- - ~>
|
@@ -208,15 +158,10 @@ dependencies:
|
|
208
158
|
version: 0.3.0
|
209
159
|
type: :development
|
210
160
|
prerelease: false
|
211
|
-
version_requirements:
|
212
|
-
none: false
|
213
|
-
requirements:
|
214
|
-
- - ~>
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: 0.3.0
|
161
|
+
version_requirements: *70305412732720
|
217
162
|
- !ruby/object:Gem::Dependency
|
218
163
|
name: hoe-highline
|
219
|
-
requirement: !ruby/object:Gem::Requirement
|
164
|
+
requirement: &70305412732180 !ruby/object:Gem::Requirement
|
220
165
|
none: false
|
221
166
|
requirements:
|
222
167
|
- - ~>
|
@@ -224,15 +169,10 @@ dependencies:
|
|
224
169
|
version: 0.1.0
|
225
170
|
type: :development
|
226
171
|
prerelease: false
|
227
|
-
version_requirements:
|
228
|
-
none: false
|
229
|
-
requirements:
|
230
|
-
- - ~>
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: 0.1.0
|
172
|
+
version_requirements: *70305412732180
|
233
173
|
- !ruby/object:Gem::Dependency
|
234
174
|
name: rdoc
|
235
|
-
requirement: !ruby/object:Gem::Requirement
|
175
|
+
requirement: &70305412731580 !ruby/object:Gem::Requirement
|
236
176
|
none: false
|
237
177
|
requirements:
|
238
178
|
- - ~>
|
@@ -240,15 +180,10 @@ dependencies:
|
|
240
180
|
version: '3.10'
|
241
181
|
type: :development
|
242
182
|
prerelease: false
|
243
|
-
version_requirements:
|
244
|
-
none: false
|
245
|
-
requirements:
|
246
|
-
- - ~>
|
247
|
-
- !ruby/object:Gem::Version
|
248
|
-
version: '3.10'
|
183
|
+
version_requirements: *70305412731580
|
249
184
|
- !ruby/object:Gem::Dependency
|
250
185
|
name: hoe-deveiate
|
251
|
-
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirement: &70305412730800 !ruby/object:Gem::Requirement
|
252
187
|
none: false
|
253
188
|
requirements:
|
254
189
|
- - ~>
|
@@ -256,15 +191,10 @@ dependencies:
|
|
256
191
|
version: '0.1'
|
257
192
|
type: :development
|
258
193
|
prerelease: false
|
259
|
-
version_requirements:
|
260
|
-
none: false
|
261
|
-
requirements:
|
262
|
-
- - ~>
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
version: '0.1'
|
194
|
+
version_requirements: *70305412730800
|
265
195
|
- !ruby/object:Gem::Dependency
|
266
196
|
name: simplecov
|
267
|
-
requirement: !ruby/object:Gem::Requirement
|
197
|
+
requirement: &70305412745860 !ruby/object:Gem::Requirement
|
268
198
|
none: false
|
269
199
|
requirements:
|
270
200
|
- - ~>
|
@@ -272,15 +202,10 @@ dependencies:
|
|
272
202
|
version: '0.6'
|
273
203
|
type: :development
|
274
204
|
prerelease: false
|
275
|
-
version_requirements:
|
276
|
-
none: false
|
277
|
-
requirements:
|
278
|
-
- - ~>
|
279
|
-
- !ruby/object:Gem::Version
|
280
|
-
version: '0.6'
|
205
|
+
version_requirements: *70305412745860
|
281
206
|
- !ruby/object:Gem::Dependency
|
282
207
|
name: hoe
|
283
|
-
requirement: !ruby/object:Gem::Requirement
|
208
|
+
requirement: &70305412745420 !ruby/object:Gem::Requirement
|
284
209
|
none: false
|
285
210
|
requirements:
|
286
211
|
- - ~>
|
@@ -288,12 +213,7 @@ dependencies:
|
|
288
213
|
version: '3.0'
|
289
214
|
type: :development
|
290
215
|
prerelease: false
|
291
|
-
version_requirements:
|
292
|
-
none: false
|
293
|
-
requirements:
|
294
|
-
- - ~>
|
295
|
-
- !ruby/object:Gem::Version
|
296
|
-
version: '3.0'
|
216
|
+
version_requirements: *70305412745420
|
297
217
|
description: ! 'Strelka is a framework for creating and deploying Mongrel2 web applications
|
298
218
|
|
299
219
|
in Ruby, and for managing a Mongrel2 cluster.
|
@@ -442,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
442
362
|
version: '0'
|
443
363
|
requirements: []
|
444
364
|
rubyforge_project: strelka
|
445
|
-
rubygems_version: 1.8.
|
365
|
+
rubygems_version: 1.8.16
|
446
366
|
signing_key:
|
447
367
|
specification_version: 3
|
448
368
|
summary: Strelka is a framework for creating and deploying Mongrel2 web applications
|
metadata.gz.sig
CHANGED
Binary file
|