mack 0.8.0.101 → 0.8.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/CHANGELOG +29 -0
- data/bin/mackery-console +6 -5
- data/bin/mackery-server +23 -7
- data/lib/mack.rb +0 -3
- data/lib/mack/application.rb +161 -0
- data/lib/mack/assets/asset_helpers.rb +8 -0
- data/lib/mack/assets/assets_mgr.rb +0 -10
- data/lib/mack/boot/app.rb +46 -0
- data/lib/mack/boot/assets.rb +10 -0
- data/lib/mack/boot/configuration.rb +87 -0
- data/lib/mack/boot/console.rb +36 -0
- data/lib/mack/boot/core.rb +21 -0
- data/lib/mack/boot/environment.rb +22 -0
- data/lib/mack/boot/extensions.rb +13 -0
- data/lib/mack/boot/gem_tasks.rb +20 -0
- data/lib/mack/boot/gems.rb +18 -0
- data/lib/mack/boot/hello.rb +11 -0
- data/lib/mack/{initialization → boot}/helpers.rb +8 -3
- data/lib/mack/boot/initializers.rb +17 -0
- data/lib/mack/boot/lib.rb +19 -0
- data/lib/mack/{initialization → boot}/logging.rb +16 -9
- data/lib/mack/{initialization → boot}/logging/basic_layout.rb +0 -0
- data/lib/mack/{initialization → boot}/logging/color_layout.rb +1 -1
- data/lib/mack/{initialization → boot}/logging/filter.rb +0 -0
- data/lib/mack/boot/paths.rb +234 -0
- data/lib/mack/boot/plugins.rb +26 -0
- data/lib/mack/boot/portlets.rb +20 -0
- data/lib/mack/boot/routes.rb +15 -0
- data/lib/mack/boot/version.rb +7 -0
- data/lib/mack/controller/request.rb +5 -2
- data/lib/mack/controller/uploaded_file.rb +4 -0
- data/lib/mack/core_extensions/kernel.rb +26 -0
- data/lib/mack/core_extensions/object.rb +16 -0
- data/lib/mack/generators/mack_application_generator/manifest.yml +5 -3
- data/lib/mack/generators/mack_application_generator/templates/config/initializers/portlets.rb.template +9 -0
- data/lib/mack/generators/mack_application_generator/templates/public/stylesheets/scaffold.css.template +4 -0
- data/lib/mack/generators/portlet_generator/portlet_generator.rb +2 -0
- data/lib/mack/generators/portlet_generator/templates/README.template +3 -0
- data/lib/mack/generators/portlet_generator/templates/portlet_config/portlet.spec.template +28 -0
- data/lib/mack/portlets/manager.rb +27 -0
- data/lib/mack/portlets/portlet.rb +93 -0
- data/lib/mack/portlets/unpacker.rb +34 -0
- data/lib/mack/rendering/engine/erubis.rb +2 -2
- data/lib/mack/rendering/type/file_base.rb +8 -4
- data/lib/mack/rendering/type/public.rb +4 -2
- data/lib/mack/routing/resource_proxy.rb +30 -4
- data/lib/mack/routing/route_map.rb +28 -15
- data/lib/mack/routing/route_object.rb +57 -24
- data/lib/mack/routing/urls.rb +12 -2
- data/lib/mack/runner.rb +6 -154
- data/lib/mack/sessions/cookie_session_store.rb +2 -1
- data/lib/mack/tasks/mack_dump_tasks.rake +62 -18
- data/lib/mack/tasks/mack_tasks.rake +1 -15
- data/lib/mack/tasks/portlet_tasks.rake +33 -0
- data/lib/mack/tasks/rake_rules.rake +6 -0
- data/lib/mack/tasks/test_tasks.rake +4 -6
- data/lib/mack/testing/helpers.rb +12 -4
- data/lib/mack/utils/server.rb +7 -1
- data/lib/mack/utils/static.rb +19 -0
- data/lib/mack/version.rb +1 -1
- data/lib/mack/view_helpers/all_helpers.rb +0 -8
- data/lib/mack/view_helpers/date_time_helpers.rb +18 -12
- data/lib/mack/view_helpers/form_helpers.rb +9 -0
- data/lib/mack/view_helpers/html_helpers.rb +18 -7
- data/lib/mack/view_helpers/link_helpers.rb +2 -1
- data/lib/mack/view_helpers/object_helpers.rb +1 -1
- data/lib/mack_app.rb +26 -14
- data/lib/mack_core.rb +50 -39
- data/lib/mack_tasks.rb +46 -19
- metadata +37 -18
- data/lib/mack/initialization/application.rb +0 -53
- data/lib/mack/initialization/boot_loader.rb +0 -72
- data/lib/mack/initialization/configuration.rb +0 -101
- data/lib/mack/initialization/console.rb +0 -29
- data/lib/mack/initialization/environment.rb +0 -16
- data/lib/mack/initialization/plugins.rb +0 -16
- data/lib/mack/initialization/server/simple_server.rb +0 -19
- data/lib/mack/tasks/mack_server_tasks.rake +0 -24
- data/lib/mack/utils/paths.rb +0 -154
@@ -3,22 +3,9 @@ namespace :mack do
|
|
3
3
|
|
4
4
|
desc "Loads the Mack environment. Default is development."
|
5
5
|
task :environment do
|
6
|
-
require File.join(File.dirname(__FILE__), '..', '..', 'mack')
|
6
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'mack'))
|
7
7
|
Mack::Environment.load
|
8
8
|
end # environment
|
9
|
-
|
10
|
-
# desc "Loads an irb console allow you full access to the application w/o a browser."
|
11
|
-
task :console do
|
12
|
-
puts %{
|
13
|
-
This task has been removed. Please use the 'mackery' command to access the console:
|
14
|
-
|
15
|
-
$ mackery console
|
16
|
-
|
17
|
-
The environment can be set like this:
|
18
|
-
|
19
|
-
$ mackery console -e test
|
20
|
-
}
|
21
|
-
end # console
|
22
9
|
|
23
10
|
namespace :freeze do
|
24
11
|
|
@@ -42,5 +29,4 @@ The environment can be set like this:
|
|
42
29
|
|
43
30
|
end # mack
|
44
31
|
|
45
|
-
alias_task :console, "mack:console"
|
46
32
|
alias_task :environment, "mack:environment"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
namespace :mack do
|
3
|
+
|
4
|
+
namespace :portlet do
|
5
|
+
|
6
|
+
desc 'Removes any generated portlet files.'
|
7
|
+
task :clean => :environment do
|
8
|
+
Mack::Portlet.clean
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Prepares your application to become a portlet.'
|
12
|
+
task :prepare => [:clean] do
|
13
|
+
Mack::Portlet.prepare
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Packages up your application into a portlet gem.'
|
17
|
+
task :package => [:prepare] do
|
18
|
+
Mack::Portlet.package
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Installs your application as a portlet gem.'
|
22
|
+
task :install => :package do
|
23
|
+
sudo = ENV['SUDOLESS'] == 'true' || RUBY_PLATFORM =~ /win32|cygwin/ ? '' : 'sudo'
|
24
|
+
puts `#{sudo} gem install #{Mack::Paths.root('pkg', Mack::Portlet.portlet_spec.name)}-#{Mack::Portlet.portlet_spec.version}.gem --no-update-sources`
|
25
|
+
end
|
26
|
+
|
27
|
+
task :unpacker => :environment do
|
28
|
+
Mack::Portlet::Unpacker.instance.unpack(ENV['unpacker_key'], ENV['FORCE'])
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -36,4 +36,10 @@ rule /^gems:freeze:/ do |t|
|
|
36
36
|
gem_name = t.name.gsub('gems:freeze:', '')
|
37
37
|
ENV['gem_name'] = gem_name
|
38
38
|
Rake::Task["gems:install_and_freeze"].invoke
|
39
|
+
end
|
40
|
+
|
41
|
+
rule /^mack:portlet:unpack:/ do |t|
|
42
|
+
key = t.name.gsub('mack:portlet:unpack:', '')
|
43
|
+
ENV['unpacker_key'] = key
|
44
|
+
Rake::Task["mack:portlet:unpacker"].invoke
|
39
45
|
end
|
@@ -3,6 +3,7 @@ require 'pathname'
|
|
3
3
|
require 'spec'
|
4
4
|
require 'spec/rake/spectask'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'mack-facets'
|
6
7
|
namespace :test do
|
7
8
|
|
8
9
|
task :setup do
|
@@ -10,8 +11,7 @@ namespace :test do
|
|
10
11
|
|
11
12
|
desc "Run test code."
|
12
13
|
Rake::TestTask.new(:test_case) do |t|
|
13
|
-
require File.
|
14
|
-
Mack::BootLoader.run(:configuration)
|
14
|
+
require File.join_from_here('..', 'boot', 'configuration.rb')
|
15
15
|
t.libs << "test"
|
16
16
|
t.pattern = configatron.mack.send("#{configatron.mack.testing_framework}_file_pattern")
|
17
17
|
t.verbose = true
|
@@ -19,8 +19,7 @@ namespace :test do
|
|
19
19
|
|
20
20
|
desc 'Run specifications'
|
21
21
|
Spec::Rake::SpecTask.new(:rspec) do |t|
|
22
|
-
require File.
|
23
|
-
Mack::BootLoader.run(:configuration)
|
22
|
+
require File.join_from_here('..', 'boot', 'configuration.rb')
|
24
23
|
t.spec_opts << '--options' << 'test/spec.opts' if File.exists?('test/spec.opts')
|
25
24
|
t.spec_files = Dir.glob(configatron.mack.send("#{configatron.mack.testing_framework}_file_pattern"))
|
26
25
|
end
|
@@ -80,8 +79,7 @@ namespace :test do
|
|
80
79
|
end
|
81
80
|
|
82
81
|
task :default do
|
83
|
-
require File.
|
84
|
-
Mack::BootLoader.run(:configuration)
|
82
|
+
require File.join_from_here('..', 'boot', 'configuration.rb')
|
85
83
|
tf = "rspec"
|
86
84
|
begin
|
87
85
|
tf = configatron.mack.testing_framework
|
data/lib/mack/testing/helpers.rb
CHANGED
@@ -151,11 +151,19 @@ module Mack
|
|
151
151
|
form_input += "content-disposition: form-data; name=\"#{k}\"; filename=\"#{v.file_name}\"\r\n"
|
152
152
|
form_input += "Content-Type: #{v.mime}\r\n\r\n"
|
153
153
|
form_input += "#{v.content}\r\n"
|
154
|
-
|
154
|
+
options - k
|
155
|
+
elsif k == :multipart
|
156
|
+
options - k
|
157
|
+
end
|
158
|
+
end
|
159
|
+
unless options.empty?
|
160
|
+
params = options.to_params
|
161
|
+
params.split('&').each do |p|
|
162
|
+
k_v = p.split('=')
|
155
163
|
form_input += boundary
|
156
|
-
form_input += "content-disposition: form-data; name=\"#{
|
164
|
+
form_input += "content-disposition: form-data; name=\"#{k_v[0]}\"\r\n"
|
157
165
|
form_input += "Content-Type: text/plain\r\n\r\n"
|
158
|
-
form_input += "#{
|
166
|
+
form_input += "#{k_v[1]}\r\n"
|
159
167
|
end
|
160
168
|
end
|
161
169
|
form_input += boundary
|
@@ -170,7 +178,7 @@ module Mack
|
|
170
178
|
|
171
179
|
def mack_app
|
172
180
|
if $mack_app.nil?
|
173
|
-
$mack_app = Rack::Recursive.new(Mack::
|
181
|
+
$mack_app = Rack::Recursive.new(Mack::Application.new)
|
174
182
|
end
|
175
183
|
$mack_app
|
176
184
|
end
|
data/lib/mack/utils/server.rb
CHANGED
@@ -18,7 +18,13 @@ module Mack
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Any urls listed will go straight to the public directly and will not be served up via the app:
|
21
|
-
|
21
|
+
Mack.search_path(:public, false).reverse.each do |path|
|
22
|
+
app = Mack::Static.new(app, :urls => configatron.mack.static_paths, :root => path)
|
23
|
+
end
|
24
|
+
|
25
|
+
app = Mack::Static.new(app, :urls => configatron.mack.static_paths, :root => Mack::Paths.public)
|
26
|
+
|
27
|
+
# app = Mack::Static.new(app)
|
22
28
|
app = Mack::Utils::ContentLengthHandler.new(app)
|
23
29
|
app = Rack::Lint.new(app) if configatron.mack.use_lint
|
24
30
|
app = Rack::ShowStatus.new(app)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Mack
|
2
|
+
class Static < Rack::Static # :nodoc:
|
3
|
+
|
4
|
+
def call(env)
|
5
|
+
path = env["PATH_INFO"]
|
6
|
+
can_serve = @urls.any? { |url| path.index(url) == 0 }
|
7
|
+
|
8
|
+
if can_serve
|
9
|
+
res = @file_server.call(env)
|
10
|
+
# This is the BIG difference between Mack::Static and Rack::Static:
|
11
|
+
return @app.call(env) if res.nil? || res[0] == 404
|
12
|
+
return res
|
13
|
+
else
|
14
|
+
return @app.call(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end # Static
|
19
|
+
end # Mack
|
data/lib/mack/version.rb
CHANGED
@@ -1,13 +1,5 @@
|
|
1
1
|
module Mack
|
2
2
|
module ViewHelpers # :nodoc:
|
3
|
-
|
4
|
-
def get_resource_root(resource)
|
5
|
-
path = ""
|
6
|
-
path = "#{configatron.mack.distributed.site_domain}" unless configatron.mack.distributed.site_domain.nil?
|
7
|
-
path = Mack::Assets::Helpers.instance.asset_hosts(resource) if path.empty?
|
8
|
-
return path
|
9
|
-
end
|
10
|
-
|
11
3
|
# Used to easily include all Mack::ViewHelpers. It will NOT include itself!
|
12
4
|
# This is primarily used to aid in testing view helpers.
|
13
5
|
def self.included(base)
|
@@ -50,7 +50,7 @@ module Mack
|
|
50
50
|
years = []
|
51
51
|
(time.year - 5).upto(time.year + 5) { |y| years << [y, y]}
|
52
52
|
|
53
|
-
options = {:years => true, :months => true, :days => true, :hours => true, :minutes => true, :seconds => false, :year_options => years, :month_options => MONTHS, :day_options => DAYS, :hour_options => HOURS, :minute_options => MINUTES, :second_options => MINUTES, :date_separator => '/', :time_separator => ':'}.merge(fe.options)
|
53
|
+
options = {:years => true, :months => true, :days => true, :hours => true, :minutes => true, :seconds => false, :year_options => years, :month_options => MONTHS, :day_options => DAYS, :hour_options => HOURS, :minute_options => MINUTES, :second_options => MINUTES, :date_separator => '/', :time_separator => ':', :date_order => [:month, :day, :year], :time_order => [:hour, :minute, :second], :date_time_order => [:date, :time]}.merge(fe.options)
|
54
54
|
|
55
55
|
[:year, :month, :day, :hour, :minute, :second].each do |v|
|
56
56
|
if options["#{v}_values".to_sym]
|
@@ -59,27 +59,33 @@ module Mack
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
fe.options - [:years, :months, :days, :hours, :minutes, :seconds, :year_options, :month_options, :day_options, :hour_options, :minute_options, :second_options, :year_values, :month_values, :day_values, :hour_values, :minute_values, :second_values]
|
62
|
+
fe.options - [:years, :months, :days, :hours, :minutes, :seconds, :year_options, :month_options, :day_options, :hour_options, :minute_options, :second_options, :year_values, :month_values, :day_values, :hour_values, :minute_values, :second_values, :date_order, :time_order, :date_time_order]
|
63
63
|
|
64
64
|
label = label_parameter_tag(name, (fe.calling_method == :to_s ? name : "#{name}_#{fe.calling_method}"), var, fe)
|
65
65
|
|
66
66
|
|
67
67
|
date_boxes = []
|
68
|
-
|
69
|
-
date_boxes
|
70
|
-
date_boxes
|
68
|
+
options[:date_order].collect! { |s| s.to_sym }
|
69
|
+
date_boxes[options[:date_order].index(:month)] = dt_select(:month, name, fe, time.month, options[:month_options]) if options[:months]
|
70
|
+
date_boxes[options[:date_order].index(:day)] = dt_select(:day, name, fe, time.day, options[:day_options]) if options[:days]
|
71
|
+
date_boxes[options[:date_order].index(:year)] = dt_select(:year, name, fe, time.year, options[:year_options]) if options[:years]
|
72
|
+
date_boxes.compact!
|
71
73
|
|
72
74
|
time_boxes = []
|
73
|
-
|
74
|
-
time_boxes
|
75
|
-
time_boxes
|
75
|
+
options[:time_order].collect! { |s| s.to_sym }
|
76
|
+
time_boxes[options[:time_order].index(:hour)] = dt_select(:hour, name, fe, time.hour, options[:hour_options]) if options[:hours]
|
77
|
+
time_boxes[options[:time_order].index(:minute)] = dt_select(:minute, name, fe, time.min, options[:minute_options]) if options[:minutes]
|
78
|
+
time_boxes[options[:time_order].index(:second)] = dt_select(:second, name, fe, time.sec, options[:second_options]) if options[:seconds]
|
79
|
+
time_boxes.compact!
|
76
80
|
|
77
|
-
|
78
|
-
|
79
|
-
unless
|
80
|
-
|
81
|
+
elts = []
|
82
|
+
elts[options[:date_time_order].index(:date)] = date_boxes.join(options[:date_separator])
|
83
|
+
unless elts.empty?
|
84
|
+
elts[options[:date_time_order].index(:time)] = time_boxes.join(options[:time_separator])
|
81
85
|
end
|
86
|
+
elts.compact!
|
82
87
|
|
88
|
+
boxes = elts.join(" ").strip
|
83
89
|
return label + boxes
|
84
90
|
end
|
85
91
|
|
@@ -288,8 +288,17 @@ module Mack
|
|
288
288
|
end
|
289
289
|
options[:value] = var.send(fe.calling_method)
|
290
290
|
|
291
|
+
if var.has_errors?(fe.calling_method)
|
292
|
+
fe.options = {:error_class => "error"}.merge(fe.options)
|
293
|
+
class_arr = fe.options[:class].to_s.split(" ").collect { |s| s.strip }
|
294
|
+
class_arr << fe.options[:error_class]
|
295
|
+
fe.options[:class] = class_arr.join(" ")
|
296
|
+
end
|
297
|
+
|
291
298
|
yield var, fe, options if block_given?
|
292
299
|
|
300
|
+
# we don't need the error_class by this time, since if used it will get appended into options[:class]
|
301
|
+
fe.options.delete(:error_class)
|
293
302
|
return label_parameter_tag(name, options[:id], var, fe) + non_content_tag(:input, options.merge(fe.options))
|
294
303
|
end
|
295
304
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Mack
|
2
2
|
module ViewHelpers # :nodoc:
|
3
3
|
module HtmlHelpers
|
4
|
-
|
4
|
+
include Mack::Assets
|
5
|
+
|
5
6
|
# Builds an HTML tag.
|
6
7
|
#
|
7
8
|
# Examples:
|
@@ -28,6 +29,16 @@ module Mack
|
|
28
29
|
|
29
30
|
# Builds a HTML image tag.
|
30
31
|
def img(image_src, options = {})
|
32
|
+
image_src = case image_src.to_s
|
33
|
+
when /^\/images/
|
34
|
+
image_src
|
35
|
+
when /^images/
|
36
|
+
'/' + image_src
|
37
|
+
when /^\//
|
38
|
+
image_src
|
39
|
+
else
|
40
|
+
'/images/' + image_src
|
41
|
+
end
|
31
42
|
image_src = "#{get_resource_root(image_src)}#{image_src}?#{configatron.mack.assets.stamp}"
|
32
43
|
non_content_tag(:img, {:src => image_src}.merge(options))
|
33
44
|
end
|
@@ -62,12 +73,12 @@ pageTracker._trackPageview();
|
|
62
73
|
opts
|
63
74
|
end
|
64
75
|
|
65
|
-
def get_resource_root(resource)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
76
|
+
# def get_resource_root(resource)
|
77
|
+
# path = ""
|
78
|
+
# path = "#{configatron.mack.distributed.site_domain}" unless configatron.mack.distributed.site_domain.nil?
|
79
|
+
# path = Mack::Assets::Helpers.instance.asset_hosts(resource) if path.empty?
|
80
|
+
# return path
|
81
|
+
# end
|
71
82
|
|
72
83
|
|
73
84
|
end # HtmlHelpers
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Mack
|
2
2
|
module ViewHelpers # :nodoc:
|
3
3
|
module LinkHelpers
|
4
|
+
include Mack::Assets
|
4
5
|
|
5
6
|
# Generates a javascript popup window. It will create the javascript needed for the window,
|
6
7
|
# as well as the href to call it.
|
@@ -87,7 +88,7 @@ module Mack
|
|
87
88
|
meth = nil
|
88
89
|
confirm = nil
|
89
90
|
|
90
|
-
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()}
|
91
|
+
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); var s2 = document.createElement('input'); s2.setAttribute('type', 'hidden'); s2.setAttribute('name', '__authenticity_token'); s2.setAttribute('value', '#{Mack::Utils::AuthenticityTokenDispenser.instance.dispense_token(session.id)}'); f.appendChild(s2); f.submit()}
|
91
92
|
options.delete(:method)
|
92
93
|
|
93
94
|
if options[:confirm]
|
data/lib/mack_app.rb
CHANGED
@@ -1,18 +1,30 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
boot_load(:start_mack_application, :configuration, :print_hello_banner, :lib, :routes, :app_files, :helpers, :runner) do
|
7
|
-
Mack::Environment.load
|
8
|
-
Mack.logger.debug "Initialization of Mack Application Environment finished."
|
1
|
+
if __FILE__ == $0
|
2
|
+
require 'fileutils'
|
3
|
+
require 'mack-facets'
|
4
|
+
ENV["MACK_ROOT"] = File.join(FileUtils.pwd, '..', 'test', 'fake_application')
|
9
5
|
end
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Mack.logger.debug "Starting application in #{Mack.env} mode."
|
7
|
+
run_once do
|
8
|
+
[:hello, :core, :gems, :plugins, :lib, :initializers, :routes, :app, :helpers].each do |f|
|
9
|
+
require File.join_from_here('mack', 'boot', "#{f}.rb")
|
10
|
+
end
|
16
11
|
end
|
17
12
|
|
18
|
-
|
13
|
+
# fl = File.join(File.dirname(__FILE__), "mack")
|
14
|
+
# require File.join(fl, "initialization", "application.rb")
|
15
|
+
# require File.join(fl, "initialization", "helpers.rb")
|
16
|
+
# require File.join(fl, "initialization", "plugins.rb")
|
17
|
+
#
|
18
|
+
# boot_load(:start_mack_application, :configuration, :print_hello_banner, :lib, :routes, :app_files, :helpers, :runner) do
|
19
|
+
# Mack::Environment.load
|
20
|
+
# Mack.logger.debug "Initialization of Mack Application Environment finished."
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# boot_load(:print_hello_banner, :configuration) do
|
24
|
+
# Mack.reset_logger!
|
25
|
+
# Mack.logger.debug "Mack root: #{Mack.root}"
|
26
|
+
# Mack.logger.debug "Mack version: #{Mack::VERSION}"
|
27
|
+
# Mack.logger.debug "Starting application in #{Mack.env} mode."
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# Mack::BootLoader.run(:start_mack_application)
|
data/lib/mack_core.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
if __FILE__ == $0
|
2
|
+
require 'fileutils'
|
3
|
+
ENV["MACK_ROOT"] = File.join(FileUtils.pwd, 'test', 'fake_application')
|
4
|
+
end
|
5
|
+
|
1
6
|
require 'rubygems'
|
2
7
|
require 'rack'
|
3
8
|
require 'digest'
|
@@ -25,45 +30,51 @@ begin
|
|
25
30
|
rescue Exception => e
|
26
31
|
end
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
require File.
|
31
|
-
require File.join(fl, "initialization", "configuration.rb")
|
32
|
-
require File.join(fl, "initialization", "logging.rb")
|
33
|
-
|
34
|
-
boot_load(:version) do
|
35
|
-
require File.join(File.dirname(__FILE__), "mack", "version")
|
36
|
-
end
|
37
|
-
|
38
|
-
boot_load(:paths) do
|
39
|
-
require File.join(File.dirname(__FILE__), "mack", "utils", "paths")
|
40
|
-
end
|
41
|
-
|
42
|
-
boot_load(:gems) do
|
43
|
-
Mack.logger.debug "Initializing custom gems..." unless configatron.mack.log.disable_initialization_logging
|
44
|
-
load Mack::Paths.initializers("gems.rb")
|
45
|
-
Mack::Utils::GemManager.instance.do_requires
|
46
|
-
end
|
47
|
-
|
48
|
-
boot_load(:core_classes) do
|
49
|
-
Mack.logger.debug "Initializing core classes..." unless configatron.mack.log.disable_initialization_logging
|
50
|
-
# Require all the necessary files to make Mack actually work!
|
51
|
-
lib_dirs = ["assets", "errors", "core_extensions", "utils", "sessions", "runner_helpers", "routing", "view_helpers", "rendering", "controller", "tasks", "initialization/server", "generators", "distributed"]
|
52
|
-
lib_dirs << "testing"# if Mack.env == "test"
|
53
|
-
lib_dirs.each do |dir|
|
54
|
-
dir_globs = Dir.glob(File.join(File.dirname(__FILE__), "mack", dir, "**/*.rb"))
|
55
|
-
dir_globs.sort.each do |d|
|
56
|
-
require d unless d.match(/console/)
|
57
|
-
end
|
33
|
+
run_once do
|
34
|
+
[:version, :extensions, :paths, :portlets, :environment, :configuration, :logging, :assets, :core, :gems].each do |f|
|
35
|
+
require File.join_from_here('mack', 'boot', "#{f}.rb")
|
58
36
|
end
|
59
37
|
end
|
60
38
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
39
|
+
# fl = File.join(File.dirname(__FILE__), "mack")
|
40
|
+
# require File.join(fl, "initialization", "boot_loader.rb")
|
41
|
+
# require File.join(fl, "initialization", "environment.rb")
|
42
|
+
# require File.join(fl, "initialization", "configuration.rb")
|
43
|
+
# require File.join(fl, "initialization", "logging.rb")
|
44
|
+
#
|
45
|
+
# boot_load(:version) do
|
46
|
+
# require File.join(File.dirname(__FILE__), "mack", "version")
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# boot_load(:paths) do
|
50
|
+
# require File.join(File.dirname(__FILE__), "mack", "utils", "paths")
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# boot_load(:gems) do
|
54
|
+
# Mack.logger.debug "Initializing custom gems..." unless configatron.mack.log.disable_initialization_logging
|
55
|
+
# load Mack::Paths.initializers("gems.rb")
|
56
|
+
# Mack::Utils::GemManager.instance.do_requires
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# boot_load(:core_classes) do
|
60
|
+
# Mack.logger.debug "Initializing core classes..." unless configatron.mack.log.disable_initialization_logging
|
61
|
+
# # Require all the necessary files to make Mack actually work!
|
62
|
+
# lib_dirs = ["assets", "errors", "core_extensions", "utils", "sessions", "runner_helpers", "routing", "view_helpers", "rendering", "controller", "tasks", "initialization/server", "generators", "distributed"]
|
63
|
+
# lib_dirs << "testing"# if Mack.env == "test"
|
64
|
+
# lib_dirs.each do |dir|
|
65
|
+
# dir_globs = Dir.glob(File.join(File.dirname(__FILE__), "mack", dir, "**/*.rb"))
|
66
|
+
# dir_globs.sort.each do |d|
|
67
|
+
# require d unless d.match(/console/)
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# boot_load(:runner) do
|
73
|
+
# require File.join(File.dirname(__FILE__), "mack", "runner")
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# boot_load(:load_mack_core, :version, :paths, :configuration, :logging, :core_classes, :gems) do
|
77
|
+
# Mack.logger.debug "Initialization of Mack Core finished." unless configatron.mack.log.disable_initialization_logging
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# Mack::BootLoader.run(:load_mack_core)
|