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.
Files changed (79) hide show
  1. data/CHANGELOG +29 -0
  2. data/bin/mackery-console +6 -5
  3. data/bin/mackery-server +23 -7
  4. data/lib/mack.rb +0 -3
  5. data/lib/mack/application.rb +161 -0
  6. data/lib/mack/assets/asset_helpers.rb +8 -0
  7. data/lib/mack/assets/assets_mgr.rb +0 -10
  8. data/lib/mack/boot/app.rb +46 -0
  9. data/lib/mack/boot/assets.rb +10 -0
  10. data/lib/mack/boot/configuration.rb +87 -0
  11. data/lib/mack/boot/console.rb +36 -0
  12. data/lib/mack/boot/core.rb +21 -0
  13. data/lib/mack/boot/environment.rb +22 -0
  14. data/lib/mack/boot/extensions.rb +13 -0
  15. data/lib/mack/boot/gem_tasks.rb +20 -0
  16. data/lib/mack/boot/gems.rb +18 -0
  17. data/lib/mack/boot/hello.rb +11 -0
  18. data/lib/mack/{initialization → boot}/helpers.rb +8 -3
  19. data/lib/mack/boot/initializers.rb +17 -0
  20. data/lib/mack/boot/lib.rb +19 -0
  21. data/lib/mack/{initialization → boot}/logging.rb +16 -9
  22. data/lib/mack/{initialization → boot}/logging/basic_layout.rb +0 -0
  23. data/lib/mack/{initialization → boot}/logging/color_layout.rb +1 -1
  24. data/lib/mack/{initialization → boot}/logging/filter.rb +0 -0
  25. data/lib/mack/boot/paths.rb +234 -0
  26. data/lib/mack/boot/plugins.rb +26 -0
  27. data/lib/mack/boot/portlets.rb +20 -0
  28. data/lib/mack/boot/routes.rb +15 -0
  29. data/lib/mack/boot/version.rb +7 -0
  30. data/lib/mack/controller/request.rb +5 -2
  31. data/lib/mack/controller/uploaded_file.rb +4 -0
  32. data/lib/mack/core_extensions/kernel.rb +26 -0
  33. data/lib/mack/core_extensions/object.rb +16 -0
  34. data/lib/mack/generators/mack_application_generator/manifest.yml +5 -3
  35. data/lib/mack/generators/mack_application_generator/templates/config/initializers/portlets.rb.template +9 -0
  36. data/lib/mack/generators/mack_application_generator/templates/public/stylesheets/scaffold.css.template +4 -0
  37. data/lib/mack/generators/portlet_generator/portlet_generator.rb +2 -0
  38. data/lib/mack/generators/portlet_generator/templates/README.template +3 -0
  39. data/lib/mack/generators/portlet_generator/templates/portlet_config/portlet.spec.template +28 -0
  40. data/lib/mack/portlets/manager.rb +27 -0
  41. data/lib/mack/portlets/portlet.rb +93 -0
  42. data/lib/mack/portlets/unpacker.rb +34 -0
  43. data/lib/mack/rendering/engine/erubis.rb +2 -2
  44. data/lib/mack/rendering/type/file_base.rb +8 -4
  45. data/lib/mack/rendering/type/public.rb +4 -2
  46. data/lib/mack/routing/resource_proxy.rb +30 -4
  47. data/lib/mack/routing/route_map.rb +28 -15
  48. data/lib/mack/routing/route_object.rb +57 -24
  49. data/lib/mack/routing/urls.rb +12 -2
  50. data/lib/mack/runner.rb +6 -154
  51. data/lib/mack/sessions/cookie_session_store.rb +2 -1
  52. data/lib/mack/tasks/mack_dump_tasks.rake +62 -18
  53. data/lib/mack/tasks/mack_tasks.rake +1 -15
  54. data/lib/mack/tasks/portlet_tasks.rake +33 -0
  55. data/lib/mack/tasks/rake_rules.rake +6 -0
  56. data/lib/mack/tasks/test_tasks.rake +4 -6
  57. data/lib/mack/testing/helpers.rb +12 -4
  58. data/lib/mack/utils/server.rb +7 -1
  59. data/lib/mack/utils/static.rb +19 -0
  60. data/lib/mack/version.rb +1 -1
  61. data/lib/mack/view_helpers/all_helpers.rb +0 -8
  62. data/lib/mack/view_helpers/date_time_helpers.rb +18 -12
  63. data/lib/mack/view_helpers/form_helpers.rb +9 -0
  64. data/lib/mack/view_helpers/html_helpers.rb +18 -7
  65. data/lib/mack/view_helpers/link_helpers.rb +2 -1
  66. data/lib/mack/view_helpers/object_helpers.rb +1 -1
  67. data/lib/mack_app.rb +26 -14
  68. data/lib/mack_core.rb +50 -39
  69. data/lib/mack_tasks.rb +46 -19
  70. metadata +37 -18
  71. data/lib/mack/initialization/application.rb +0 -53
  72. data/lib/mack/initialization/boot_loader.rb +0 -72
  73. data/lib/mack/initialization/configuration.rb +0 -101
  74. data/lib/mack/initialization/console.rb +0 -29
  75. data/lib/mack/initialization/environment.rb +0 -16
  76. data/lib/mack/initialization/plugins.rb +0 -16
  77. data/lib/mack/initialization/server/simple_server.rb +0 -19
  78. data/lib/mack/tasks/mack_server_tasks.rake +0 -24
  79. 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.join(File.dirname(__FILE__), '..', 'initialization', 'configuration')
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.join(File.dirname(__FILE__), '..', 'initialization', 'configuration')
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.join(File.dirname(__FILE__), '..', 'initialization', 'configuration')
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
@@ -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
- elsif k != :multipart
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=\"#{k}\"\r\n"
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 += "#{v}\r\n"
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::Runner.new)
181
+ $mack_app = Rack::Recursive.new(Mack::Application.new)
174
182
  end
175
183
  $mack_app
176
184
  end
@@ -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
- app = Rack::Static.new(app, :urls => ["/css", "/images", "/files", "/images", "/stylesheets", "/javascripts", "/media", "/favicon.ico"], :root => "public")
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
@@ -1,3 +1,3 @@
1
1
  module Mack
2
- VERSION = '0.8.0.101' unless const_defined?("VERSION")
2
+ VERSION = '0.8.1' unless const_defined?("VERSION")
3
3
  end
@@ -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
- date_boxes << dt_select(:month, name, fe, time.month, options[:month_options]) if options[:months]
69
- date_boxes << dt_select(:day, name, fe, time.day, options[:day_options]) if options[:days]
70
- date_boxes << dt_select(:year, name, fe, time.year, options[:year_options]) if options[:years]
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
- time_boxes << dt_select(:hour, name, fe, time.hour, options[:hour_options]) if options[:hours]
74
- time_boxes << dt_select(:minute, name, fe, time.min, options[:minute_options]) if options[:minutes]
75
- time_boxes << dt_select(:second, name, fe, time.sec, options[:second_options]) if options[:seconds]
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
- boxes = date_boxes.join(options[:date_separator])
78
-
79
- unless time_boxes.empty?
80
- boxes << " " << time_boxes.join(options[:time_separator])
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
- path = ""
67
- path = "#{configatron.mack.distributed.site_domain}" unless configatron.mack.distributed.site_domain.nil?
68
- path = Mack::Assets::Helpers.instance.asset_hosts(resource) if path.empty?
69
- return path
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]
@@ -6,7 +6,7 @@ module Mack
6
6
  # and will grap the pretty print of the inspect and wrap it in
7
7
  # HTML pre tags.
8
8
  def debug(obj)
9
- "<pre>#{pp_to_s(obj)}</pre>"
9
+ "<pre>#{pp_to_s(obj).gsub('<', '&lt;')}</pre>"
10
10
  end
11
11
 
12
12
  end # ObjectHelpers
@@ -1,18 +1,30 @@
1
- fl = File.join(File.dirname(__FILE__), "mack")
2
- require File.join(fl, "initialization", "application.rb")
3
- require File.join(fl, "initialization", "helpers.rb")
4
- require File.join(fl, "initialization", "plugins.rb")
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
- boot_load(:print_hello_banner, :configuration) do
12
- Mack.reset_logger!
13
- Mack.logger.debug "Mack root: #{Mack.root}"
14
- Mack.logger.debug "Mack version: #{Mack::VERSION}"
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
- Mack::BootLoader.run(:start_mack_application)
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)
@@ -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
- fl = File.join(File.dirname(__FILE__), "mack")
29
- require File.join(fl, "initialization", "boot_loader.rb")
30
- require File.join(fl, "initialization", "environment.rb")
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
- boot_load(:runner) do
62
- require File.join(File.dirname(__FILE__), "mack", "runner")
63
- end
64
-
65
- boot_load(:load_mack_core, :version, :paths, :configuration, :logging, :core_classes, :gems) do
66
- Mack.logger.debug "Initialization of Mack Core finished." unless configatron.mack.log.disable_initialization_logging
67
- end
68
-
69
- Mack::BootLoader.run(:load_mack_core)
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)