mack 0.5.5.4 → 0.6.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 +34 -0
- data/README +1 -1
- data/bin/mack +7 -2
- data/lib/controller/controller.rb +371 -0
- data/lib/controller/cookie_jar.rb +2 -1
- data/lib/controller/filter.rb +3 -2
- data/lib/controller/request.rb +30 -26
- data/lib/controller/session.rb +5 -0
- data/lib/distributed/utils/rinda.rb +1 -1
- data/lib/errors/errors.rb +5 -3
- data/lib/generators/mack_application_generator/mack_application_generator.rb +4 -0
- data/lib/generators/mack_application_generator/manifest.yml +40 -7
- data/lib/generators/mack_application_generator/templates/Rakefile.template +5 -1
- data/lib/generators/mack_application_generator/templates/app/controllers/default_controller.rb.template +2 -1
- data/lib/generators/mack_application_generator/templates/app/helpers/controllers/default_controller_helper.rb.template +7 -0
- data/lib/generators/mack_application_generator/templates/app/helpers/views/application_helper.rb.template +7 -0
- data/lib/generators/mack_application_generator/templates/config/app_config/default.yml.template +2 -1
- data/lib/generators/mack_application_generator/templates/config/database.yml.template +11 -10
- data/lib/generators/mack_application_generator/templates/test/functional/default_controller_spec.rb.template +9 -0
- data/lib/generators/mack_application_generator/templates/test/functional/default_controller_test.rb.template +10 -0
- data/lib/generators/mack_application_generator/templates/test/spec.opts.template +2 -0
- data/lib/generators/mack_application_generator/templates/test/spec_helper.rb.template +8 -0
- data/lib/generators/mack_application_generator/templates/test/test_helper.rb.template +2 -1
- data/lib/initialization/application.rb +46 -0
- data/lib/initialization/configuration.rb +23 -38
- data/lib/initialization/console.rb +5 -2
- data/lib/initialization/helpers.rb +31 -0
- data/lib/initialization/logging.rb +69 -15
- data/lib/initialization/orm_support.rb +10 -4
- data/lib/initialization/plugins.rb +1 -1
- data/lib/mack.rb +18 -76
- data/lib/mack_tasks.rb +4 -1
- data/lib/rendering/engine/erubis.rb +1 -1
- data/lib/rendering/engine/registry.rb +5 -5
- data/lib/rendering/type/action.rb +3 -2
- data/lib/rendering/type/base.rb +1 -1
- data/lib/rendering/type/layout.rb +2 -2
- data/lib/rendering/type/partial.rb +1 -1
- data/lib/rendering/type/public.rb +1 -1
- data/lib/rendering/type/template.rb +1 -1
- data/lib/rendering/type/url.rb +4 -4
- data/lib/rendering/type/xml.rb +3 -2
- data/lib/rendering/view_template.rb +7 -7
- data/lib/routing/route_map.rb +27 -5
- data/lib/routing/urls.rb +1 -0
- data/lib/runner.rb +52 -17
- data/lib/tasks/cachetastic_tasks.rake +2 -2
- data/lib/tasks/mack_server_tasks.rake +2 -4
- data/lib/tasks/mack_update_tasks.rake +26 -0
- data/lib/tasks/rake_rules.rake +6 -2
- data/lib/tasks/test_tasks.rake +28 -10
- data/lib/testing/helpers.rb +187 -0
- data/lib/testing/response.rb +49 -0
- data/lib/testing/rspec.rb +20 -0
- data/lib/testing/test_assertions.rb +55 -0
- data/lib/{test_extensions → testing}/test_case.rb +9 -7
- data/lib/utils/crypt/keeper.rb +1 -1
- data/lib/utils/server.rb +2 -2
- data/lib/view_helpers/html_helpers.rb +4 -0
- metadata +26 -40
- data/lib/controller/base.rb +0 -345
- data/lib/generators/mack_application_generator/templates/app/helpers/application_helper.rb.template +0 -2
- data/lib/generators/mack_application_generator/templates/config/thin.ru.template +0 -1
- data/lib/generators/mack_application_generator/templates/config/thin.yml.template +0 -8
- data/lib/rendering/engine/haml.rb +0 -18
- data/lib/rendering/engine/markaby.rb +0 -28
- data/lib/test_extensions/test_assertions.rb +0 -55
- data/lib/test_extensions/test_helpers.rb +0 -192
data/lib/controller/filter.rb
CHANGED
@@ -2,10 +2,11 @@ module Mack
|
|
2
2
|
module Controller
|
3
3
|
# A wrapper class to hold calls to filter methods for Controllers.
|
4
4
|
# This class should never be called by itself. Instead there are helper
|
5
|
-
# methods in Mack::Controller
|
5
|
+
# methods in Mack::Controller to do this for.
|
6
6
|
#
|
7
7
|
# Examples:
|
8
|
-
# class MyAwesomeController
|
8
|
+
# class MyAwesomeController
|
9
|
+
# include Mack::Controller
|
9
10
|
# # all actions in this controller will have this filter run:
|
10
11
|
# before_filter: authenticate
|
11
12
|
# # only the show and index actions in this controller will have this filter run:
|
data/lib/controller/request.rb
CHANGED
@@ -1,19 +1,34 @@
|
|
1
1
|
module Mack
|
2
|
+
|
2
3
|
class Request < Rack::Request
|
3
4
|
|
5
|
+
class Parameters < Hash # :nodoc:
|
6
|
+
alias_method :old_hash, :[]
|
7
|
+
def [](key)
|
8
|
+
data = old_hash(key.to_sym) || old_hash(key.to_s)
|
9
|
+
data = data.to_s if data.is_a?(Symbol)
|
10
|
+
return data
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
s = self.inspect
|
15
|
+
Mack::Logging::Filter.list.each do |p|
|
16
|
+
s.gsub!(/:#{p}=>\"[^\"]+\"/, ":#{p}=>\"<FILTERED>\"")
|
17
|
+
end
|
18
|
+
s
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
4
24
|
def initialize(env) # :nodoc:
|
5
25
|
super(env)
|
6
|
-
@mack_params =
|
26
|
+
@mack_params = Mack::Request::Parameters.new
|
7
27
|
parse_params(rack_params)
|
8
28
|
end
|
9
29
|
|
10
30
|
alias_method :rack_params, :params # :nodoc:
|
11
|
-
|
12
|
-
# Returns all parameters associated with this request.
|
13
|
-
def all_params
|
14
|
-
@mack_params
|
15
|
-
end
|
16
|
-
|
31
|
+
|
17
32
|
# Merges another Hash with the parameters for this request.
|
18
33
|
def merge_params(opts = {})
|
19
34
|
parse_params(opts)
|
@@ -52,29 +67,16 @@ module Mack
|
|
52
67
|
# uri: '/users/1?foo=bar'
|
53
68
|
# route: '/users/:id' => {:controller => 'users', :action => 'show'}
|
54
69
|
# parameters: {:controller => 'users', :action => 'show', :id => 1, :foo => "bar"}
|
55
|
-
def params
|
56
|
-
|
57
|
-
p = (@mack_params[key.to_sym] || @mack_params[key.to_s])
|
58
|
-
unless p.nil?
|
59
|
-
p = p.to_s if p.is_a?(Symbol)
|
60
|
-
if p.is_a?(String)
|
61
|
-
p = p.to_s.uri_unescape
|
62
|
-
elsif p.is_a?(Hash)
|
63
|
-
p.each_pair do |k,v|
|
64
|
-
if v.is_a?(String)
|
65
|
-
p[k] = v.to_s.uri_unescape
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
p
|
71
|
-
end
|
70
|
+
def params
|
71
|
+
@mack_params
|
72
72
|
end
|
73
73
|
|
74
|
+
alias_method :all_params, :params
|
75
|
+
|
74
76
|
# Returns a Mack::Request::UploadedFile object.
|
75
77
|
def file(key)
|
76
78
|
ivar_cache("file_#{key}") do
|
77
|
-
Mack::Request::UploadedFile.new(params
|
79
|
+
Mack::Request::UploadedFile.new(params[key] ||= {})
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -85,9 +87,11 @@ module Mack
|
|
85
87
|
nv = k.to_s.match(/.+\[(.+)\]/).captures.first
|
86
88
|
nk = k.to_s.match(/(.+)\[.+\]/).captures.first
|
87
89
|
@mack_params[nk.to_sym] = {} if @mack_params[nk.to_sym].nil?
|
90
|
+
v = v.uri_unescape if v.is_a?(String)
|
88
91
|
@mack_params[nk.to_sym].merge!(nv.to_sym => v)
|
89
92
|
else
|
90
|
-
|
93
|
+
v = v.uri_unescape if v.is_a?(String)
|
94
|
+
@mack_params[k.to_sym] = v#.to_s.uri_unescape
|
91
95
|
end
|
92
96
|
end
|
93
97
|
end
|
data/lib/controller/session.rb
CHANGED
data/lib/errors/errors.rb
CHANGED
@@ -4,7 +4,8 @@ module Mack
|
|
4
4
|
# Raised when someone calls render twice in one action
|
5
5
|
#
|
6
6
|
# Example:
|
7
|
-
# class FooController
|
7
|
+
# class FooController
|
8
|
+
# include Mack::Controller
|
8
9
|
# def index
|
9
10
|
# render(:text, "Hello World")
|
10
11
|
# render(:action, "edit")
|
@@ -16,7 +17,8 @@ module Mack
|
|
16
17
|
# Raised when an action returns something other then a string.
|
17
18
|
#
|
18
19
|
# Example:
|
19
|
-
# class FooController
|
20
|
+
# class FooController
|
21
|
+
# include Mack::Controller
|
20
22
|
# def index
|
21
23
|
# [1,2,3,4]
|
22
24
|
# end
|
@@ -58,7 +60,7 @@ module Mack
|
|
58
60
|
class UnknownLayout < StandardError
|
59
61
|
# Takes a layout name.
|
60
62
|
def initialize(layout)
|
61
|
-
super("Could not find layout in: #{File.join(Mack
|
63
|
+
super("Could not find layout in: #{File.join(Mack.root, "app", "views", layout.to_s + ".html.erb")}")
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -5,8 +5,12 @@ default_controller:
|
|
5
5
|
output_path: <%= File.join(app_name, "app", "controllers", "default_controller.rb") %>
|
6
6
|
application_helper:
|
7
7
|
type: file
|
8
|
-
template_path: <%= File.join(templates_directory_path, "app", "helpers", "application_helper.rb.template") %>
|
9
|
-
output_path: <%= File.join(app_name, "app", "helpers", "application_helper.rb") %>
|
8
|
+
template_path: <%= File.join(templates_directory_path, "app", "helpers", "views", "application_helper.rb.template") %>
|
9
|
+
output_path: <%= File.join(app_name, "app", "helpers", "views", "application_helper.rb") %>
|
10
|
+
default_controller_helper:
|
11
|
+
type: file
|
12
|
+
template_path: <%= File.join(templates_directory_path, "app", "helpers", "controllers", "default_controller_helper.rb.template") %>
|
13
|
+
output_path: <%= File.join(app_name, "app", "helpers", "controllers", "default_controller_helper.rb") %>
|
10
14
|
index_view:
|
11
15
|
type: file
|
12
16
|
template_path: <%= File.join(templates_directory_path, "app", "views", "default", "index.html.erb.template") %>
|
@@ -25,7 +29,7 @@ database_yml:
|
|
25
29
|
type: file
|
26
30
|
template_path: <%= File.join(templates_directory_path, "config", "database.yml.template") %>
|
27
31
|
output_path: <%= File.join(app_name, "config", "database.yml") %>
|
28
|
-
<% ["routes.rb"
|
32
|
+
<% ["routes.rb"].each do |f| -%>
|
29
33
|
<%= f %>_config_file:
|
30
34
|
type: file
|
31
35
|
template_path: <%= File.join(templates_directory_path, "config", "#{f}.template") %>
|
@@ -47,10 +51,6 @@ rakefile:
|
|
47
51
|
type: file
|
48
52
|
template_path: <%= File.join(templates_directory_path, "Rakefile.template") %>
|
49
53
|
output_path: <%= File.join(app_name, "Rakefile") %>
|
50
|
-
test_helper:
|
51
|
-
type: file
|
52
|
-
template_path: <%= File.join(templates_directory_path, "test", "test_helper.rb.template") %>
|
53
|
-
output_path: <%= File.join(app_name, "test", "test_helper.rb") %>
|
54
54
|
|
55
55
|
# Directories:
|
56
56
|
models:
|
@@ -59,17 +59,50 @@ models:
|
|
59
59
|
lib_tasks:
|
60
60
|
type: directory
|
61
61
|
output_path: <%= File.join(app_name, "lib", "tasks") %>
|
62
|
+
db_migrations:
|
63
|
+
type: directory
|
64
|
+
output_path: <%= File.join(app_name, "db", "migrations") %>
|
62
65
|
<% ["images", "javascripts"].each do |f| -%>
|
63
66
|
public_<%= f %>:
|
64
67
|
type: directory
|
65
68
|
output_path: <%= File.join(app_name, "public", f) %>
|
66
69
|
<% end -%>
|
70
|
+
|
71
|
+
# Test
|
72
|
+
<% if testing_framework == "test_case" %>
|
73
|
+
test_helper:
|
74
|
+
type: file
|
75
|
+
template_path: <%= File.join(templates_directory_path, "test", "test_helper.rb.template") %>
|
76
|
+
output_path: <%= File.join(app_name, "test", "test_helper.rb") %>
|
67
77
|
test_functional:
|
68
78
|
type: directory
|
69
79
|
output_path: <%= File.join(app_name, "test", "functional") %>
|
80
|
+
test_example:
|
81
|
+
type: file
|
82
|
+
template_path: <%= File.join(templates_directory_path, "test", "functional", "default_controller_test.rb.template") %>
|
83
|
+
output_path: <%= File.join(app_name, "test", "functional", "default_controller_test.rb") %>
|
70
84
|
test_unit:
|
71
85
|
type: directory
|
72
86
|
output_path: <%= File.join(app_name, "test", "unit") %>
|
87
|
+
<% elsif testing_framework == "rspec" %>
|
88
|
+
test_spec_helper:
|
89
|
+
type: file
|
90
|
+
template_path: <%= File.join(templates_directory_path, "test", "spec_helper.rb.template") %>
|
91
|
+
output_path: <%= File.join(app_name, "test", "spec_helper.rb") %>
|
92
|
+
test_spec_opts:
|
93
|
+
type: file
|
94
|
+
template_path: <%= File.join(templates_directory_path, "test", "spec.opts.template") %>
|
95
|
+
output_path: <%= File.join(app_name, "test", "spec.opts") %>
|
96
|
+
test_spec_example:
|
97
|
+
type: file
|
98
|
+
template_path: <%= File.join(templates_directory_path, "test", "functional", "default_controller_spec.rb.template") %>
|
99
|
+
output_path: <%= File.join(app_name, "test", "functional", "default_controller_spec.rb") %>
|
100
|
+
test_spec_unit:
|
101
|
+
type: directory
|
102
|
+
output_path: <%= File.join(app_name, "test", "unit") %>
|
103
|
+
<% end %>
|
104
|
+
|
105
|
+
# Plugins
|
73
106
|
vendor_plugins:
|
74
107
|
type: directory
|
75
108
|
output_path: <%= File.join(app_name, "vendor", "plugins") %>
|
@@ -3,4 +3,8 @@ require 'rake/testtask'
|
|
3
3
|
require 'rake/rdoctask'
|
4
4
|
|
5
5
|
gem 'mack', '<%= @options["version"] %>'
|
6
|
-
require 'mack_tasks'
|
6
|
+
require 'mack_tasks'
|
7
|
+
|
8
|
+
<% if @options["testing_framework"] != "rspec" -%>
|
9
|
+
alias_task :default, "test:<%= @options["testing_framework"] %>"
|
10
|
+
<% end -%>
|
@@ -29,17 +29,18 @@ when "data_mapper"
|
|
29
29
|
development:
|
30
30
|
default:
|
31
31
|
adapter: sqlite3
|
32
|
-
database: db
|
33
|
-
|
32
|
+
database: <%%= File.join(Mack.root, "db", "<%= @options["app"].downcase %>_development.db") %>
|
33
|
+
|
34
34
|
test:
|
35
35
|
default:
|
36
36
|
adapter: sqlite3
|
37
|
-
database: db
|
38
|
-
|
37
|
+
database: <%%= File.join(Mack.root, "db", "<%= @options["app"].downcase %>_test.db") %>
|
38
|
+
|
39
39
|
production:
|
40
40
|
default:
|
41
41
|
adapter: sqlite3
|
42
|
-
database: db
|
42
|
+
database: <%%= File.join(Mack.root, "db", "<%= @options["app"].downcase %>_production.db") %>
|
43
|
+
|
43
44
|
<% else -%>
|
44
45
|
# development:
|
45
46
|
# adapter: mysql
|
@@ -64,13 +65,13 @@ production:
|
|
64
65
|
|
65
66
|
development:
|
66
67
|
adapter: sqlite3
|
67
|
-
database: db
|
68
|
-
|
68
|
+
database: <%%= File.join(Mack.root, "db", "<%= @options["app"].downcase %>_development.db") %>
|
69
|
+
|
69
70
|
test:
|
70
71
|
adapter: sqlite3
|
71
|
-
database: db
|
72
|
-
|
72
|
+
database: <%%= File.join(Mack.root, "db", "<%= @options["app"].downcase %>_test.db") %>
|
73
|
+
|
73
74
|
production:
|
74
75
|
adapter: sqlite3
|
75
|
-
database: db
|
76
|
+
database: <%%= File.join(Mack.root, "db", "<%= @options["app"].downcase %>_production.db") %>
|
76
77
|
<% end -%>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
|
2
|
+
|
3
|
+
describe DefaultController do
|
4
|
+
it "should be able to successfully connect to home page" do
|
5
|
+
get home_page_url
|
6
|
+
response.should be_successful
|
7
|
+
response.body.should match(/Welcome to your Mack application!/)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This is a sample TestCase file. You can safely delete this file
|
2
|
+
require File.join(File.dirname(__FILE__), "..", "test_helper.rb")
|
3
|
+
|
4
|
+
class DefaultControllerTest < Test::Unit::TestCase
|
5
|
+
def test_home_page
|
6
|
+
get home_page_url
|
7
|
+
assert_response :success
|
8
|
+
assert_match("Welcome to your Mack application!", response.body)
|
9
|
+
end
|
10
|
+
end
|
@@ -2,7 +2,8 @@ require 'rubygems'
|
|
2
2
|
require "test/unit"
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
|
-
ENV["
|
5
|
+
ENV["MACK_ENV"] = "test"
|
6
|
+
ENV["MACK_ROOT"] = File.join(File.dirname(__FILE__), "..")
|
6
7
|
|
7
8
|
# load the mack framework:
|
8
9
|
load(File.join(File.dirname(__FILE__), "..", "Rakefile"))
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# set up initializers:
|
2
|
+
Mack.logger.info "Initializing custom initializers..."
|
3
|
+
Dir.glob(File.join(Mack.root, "config", "initializers", "**/*.rb")) do |d|
|
4
|
+
require d
|
5
|
+
end
|
6
|
+
Mack.logger.info "Initializing custom gems..."
|
7
|
+
Mack::Utils::GemManager.instance.do_requires
|
8
|
+
|
9
|
+
# require 'plugins':
|
10
|
+
Mack.logger.info "Initializing plugins..."
|
11
|
+
require File.join(File.dirname(__FILE__), "plugins.rb")
|
12
|
+
|
13
|
+
# make sure that default_controller is available to other controllers
|
14
|
+
path = File.join(Mack.root, "app", "controllers", "default_controller.rb")
|
15
|
+
require path if File.exists?(path)
|
16
|
+
|
17
|
+
# require 'lib' files:
|
18
|
+
Mack.logger.info "Initializing lib classes..."
|
19
|
+
Dir.glob(File.join(Mack.root, "lib", "**/*.rb")).each do |d|
|
20
|
+
require d
|
21
|
+
end
|
22
|
+
|
23
|
+
# set up routes:
|
24
|
+
Mack.logger.info "Initializing routes..."
|
25
|
+
require File.join(Mack.root, "config", "routes")
|
26
|
+
|
27
|
+
# require 'app' files:
|
28
|
+
Mack.logger.info "Initializing 'app' classes..."
|
29
|
+
Dir.glob(File.join(Mack.root, "app", "**/*.rb")).each do |d|
|
30
|
+
# puts "d: #{d}"
|
31
|
+
begin
|
32
|
+
require d
|
33
|
+
rescue NameError => e
|
34
|
+
if e.message.match("uninitialized constant")
|
35
|
+
mod = e.message.gsub("uninitialized constant ", "")
|
36
|
+
x =%{
|
37
|
+
module ::#{mod}
|
38
|
+
end
|
39
|
+
}
|
40
|
+
eval(x)
|
41
|
+
require d
|
42
|
+
else
|
43
|
+
raise e
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,52 +1,41 @@
|
|
1
1
|
module Mack
|
2
2
|
|
3
|
+
# Returns the root of the current Mack application
|
4
|
+
def self.root
|
5
|
+
ENV["MACK_ROOT"] ||= FileUtils.pwd
|
6
|
+
end
|
7
|
+
|
8
|
+
# Returns the environment of the current Mack application
|
9
|
+
def self.env
|
10
|
+
ENV["MACK_ENV"] ||= "development"
|
11
|
+
end
|
12
|
+
|
3
13
|
# All configuration for the Mack subsystem happens here. Each of the default environments,
|
4
14
|
# production, development, and test have their own default configuration options. These
|
5
15
|
# get merged with overall default options.
|
6
16
|
module Configuration # :nodoc:
|
7
|
-
|
8
|
-
def self.env
|
9
|
-
ENV["_mack_env"] ||= ENV["MACK_ENV"]
|
10
|
-
end
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
return ENV[ev]
|
18
|
+
class << self
|
19
|
+
attr_accessor :initialized
|
15
20
|
end
|
16
|
-
|
17
|
-
def self.set(name, value)
|
18
|
-
ENV["_mack_#{name.to_s.downcase}"] = value
|
19
|
-
end
|
20
|
-
|
21
|
-
self.set(:env, "development") if self.env.nil?
|
22
|
-
self.set(:root, FileUtils.pwd) if self.root.nil?
|
23
|
-
self.set(:public_directory, File.join(self.root, "public")) if self.public_directory.nil?
|
24
|
-
self.set(:app_directory, File.join(self.root, "app")) if self.app_directory.nil?
|
25
|
-
self.set(:lib_directory, File.join(self.root, "lib")) if self.lib_directory.nil?
|
26
|
-
self.set(:config_directory, File.join(self.root, "config")) if self.config_directory.nil?
|
27
|
-
self.set(:views_directory, File.join(self.app_directory, "views")) if self.views_directory.nil?
|
28
|
-
self.set(:layouts_directory, File.join(self.views_directory, "layouts")) if self.layouts_directory.nil?
|
29
|
-
self.set(:plugins, File.join(self.root, "vendor", "plugins")) if self.plugins.nil?
|
30
|
-
|
31
|
-
|
32
21
|
|
33
22
|
# use local memory and store stuff for 24 hours:
|
34
23
|
# use file for sessions and store them for 4 hours:
|
35
24
|
DEFAULTS_PRODUCTION = {
|
36
25
|
"mack::use_lint" => false,
|
37
26
|
"mack::show_exceptions" => false,
|
38
|
-
"
|
27
|
+
"log_level" => "info",
|
39
28
|
"log::detailed_requests" => false,
|
40
29
|
"cachetastic_caches_mack_session_cache_options" => {
|
41
30
|
"debug" => false,
|
42
31
|
"adapter" => "file",
|
43
32
|
"store_options" =>
|
44
|
-
{"dir" => File.join(Mack
|
33
|
+
{"dir" => File.join(Mack.root, "tmp")},
|
45
34
|
"expiry_time" => 14400,
|
46
35
|
"logging" => {
|
47
36
|
"logger_1" => {
|
48
37
|
"type" => "file",
|
49
|
-
"file" => File.join(Mack
|
38
|
+
"file" => File.join(Mack.root, "log", "cachetastic_caches_mack_session_cache.log")
|
50
39
|
}
|
51
40
|
}
|
52
41
|
}
|
@@ -55,13 +44,12 @@ module Mack
|
|
55
44
|
# use local memory and store stuff for 5 minutes:
|
56
45
|
DEFAULTS_DEVELOPMENT = {
|
57
46
|
"mack::cache_classes" => false,
|
58
|
-
"
|
59
|
-
"log::console" => true,
|
47
|
+
"log_level" => "debug"
|
60
48
|
} unless self.const_defined?("DEFAULTS_DEVELOPMENT")
|
61
49
|
|
62
50
|
# use local memory and store stuff for 1 hour:
|
63
51
|
DEFAULTS_TEST = {
|
64
|
-
"
|
52
|
+
"log_level" => "error",
|
65
53
|
"run_remote_tests" => true,
|
66
54
|
"mack::drb_timeout" => 0,
|
67
55
|
"mack::cookie_values" => {}
|
@@ -85,7 +73,7 @@ module Mack
|
|
85
73
|
"logging" => {
|
86
74
|
"logger_1" => {
|
87
75
|
"type" => "file",
|
88
|
-
"file" => File.join(Mack
|
76
|
+
"file" => File.join(Mack.root, "log", "cachetastic.log")
|
89
77
|
}
|
90
78
|
}
|
91
79
|
},
|
@@ -94,18 +82,15 @@ module Mack
|
|
94
82
|
"mack::distributed_app_name" => nil,
|
95
83
|
"mack::distributed_site_domain" => "http://localhost:3000",
|
96
84
|
"mack::drb_timeout" => 1,
|
85
|
+
"mack::default_respository_name" => "default",
|
97
86
|
"log::detailed_requests" => true,
|
98
|
-
"
|
99
|
-
|
100
|
-
"log::file" => true,
|
101
|
-
"log::console_format" => "%l:\t[%d]\t%M",
|
102
|
-
"log::file_format" => "%l:\t[%d]\t%M"
|
103
|
-
}.merge(eval("DEFAULTS_#{Mack::Configuration.env.upcase}"))
|
87
|
+
"log_level" => "info"
|
88
|
+
}.merge(eval("DEFAULTS_#{Mack.env.upcase}"))
|
104
89
|
end
|
105
90
|
|
106
91
|
app_config.load_hash(DEFAULTS, "mack_defaults")
|
107
|
-
app_config.load_file(File.join(Mack
|
108
|
-
app_config.load_file(File.join(Mack
|
92
|
+
app_config.load_file(File.join(Mack.root, "config", "app_config", "default.yml"))
|
93
|
+
app_config.load_file(File.join(Mack.root, "config", "app_config", "#{Mack.env}.yml"))
|
109
94
|
# app_config.reload
|
110
95
|
|
111
96
|
end
|