mack 0.6.0.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/CHANGELOG +45 -0
  2. data/bin/mack +8 -3
  3. data/lib/mack.rb +2 -57
  4. data/lib/mack/controller/all_helpers.rb +14 -0
  5. data/lib/{controller → mack/controller}/controller.rb +7 -1
  6. data/lib/{controller → mack/controller}/cookie_jar.rb +0 -0
  7. data/lib/{controller → mack/controller}/filter.rb +0 -0
  8. data/lib/{controller → mack/controller}/request.rb +0 -0
  9. data/lib/{controller → mack/controller}/response.rb +0 -0
  10. data/lib/{controller → mack/controller}/session.rb +0 -0
  11. data/lib/{controller → mack/controller}/uploaded_file.rb +0 -0
  12. data/lib/{core_extensions → mack/core_extensions}/kernel.rb +0 -0
  13. data/lib/{core_extensions → mack/core_extensions}/string.rb +0 -0
  14. data/lib/{distributed → mack/distributed}/errors/errors.rb +0 -0
  15. data/lib/{distributed → mack/distributed}/routing/urls.rb +10 -1
  16. data/lib/{distributed → mack/distributed}/utils/rinda.rb +0 -0
  17. data/lib/{errors → mack/errors}/errors.rb +4 -0
  18. data/lib/{generators → mack/generators}/mack_application_generator/mack_application_generator.rb +0 -0
  19. data/lib/{generators → mack/generators}/mack_application_generator/manifest.yml +0 -0
  20. data/lib/mack/generators/mack_application_generator/templates/Rakefile.template +6 -0
  21. data/lib/{generators → mack/generators}/mack_application_generator/templates/app/controllers/default_controller.rb.template +0 -0
  22. data/lib/{generators → mack/generators}/mack_application_generator/templates/app/helpers/controllers/default_controller_helper.rb.template +0 -0
  23. data/lib/{generators → mack/generators}/mack_application_generator/templates/app/helpers/views/application_helper.rb.template +0 -0
  24. data/lib/{generators → mack/generators}/mack_application_generator/templates/app/views/default/index.html.erb.template +0 -0
  25. data/lib/{generators → mack/generators}/mack_application_generator/templates/app/views/layouts/application.html.erb.template +0 -0
  26. data/lib/mack/generators/mack_application_generator/templates/config/app_config/default.yml.template +11 -0
  27. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/app_config/development.yml.template +0 -0
  28. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/app_config/production.yml.template +0 -0
  29. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/app_config/test.yml.template +0 -0
  30. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/database.yml.template +0 -0
  31. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/initializers/gems.rb.template +3 -0
  32. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/initializers/mime_types.rb.template +0 -0
  33. data/lib/{generators → mack/generators}/mack_application_generator/templates/config/routes.rb.template +0 -0
  34. data/lib/{generators → mack/generators}/mack_application_generator/templates/public/favicon.ico.template +0 -0
  35. data/lib/{generators → mack/generators}/mack_application_generator/templates/public/stylesheets/scaffold.css.template +0 -0
  36. data/lib/{generators → mack/generators}/mack_application_generator/templates/test/functional/default_controller_spec.rb.template +0 -0
  37. data/lib/{generators → mack/generators}/mack_application_generator/templates/test/functional/default_controller_test.rb.template +0 -0
  38. data/lib/{generators → mack/generators}/mack_application_generator/templates/test/spec.opts.template +0 -0
  39. data/lib/{generators → mack/generators}/mack_application_generator/templates/test/spec_helper.rb.template +0 -0
  40. data/lib/{generators → mack/generators}/mack_application_generator/templates/test/test_helper.rb.template +0 -0
  41. data/lib/{generators → mack/generators}/plugin_generator/plugin_generator.rb +0 -0
  42. data/lib/{generators → mack/generators}/plugin_generator/templates/vendor/plugins/%=@plugin_name%/init.rb.template +0 -0
  43. data/lib/{generators → mack/generators}/plugin_generator/templates/vendor/plugins/%=@plugin_name%/lib/%=@plugin_name%.rb.template +0 -0
  44. data/lib/{generators → mack/generators}/plugin_generator/templates/vendor/plugins/%=@plugin_name%/lib/tasks/%=@plugin_name%_tasks.rake.template +0 -0
  45. data/lib/{initialization → mack/initialization}/application.rb +6 -6
  46. data/lib/{initialization → mack/initialization}/configuration.rb +7 -2
  47. data/lib/{initialization → mack/initialization}/console.rb +1 -1
  48. data/lib/{initialization → mack/initialization}/helpers.rb +1 -1
  49. data/lib/{initialization → mack/initialization}/logging.rb +25 -0
  50. data/lib/mack/initialization/orm_support.rb +20 -0
  51. data/lib/{initialization → mack/initialization}/plugins.rb +0 -0
  52. data/lib/{initialization → mack/initialization}/server/simple_server.rb +0 -0
  53. data/lib/{rendering → mack/rendering}/engine/base.rb +0 -0
  54. data/lib/{rendering → mack/rendering}/engine/builder.rb +0 -0
  55. data/lib/{rendering → mack/rendering}/engine/erubis.rb +0 -0
  56. data/lib/{rendering → mack/rendering}/engine/registry.rb +0 -0
  57. data/lib/{rendering → mack/rendering}/type/action.rb +0 -0
  58. data/lib/{rendering → mack/rendering}/type/base.rb +0 -0
  59. data/lib/{rendering → mack/rendering}/type/file_base.rb +0 -0
  60. data/lib/{rendering → mack/rendering}/type/inline.rb +0 -0
  61. data/lib/{rendering → mack/rendering}/type/layout.rb +0 -0
  62. data/lib/{rendering → mack/rendering}/type/partial.rb +0 -0
  63. data/lib/{rendering → mack/rendering}/type/public.rb +0 -0
  64. data/lib/{rendering → mack/rendering}/type/template.rb +0 -0
  65. data/lib/{rendering → mack/rendering}/type/text.rb +0 -0
  66. data/lib/{rendering → mack/rendering}/type/url.rb +0 -0
  67. data/lib/{rendering → mack/rendering}/type/xml.rb +0 -0
  68. data/lib/{rendering → mack/rendering}/view_template.rb +0 -0
  69. data/lib/{routing → mack/routing}/route_map.rb +1 -7
  70. data/lib/{routing → mack/routing}/urls.rb +0 -0
  71. data/lib/mack/runner.rb +121 -0
  72. data/lib/mack/runner_helpers/base.rb +13 -0
  73. data/lib/mack/runner_helpers/registry.rb +13 -0
  74. data/lib/mack/runner_helpers/request_logger.rb +32 -0
  75. data/lib/mack/runner_helpers/session.rb +41 -0
  76. data/lib/{tasks → mack/tasks}/cachetastic_tasks.rake +0 -11
  77. data/lib/{tasks → mack/tasks}/gem_tasks.rake +3 -17
  78. data/lib/{tasks → mack/tasks}/generator_tasks.rake +1 -1
  79. data/lib/{tasks → mack/tasks}/log_tasks.rake +0 -0
  80. data/lib/{tasks → mack/tasks}/mack_dump_tasks.rake +0 -0
  81. data/lib/{tasks → mack/tasks}/mack_ring_server_tasks.rake +0 -0
  82. data/lib/{tasks → mack/tasks}/mack_server_tasks.rake +0 -0
  83. data/lib/{tasks → mack/tasks}/mack_tasks.rake +1 -2
  84. data/lib/{tasks → mack/tasks}/mack_update_tasks.rake +0 -0
  85. data/lib/{tasks → mack/tasks}/rake_helpers.rb +0 -0
  86. data/lib/{tasks → mack/tasks}/rake_rules.rake +1 -5
  87. data/lib/{tasks → mack/tasks}/test_tasks.rake +18 -8
  88. data/lib/mack/tasks/tmp_tasks.rake +8 -0
  89. data/lib/{testing → mack/testing}/helpers.rb +1 -1
  90. data/lib/{testing → mack/testing}/response.rb +0 -0
  91. data/lib/{testing → mack/testing}/rspec.rb +3 -2
  92. data/lib/{testing → mack/testing}/test_assertions.rb +0 -0
  93. data/lib/{testing → mack/testing}/test_case.rb +0 -0
  94. data/lib/mack/utils/ansi/ansi_color.rb +22 -0
  95. data/lib/{utils → mack/utils}/crypt/default_worker.rb +0 -0
  96. data/lib/{utils → mack/utils}/crypt/keeper.rb +0 -0
  97. data/lib/{utils → mack/utils}/gem_manager.rb +10 -5
  98. data/lib/{utils → mack/utils}/mime_types.rb +0 -0
  99. data/lib/{utils → mack/utils}/mime_types.yml +2 -1
  100. data/lib/{utils → mack/utils}/server.rb +11 -5
  101. data/lib/mack/view_helpers/all_helpers.rb +16 -0
  102. data/lib/{view_helpers → mack/view_helpers}/html_helpers.rb +1 -1
  103. data/lib/{view_helpers → mack/view_helpers}/string_helpers.rb +1 -1
  104. data/lib/mack_app.rb +19 -0
  105. data/lib/mack_core.rb +52 -0
  106. data/lib/mack_tasks.rb +16 -1
  107. metadata +118 -98
  108. data/lib/generators/mack_application_generator/templates/Rakefile.template +0 -10
  109. data/lib/generators/mack_application_generator/templates/config/app_config/default.yml.template +0 -6
  110. data/lib/initialization/orm_support.rb +0 -10
  111. data/lib/runner.rb +0 -172
data/CHANGELOG CHANGED
@@ -1,3 +1,48 @@
1
+ ===0.6.1
2
+ * [#70] Mack-more: better association rules for data_factory
3
+ * [#60] Fixed Mack executable problem
4
+ * [#59] Fixed gems:* tasks
5
+ * [#57] Moved most files under to lib/mack
6
+ * [#56] mack-more: Added Mack::Utils::RegistryMap
7
+ * [#55] mack-more: mack-facets: Mack::Utils::Registry is now Mack::Utils::RegistryList
8
+ * [#54] Added DataMapper 0.9.3 support
9
+ * [#52] mack-more: mack-[orm] should require mack-[orm].rb using its full path.
10
+ * [#51] Application generator should generate orm support in the right place
11
+ * [#50] Mack will now have 2 environment files: mack_core and mack_app. Mack.rb will load both files, but it gives other module chance to load just the core files and not the application's files.
12
+ * [#49] Making sure the orm tasks is available when orm_support is removed from the app_config
13
+ * [#49] mack-active_record: mack-active_record.rb will require mack-active_record_tasks.rb
14
+ * [#49] mack-data_mapper: mack-data_mapper.rb will require mack-data_mapper_tasks.rb
15
+ * [#49] Updated warning message if orm is defined in app_config (i.e. user only needs to require mack-[orm_name], instead of both that and mack-[orm_name]_tasks).
16
+ * [#48] rake generator:list now displays the correct names for the generator tasks.
17
+ * [#47] rake gems:* tasks now work, and no longer require mack_ruby_core_extensions
18
+ * [#46] Calling .to_param on nil now raises a NoMethodError exception.
19
+ * [#45] rake stats task now works with Test::Unit::TestCase
20
+ * [#44] Mack::Runner has now been extended to allow for greater extension flexibility.
21
+ * [#43] Added a Mack::Utils::Registry class to allow for easy creation of registries.
22
+ * [#42] Sessions can now be turned off globally using the app_config.mack.use_sessions switch.
23
+ * [#41] Deprecate orm_support.rb
24
+ * [#38] There is now a registry of Controllers that are in the system.
25
+ * [#36] Renamed the initialize method in the Mack::Controller module to configure_controller. This gives
26
+ control of the initialize method back to the class.
27
+ * [#34] Mack::l10n now raises exception with a fully qualified name.
28
+ * [#33] mack-active_record now requires ActiveRecord 2.0.2 explicitly, not >=2.0.2
29
+ * [#31] Added support for ruby-debug.
30
+ * [#26] Log Coloring for console output.
31
+ * [#24] Added mack-notifier support.
32
+ * [#18] Added Page caching. All that's needed for using page caching is to require the mack-caching gem, turn on
33
+ page caching in your config files with:
34
+ use_page_caching: true
35
+ and, in your controllers, specify which pages you would like cached with the cache_pages directive:
36
+ cache_pages :only => [:index, :show] # you can also use :except
37
+ * [#14] Data Factory
38
+ * [#7] Added support for Extlib::Hook in a few places.
39
+ * [#6] RJS support
40
+ * Added a rake tmp:clear task.
41
+ * gem: cachetastic 1.7.3
42
+ * gem: application_configuration 1.5.2
43
+ * gem: ruby-debug 0.10.0
44
+ * gem: data_mapper 0.9.3
45
+
1
46
  ===0.6.0.1
2
47
  * Updated mack-localization (in mack-more) to be independent from utf8proc gem
3
48
 
data/bin/mack CHANGED
@@ -6,7 +6,7 @@ require 'ostruct'
6
6
  require 'pp'
7
7
  require 'erb'
8
8
  require 'genosaurus'
9
- require File.join(File.dirname(__FILE__), "..", "lib", "generators", "mack_application_generator", "mack_application_generator")
9
+ require File.join(File.dirname(__FILE__), "..", "lib", "mack", "generators", "mack_application_generator", "mack_application_generator")
10
10
 
11
11
  app = ARGV[0]
12
12
  raise "You must specify a name for this application!" if app.nil?
@@ -14,7 +14,8 @@ raise "You must specify a name for this application!" if app.nil?
14
14
  options = OpenStruct.new
15
15
  options.orm = "data_mapper"
16
16
  options.testing_framework = "rspec"
17
- options.version = "0.6.0.1"
17
+ options.js_framework = "jquery"
18
+ options.version = "0.6.1"
18
19
 
19
20
  opts = OptionParser.new do |opts|
20
21
  opts.banner = "Usage: mack <application_name> [options]"
@@ -27,8 +28,12 @@ opts = OptionParser.new do |opts|
27
28
  options.testing_framework = v
28
29
  end
29
30
 
31
+ opts.on("-j [jquery|prototype]") do |v|
32
+ options.js_framework = v
33
+ end
34
+
30
35
  end
31
36
 
32
37
  opts.parse!(ARGV)
33
38
 
34
- MackApplicationGenerator.run({"version" => options.version, "app" => app, "orm" => options.orm, "testing_framework" => options.testing_framework})
39
+ MackApplicationGenerator.run({"version" => options.version, "app" => app, "orm" => options.orm, "testing_framework" => options.testing_framework, "js_framework" => options.js_framework})
@@ -1,57 +1,2 @@
1
- require 'rubygems'
2
- require 'rack'
3
- require 'digest'
4
- require 'mack-facets'
5
- require 'application_configuration'
6
- require 'cachetastic'
7
- require 'fileutils'
8
- require 'log4r'
9
- require 'crypt/rijndael'
10
- require 'singleton'
11
- require 'uri'
12
- require 'drb'
13
- require 'rinda/ring'
14
- require 'rinda/tuplespace'
15
- require 'builder'
16
- require 'erubis'
17
- require 'erb'
18
- require 'genosaurus'
19
- require 'net/http'
20
- require 'pp'
21
- require 'test/unit'
22
-
23
- require File.join(File.dirname(__FILE__), "initialization", "configuration.rb")
24
-
25
- unless Mack::Configuration.initialized
26
-
27
- puts "Initializing logging..."
28
- require File.join(File.dirname(__FILE__), "initialization", "logging.rb")
29
-
30
- fl = File.join(File.dirname(__FILE__))
31
-
32
- Mack.logger.info "Starting application in #{Mack.env} mode."
33
- Mack.logger.info "Mack root: #{Mack.root}"
34
-
35
- Mack.logger.info "Initializing core classes..."
36
- # Require all the necessary files to make Mack actually work!
37
- lib_dirs = ["distributed", "errors", "core_extensions", "utils", "routing", "view_helpers", "rendering", "controller", "tasks", "initialization/server", "generators"]
38
- lib_dirs << "testing" if Mack.env == "test"
39
- lib_dirs.each do |dir|
40
- dir_globs = Dir.glob(File.join(fl, dir, "**/*.rb"))
41
- dir_globs.each do |d|
42
- require d
43
- end
44
- end
45
-
46
- require File.join(File.dirname(__FILE__), "runner")
47
-
48
- require File.join(File.dirname(__FILE__), "initialization", "orm_support.rb")
49
-
50
- require File.join(File.dirname(__FILE__), "initialization", "application.rb")
51
-
52
- require File.join(File.dirname(__FILE__), "initialization", "helpers.rb")
53
-
54
- Mack::Configuration.initialized = true if Mack::Configuration.initialized.nil?
55
-
56
- Mack.logger.info "Initialization finished."
57
- end
1
+ require File.join(File.dirname(__FILE__), 'mack_core')
2
+ require File.join(File.dirname(__FILE__), 'mack_app')
@@ -0,0 +1,14 @@
1
+ module Mack
2
+ module ControllerHelpers # :nodoc:
3
+
4
+ # Used to easily include all Mack::ControllerHelpers. It will NOT include itself!
5
+ # This is primarily used to aid in testing controller helpers.
6
+ def self.included(base)
7
+ Mack::ControllerHelpers.constants.each do |c|
8
+ mod = "Mack::ControllerHelpers::#{c}".constantize
9
+ mod.include_safely_into(base) unless base.is_a?(mod)
10
+ end
11
+ end # included
12
+
13
+ end # ViewHelpers
14
+ end # Mack
@@ -25,7 +25,7 @@ module Mack
25
25
  # If an exception was thrown by a request this represents that error.
26
26
  attr_accessor :caught_exception
27
27
 
28
- def initialize(request, response, cookies)
28
+ def configure_controller(request, response, cookies)
29
29
  @request = request
30
30
  @response = response
31
31
  @render_options = {}
@@ -43,6 +43,7 @@ module Mack
43
43
 
44
44
  # Gives access to the session. See Mack::Session for more information.
45
45
  def session
46
+ raise Mack::Errors::NoSessionError.new if self.request.session.nil?
46
47
  self.request.session
47
48
  end
48
49
 
@@ -364,8 +365,13 @@ module Mack
364
365
  # Make sure that all the class level methods got included into the receiver's class
365
366
  #
366
367
  def self.included(base)
368
+ Mack::Controller::Registry.add(base)
367
369
  base.extend(ClassMethods)
368
370
  end
369
371
 
372
+ # Houses a repository of all the controllers in the system.
373
+ class Registry < Mack::Utils::RegistryList
374
+ end
375
+
370
376
  end # Controller
371
377
  end # Mack
@@ -32,4 +32,13 @@ module Mack
32
32
 
33
33
  end # Routes
34
34
  end # Distributed
35
- end # Mack
35
+ end # Mack
36
+
37
+ Mack::Routes.after_class_method(:build) do
38
+ if app_config.mack.use_distributed_routes
39
+ raise Mack::Distributed::Errors::ApplicationNameUndefined.new if app_config.mack.distributed_app_name.nil?
40
+
41
+ d_urls = Mack::Distributed::Routes::Urls.new(app_config.mack.distributed_site_domain)
42
+ d_urls.put
43
+ end
44
+ end
@@ -1,6 +1,10 @@
1
1
  module Mack
2
2
  module Errors # :nodoc:
3
3
 
4
+ # Raised when there is no session available and one is trying to be accessed.
5
+ class NoSessionError < StandardError
6
+ end
7
+
4
8
  # Raised when someone calls render twice in one action
5
9
  #
6
10
  # Example:
@@ -0,0 +1,6 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ gem 'mack', '<%= @options["version"] %>'
6
+ require 'mack_tasks'
@@ -0,0 +1,11 @@
1
+ whiny_config_missing: false
2
+
3
+ mack::session_id: _<%= @options["app"].downcase %>_session_id
4
+
5
+ mack::testing_framework: <%= @options["testing_framework"] %>
6
+
7
+ # Mack provides RJS support through mack-javascript gem.
8
+ # In order to have RJS support, you will need to perform the following steps:
9
+ # 1. Uncomment the code below, and make sure that the framework is the one you want to use
10
+ # 2. run: rake generate:javascript
11
+ # mack::js_framework: <%= @options["js_framework"] %>
@@ -5,6 +5,9 @@
5
5
  # :libs, optional, is an array of files you want to require.
6
6
  # :source, options, is the source you want to use to install a particular gem.
7
7
  require_gems do |gem|
8
+ <% if @options["orm"] -%>
9
+ gem.add "mack-<%=@options["orm"]%>", :libs => "mack-<%=@options["orm"]%>"
10
+ <% end -%>
8
11
  # examples:
9
12
  # gem.add :redgreen, :version => "1.2.2", :libs => :redgreen
10
13
  # gem.add :termios
@@ -1,13 +1,13 @@
1
1
  # set up initializers:
2
- Mack.logger.info "Initializing custom initializers..."
2
+ Mack.logger.debug "Initializing custom initializers..."
3
3
  Dir.glob(File.join(Mack.root, "config", "initializers", "**/*.rb")) do |d|
4
4
  require d
5
5
  end
6
- Mack.logger.info "Initializing custom gems..."
6
+ Mack.logger.debug "Initializing custom gems..."
7
7
  Mack::Utils::GemManager.instance.do_requires
8
8
 
9
9
  # require 'plugins':
10
- Mack.logger.info "Initializing plugins..."
10
+ Mack.logger.debug "Initializing plugins..."
11
11
  require File.join(File.dirname(__FILE__), "plugins.rb")
12
12
 
13
13
  # make sure that default_controller is available to other controllers
@@ -15,17 +15,17 @@ path = File.join(Mack.root, "app", "controllers", "default_controller.rb")
15
15
  require path if File.exists?(path)
16
16
 
17
17
  # require 'lib' files:
18
- Mack.logger.info "Initializing lib classes..."
18
+ Mack.logger.debug "Initializing lib classes..."
19
19
  Dir.glob(File.join(Mack.root, "lib", "**/*.rb")).each do |d|
20
20
  require d
21
21
  end
22
22
 
23
23
  # set up routes:
24
- Mack.logger.info "Initializing routes..."
24
+ Mack.logger.debug "Initializing routes..."
25
25
  require File.join(Mack.root, "config", "routes")
26
26
 
27
27
  # require 'app' files:
28
- Mack.logger.info "Initializing 'app' classes..."
28
+ Mack.logger.debug "Initializing 'app' classes..."
29
29
  Dir.glob(File.join(Mack.root, "app", "**/*.rb")).each do |d|
30
30
  # puts "d: #{d}"
31
31
  begin
@@ -16,7 +16,8 @@ module Mack
16
16
  module Configuration # :nodoc:
17
17
 
18
18
  class << self
19
- attr_accessor :initialized
19
+ attr_accessor :initialized_core
20
+ attr_accessor :initialized_application
20
21
  end
21
22
 
22
23
  # use local memory and store stuff for 24 hours:
@@ -61,8 +62,8 @@ module Mack
61
62
  "mack::cache_classes" => true,
62
63
  "mack::use_lint" => true,
63
64
  "mack::show_exceptions" => true,
65
+ "mack::use_sessions" => true,
64
66
  "mack::session_id" => "_mack_session_id",
65
- "mack::rendering_systems" => [:action, :text, :partial, :public, :url, :xml],
66
67
  "mack::cookie_values" => {
67
68
  "path" => "/"
68
69
  },
@@ -83,7 +84,11 @@ module Mack
83
84
  "mack::distributed_site_domain" => "http://localhost:3000",
84
85
  "mack::drb_timeout" => 1,
85
86
  "mack::default_respository_name" => "default",
87
+ "mack::testing_framework" => "rspec",
86
88
  "log::detailed_requests" => true,
89
+ "log::db_color" => "yellow",
90
+ "log::error_color" => "red",
91
+ "log::completed_color" => "green",
87
92
  "log_level" => "info"
88
93
  }.merge(eval("DEFAULTS_#{Mack.env.upcase}"))
89
94
  end
@@ -7,7 +7,7 @@
7
7
 
8
8
  fl = File.join(File.dirname(__FILE__), "..")
9
9
 
10
- require File.join(fl, "mack")
10
+ require File.join(fl, "..", "mack")
11
11
 
12
12
  require File.join(fl, "testing", "helpers")
13
13
 
@@ -1,5 +1,5 @@
1
1
  # Include ApplicationHelper into all controllers:
2
- Mack.logger.info "Initializing helpers..."
2
+ Mack.logger.debug "Initializing helpers..."
3
3
  # adding application_helper module into all defined controllers
4
4
  if Object.const_defined?("ApplicationHelper")
5
5
  Mack.logger.warn("ApplicationHelper has been deprecated! Please use move it to Mack::ViewHelpers::ApplicationHelper instead.")
@@ -15,6 +15,31 @@ module Mack
15
15
  end
16
16
 
17
17
  unless Mack.logger
18
+
19
+ module Log4r # :nodoc:
20
+ class IOOutputter # :nodoc:
21
+
22
+ # let's not do this more than once. :)
23
+ unless Log4r::IOOutputter.private_instance_methods.include?("old_write")
24
+
25
+ alias_method :old_write, :write
26
+
27
+ def write(data)
28
+ case data
29
+ when /^(DEBUG:|INFO:|WARN:|ERROR:|FATAL:)\s\[.*\]\s(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP)/
30
+ old_write(Mack::Utils::Ansi::Color.wrap(app_config.log.db_color, data))
31
+ when /^(ERROR:|FATAL:)/
32
+ old_write(Mack::Utils::Ansi::Color.wrap(app_config.log.error_color, data))
33
+ else
34
+ old_write(data)
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ end # IOOutputter
41
+ end # Log4r
42
+
18
43
  log_directory = app_config.log_root || File.join(Mack.root, "log")
19
44
  FileUtils.mkdir_p(log_directory)
20
45
 
@@ -0,0 +1,20 @@
1
+ # If the application explicitly says it doesn't want to use any orm,
2
+ # then we're not going to initialize any default orm.
3
+ # Note: this is initialization process only. By the default, application
4
+ # generated by mack still have data_mapper as default.
5
+ orm = app_config.orm
6
+ unless orm.nil?
7
+ Mack.logger.warn %{
8
+ Please note that setting up orm in app_config has been deprecated, and will not be supported in future mack releases.
9
+ Here's how to update your existing application:
10
+ 1. Remove the line:
11
+ orm: data_mapper
12
+ from the app_config/default.yml file
13
+ 2. In gems.rb, add the following line in the require_gems block:
14
+ gem.add "mack-data_mapper", :libs => "mack-data_mapper"
15
+ ** if you use active record, then change it to mack-active_record instead of mack-data_mapper
16
+ }
17
+ Mack.logger.debug "Initializing #{orm} orm..."
18
+ require "mack-#{orm}"
19
+ require "mack-#{orm}_tasks"
20
+ end