public
Description: Merb More: The Full Stack. Take what you need; leave what you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-more.git
Search Repo:
Merge branch 'master' of git@github.com:wycats/merb-more
mattetti (author)
Fri May 09 18:43:31 -0700 2008
commit  a59a3f43f63f7eaf13bcc9ecd15e2749b4fd0a4a
tree    5f9609e6242b1c61cd013a4c66603d2926c7ebd6
parent  1b2868d91c76928c4a487454622fedeff9b43d5b parent  f70ea831e25a8f20bd286df58eedb19762521ac0
...
1
 
2
3
4
...
13
14
15
 
...
 
1
2
3
4
...
13
14
15
16
0
@@ -1,4 +1,4 @@
0
-test_log
0
+ytest_log
0
 pkg
0
 pkg/*
0
 */pkg/*
0
@@ -13,4 +13,5 @@
0
 bundle
0
 lib/merb-more.rb
0
 *.DS_Store
0
+TAGS
...
1
2
3
4
 
5
6
7
 
8
9
10
...
54
55
56
57
58
59
60
61
62
63
...
65
66
67
 
 
 
68
69
70
71
 
 
72
73
74
...
1
2
3
 
4
5
6
 
7
8
9
10
...
54
55
56
 
 
 
57
58
59
60
...
62
63
64
65
66
67
68
69
 
 
70
71
72
73
74
0
@@ -1,10 +1,10 @@
0
 ## THESE ARE CRUCIAL
0
 module Merb
0
   # Set this to the version of merb-core that you are building against/for
0
- VERSION = "0.9.2"
0
+ VERSION = "0.9.4"
0
 
0
   # Set this to the version of merb-more you plan to release
0
- MORE_VERSION = "0.9.2"
0
+ MORE_VERSION = "0.9.4"
0
 end
0
 
0
 require "rake/clean"
0
@@ -54,9 +54,6 @@
0
 
0
 SUDO = windows ? "" : "sudo"
0
 
0
-# desc "Installs Merb More."
0
-# task :default => :install
0
-
0
 Rake::GemPackageTask.new(merb_more_spec) do |package|
0
   package.gem_spec = merb_more_spec
0
 end
0
0
@@ -65,10 +62,13 @@
0
   package.gem_spec = merb_spec
0
 end
0
 
0
+gem_home = ENV['GEM_HOME'] ? "GEM_HOME=#{ENV['GEM_HOME']}" : ""
0
+install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
0
+
0
 desc "Install it all"
0
 task :install => [:install_gems, :package] do
0
- sh %{#{SUDO} gem install --local pkg/merb-more-#{Merb::MORE_VERSION}.gem --no-update-sources}
0
- sh %{#{SUDO} gem install --local pkg/merb-#{Merb::MORE_VERSION}.gem --no-update-sources}
0
+ sh %{#{SUDO} gem install #{install_home} --local pkg/merb-more-#{Merb::MORE_VERSION}.gem --no-update-sources}
0
+ sh %{#{SUDO} gem install #{install_home} --local pkg/merb-#{Merb::MORE_VERSION}.gem --no-update-sources}
0
 end
0
 
0
 desc "Build the merb-more gems"
...
3
4
5
6
 
7
8
9
...
20
21
22
23
24
 
 
25
26
27
28
29
30
...
31
32
33
 
 
34
35
 
36
37
38
39
40
41
42
 
43
44
 
45
...
3
4
5
 
6
7
8
9
...
20
21
22
 
 
23
24
25
26
27
28
29
30
...
31
32
33
34
35
36
 
37
38
39
40
41
42
43
 
44
45
 
46
47
0
@@ -3,7 +3,7 @@
0
 
0
 PLUGIN = "merb-action-args"
0
 NAME = "merb-action-args"
0
-VERSION = "0.9.2"
0
+VERSION = "0.9.4"
0
 AUTHOR = "Yehuda Katz"
0
 EMAIL = "ykatz@engineyard.com"
0
 HOMEPAGE = "http://merb-plugins.rubyforge.org/merb-haml/"
0
@@ -20,8 +20,8 @@
0
   s.author = AUTHOR
0
   s.email = EMAIL
0
   s.homepage = HOMEPAGE
0
- s.add_dependency('merb-core', '>= 0.9.2')
0
- s.add_dependency('ruby2ruby', '>= 1.1.8')
0
+ s.add_dependency('merb-core', '>= 0.9.4')
0
+ s.add_dependency('ruby2ruby', '>= 1.1.8')
0
   s.require_path = 'lib'
0
   s.autorequire = PLUGIN
0
   s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
0
0
0
0
@@ -31,16 +31,18 @@
0
   pkg.gem_spec = spec
0
 end
0
 
0
+install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
0
+
0
 task :install => [:package] do
0
- sh %{sudo gem install pkg/#{NAME}-#{VERSION} --no-update-sources}
0
+ sh %{sudo gem install #{install_home} pkg/#{NAME}-#{VERSION} --no-update-sources}
0
 end
0
 
0
 namespace :jruby do
0
 
0
   desc "Run :package and install the resulting .gem with jruby"
0
   task :install => :package do
0
- sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
+ sh %{#{SUDO} jruby -S gem install #{install_home} pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
   end
0
-
0
+
0
 end
...
3
4
5
6
 
7
8
9
...
20
21
22
23
 
24
25
26
...
40
41
42
43
 
44
...
3
4
5
 
6
7
8
9
...
20
21
22
 
23
24
25
26
...
40
41
42
 
43
44
0
@@ -3,7 +3,7 @@
0
 
0
 PLUGIN = "merb-assets"
0
 NAME = "merb-assets"
0
-VERSION = "0.9.2"
0
+VERSION = "0.9.4"
0
 AUTHOR = "Ezra Zygmuntowicz"
0
 EMAIL = "ez@engineyard.com"
0
 HOMEPAGE = "http://merb-plugins.rubyforge.org/merb-assets/"
0
@@ -20,7 +20,7 @@
0
   s.author = AUTHOR
0
   s.email = EMAIL
0
   s.homepage = HOMEPAGE
0
- s.add_dependency('merb-core', '>= 0.9.2')
0
+ s.add_dependency('merb-core', '>= 0.9.4')
0
   s.require_path = 'lib'
0
   s.autorequire = PLUGIN
0
   s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
0
@@ -40,6 +40,6 @@
0
   task :install => :package do
0
     sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
   end
0
-
0
+
0
 end
...
42
43
44
45
 
46
47
48
49
50
...
97
98
99
 
 
 
 
100
101
 
 
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
104
105
106
...
146
147
148
149
150
 
 
 
 
 
 
 
151
152
 
 
 
 
 
153
154
155
156
...
165
166
167
 
168
 
169
170
171
...
42
43
44
 
45
46
47
48
49
50
...
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
...
179
180
181
 
 
182
183
184
185
186
187
188
189
 
190
191
192
193
194
195
196
197
198
...
207
208
209
210
211
212
213
214
215
0
@@ -42,7 +42,7 @@
0
       # # => "public/javascripts/dingo.js"
0
       def asset_path(asset_type, filename, local_path = false)
0
         filename = filename.to_s
0
- if filename !~ /#{'\\' + ASSET_FILE_EXTENSIONS[asset_type]}\Z/
0
+ if filename !~ /#{'\\' + ASSET_FILE_EXTENSIONS[asset_type]}\Z/ && filename.index('?').nil?
0
           filename << ASSET_FILE_EXTENSIONS[asset_type]
0
         end
0
         if filename !~ %r{^https?://}
0
0
0
@@ -97,9 +97,42 @@
0
     
0
     # An abstract class for bundling text assets into single files.
0
     class AbstractAssetBundler
0
+
0
+ class_inheritable_array :cached_bundles
0
+ self.cached_bundles ||= []
0
+
0
       class << self
0
         
0
+ # Mark a bundle as cached.
0
+ #
0
         # ==== Parameters
0
+ # name<~to_s>:: Name of the bundle
0
+ #
0
+ def cache_bundle(name)
0
+ cached_bundles.push(name.to_s)
0
+ end
0
+
0
+ # Purge a bundle from the cache.
0
+ #
0
+ # ==== Parameters
0
+ # name<~to_s>:: Name of the bundle
0
+ #
0
+ def purge_bundle(name)
0
+ cached_bundles.delete(name.to_s)
0
+ end
0
+
0
+ # Test if a bundle has been cached.
0
+ #
0
+ # ==== Parameters
0
+ # name<~to_s>:: Name of the bundle
0
+ #
0
+ # ==== Returns
0
+ # Boolean:: Whether the bundle has been cached or not.
0
+ def cached_bundle?(name)
0
+ cached_bundles.include?(name.to_s)
0
+ end
0
+
0
+ # ==== Parameters
0
         # &block:: A block to add as a post-bundle callback.
0
         #
0
         # ==== Examples
0
0
@@ -146,10 +179,19 @@
0
       # ==== Returns
0
       # Symbol:: Name of the bundle.
0
       def bundle!
0
- # TODO: Move this file check out into an in-memory cache. Also, push it out to the helper level so we don't have to create the helper object.
0
- unless File.exist?(@bundle_filename)
0
+ # TODO: push it out to the helper level so we don't have to create the helper object.
0
+ unless self.class.cached_bundle?(@bundle_name)
0
+ # skip regeneration of new bundled files - preventing multiple merb apps stepping on eachother
0
+ # file needs to be older than 60 seconds to be regenerated
0
+ if File.exist?(@bundle_filename) && File.mtime(@bundle_filename) >= Time.now - 60
0
+ return @bundle_name # serve the old file for now - to be regenerated later
0
+ end
0
           bundle_files(@bundle_filename, *@files)
0
- self.class.callbacks.each { |c| c.call(@bundle_filename) }
0
+ if File.exist?(@bundle_filename)
0
+ self.class.callbacks.each { |c| c.call(@bundle_filename) }
0
+ Merb.logger.info("Assets: bundled :#{@bundle_name} into #{File.basename(@bundle_filename)}")
0
+ self.class.cache_bundle(@bundle_name)
0
+ end
0
         end
0
         return @bundle_name
0
       end
0
0
@@ -165,7 +207,9 @@
0
       # *files<String>:: Filenames to be bundled.
0
       def bundle_files(filename, *files)
0
         File.open(filename, "w") do |f|
0
+ f.flock(File::LOCK_EX)
0
           files.each { |file| f.puts(File.read(file)) }
0
+ f.flock(File::LOCK_UN)
0
         end
0
       end
0
       
...
7
8
9
 
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
12
13
...
265
266
267
268
 
269
270
271
...
287
288
289
290
 
291
292
293
...
296
297
298
 
 
 
 
299
300
301
...
314
315
316
317
318
 
 
 
 
 
 
 
 
319
320
321
...
327
328
329
 
 
 
 
 
 
330
331
332
...
341
342
343
344
345
 
 
 
 
 
 
 
 
346
347
348
...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
306
307
308
 
309
310
311
312
...
328
329
330
 
331
332
333
334
...
337
338
339
340
341
342
343
344
345
346
...
359
360
361
 
 
362
363
364
365
366
367
368
369
370
371
372
...
378
379
380
381
382
383
384
385
386
387
388
389
...
398
399
400
 
 
401
402
403
404
405
406
407
408
409
410
411
0
@@ -7,7 +7,48 @@
0
     # Merb provides views with convenience methods for links images and other
0
     # assets.
0
 
0
+
0
     # ==== Parameters
0
+ # none
0
+ #
0
+ # ==== Returns
0
+ # html<String>
0
+ #
0
+ # ==== Examples
0
+ # We want all possible matches in the FileSys up to the action name
0
+ # Given: controller_name = "namespace/controller"
0
+ # action_name = "action"
0
+ # If all files are present should generate link/script tags for:
0
+ # namespace.(css|js)
0
+ # namespace/controller.(css|js)
0
+ # namespace/controller/action.(css|js)
0
+ #
0
+ def auto_link
0
+ html = ""
0
+ prefix = ""
0
+ (controller_name / action_name).split("/").each do |path|
0
+ path = prefix + path
0
+
0
+ css_path = path + ".css"
0
+ if File.exists? Merb.root / "public" / "stylesheets" / css_path
0
+ html << %{<link rel="stylesheet" type="text/css" href="/stylesheets/#{css_path}" /> }
0
+ end
0
+
0
+ js_path = path + ".js"
0
+ if File.exists? Merb.root / "public" / "javascripts" / js_path
0
+ html << %{<script type="text/javascript" language="javascript" src="/javascripts/#{js_path}"></script>}
0
+ end
0
+
0
+ #Update the prefix for the next iteration
0
+ prefix += path / ""
0
+ end
0
+
0
+ #Return the generated HTML
0
+ html
0
+ end
0
+
0
+
0
+ # ==== Parameters
0
     # name<~to_s>:: The text of the link.
0
     # url<~to_s>:: The URL to link to. Defaults to an empty string.
0
     # opts<Hash>:: Additional HTML options for the link.
0
@@ -265,7 +306,7 @@
0
     #
0
     def require_js(*js)
0
       @required_js ||= []
0
- @required_js |= js
0
+ @required_js << js
0
     end
0
     
0
     # The require_css method can be used to require any CSS file anywhere in
0
@@ -287,7 +328,7 @@
0
     #
0
     def require_css(*css)
0
       @required_css ||= []
0
- @required_css |= css
0
+ @required_css << css
0
     end
0
     
0
     # A method used in the layout of an application to create +<script>+ tags
0
@@ -296,6 +337,10 @@
0
     #
0
     # ==== Parameters
0
     # options<Hash>:: Options to pass to js_include_tag.
0
+ #
0
+ # ==== Options
0
+ # :bundle<~to_s>::
0
+ # The name of the bundle the scripts should be combined into.
0
     #
0
     # ==== Returns
0
     # String:: The JavaScript tag.
0
@@ -314,8 +359,14 @@
0
     # # <script src="/javascripts/validation.js" type="text/javascript"></script>
0
     #
0
     def include_required_js(options = {})
0
- return '' if @required_js.nil?
0
- js_include_tag(*(@required_js + [options]))
0
+ return '' if @required_js.nil? || @required_js.empty?
0
+ @required_js.map do |req_js|
0
+ if req_js.last.is_a?(Hash)
0
+ js_include_tag(*(req_js[0..-2] + [options.merge(req_js.last)]))
0
+ else
0
+ js_include_tag(*(req_js + [options]))
0
+ end
0
+ end.join
0
     end
0
     
0
     # A method used in the layout of an application to create +<link>+ tags for
0
@@ -327,6 +378,12 @@
0
     #
0
     # ==== Returns
0
     # String:: The CSS tag.
0
+ #
0
+ # ==== Options
0
+ # :bundle<~to_s>::
0
+ # The name of the bundle the stylesheets should be combined into.
0
+ # :media<~to_s>::
0
+ # The media attribute for the generated link element. Defaults to :all.
0
     #
0
     # ==== Examples
0
     # # my_action.herb has a call to require_css 'style'
0
@@ -341,8 +398,14 @@
0
     # # <link href="/stylesheets/ie-specific.css" media="all" rel="Stylesheet" type="text/css"/>
0
     #
0
     def include_required_css(options = {})
0
- return '' if @required_css.nil?
0
- css_include_tag(*(@required_css + [options]))
0
+ return '' if @required_css.nil? || @required_css.empty?
0
+ @required_css.map do |req_css|
0
+ if req_css.last.is_a?(Hash)
0
+ css_include_tag(*(req_css[0..-2] + [options.merge(req_css.last)]))
0
+ else
0
+ css_include_tag(*(req_css + [options]))
0
+ end
0
+ end.join
0
     end
0
     
0
     # ==== Parameters
...
3
4
5
6
 
7
8
9
...
20
21
22
23
 
 
24
25
26
27
28
29
...
30
31
32
 
 
33
34
 
35
36
37
38
39
40
41
 
42
43
 
44
...
3
4
5
 
6
7
8
9
...
20
21
22
 
23
24
25
26
27
28
29
30
...
31
32
33
34
35
36
 
37
38
39
40
41
42
43
 
44
45
 
46
47
0
@@ -3,7 +3,7 @@
0
 
0
 PLUGIN = "merb-builder"
0
 NAME = "merb-builder"
0
-VERSION = "0.9.2"
0
+VERSION = "0.9.4"
0
 AUTHOR = "Jonathan Younger"
0
 EMAIL = "jonathan@daikini.com"
0
 HOMEPAGE = "http://merb-plugins.rubyforge.org/merb-builder/"
0
@@ -20,7 +20,8 @@
0
   s.author = AUTHOR
0
   s.email = EMAIL
0
   s.homepage = HOMEPAGE
0
- s.add_dependency('merb-core', '>= 0.9.2')
0
+ s.add_dependency('merb-core', '>= 0.9.4')
0
+ s.add_dependency('builder', '>= 2.0.0')
0
   s.require_path = 'lib'
0
   s.autorequire = PLUGIN
0
   s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
0
0
0
0
@@ -30,16 +31,18 @@
0
   pkg.gem_spec = spec
0
 end
0
 
0
+install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
0
+
0
 task :install => [:package] do
0
- sh %{sudo gem install pkg/#{NAME}-#{VERSION} --no-update-sources}
0
+ sh %{sudo gem install #{install_home} pkg/#{NAME}-#{VERSION} --no-update-sources}
0
 end
0
 
0
 namespace :jruby do
0
 
0
   desc "Run :package and install the resulting .gem with jruby"
0
   task :install => :package do
0
- sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
+ sh %{#{SUDO} jruby -S gem install #{install_home} pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
   end
0
-
0
+
0
 end
...
28
29
30
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
33
34
...
28
29
30
 
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
0
@@ -28,7 +28,36 @@
0
       name
0
     end
0
   
0
- module Mixin; end
0
+ module Mixin
0
+ def _builder_buffer(the_binding)
0
+ @_buffer = eval("xml", the_binding, __FILE__, __LINE__)
0
+ end
0
+ # ==== Parameters
0
+ # *args:: Arguments to pass to the block.
0
+ # &block:: The template block to call.
0
+ #
0
+ # ==== Returns
0
+ # String:: The output of the block.
0
+ #
0
+ # ==== Examples
0
+ # Capture being used in a .html.erb page:
0
+ #
0
+ # @foo = capture do
0
+ # xml.instruct!
0
+ # xml.foo do
0
+ # xml.bar "baz"
0
+ # end
0
+ # xml.target!
0
+ # end
0
+ def capture_builder(*args, &block)
0
+ block.call(*args)
0
+ end
0
+
0
+ def concat_builder(string, binding)
0
+ _builder_buffer(binding) << string
0
+ end
0
+
0
+ end
0
     Merb::Template.register_extensions(self, %w[builder])
0
   end
0
 end
...
33
34
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
0
@@ -33,5 +33,25 @@
0
     end
0
     c.body.should == xml.target!
0
   end
0
+
0
+ it "should capture_builder properly" do
0
+ c = dispatch_to(CaptureBuilder, :index, :format => "xml")
0
+ xml = ::Builder::XmlMarkup.new :indent => 4
0
+ xml.instruct!
0
+ xml.comment! "I would not say such things if I were you"
0
+ xml.node 'Capture'
0
+
0
+ c.body.should == xml.target!
0
+ end
0
+
0
+ it "should concat_builder properly" do
0
+ c = dispatch_to(ConcatBuilder, :index, :format => "xml")
0
+ xml = ::Builder::XmlMarkup.new :indent => 4
0
+ xml.instruct!
0
+ xml.node 'Concat'
0
+
0
+ c.body.should == xml.target!.chomp
0
+ end
0
+
0
 end
...
21
22
23
 
 
 
 
 
 
 
 
 
...
21
22
23
24
25
26
27
28
29
30
31
32
0
@@ -21,4 +21,13 @@
0
 
0
 class CaptureBuilder < BuilderController
0
 end
0
+
0
+module Merb::ConcatBuilderHelper
0
+ def concatter(&blk)
0
+ concat("<node>Concat</node>", blk.binding)
0
+ end
0
+end
0
+
0
+class ConcatBuilder < BuilderController
0
+end
...
 
 
 
 
 
...
1
2
3
4
5
0
@@ -1 +1,6 @@
0
+xml.instruct!
0
+@foo = capture do
0
+ xml.comment!('I would not say such things if I were you')
0
+end
0
+xml.node 'Capture'
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+xml.instruct!
0
+concatter do
0
+ xml.comment!('I would not do that if I were you')
0
+end
...
5
6
7
8
 
9
10
11
...
22
23
24
25
 
26
27
28
29
30
31
...
63
64
65
 
 
66
67
 
68
69
70
71
72
73
74
 
75
76
 
77
...
5
6
7
 
8
9
10
11
...
22
23
24
 
25
26
27
28
29
30
31
...
63
64
65
66
67
68
 
69
70
71
72
73
74
75
 
76
77
 
78
79
0
@@ -5,7 +5,7 @@
0
 
0
 PLUGIN = "merb-cache"
0
 NAME = "merb-cache"
0
-MERB_CACHE_VERSION = Merb::MORE_VERSION rescue "0.9.2"
0
+MERB_CACHE_VERSION = Merb::MORE_VERSION rescue "0.9.4"
0
 AUTHOR = "Alex Boussinet"
0
 EMAIL = "alex.boussinet@gmail.com"
0
 HOMEPAGE = "http://www.merbivore.com"
0
@@ -22,7 +22,7 @@
0
   s.author = AUTHOR
0
   s.email = EMAIL
0
   s.homepage = HOMEPAGE
0
- s.add_dependency('merb-core', '>= 0.9.2')
0
+ s.add_dependency('merb-core', '>= 0.9.4')
0
   s.require_path = 'lib'
0
   s.autorequire = PLUGIN
0
   s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
0
0
0
0
@@ -63,16 +63,18 @@
0
   pkg.gem_spec = spec
0
 end
0
 
0
+install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
0
+
0
 task :install => [:package] do
0
- sh %{sudo gem install pkg/#{NAME}-#{MERB_CACHE_VERSION} --no-update-sources}
0
+ sh %{sudo gem install #{install_home} pkg/#{NAME}-#{MERB_CACHE_VERSION} --no-update-sources}
0
 end
0
 
0
 namespace :jruby do
0
 
0
   desc "Run :package and install the resulting .gem with jruby"
0
   task :install => :package do
0
- sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
+ sh %{#{SUDO} jruby -S gem install #{install_home} pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
0
   end
0
-
0
+
0
 end
...
33
34
35
36
 
37
38
39
...
44
45
46
 
 
47
48
49
50
...
54
55
56
 
57
58
59
 
 
60
61
62
63
64
65
...
64
65
66
67
 
 
 
 
 
68
 
 
69
 
 
 
70
71
72
73
74
75
76
 
 
77
78
79
80
81
...
106
107
108
 
109
 
110
111
112
113
114
115
116
 
 
 
 
117
118
119
...
33
34
35
 
36
37
38
39
...
44
45
46
47
48
49
50
51
52
...
56
57
58
59
60
61
 
62
63
64
65
66
67
68
69
...
68
69
70
 
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 
89
90
91
92
93
94
95
...
120
121
122
123
124
125
126
127
128
129
130
131
 
132
133
134
135
136
137
138
0
@@ -33,7 +33,7 @@
0
       before(:cache_page_before)
0
       after(:cache_page_after)
0
     end
0
- pages.each do |action, from_now|
0
+ pages.each do |action, from_now|
0
       _pages = Merb::Cache.cached_pages[controller_name] ||= {}
0
       _pages[action] = [from_now, 0]
0
     end
0
@@ -44,6 +44,8 @@
0
 module Merb::Cache::ControllerInstanceMethods
0
   # Mixed in Merb::Controller. Provides methods related to page caching
0
 
0
+ DEFAULT_PAGE_EXTENSION = 'html'
0
+
0
   # Checks whether a cache entry exists
0
   #
0
   # ==== Parameter
0
0
@@ -54,9 +56,11 @@
0
   #
0
   # ==== Example
0
   # cached_page?(:action => 'show', :params => [params[:page]])
0
+ # cached_page?(:action => 'show', :extension => 'js')
0
   def cached_page?(options)
0
     key = Merb::Controller._cache.key_for(options, controller_name, true)
0
- File.file?(Merb::Controller._cache.config[:cache_html_directory] / "#{key}.html")
0
+ extension = options[:extension] || DEFAULT_PAGE_EXTENSION
0
+ File.file?(Merb::Controller._cache.config[:cache_html_directory] / "#{key}.#{extension}")
0
   end
0
 
0
   # Expires the page identified by the key computed after the parameters
0
0
0
0
@@ -64,16 +68,26 @@
0
   # ==== Parameter
0
   # options<String,Hash>:: The options that will be passed to #expire_key_for
0
   #
0
- # ==== Examples
0
+ # ==== Examples (See Merb::Cache#expire_key_for for more options)
0
+ # # will expire path/to/page/cache/news/show/1.html
0
+ # expire_page(:key => url(:news,News.find(1)))
0
+ #
0
+ # # will expire path/to/page/cache/news/show.html
0
   # expire_page(:action => 'show', :controller => 'news')
0
+ #
0
+ # # will expire path/to/page/cache/news/show*
0
   # expire_page(:action => 'show', :match => true)
0
+ #
0
+ # # will expire path/to/page/cache/news/show.js
0
+ # expire_page(:action => 'show', :extension => 'js')
0
   def expire_page(options)