mack 0.4.7 → 0.5.0
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/CHANGELOG +21 -2
- data/README +1 -4
- data/bin/mack +2 -2
- data/lib/errors/errors.rb +1 -10
- data/lib/generators/mack_application_generator/manifest.yml +5 -1
- data/lib/generators/mack_application_generator/templates/config/database.yml.template +45 -1
- data/lib/generators/mack_application_generator/templates/test/test_helper.rb.template +1 -1
- data/lib/generators/plugin_generator/templates/vendor/plugins/{<%= @plugin_name %> → %=@plugin_name%}/init.rb.template +0 -0
- data/lib/generators/plugin_generator/templates/vendor/plugins/{<%= @plugin_name %>/lib/<%= @plugin_name %>.rb.template → %=@plugin_name%/lib/%=@plugin_name%.rb.template} +0 -0
- data/lib/generators/plugin_generator/templates/vendor/plugins/{<%= @plugin_name %>/lib/tasks/<%= @plugin_name %>_tasks.rake.template → %=@plugin_name%/lib/tasks/%=@plugin_name%_tasks.rake.template} +0 -0
- data/lib/initialization/configuration.rb +28 -6
- data/lib/initialization/console.rb +2 -0
- data/lib/initialization/initializer.rb +23 -36
- data/lib/initialization/initializers/logging.rb +2 -2
- data/lib/initialization/initializers/orm_support.rb +4 -63
- data/lib/initialization/initializers/plugins.rb +1 -1
- data/lib/initialization/server/simple_server.rb +0 -2
- data/lib/mack.rb +2 -2
- data/lib/mack_tasks.rb +6 -0
- data/lib/rendering/base.rb +1 -1
- data/lib/rendering/classes/action.rb +1 -1
- data/lib/rendering/classes/public.rb +1 -1
- data/lib/rendering/classes/url.rb +1 -0
- data/lib/rendering/classes/xml.rb +1 -1
- data/lib/sea_level/controller_base.rb +19 -10
- data/lib/sea_level/helpers/view_helpers/html_helpers.rb +96 -11
- data/lib/sea_level/helpers/view_helpers/string_helpers.rb +22 -0
- data/lib/sea_level/uploaded_file.rb +1 -0
- data/lib/sea_level/view_binder.rb +14 -11
- data/lib/tasks/cachetastic_tasks.rake +11 -11
- data/lib/tasks/mack_server_tasks.rake +3 -3
- data/lib/tasks/mack_tasks.rake +2 -5
- data/lib/tasks/rake_rules.rake +1 -2
- data/lib/tasks/test_tasks.rake +22 -1
- data/lib/test_extensions/test_case.rb +50 -0
- data/lib/test_extensions/test_helpers.rb +22 -5
- metadata +30 -30
- data/lib/generators/genosaurus_helpers.rb +0 -38
- data/lib/generators/migration_generator/migration_generator.rb +0 -67
- data/lib/generators/migration_generator/templates/db/migrations/<%=@migration_name%>.rb.template +0 -31
- data/lib/generators/model_column.rb +0 -55
- data/lib/generators/model_generator/manifest.yml +0 -11
- data/lib/generators/model_generator/model_generator.rb +0 -93
- data/lib/generators/model_generator/templates/active_record.rb.template +0 -2
- data/lib/generators/model_generator/templates/data_mapper.rb.template +0 -11
- data/lib/generators/model_generator/templates/test.rb.template +0 -9
- data/lib/generators/scaffold_generator/manifest.yml +0 -31
- data/lib/generators/scaffold_generator/scaffold_generator.rb +0 -43
- data/lib/generators/scaffold_generator/templates/generic/app/controllers/controller.rb.template +0 -50
- data/lib/generators/scaffold_generator/templates/generic/app/views/edit.html.erb.template +0 -20
- data/lib/generators/scaffold_generator/templates/generic/app/views/index.html.erb.template +0 -41
- data/lib/generators/scaffold_generator/templates/generic/app/views/new.html.erb.template +0 -19
- data/lib/generators/scaffold_generator/templates/generic/app/views/show.html.erb.template +0 -12
- data/lib/generators/scaffold_generator/templates/no_orm/controller.rb.template +0 -38
- data/lib/generators/scaffold_generator/templates/test.rb.template +0 -9
- data/lib/sea_level/helpers/view_helpers/orm_helpers.rb +0 -87
- data/lib/tasks/db_tasks.rake +0 -94
- data/lib/utils/html.rb +0 -104
@@ -2,8 +2,6 @@ module Mack
|
|
2
2
|
# Even though it's called, SimpleServer, this might be the only server you need to run
|
3
3
|
# a Mack application.
|
4
4
|
#
|
5
|
-
# $ ruby script/server
|
6
|
-
#
|
7
5
|
# This SimpleServer does not use Thin. But does work with anything that Rack has a handler for.
|
8
6
|
class SimpleServer
|
9
7
|
|
data/lib/mack.rb
CHANGED
@@ -113,8 +113,8 @@ module Mack
|
|
113
113
|
if File.extname(env["PATH_INFO"]).blank?
|
114
114
|
env["PATH_INFO"] << ".html"
|
115
115
|
end
|
116
|
-
if File.exists?(File.join(
|
117
|
-
return Rack::File.new(File.join(
|
116
|
+
if File.exists?(File.join(Mack::Configuration.public_directory, env["PATH_INFO"]))
|
117
|
+
return Rack::File.new(File.join(Mack::Configuration.public_directory)).call(env)
|
118
118
|
else
|
119
119
|
raise exception
|
120
120
|
end
|
data/lib/mack_tasks.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'rake/rdoctask'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'application_configuration'
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), "initialization", "configuration.rb")
|
8
|
+
require File.join(File.dirname(__FILE__), "initialization", "initializers", "orm_support.rb")
|
9
|
+
|
4
10
|
# Requires all rake tasks that ship with the Mack framework.
|
5
11
|
[File.join(File.dirname(__FILE__)), File.join(FileUtils.pwd, "lib"), File.join(FileUtils.pwd, "vendor", "plugins")].each do |dir|
|
6
12
|
begin
|
data/lib/rendering/base.rb
CHANGED
@@ -41,7 +41,7 @@ module Mack
|
|
41
41
|
private
|
42
42
|
# Used to render a file from disk.
|
43
43
|
def render_file(f, options = {})
|
44
|
-
options = {:is_partial => false, :ext => ".#{self.params(:format)}.erb", :dir =>
|
44
|
+
options = {:is_partial => false, :ext => ".#{self.params(:format)}.erb", :dir => Mack::Configuration.views_directory}.merge(options)
|
45
45
|
partial = f.to_s
|
46
46
|
parts = partial.split("/")
|
47
47
|
if parts.size == 1
|
@@ -10,7 +10,7 @@ module Mack
|
|
10
10
|
rescue Errno::ENOENT => e
|
11
11
|
begin
|
12
12
|
# If the action doesn't exist on disk, try to render it from the public directory:
|
13
|
-
t = render_file(options[:action], {:dir =>
|
13
|
+
t = render_file(options[:action], {:dir => Mack::Configuration.public_directory, :ext => ".#{params(:format)}", :layout => false}.merge(options))
|
14
14
|
# Because it's being served from public don't wrap a layout around it!
|
15
15
|
# self.controller.instance_variable_get("@render_options").merge!({:layout => false})
|
16
16
|
return t
|
@@ -5,7 +5,7 @@ module Mack
|
|
5
5
|
class Public < Base
|
6
6
|
|
7
7
|
def render
|
8
|
-
render_file(options[:public], {:dir =>
|
8
|
+
render_file(options[:public], {:dir => Mack::Configuration.public_directory, :ext => ".html", :layout => false}.merge(options))
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
@@ -10,7 +10,7 @@ module Mack
|
|
10
10
|
rescue Errno::ENOENT => e
|
11
11
|
begin
|
12
12
|
# If the action doesn't exist on disk, try to render it from the public directory:
|
13
|
-
t = render_file(options[:xml], {:dir =>
|
13
|
+
t = render_file(options[:xml], {:dir => Mack::Configuration.public_directory, :ext => ".xml.erb", :layout => false}.merge(options.merge(:format => :xml)))
|
14
14
|
return t
|
15
15
|
rescue Errno::ENOENT => ex
|
16
16
|
end
|
@@ -77,6 +77,8 @@ module Mack
|
|
77
77
|
# An implicit render will happen if one is not specified in the action.
|
78
78
|
#
|
79
79
|
# Only :action and :text will get layouts wrapped around them.
|
80
|
+
#
|
81
|
+
# You can also specify the response status code as part of the options hash.
|
80
82
|
#
|
81
83
|
# Examples:
|
82
84
|
# class MyAwesomeController < Mack::Controller::Base
|
@@ -85,7 +87,7 @@ module Mack
|
|
85
87
|
# render(:text => "Hello World!")
|
86
88
|
# end
|
87
89
|
#
|
88
|
-
# # This will render
|
90
|
+
# # This will render Mack::Configuration.root/views/my_awesome_controller/foo.html.erb
|
89
91
|
# def show
|
90
92
|
# render(:action => :foo)
|
91
93
|
# end
|
@@ -96,12 +98,12 @@ module Mack
|
|
96
98
|
# render(:action => :foo)
|
97
99
|
# end
|
98
100
|
#
|
99
|
-
# # This will render
|
101
|
+
# # This will render Mack::Configuration.root/views/my_awesome_controller/delete.html.erb
|
100
102
|
# def delete
|
101
103
|
# end
|
102
104
|
#
|
103
105
|
# # This will render the text 'Hello World!' to the screen. Assuming that
|
104
|
-
# # there is no file:
|
106
|
+
# # there is no file: Mack::Configuration.root/views/my_awesome_controller/update.html.erb
|
105
107
|
# # The reason for this is if the view for the action doesn't exist, and the
|
106
108
|
# # last thing returned from the action is a String, that string will be returned.
|
107
109
|
# def update
|
@@ -109,13 +111,13 @@ module Mack
|
|
109
111
|
# end
|
110
112
|
#
|
111
113
|
# # This will raise a Mack::Errors::InvalidRenderType error. Assuming that
|
112
|
-
# # there is no file:
|
114
|
+
# # there is no file: Mack::Configuration.root/views/my_awesome_controller/create.html.erb
|
113
115
|
# def create
|
114
116
|
# @user = User.find(1)
|
115
117
|
# end
|
116
118
|
#
|
117
119
|
# # This will raise a Errno::ENOENT error. Assuming that
|
118
|
-
# # there is no file:
|
120
|
+
# # there is no file: Mack::Configuration.root/views/my_awesome_controller/bar.html.erb
|
119
121
|
# def bar
|
120
122
|
# render(:action => "bar")
|
121
123
|
# end
|
@@ -137,14 +139,14 @@ module Mack
|
|
137
139
|
# end
|
138
140
|
#
|
139
141
|
# # This will render a partial. In this case it will look for:
|
140
|
-
# #
|
142
|
+
# # Mack::Configuration.root/views/my_awesome_controller/_latest_news.html.erb
|
141
143
|
# # Partials do NOT get wrapped in layouts.
|
142
144
|
# def latest_news
|
143
145
|
# render(:partial => :latest_news)
|
144
146
|
# end
|
145
147
|
#
|
146
148
|
# # This will render a partial. In this case it will look for:
|
147
|
-
# #
|
149
|
+
# # Mack::Configuration.root/views/some_other/_old_news.html.erb
|
148
150
|
# # Partials do NOT get wrapped in layouts.
|
149
151
|
# def latest_news
|
150
152
|
# render(:partial => "some_other/old_news")
|
@@ -175,9 +177,16 @@ module Mack
|
|
175
177
|
# def get_index
|
176
178
|
# render(:url => "/")
|
177
179
|
# end
|
180
|
+
#
|
181
|
+
# # This will render 'application/404' and set the response status code to 404
|
182
|
+
# def to_the_unknown
|
183
|
+
# return render(:action => '/application/404', :status => 404)
|
184
|
+
# end
|
185
|
+
#
|
178
186
|
# end
|
179
187
|
def render(options = {:action => self.action_name})
|
180
188
|
raise Mack::Errors::DoubleRender.new if render_performed?
|
189
|
+
response.status = options[:status] unless options[:status].nil?
|
181
190
|
unless options[:action] || options[:text]
|
182
191
|
options = {:layout => false}.merge(options)
|
183
192
|
end
|
@@ -345,11 +354,11 @@ module Mack
|
|
345
354
|
#
|
346
355
|
# Example:
|
347
356
|
# class MyAwesomeController < Mack::Controller::Base
|
348
|
-
# # Sets all actions to use: "#{
|
357
|
+
# # Sets all actions to use: "#{Mack::Configuration.root}/app/views/layouts/dark.html.erb" as they're layout.
|
349
358
|
# layout :dark
|
350
359
|
#
|
351
360
|
# def index
|
352
|
-
# # Sets this action to use: "#{
|
361
|
+
# # Sets this action to use: "#{Mack::Configuration.root}/app/views/layouts/bright.html.erb" as it's layout.
|
353
362
|
# render(:text => "Welcome...", :layout => :bright)
|
354
363
|
# end
|
355
364
|
#
|
@@ -359,7 +368,7 @@ module Mack
|
|
359
368
|
# end
|
360
369
|
# end
|
361
370
|
#
|
362
|
-
# The default layout is "#{
|
371
|
+
# The default layout is "#{Mack::Configuration.root}/app/views/layouts/application.html.erb".
|
363
372
|
#
|
364
373
|
# If a layout is specified, and it doesn't exist a Mack::Errors::UnknownLayout error will be raised.
|
365
374
|
def layout(lay)
|
@@ -2,7 +2,7 @@ module Mack
|
|
2
2
|
module ViewHelpers
|
3
3
|
module HtmlHelpers
|
4
4
|
|
5
|
-
# This is just an alias to
|
5
|
+
# This is just an alias to
|
6
6
|
#
|
7
7
|
# Examples:
|
8
8
|
# <%= link_to("http://www.mackframework.com") %> # => <a href="http://www.mackframework.com">http://www.mackframework.com</a>
|
@@ -17,31 +17,116 @@ module Mack
|
|
17
17
|
# nothing will happen. This is extremely useful for 'delete' type of links.
|
18
18
|
# <%= link_to("Mack", "http://www.mackframework.com", :method => :delete, :confirm => "Are you sure?") %>
|
19
19
|
def link_to(link_text, url = link_text, html_options = {})
|
20
|
-
|
20
|
+
options = {:href => url}.merge(html_options)
|
21
|
+
a(link_text, options)
|
21
22
|
end
|
22
23
|
|
23
|
-
#
|
24
|
+
# Used in views to create href links. It takes link_text, url, and a Hash that gets added
|
25
|
+
# to the href as options.
|
24
26
|
#
|
25
27
|
# Examples:
|
26
|
-
#
|
27
|
-
|
28
|
-
|
28
|
+
# a("http://www.mackframework.com") # => <a href="http://www.mackframework.com">http://www.mackframework.com</a>
|
29
|
+
# a("Mack", :href => "http://www.mackframework.com") # => <a href="http://www.mackframework.com">Mack</a>
|
30
|
+
# a("Mack", :href => "http://www.mackframework.com", :target => "_blank") # => <a href="http://www.mackframework.com" target="_blank">Mack</a>
|
31
|
+
# a("Mack", :href => "http://www.mackframework.com", :target => "_blank", :rel => :nofollow) # => <a href="http://www.mackframework.com" target="_blank" rel="nofollow">Mack</a>
|
32
|
+
# If you pass in :method as an option it will be a JavaScript form that will post to the specified link with the
|
33
|
+
# methd specified.
|
34
|
+
# a("Mack", :href => "http://www.mackframework.com", :method => :delete)
|
35
|
+
# If you use the :method option you can also pass in a :confirm option. The :confirm option will generate a
|
36
|
+
# javascript confirmation window. If 'OK' is selected the the form will submit. If 'cancel' is selected, then
|
37
|
+
# nothing will happen. This is extremely useful for 'delete' type of links.
|
38
|
+
# a("Mack", :href => "http://www.mackframework.com", :method => :delete, :confirm => "Are you sure?")
|
39
|
+
def a(link_text, options = {})
|
40
|
+
options = {:href => link_text}.merge(options)
|
41
|
+
if options[:method]
|
42
|
+
meth = nil
|
43
|
+
confirm = nil
|
44
|
+
|
45
|
+
meth = %{var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var s = document.createElement('input'); s.setAttribute('type', 'hidden'); s.setAttribute('name', '_method'); s.setAttribute('value', '#{options[:method]}'); f.appendChild(s);f.submit()}
|
46
|
+
options.delete(:method)
|
47
|
+
|
48
|
+
if options[:confirm]
|
49
|
+
confirm = %{if (confirm('#{options[:confirm]}'))}
|
50
|
+
options.delete(:confirm)
|
51
|
+
end
|
52
|
+
|
53
|
+
options[:onclick] = (confirm ? (confirm + " { ") : "") << meth << (confirm ? (" } ") : "") << ";return false;"
|
54
|
+
end
|
55
|
+
content_tag(:a, options, link_text)
|
29
56
|
end
|
30
57
|
|
31
|
-
#
|
58
|
+
# Builds an HTML tag.
|
59
|
+
#
|
60
|
+
# Examples:
|
61
|
+
# content_tag(:b) {"hello"} # => <b>hello</b>
|
62
|
+
# content_tag("div", :class => :foo) {"hello world!"} # => <div class="foo">hello world!</div>
|
63
|
+
def content_tag(tag, options = {}, content = nil, &block)
|
64
|
+
if block_given?
|
65
|
+
concat("<#{tag}#{build_options(options)}>\n", block.binding)
|
66
|
+
yield
|
67
|
+
concat("</#{tag}>", block.binding)
|
68
|
+
else
|
69
|
+
"<#{tag}#{build_options(options)}>#{content}</#{tag}>"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Builds an HTML tag with no content.
|
74
|
+
#
|
75
|
+
# Examples:
|
76
|
+
# non_content_tag(:br) # => <br />
|
77
|
+
# non_content_tag(:hr, :width => "100%") # => <hr width="100%" />
|
78
|
+
def non_content_tag(tag, options = {})
|
79
|
+
"<#{tag}#{build_options(options)} />"
|
80
|
+
end
|
81
|
+
|
82
|
+
# Builds a HTML image tag.
|
83
|
+
def img(image_src, options = {})
|
84
|
+
non_content_tag(:img, {:src => image_src}.merge(options))
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
# Wraps an image tag with a link tag.
|
32
89
|
#
|
33
90
|
# Examples:
|
34
91
|
# <%= link_image_to("/images/foo.jpg", "#" %> # => <a href="#"><img src="/images/foo.jpg"></a>
|
35
92
|
def link_image_to(image_url, url, image_options = {}, html_options = {})
|
36
|
-
link_to(
|
93
|
+
link_to(img(image_url, image_options), url, html_options)
|
37
94
|
end
|
38
95
|
|
39
|
-
# A wrapper to Mack::Utils::Html rss method.
|
40
|
-
#
|
41
96
|
# Example:
|
42
97
|
# <%= rss_tag(posts_index_url(:format => :xml)) %>
|
43
98
|
def rss_tag(url)
|
44
|
-
|
99
|
+
"<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"#{url}\">"
|
100
|
+
end
|
101
|
+
|
102
|
+
def form(action, options = {}, &block)
|
103
|
+
options = {:method => :post, :action => action}.merge(options)
|
104
|
+
if options[:id]
|
105
|
+
options = {:class => options[:id]}.merge(options)
|
106
|
+
end
|
107
|
+
if options[:multipart]
|
108
|
+
options = {:enctype => "multipart/form-data"}.merge(options)
|
109
|
+
options.delete(:multipart)
|
110
|
+
end
|
111
|
+
meth = nil
|
112
|
+
unless options[:method] == :get || options[:method] == :post
|
113
|
+
meth = "<input name=\"_method\" type=\"hidden\" value=\"#{options[:method]}\" />\n"
|
114
|
+
options[:method] = :post
|
115
|
+
end
|
116
|
+
concat("<form#{build_options(options)}>\n", block.binding)
|
117
|
+
concat(meth, block.binding) unless meth.blank?
|
118
|
+
yield
|
119
|
+
concat("</form>", block.binding)
|
120
|
+
# content_tag(:form, options, &block)
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
def build_options(options)
|
125
|
+
opts = ""
|
126
|
+
unless options.empty?
|
127
|
+
opts = " " << options.join("%s=\"%s\"", " ")
|
128
|
+
end
|
129
|
+
opts
|
45
130
|
end
|
46
131
|
|
47
132
|
end # HtmlHelpers
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Mack
|
2
|
+
module ViewHelpers
|
3
|
+
module StringHelpers
|
4
|
+
|
5
|
+
# Takes a count integer and a word and returns a phrase containing the count
|
6
|
+
# and the correct inflection of the word.
|
7
|
+
#
|
8
|
+
# Examples:
|
9
|
+
# pluralize_word(0, "error") # => "0 errors"
|
10
|
+
# pluralize_word(1, "error") # => "1 error"
|
11
|
+
# pluralize_word(2, "error") # => "2 errors"
|
12
|
+
def pluralize_word(count, word)
|
13
|
+
if count.to_i == 1
|
14
|
+
"#{count} #{word.singular}"
|
15
|
+
else
|
16
|
+
"#{count} #{word.plural}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end # StringHelpers
|
21
|
+
end # ViewHelpers
|
22
|
+
end # Mack
|
@@ -13,11 +13,6 @@ class Mack::ViewBinder
|
|
13
13
|
@xml = Builder::XmlMarkup.new(:target => @xml_output, :indent => 1)
|
14
14
|
end
|
15
15
|
|
16
|
-
# Returns the binding for this class.
|
17
|
-
def view_binding
|
18
|
-
binding
|
19
|
-
end
|
20
|
-
|
21
16
|
# If a method can not be found then the :locals key of
|
22
17
|
# the options is used to find the variable.
|
23
18
|
def method_missing(sym, *args)
|
@@ -57,6 +52,19 @@ class Mack::ViewBinder
|
|
57
52
|
raise Mack::Errors::UnknownRenderOption.new(options)
|
58
53
|
end
|
59
54
|
|
55
|
+
def run(io)
|
56
|
+
# TODO: find a nicer way of doing this:
|
57
|
+
if ((controller.params(:format).to_sym == :xml) || options[:format] == :xml) && (options[:action] || options[:xml])
|
58
|
+
return eval(io, binding)
|
59
|
+
else
|
60
|
+
return Erubis::Eruby.new(io).result(binding)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def concat(txt, b)
|
65
|
+
eval( "_buf", b) << txt
|
66
|
+
end
|
67
|
+
|
60
68
|
private
|
61
69
|
|
62
70
|
# Transfer instance variables from the controller to the view.
|
@@ -72,12 +80,7 @@ class Mack::ViewBinder
|
|
72
80
|
# and returns a String. The io can be either an IO object or a String.
|
73
81
|
def render(io, controller, options = {})
|
74
82
|
vb = Mack::ViewBinder.new(controller, options)
|
75
|
-
|
76
|
-
if ((controller.params(:format).to_sym == :xml) || options[:format] == :xml) && (options[:action] || options[:xml])
|
77
|
-
return eval(io, vb.view_binding)
|
78
|
-
else
|
79
|
-
return Erubis::Eruby.new(io).result(vb.view_binding)
|
80
|
-
end
|
83
|
+
vb.run(io)
|
81
84
|
end
|
82
85
|
|
83
86
|
end
|
@@ -10,7 +10,7 @@ namespace :cachetastic do
|
|
10
10
|
when "All"
|
11
11
|
puts "About to work on ALL caches!"
|
12
12
|
# force all caches to register themselves:
|
13
|
-
["#{
|
13
|
+
["#{Mack::Configuration.root}/lib/caches"].each do |dir|
|
14
14
|
Find.find(dir) do |f|
|
15
15
|
# puts f
|
16
16
|
if FileTest.directory?(f) and !f.match(/.svn/)
|
@@ -55,15 +55,15 @@ namespace :cachetastic do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
namespace :page_cache do
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
58
|
+
# namespace :page_cache do
|
59
|
+
#
|
60
|
+
# desc "Expires the page cache."
|
61
|
+
# task :expire_all => :environment do
|
62
|
+
# running_time do("Cachetastic::Caches::PageCache.expire_all")
|
63
|
+
# Cachetastic::Caches::PageCache.expire_all
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# end
|
68
68
|
|
69
69
|
end
|
@@ -22,15 +22,15 @@ namespace :mack do
|
|
22
22
|
d_handler = "thin"
|
23
23
|
rescue Exception => e
|
24
24
|
end
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
Mack::Configuration.set(:root, FileUtils.pwd) if Mack::Configuration.root.nil?
|
27
27
|
|
28
28
|
options = OpenStruct.new
|
29
29
|
options.port = (ENV["PORT"] ||= "3000") # Does NOT work with Thin!! You must edit the thin.yml file!
|
30
30
|
options.handler = (ENV["HANDLER"] ||= d_handler)
|
31
31
|
|
32
32
|
|
33
|
-
# require File.join(
|
33
|
+
# require File.join(Mack::Configuration.root, "config", "boot.rb")
|
34
34
|
require 'mack'
|
35
35
|
|
36
36
|
if options.handler == "thin"
|