merb-core 1.0 → 1.0.1
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.
- data/Rakefile +8 -0
- data/lib/merb-core/controller/template.rb +3 -2
- data/lib/merb-core/core_ext/kernel.rb +59 -5
- data/lib/merb-core/dispatch/router.rb +19 -19
- data/lib/merb-core/version.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -187,6 +187,8 @@ def setup_specs(name, spec_cmd='spec', run_opts = "-c")
|
|
187
187
|
except += Dir["spec/**/memcache*_spec.rb"] if ENV['MEMCACHED'] == 'no'
|
188
188
|
|
189
189
|
public_globs = Dir["#{Dir.pwd}/spec/public/**/*_spec.rb"].reject{|file| file.include?('/gems/')}
|
190
|
+
public_globs_10 =
|
191
|
+
Dir["#{Dir.pwd}/spec10/public/**/*_spec.rb"].reject{|file| file.include?('/gems/')}
|
190
192
|
|
191
193
|
private_globs = Dir["#{Dir.pwd}/spec/private/**/*_spec.rb"]
|
192
194
|
|
@@ -197,6 +199,12 @@ def setup_specs(name, spec_cmd='spec', run_opts = "-c")
|
|
197
199
|
run_specs(globs, spec_cmd, ENV['RSPEC_OPTS'] || run_opts, except)
|
198
200
|
end
|
199
201
|
|
202
|
+
task "specs:oneoh" do
|
203
|
+
require "lib/merb-core/test/run_specs"
|
204
|
+
globs = public_globs_10
|
205
|
+
run_specs(globs, spec_cmd, ENV['RSPEC_OPTS'] || run_opts, except)
|
206
|
+
end
|
207
|
+
|
200
208
|
desc "Run private specs (#{name})"
|
201
209
|
task "specs:#{name}:private" do
|
202
210
|
require "lib/merb-core/test/run_specs"
|
@@ -129,9 +129,10 @@ module Merb::Template
|
|
129
129
|
full_file_path = File.expand_path(io.path)
|
130
130
|
engine_neutral_path = full_file_path.gsub(/\.[^\.]*$/, "")
|
131
131
|
|
132
|
-
SUPPORTED_LOCALS_LIST[engine_neutral_path] |= locals
|
132
|
+
local_list = (SUPPORTED_LOCALS_LIST[engine_neutral_path] |= locals)
|
133
133
|
ret = METHOD_LIST[engine_neutral_path] =
|
134
|
-
engine_for(full_file_path).compile_template(io,
|
134
|
+
engine_for(full_file_path).compile_template(io,
|
135
|
+
template_name(full_file_path), local_list, mod)
|
135
136
|
|
136
137
|
io.close
|
137
138
|
ret
|
@@ -34,7 +34,7 @@ module Kernel
|
|
34
34
|
|
35
35
|
new_dep
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# Loads the given string as a gem. Execution is deferred until
|
39
39
|
# after the logger has been instantiated and the framework directory
|
40
40
|
# structure is defined.
|
@@ -49,16 +49,70 @@ module Kernel
|
|
49
49
|
# If the last argument is a Hash, extract the :immediate option,
|
50
50
|
# forcing a dependency to load immediately.
|
51
51
|
#
|
52
|
+
# ==== Options
|
53
|
+
#
|
54
|
+
# :immediate when true, gem is loaded immediately even if framework is not yet ready.
|
55
|
+
# :require_as file name to require for this gem.
|
56
|
+
#
|
57
|
+
# See examples below.
|
58
|
+
#
|
59
|
+
# ==== Notes
|
60
|
+
#
|
61
|
+
# If block is given, it is called after require is called. If you use a block to
|
62
|
+
# require multiple files, require first using :require_as option and the rest
|
63
|
+
# in the block.
|
64
|
+
#
|
65
|
+
# ==== Examples
|
66
|
+
#
|
67
|
+
# Usage scenario is typically one of the following:
|
68
|
+
#
|
69
|
+
# 1. Gem name and loaded file names are the same (ex.: amqp gem uses amqp.rb).
|
70
|
+
# In this case no extra options needed.
|
71
|
+
#
|
72
|
+
# dependency "amqp"
|
73
|
+
#
|
74
|
+
# 2. Gem name is different from the file needs to be required
|
75
|
+
# (ex.: ParseTree gem uses parse_tree.rb as main file).
|
76
|
+
#
|
77
|
+
# dependency "ParseTree", :require_as => "parse_tree"
|
78
|
+
#
|
79
|
+
# 3. You need to require a number of files from the library explicitly
|
80
|
+
# (ex.: cherry pick features from xmpp4r). Pass an array to :require_as.
|
81
|
+
#
|
82
|
+
# dependency "xmpp4r", :require_as => %w(xmpp4r/client xmpp4r/sasl xmpp4r/vcard)
|
83
|
+
#
|
84
|
+
# 4. You need to require a specific version of the gem.
|
85
|
+
#
|
86
|
+
# dependency "RedCloth", "3.0.4"
|
87
|
+
#
|
88
|
+
# 5. You want to load dependency as soon as the method is called.
|
89
|
+
#
|
90
|
+
# dependency "syslog", :immediate => true
|
91
|
+
#
|
92
|
+
# 6. You need to execute some arbitraty code after dependency is loaded:
|
93
|
+
#
|
94
|
+
# dependency "ruby-growl" do
|
95
|
+
# g = Growl.new "localhost", "ruby-growl",
|
96
|
+
# ["ruby-growl Notification"]
|
97
|
+
# g.notify "ruby-growl Notification", "Ruby-Growl is set up",
|
98
|
+
# "Ruby-Growl is set up"
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# When specifying a gem version to use, you can use the same syntax RubyGems
|
102
|
+
# support, for instance, >= 3.0.2 or >~ 1.2.
|
103
|
+
#
|
104
|
+
# See rubygems.org/read/chapter/16 for a complete reference.
|
105
|
+
#
|
52
106
|
# ==== Returns
|
53
107
|
# Gem::Dependency:: The dependency information.
|
54
108
|
#
|
55
109
|
# :api: public
|
56
|
-
def dependency(name, *
|
57
|
-
immediate =
|
110
|
+
def dependency(name, *opts, &blk)
|
111
|
+
immediate = opts.last.delete(:immediate) if opts.last.is_a?(Hash)
|
58
112
|
if immediate || Merb::BootLoader.finished?(Merb::BootLoader::Dependencies)
|
59
|
-
load_dependency(name, *
|
113
|
+
load_dependency(name, *opts, &blk)
|
60
114
|
else
|
61
|
-
track_dependency(name, *
|
115
|
+
track_dependency(name, *opts, &blk)
|
62
116
|
end
|
63
117
|
end
|
64
118
|
|
@@ -37,14 +37,14 @@ module Merb
|
|
37
37
|
class << self
|
38
38
|
# An array containing all the application routes in order of
|
39
39
|
# priority.
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# :api: private
|
42
42
|
attr_accessor :routes
|
43
43
|
|
44
44
|
# A hash containing all the named application routes. The names
|
45
45
|
# are absolute (as in, all routes named in a namespace will
|
46
46
|
# contain the name of the namespace).
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# :api: private
|
49
49
|
attr_accessor :named_routes
|
50
50
|
|
@@ -57,7 +57,7 @@ module Merb
|
|
57
57
|
# end
|
58
58
|
#
|
59
59
|
# The show comment route will have a key of ["User", "Comment"]
|
60
|
-
#
|
60
|
+
#
|
61
61
|
# :api: private
|
62
62
|
attr_accessor :resource_routes
|
63
63
|
|
@@ -73,13 +73,13 @@ module Merb
|
|
73
73
|
# It is important to note that this attribute must be set before any
|
74
74
|
# routes are defined in order for the behavior to be applied to the
|
75
75
|
# routes.
|
76
|
-
#
|
76
|
+
#
|
77
77
|
# :api: plugin
|
78
78
|
attr_accessor :root_behavior
|
79
79
|
|
80
80
|
# A block that will be run around route matching. This block must yield
|
81
81
|
# in order for the actual matching to happen.
|
82
|
-
#
|
82
|
+
#
|
83
83
|
# :api: plugin
|
84
84
|
attr_accessor :around_match
|
85
85
|
|
@@ -98,7 +98,7 @@ module Merb
|
|
98
98
|
# ==== Returns
|
99
99
|
# Merb::Router::
|
100
100
|
# Returns self to allow chaining of methods.
|
101
|
-
#
|
101
|
+
#
|
102
102
|
# :api: public
|
103
103
|
def prepare(first = [], last = [], &block)
|
104
104
|
@routes = []
|
@@ -216,7 +216,7 @@ module Merb
|
|
216
216
|
# end
|
217
217
|
#
|
218
218
|
# url(:articles, 2008, 10, "test_article")
|
219
|
-
#
|
219
|
+
#
|
220
220
|
# :api: plugin
|
221
221
|
def url(name, *args)
|
222
222
|
if name.is_a?(Route)
|
@@ -250,7 +250,7 @@ module Merb
|
|
250
250
|
#
|
251
251
|
# ==== Returns
|
252
252
|
# String:: The generated URL
|
253
|
-
#
|
253
|
+
#
|
254
254
|
# :api: plugin
|
255
255
|
def resource(*args)
|
256
256
|
defaults = args.pop
|
@@ -289,23 +289,23 @@ module Merb
|
|
289
289
|
# nil
|
290
290
|
#
|
291
291
|
# ==== Example
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
292
|
+
# Merb::Router.extensions do
|
293
|
+
# def domain(name, domain, options={}, &block)
|
294
|
+
# match(:domain => domain).namespace(name, :path => nil, &block)
|
295
|
+
# end
|
295
296
|
# end
|
296
|
-
# end
|
297
297
|
#
|
298
298
|
# In this case, a method 'domain' will be available to the route builder
|
299
299
|
# which will create namespaces around domains instead of path prefixes.
|
300
300
|
#
|
301
301
|
# This can then be used as follows.
|
302
302
|
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
#
|
303
|
+
# Merb::Router.prepare do
|
304
|
+
# domain(:admin, "my-admin.com") do
|
305
|
+
# # ... routes come here ...
|
306
|
+
# end
|
306
307
|
# end
|
307
|
-
#
|
308
|
-
# ---
|
308
|
+
#
|
309
309
|
# :api: public
|
310
310
|
def extensions(&block)
|
311
311
|
Router::Behavior.class_eval(&block)
|
@@ -314,7 +314,7 @@ module Merb
|
|
314
314
|
private
|
315
315
|
|
316
316
|
# Compiles the routes and creates the +match+ method.
|
317
|
-
#
|
317
|
+
#
|
318
318
|
# :api: private
|
319
319
|
def compile
|
320
320
|
if routes.any?
|
@@ -326,7 +326,7 @@ module Merb
|
|
326
326
|
|
327
327
|
# Generates the method for evaluation defining a +match+ method to match
|
328
328
|
# a request with the defined routes.
|
329
|
-
#
|
329
|
+
#
|
330
330
|
# :api: private
|
331
331
|
def compiled_statement
|
332
332
|
@compiler_mutex.synchronize do
|
data/lib/merb-core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-18 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|