mack 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,10 @@
1
+ ===0.0.5
2
+ * rake dump:config - prints out the configuration information for the specified environment.
3
+ * redirect_to now takes an optional Hash as a second parameter, instead of a fixnum.
4
+ * redirect_to will now do server side redirects if passed :server_side => true as part of the optional second argument Hash.
5
+ * plugin in support. plugins get loaded before the 'app' directory. each plugins 'lib' directory is added to the global load path and then each plugins 'init.rb' file is called, which is responsible for loading the necessary files. The 'lib' directories are finally removed from the global load path.
6
+ * renamed initialize directory to initialization. moved logging, orm_support, and plugins to a subfolder called initializers.
7
+
8
+ ===0.0.4
9
+ * gem: rack 0.3.0
10
+ * gem: ruby_extensions 1.0.11
File without changes
File without changes
@@ -19,6 +19,7 @@ Object::MACK_LIB = File.join(MACK_ROOT, "lib") unless Object.const_defined?("MAC
19
19
  Object::MACK_CONFIG = File.join(MACK_ROOT, "config") unless Object.const_defined?("MACK_CONFIG")
20
20
  Object::MACK_VIEWS = File.join(MACK_APP, "views") unless Object.const_defined?("MACK_VIEWS")
21
21
  Object::MACK_LAYOUTS = File.join(MACK_VIEWS, "layouts") unless Object.const_defined?("MACK_LAYOUTS")
22
+ Object::MACK_PLUGINS = File.join(MACK_ROOT, "vendor", "plugins") unless Object.const_defined?("MACK_PLUGINS")
22
23
 
23
24
  unless Object.const_defined?("MACK_INITIALIZED")
24
25
  puts "Starting application in #{MACK_ENV} mode."
@@ -32,9 +33,9 @@ unless Object.const_defined?("MACK_INITIALIZED")
32
33
 
33
34
  require File.join(File.dirname(__FILE__), "configuration.rb")
34
35
 
35
- require File.join(File.dirname(__FILE__), "configure_logging.rb")
36
+ require File.join(File.dirname(__FILE__), "initializers", "logging.rb")
36
37
 
37
- require File.join(File.dirname(__FILE__), "configure_orm_support.rb")
38
+ require File.join(File.dirname(__FILE__), "initializers", "orm_support.rb")
38
39
 
39
40
  fl = File.join(File.dirname(__FILE__), "..")
40
41
 
@@ -55,6 +56,9 @@ unless Object.const_defined?("MACK_INITIALIZED")
55
56
  # set up routes:
56
57
  require File.join(MACK_ROOT, "config", "routes")
57
58
 
59
+ # require 'plugins':
60
+ require File.join(File.dirname(__FILE__), "initializers", "plugins.rb")
61
+
58
62
  # require 'app' files:
59
63
  Dir.glob(File.join(MACK_APP, "**/*.rb")).each do |d|
60
64
  require d
@@ -64,7 +68,7 @@ unless Object.const_defined?("MACK_INITIALIZED")
64
68
  Dir.glob(File.join(MACK_LIB, "**/*.rb")).each do |d|
65
69
  require d
66
70
  end
67
-
71
+
68
72
 
69
73
  # ------------------------------------------------------------------------
70
74
 
@@ -0,0 +1,9 @@
1
+ plugins = [] # a list of all plugins
2
+ Dir.glob(File.join(MACK_PLUGINS, "*")).each do |d|
3
+ plugins << d
4
+ $: << File.join(d, "lib") # add the lib for this plugin to the global load path
5
+ end
6
+ plugins.sort.each do |plug|
7
+ require File.join(plug, "init.rb") # load the init.rb for each plugin.
8
+ $:.delete(File.join(plug, "lib")) # remove the plugins lib directory from the global load path.
9
+ end
data/mack.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "initialize", "initializer")
1
+ require File.join(File.dirname(__FILE__), "initialization", "initializer")
2
2
 
3
3
  module Mack
4
4
  # This is the heart and soul of the Mack framework! This class interfaces with the Rack framework.
@@ -160,11 +160,16 @@ module Mack
160
160
 
161
161
  # This will redirect the request to the specified url. A default status of
162
162
  # 302, Moved Temporarily, is set if no status is specified. A simple HTML
163
- # page is rendered in case the redirect does not occur.
164
- def redirect_to(url, status = 302)
165
- response.status = status
163
+ # page is rendered in case the redirect does not occur. A server side
164
+ # redirect is also possible by using the option :server_side => true.
165
+ # When a server side redirect occurs the url must be a 'local' url, not an
166
+ # external url. The 'original' url of the request will NOT change.
167
+ def redirect_to(url, options = {})
168
+ options = {:status => 302}.merge(options)
169
+ raise Rack::ForwardRequest.new(url) if options[:server_side]
170
+ response.status = options[:status]
166
171
  response[:location] = url
167
- render(:text => redirect_html(request.path_info, url, status))
172
+ render(:text => redirect_html(request.path_info, url, options[:status]))
168
173
  end
169
174
 
170
175
  # Returns true/false depending on whether the render action has been called yet.
@@ -12,4 +12,20 @@ task :console do
12
12
  libs << "-r #{File.join(File.dirname(__FILE__), '..', 'mack')}"
13
13
  libs << "-r #{File.join(File.dirname(__FILE__), '..', 'initialize', 'console')}"
14
14
  exec "irb #{libs.join(" ")} --simple-prompt"
15
+ end
16
+
17
+ namespace :dump do
18
+
19
+ desc "Dumps out the configuration for the specified environment."
20
+ task :config => :environment do
21
+ fcs = app_config.instance.instance_variable_get("@final_configuration_settings")
22
+ conf = {}
23
+ fcs.each_pair do |k, v|
24
+ unless v.is_a?(Application::Configuration::Namespace)
25
+ conf[k.to_s] = v unless k.to_s.match("__")
26
+ end
27
+ end
28
+ pp conf
29
+ end
30
+
15
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-27 00:00:00 -05:00
12
+ date: 2008-02-28 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -67,13 +67,14 @@ dependencies:
67
67
  version: 0.6.4
68
68
  version:
69
69
  description: "mack was developed by: markbates"
70
- email: mark@markbates.com
70
+ email: mark@mackframework.com
71
71
  executables:
72
72
  - mack
73
73
  extensions: []
74
74
 
75
75
  extra_rdoc_files:
76
76
  - README
77
+ - CHANGELOG
77
78
  files:
78
79
  - README
79
80
  - bin/templates/app/controllers/default_controller.rb.template
@@ -98,12 +99,13 @@ files:
98
99
  - core_extensions/object.rb
99
100
  - core_extensions/string.rb
100
101
  - errors/errors.rb
101
- - initialize/configuration.rb
102
- - initialize/configure_logging.rb
103
- - initialize/configure_orm_support.rb
104
- - initialize/console.rb
105
- - initialize/initializer.rb
106
- - initialize/server/simple_server.rb
102
+ - initialization/configuration.rb
103
+ - initialization/console.rb
104
+ - initialization/initializer.rb
105
+ - initialization/initializers/logging.rb
106
+ - initialization/initializers/orm_support.rb
107
+ - initialization/initializers/plugins.rb
108
+ - initialization/server/simple_server.rb
107
109
  - lib/utils/html.rb
108
110
  - lib/utils/server.rb
109
111
  - mack.rb
@@ -128,8 +130,9 @@ files:
128
130
  - tasks/test_tasks.rake
129
131
  - test_extensions/test_assertions.rb
130
132
  - test_extensions/test_helpers.rb
133
+ - CHANGELOG
131
134
  has_rdoc: true
132
- homepage:
135
+ homepage: http://www.mackframework.com
133
136
  post_install_message:
134
137
  rdoc_options:
135
138
  - --title
@@ -144,7 +147,7 @@ require_paths:
144
147
  - bin
145
148
  - core_extensions
146
149
  - errors
147
- - initialize
150
+ - initialization
148
151
  - lib
149
152
  - routing
150
153
  - sea_level