public
Description: A Ruby web application framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack.git
Search Repo:
Click here to lend your support to: mack and make a donation at www.pledgie.com !
Refactored out constants, such as MACK_ROOT and MACK_ENV and made them 
into Mack::Configuration.env, Mack::Configuration.root, etc...
markbates (author)
Mon May 05 12:38:52 -0700 2008
commit  d8bc41b83f32361b44d60c016987625055d0e9d5
tree    80d5b92378b3c1d2bdfdffd1aa8b82218084a302
parent  b76e03903b169dcbd886584fde82ade0f203e17b
...
 
1
2
3
...
7
8
9
10
 
11
12
13
...
23
24
25
26
 
27
28
29
...
1
2
3
4
...
8
9
10
 
11
12
13
14
...
24
25
26
 
27
28
29
30
0
@@ -1,3 +1,4 @@
0
+* Refactored out constants, such as MACK_ROOT and MACK_ENV and made them into Mack::Configuration.env, Mack::Configuration.root, etc...
0
 * Added test:stats and test:coverage Rake tasks.
0
 * Removed support for ActiveRecord and DataMapper and moved them into their own gems.
0
 * Fixed a bug where yields in ERB weren't giving the desired results.
0
@@ -7,7 +8,7 @@
0
 * Made error_messages_for more compatible with DataMapper.
0
 * Fixed a bug loading url.rb and uploaded_file.rb found by Phil Darnowsky
0
 * gem: mack_ruby_core_extensions 0.1.23
0
-* gem: genosaurus 1.1.3
0
+* gem: genosaurus 1.1.4
0
 * gem: datamapper 0.3.2
0
 * gem: rcov 0.8.1.2.0
0
 * gem: mack-data_mapper 0.5.0
0
@@ -23,7 +24,7 @@
0
 * model generator now creates a stub unit test.
0
 * Rake tasks in plugins now show up in the Rake tasks list.
0
 * All generators, including the 'mack' binary are now using Genosaurus.
0
-* [dsutedja] initializer will load MACK_APP/controllers/default_controller.rb if it exists
0
+* [dsutedja] initializer will load Mack::Configuration.app_directory/controllers/default_controller.rb if it exists
0
 * [dsutedja] added link_image_to and image_tag to html helper.
0
 * gem: thin 0.8.1
0
 * gem: genosaurus 1.1.1
0
...
20
21
22
23
 
24
25
26
...
20
21
22
 
23
24
25
26
0
@@ -20,7 +20,7 @@
0
   * WEBrick
0
 
0
 rake script:server takes the following options:
0
- $ rake script:server PORT=<port> MACK_ENV=<environment> HANDLER=<rack_handler>
0
+ $ rake script:server PORT=<port> Mack::Configuration.env=<environment> HANDLER=<rack_handler>
0
   
0
 The port and rack_handler flags don't apply if you're using Thin[http://code.macournoyer.com/thin] to run the app, which is the default if it is installed. Use the thin.yml file in your application's config directory to configure Thin. The rack_handler one will allow you to switch which server is used to run the app. See Rack for more Rack::Handlers.
0
   
...
58
59
60
61
 
62
63
64
...
58
59
60
 
61
62
63
64
0
@@ -58,7 +58,7 @@
0
     class UnknownLayout < StandardError
0
       # Takes a layout name.
0
       def initialize(layout)
0
- super("Could not find layout in: #{File.join(MACK_ROOT, "app", "views", layout.to_s + ".html.erb")}")
0
+ super("Could not find layout in: #{File.join(Mack::Configuration.root, "app", "views", layout.to_s + ".html.erb")}")
0
       end
0
     end
0
     
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@
0
 require "test/unit"
0
 require 'fileutils'
0
 
0
-ENV["MACK_ENV"] = "test"
0
+ENV["_mack_env"] = "test"
0
 
0
 # load the mack framework:
0
 load(File.join(File.dirname(__FILE__), "..", "Rakefile"))
...
1
 
2
3
4
5
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8
9
10
...
15
16
17
18
 
19
20
21
22
23
 
24
25
26
...
58
59
60
61
 
62
63
64
65
...
73
74
75
76
 
77
78
79
80
81
 
 
82
83
84
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
37
38
39
 
40
41
42
43
44
 
45
46
47
48
...
80
81
82
 
83
84
85
86
87
...
95
96
97
 
98
99
100
101
 
 
102
103
104
105
106
0
@@ -1,9 +1,31 @@
0
 module Mack
0
+
0
   # All configuration for the Mack subsystem happens here. Each of the default environments,
0
   # production, development, and test have their own default configuration options. These
0
   # get merged with overall default options.
0
   module Configuration # :nodoc:
0
 
0
+ def self.method_missing(sym, *args)
0
+ ev = "_mack_#{sym}".downcase
0
+ return ENV[ev]
0
+ end
0
+
0
+ def self.set(name, value)
0
+ ENV["_mack_#{name.to_s.downcase}"] = value
0
+ end
0
+
0
+ self.set(:env, "development") if self.env.nil?
0
+ self.set(:root, FileUtils.pwd) if self.root.nil?
0
+ self.set(:public_directory, File.join(self.root, "public")) if self.public_directory.nil?
0
+ self.set(:app_directory, File.join(self.root, "app")) if self.app_directory.nil?
0
+ self.set(:lib_directory, File.join(self.root, "lib")) if self.lib_directory.nil?
0
+ self.set(:config_directory, File.join(self.root, "config")) if self.config_directory.nil?
0
+ self.set(:views_directory, File.join(self.app_directory, "views")) if self.views_directory.nil?
0
+ self.set(:layouts_directory, File.join(self.views_directory, "layouts")) if self.layouts_directory.nil?
0
+ self.set(:plugins, File.join(self.root, "vendor", "plugins")) if self.plugins.nil?
0
+
0
+
0
+
0
     # use local memory and store stuff for 24 hours:
0
     # use file for sessions and store them for 4 hours:
0
     DEFAULTS_PRODUCTION = {
0
0
@@ -15,12 +37,12 @@
0
         "debug" => false,
0
         "adapter" => "file",
0
         "store_options" =>
0
- {"dir" => File.join(MACK_ROOT, "tmp")},
0
+ {"dir" => File.join(Mack::Configuration.root, "tmp")},
0
         "expiry_time" => 14400,
0
         "logging" => {
0
           "logger_1" => {
0
             "type" => "file",
0
- "file" => File.join(MACK_ROOT, "log", "cachetastic_caches_mack_session_cache.log")
0
+ "file" => File.join(Mack::Configuration.root, "log", "cachetastic_caches_mack_session_cache.log")
0
           }
0
         }
0
       }
0
@@ -58,7 +80,7 @@
0
           "logging" => {
0
             "logger_1" => {
0
               "type" => "file",
0
- "file" => File.join(MACK_ROOT, "log", "cachetastic.log")
0
+ "file" => File.join(Mack::Configuration.root, "log", "cachetastic.log")
0
             }
0
           }
0
         },
0
0
@@ -73,12 +95,12 @@
0
         "log::file" => true,
0
         "log::console_format" => "%l:\t[%d]\t%M",
0
         "log::file_format" => "%l:\t[%d]\t%M"
0
- }.merge(eval("DEFAULTS_#{MACK_ENV.upcase}"))
0
+ }.merge(eval("DEFAULTS_#{Mack::Configuration.env.upcase}"))
0
     end
0
     
0
     app_config.load_hash(DEFAULTS, "mack_defaults")
0
- app_config.load_file(File.join(MACK_CONFIG, "app_config", "default.yml"))
0
- app_config.load_file(File.join(MACK_CONFIG, "app_config", "#{MACK_ENV}.yml"))
0
+ app_config.load_file(File.join(Mack::Configuration.config_directory, "app_config", "default.yml"))
0
+ app_config.load_file(File.join(Mack::Configuration.config_directory, "app_config", "#{Mack::Configuration.env}.yml"))
0
     # app_config.reload
0
     
0
   end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
...
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,14 +1 @@
0
-# Set up Mack constants, if they haven't already been set up.
0
-unless Object.const_defined?("MACK_ENV")
0
- (Object::MACK_ENV = (ENV["MACK_ENV"] ||= "development")).to_sym
0
-end
0
-(Object::MACK_ROOT = (ENV["MACK_ROOT"] ||= FileUtils.pwd)) unless Object.const_defined?("MACK_ROOT")
0
-
0
-Object::MACK_PUBLIC = File.join(MACK_ROOT, "public") unless Object.const_defined?("MACK_PUBLIC")
0
-Object::MACK_APP = File.join(MACK_ROOT, "app") unless Object.const_defined?("MACK_APP")
0
-Object::MACK_LIB = File.join(MACK_ROOT, "lib") unless Object.const_defined?("MACK_LIB")
0
-Object::MACK_CONFIG = File.join(MACK_ROOT, "config") unless Object.const_defined?("MACK_CONFIG")
0
-Object::MACK_VIEWS = File.join(MACK_APP, "views") unless Object.const_defined?("MACK_VIEWS")
0
-Object::MACK_LAYOUTS = File.join(MACK_VIEWS, "layouts") unless Object.const_defined?("MACK_LAYOUTS")
0
-Object::MACK_PLUGINS = File.join(MACK_ROOT, "vendor", "plugins") unless Object.const_defined?("MACK_PLUGINS")
...
17
18
19
20
 
21
22
23
24
 
25
26
 
 
27
28
29
30
31
32
33
34
35
36
37
38
...
53
54
55
56
 
57
58
59
 
60
61
62
63
...
65
66
67
68
 
69
70
71
72
 
73
74
75
...
89
90
91
92
 
93
94
95
...
113
114
115
 
 
116
...
17
18
19
 
20
21
 
 
 
22
23
 
24
25
26
 
 
 
 
 
 
 
27
28
29
30
...
45
46
47
 
48
49
50
 
51
52
53
54
55
...
57
58
59
 
60
61
62
63
 
64
65
66
67
...
81
82
83
 
84
85
86
87
...
105
106
107
108
109
110
0
@@ -17,21 +17,13 @@
0
 require 'erb'
0
 require 'genosaurus'
0
 
0
-require File.join(File.dirname(__FILE__), "constants.rb")
0
+require File.join(File.dirname(__FILE__), "configuration.rb")
0
 
0
-unless Object.const_defined?("MACK_INITIALIZED")
0
- puts "Starting application in #{MACK_ENV} mode."
0
- puts "Mack root: #{MACK_ROOT}"
0
+unless Mack::Configuration.initialized
0
   
0
- Object::MACK_INITIALIZED = true
0
+ puts "Starting application in #{Mack::Configuration.env} mode."
0
+ puts "Mack root: #{Mack::Configuration.root}"
0
   
0
- # Set up 'Rails' constants to allow for easier use of existing gems/plugins like application_configuration.
0
- # I would like to take these out eventually, but for right now, it's not doing too much harm.
0
- # Object::RAILS_ENV = MACK_ENV unless Object.const_defined?("RAILS_ENV")
0
- # Object::RAILS_ROOT = MACK_ROOT unless Object.const_defined?("RAILS_ROOT")
0
-
0
- require File.join(File.dirname(__FILE__), "configuration.rb")
0
-
0
   require File.join(File.dirname(__FILE__), "initializers", "logging.rb")
0
   
0
   require File.join(File.dirname(__FILE__), "initializers", "orm_support.rb")
0
0
@@ -53,10 +45,10 @@
0
   # set up application stuff:
0
 
0
   # set up routes:
0
- require File.join(MACK_CONFIG, "routes")
0
+ require File.join(Mack::Configuration.config_directory, "routes")
0
   
0
   # set up initializers:
0
- Dir.glob(File.join(MACK_CONFIG, "initializers", "**/*.rb")) do |d|
0
+ Dir.glob(File.join(Mack::Configuration.config_directory, "initializers", "**/*.rb")) do |d|
0
     require d
0
   end
0
   Mack::Utils::GemManager.instance.do_requires
0
0
@@ -65,11 +57,11 @@
0
   require File.join(File.dirname(__FILE__), "initializers", "plugins.rb")
0
   
0
   # make sure that default_controller is available to other controllers
0
- path = File.join(MACK_APP, "controllers", "default_controller.rb")
0
+ path = File.join(Mack::Configuration.app_directory, "controllers", "default_controller.rb")
0
   require path if File.exists?(path)
0
   
0
   # require 'app' files:
0
- Dir.glob(File.join(MACK_APP, "**/*.rb")).each do |d|
0
+ Dir.glob(File.join(Mack::Configuration.app_directory, "**/*.rb")).each do |d|
0
     # puts "d: #{d}"
0
     begin
0
       require d
0
@@ -89,7 +81,7 @@
0
   end
0
   
0
   # require 'lib' files:
0
- Dir.glob(File.join(MACK_LIB, "**/*.rb")).each do |d|
0
+ Dir.glob(File.join(Mack::Configuration.lib_directory, "**/*.rb")).each do |d|
0
     require d
0
   end
0
   
0
@@ -113,5 +105,7 @@
0
       h = "Mack::ViewHelpers::#{cont}".constantize
0
       h.include_safely_into(Mack::ViewBinder)
0
   end
0
+
0
+ Mack::Configuration.set(:initialized, "true") if Mack::Configuration.initialized.nil?
0
 end
...
3
4
5
6
 
7
8
9
...
17
18
19
20
 
21
22
23
...
3
4
5
 
6
7
8
9
...
17
18
19
 
20
21
22
23
0
@@ -3,7 +3,7 @@
0
 #++
0
 include Log4r
0
 
0
-log_dir_loc = File.join(MACK_ROOT, "log")
0
+log_dir_loc = File.join(Mack::Configuration.root, "log")
0
 FileUtils.mkdir_p(log_dir_loc)
0
 
0
 unless Object.const_defined?("MACK_DEFAULT_LOGGER")
0
@@ -17,7 +17,7 @@
0
   # file:
0
   if app_config.log.file
0
     file_format = PatternFormatter.new(:pattern => app_config.log.file_format)
0
- log.add(FileOutputter.new('fileOutputter', :filename => File.join(log_dir_loc, "#{MACK_ENV}.log"), :trunc => false, :formatter => file_format))
0
+ log.add(FileOutputter.new('fileOutputter', :filename => File.join(log_dir_loc, "#{Mack::Configuration.env}.log"), :trunc => false, :formatter => file_format))
0
   end
0
   
0
   Object::MACK_DEFAULT_LOGGER = log
...
1
2
3
4
5
 
6
7
...
 
 
 
1
 
2
3
4
0
@@ -1,8 +1,5 @@
0
-#--
0
-# setup ORM:
0
-#++
0
 orm = app_config.orm || 'data_mapper'
0
-
0
+
0
 require "mack-#{orm}"
0
 require "mack-#{orm}_tasks"
...
1
2
 
3
4
5
...
1
 
2
3
4
5
0
@@ -1,5 +1,5 @@
0
 plugins = [] # a list of all plugins
0
-Dir.glob(File.join(MACK_PLUGINS, "*")).each do |d|
0
+Dir.glob(File.join(Mack::Configuration.plugins, "*")).each do |d|
0
   plugins << d
0
   $: << File.join(d, "lib") # add the lib for this plugin to the global load path
0
 end
...
113
114
115
116
117
 
 
118
119
120
...
113
114
115
 
 
116
117
118
119
120
0
@@ -113,8 +113,8 @@
0
       if File.extname(env["PATH_INFO"]).blank?
0
         env["PATH_INFO"] << ".html"
0
       end
0
- if File.exists?(File.join(MACK_PUBLIC, env["PATH_INFO"]))
0
- return Rack::File.new(File.join(MACK_PUBLIC)).call(env)
0
+ if File.exists?(File.join(Mack::Configuration.public_directory, env["PATH_INFO"]))
0
+ return Rack::File.new(File.join(Mack::Configuration.public_directory)).call(env)
0
       else
0
         raise exception
0
       end
...
4
5
6
7
8
9
10
...
4
5
6
 
7
8
9
0
@@ -4,7 +4,6 @@
0
 require 'rubygems'
0
 require 'application_configuration'
0
 
0
-require File.join(File.dirname(__FILE__), "initialization", "constants.rb")
0
 require File.join(File.dirname(__FILE__), "initialization", "configuration.rb")
0
 require File.join(File.dirname(__FILE__), "initialization", "initializers", "orm_support.rb")
0
 
...
41
42
43
44
 
45
46
47
...
41
42
43
 
44
45
46
47
0
@@ -41,7 +41,7 @@
0
       private
0
       # Used to render a file from disk.
0
       def render_file(f, options = {})
0
- options = {:is_partial => false, :ext => ".#{self.params(:format)}.erb", :dir => MACK_VIEWS}.merge(options)
0
+ options = {:is_partial => false, :ext => ".#{self.params(:format)}.erb", :dir => Mack::Configuration.views_directory}.merge(options)
0
         partial = f.to_s
0
         parts = partial.split("/")
0
         if parts.size == 1
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@
0
         rescue Errno::ENOENT => e
0
           begin
0
             # If the action doesn't exist on disk, try to render it from the public directory:
0
- t = render_file(options[:action], {:dir => MACK_PUBLIC, :ext => ".#{params(:format)}", :layout => false}.merge(options))
0
+ t = render_file(options[:action], {:dir => Mack::Configuration.public_directory, :ext => ".#{params(:format)}", :layout => false}.merge(options))
0
             # Because it's being served from public don't wrap a layout around it!
0
             # self.controller.instance_variable_get("@render_options").merge!({:layout => false})
0
             return t
...
5
6
7
8
 
9
10
11
...
5
6
7
 
8
9
10
11
0
@@ -5,7 +5,7 @@
0
     class Public < Base
0
       
0
       def render
0
- render_file(options[:public], {:dir => MACK_PUBLIC, :ext => ".html", :layout => false}.merge(options))
0
+ render_file(options[:public], {:dir => Mack::Configuration.public_directory, :ext => ".html", :layout => false}.merge(options))
0
       end
0
       
0
     end
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@
0
         rescue Errno::ENOENT => e
0
           begin
0
             # If the action doesn't exist on disk, try to render it from the public directory:
0
- t = render_file(options[:xml], {:dir => MACK_PUBLIC, :ext => ".xml.erb", :layout => false}.merge(options.merge(:format => :xml)))
0
+ t = render_file(options[:xml], {:dir => Mack::Configuration.public_directory, :ext => ".xml.erb", :layout => false}.merge(options.merge(:format => :xml)))
0
             return t
0
           rescue Errno::ENOENT => ex
0
           end
...
85
86
87
88
 
89
90
91
92
...
96
97
98
99
 
100
101
102
103
104
 
105
106
107
108
...
109
110
111
112
 
113
114
115
116
117
118
 
119
120
121
122
...
137
138
139
140
 
141
142
143
144
145
146
147
 
148
149
150
151
...
345
346
347
348
 
349
350
351
352
 
353
354
355
...
359
360
361
362
 
363
364
365
...
85
86
87
 
88
89
90
91
92
...
96
97
98
 
99
100
101
102
103
 
104
105
106
107
108
...
109
110
111
 
112
113
114
115
116
117
 
118
119
120
121
122
...
137
138
139
 
140
141
142
143
144
145
146
 
147
148
149
150
151
...
345
346
347
 
348
349
350
351
 
352
353
354
355
...
359
360
361
 
362
363
364
365
0
@@ -85,7 +85,7 @@
0
       # render(:text => "Hello World!")
0
       # end
0
       #
0
- # # This will render MACK_ROOT/views/my_awesome_controller/foo.html.erb
0
+ # # This will render Mack::Configuration.root/views/my_awesome_controller/foo.html.erb
0
       # def show
0
       # render(:action => :foo)
0
       # end
0
0
@@ -96,12 +96,12 @@
0
       # render(:action => :foo)
0
       # end
0
       #
0
- # # This will render MACK_ROOT/views/my_awesome_controller/delete.html.erb
0
+ # # This will render Mack::Configuration.root/views/my_awesome_controller/delete.html.erb
0
       # def delete
0
       # end
0
       #
0
       # # This will render the text 'Hello World!' to the screen. Assuming that
0
- # # there is no file: MACK_ROOT/views/my_awesome_controller/update.html.erb
0
+ # # there is no file: Mack::Configuration.root/views/my_awesome_controller/update.html.erb
0
       # # The reason for this is if the view for the action doesn't exist, and the
0
       # # last thing returned from the action is a String, that string will be returned.
0
       # def update
0
0
@@ -109,13 +109,13 @@
0
       # end
0
       #
0
       # # This will raise a Mack::Errors::InvalidRenderType error. Assuming that
0
- # # there is no file: MACK_ROOT/views/my_awesome_controller/create.html.erb
0
+ # # there is no file: Mack::Configuration.root/views/my_awesome_controller/create.html.erb
0
       # def create
0
       # @user = User.find(1)
0
       # end
0
       #
0
       # # This will raise a Errno::ENOENT error. Assuming that
0
- # # there is no file: MACK_ROOT/views/my_awesome_controller/bar.html.erb
0
+ # # there is no file: Mack::Configuration.root/views/my_awesome_controller/bar.html.erb
0
       # def bar
0
       # render(:action => "bar")
0
       # end
0
0
@@ -137,14 +137,14 @@
0
       # end
0
       #
0
       # # This will render a partial. In this case it will look for:
0
- # # MACK_ROOT/views/my_awesome_controller/_latest_news.html.erb
0
+ # # Mack::Configuration.root/views/my_awesome_controller/_latest_news.html.erb
0
       # # Partials do NOT get wrapped in layouts.
0
       # def latest_news
0
       # render(:partial => :latest_news)
0
       # end
0
       #
0
       # # This will render a partial. In this case it will look for:
0
- # # MACK_ROOT/views/some_other/_old_news.html.erb
0
+ # # Mack::Configuration.root/views/some_other/_old_news.html.erb
0
       # # Partials do NOT get wrapped in layouts.
0
       # def latest_news
0
       # render(:partial => "some_other/old_news")
0
0
@@ -345,11 +345,11 @@
0
         #
0
         # Example:
0
         # class MyAwesomeController < Mack::Controller::Base
0
- # # Sets all actions to use: "#{MACK_ROOT}/app/views/layouts/dark.html.erb" as they're layout.
0
+ # # Sets all actions to use: "#{Mack::Configuration.root}/app/views/layouts/dark.html.erb" as they're layout.
0
         # layout :dark
0
         #
0
         # def index
0
- # # Sets this action to use: "#{MACK_ROOT}/app/views/layouts/bright.html.erb" as it's layout.
0
+ # # Sets this action to use: "#{Mack::Configuration.root}/app/views/layouts/bright.html.erb" as it's layout.
0
         # render(:text => "Welcome...", :layout => :bright)
0
         # end
0
         #
0
@@ -359,7 +359,7 @@
0
         # end
0
         # end
0
         #
0
- # The default layout is "#{MACK_ROOT}/app/views/layouts/application.html.erb".
0
+ # The default layout is "#{Mack::Configuration.root}/app/views/layouts/application.html.erb".
0
         #
0
         # If a layout is specified, and it doesn't exist a Mack::Errors::UnknownLayout error will be raised.
0
         def layout(lay)
...
10
11
12
13
 
14
15
16
...
10
11
12
 
13
14
15
16
0
@@ -10,7 +10,7 @@
0
       when "All"
0
         puts "About to work on ALL caches!"
0
         # force all caches to register themselves:
0
- ["#{MACK_ROOT}/lib/caches"].each do |dir|
0
+ ["#{Mack::Configuration.root}/lib/caches"].each do |dir|
0
           Find.find(dir) do |f|
0
             # puts f
0
             if FileTest.directory?(f) and !f.match(/.svn/)
...
23
24
25
26
 
27
28
29
30
31
32
33
 
34
35
36
...
23
24
25
 
26
27
28
29
30
31
32
 
33
34
35
36
0
@@ -23,14 +23,14 @@
0
       rescue Exception => e
0
       end
0
 
0
- MACK_ROOT = FileUtils.pwd unless Object.const_defined?("MACK_ROOT")
0
+ Mack::Configuration.root = FileUtils.pwd unless Object.const_defined?("Mack::Configuration.root")
0
 
0
       options = OpenStruct.new
0
       options.port = (ENV["PORT"] ||= "3000") # Does NOT work with Thin!! You must edit the thin.yml file!
0
       options.handler = (ENV["HANDLER"] ||= d_handler)
0
 
0
 
0
- # require File.join(MACK_ROOT, "config", "boot.rb")
0
+ # require File.join(Mack::Configuration.root, "config", "boot.rb")
0
       require 'mack'
0
 
0
       if options.handler == "thin"
...
2
3
4
5
6
7
8
 
9
10
11
...
2
3
4
 
 
 
 
5
6
7
8
0
@@ -2,10 +2,7 @@
0
   
0
   desc "Loads the Mack environment. Default is development."
0
   task :environment do
0
- MACK_ENV = ENV["MACK_ENV"] ||= "development" unless Object.const_defined?("MACK_ENV")
0
- MACK_ROOT = FileUtils.pwd unless Object.const_defined?("MACK_ROOT")
0
- require 'mack'
0
- # require File.join(MACK_ROOT, "config", "boot.rb")
0
+ require File.join(File.dirname(__FILE__), '..', 'mack')
0
   end # environment
0
 
0
   desc "Loads an irb console allow you full access to the application w/o a browser."
...
1
2
3
4
 
5
6
7
...
1
2
 
 
3
4
5
6
0
@@ -1,7 +1,6 @@
0
 rule /\#.*/ do |t|
0
   env = t.name.match(/\#.*/).to_s.gsub("#", "")
0
- Object::MACK_ENV = env
0
- ENV["MACK_ENV"] = env
0
+ Mack::Configuration.set(:env, env)
0
   name = t.name.gsub("##{env}", "")
0
   Rake::Task[name].invoke
0
 end
...
57
58
59
60
 
61
62
63
...
57
58
59
 
60
61
62
63
0
@@ -57,7 +57,7 @@
0
         s.add_dependency("crypt", "1.1.4")
0
         s.add_dependency("daemons", "1.0.10")
0
         s.add_dependency("erubis", "2.5.0")
0
- s.add_dependency("genosaurus", "1.1.3")
0
+ s.add_dependency("genosaurus", "1.1.4")
0
         s.add_dependency("rcov", "0.8.1.2.0")
0
         s.add_dependency("mack-data_mapper", gh.version)
0
         
...
31
32
33
34
 
35
36
37
...
31
32
33
 
34
35
36
37
0
@@ -31,7 +31,7 @@
0
   end
0
   
0
   def env
0
- "MACK_ENV: #{MACK_ENV}"
0
+ "Mack::Configuration.env: #{Mack::Configuration.env}"
0
   end
0
   
0
   def kill_kenny_bad
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@
0
     
0
 test:
0
   adapter: sqlite3
0
- database: <%= File.join(MACK_ROOT, "db", "fake_application_test.db") %>
0
+ database: <%= File.join(Mack::Configuration.root, "db", "fake_application_test.db") %>
0
 
0
 production:
0
   adapter: sqlite3
...
31
32
33
34
 
35
36
37
...
31
32
33
 
34
35
36
37
0
@@ -31,7 +31,7 @@
0
   end
0
   
0
   def bandit_dir
0
- File.join(MACK_PLUGINS, "bandit")
0
+ File.join(Mack::Configuration.plugins, "bandit")
0
   end
0
   
0
 end
0