merb 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ windows = (PLATFORM =~ /win32|cygwin/)
28
28
 
29
29
  SUDO = windows ? "" : "sudo"
30
30
 
31
- setup_clean [ "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache", "log"]
31
+ setup_clean ["pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache"]
32
32
 
33
33
  desc "Packages up Merb."
34
34
  task :default => :package
@@ -1 +1 @@
1
- 1253
1
+ 1274
@@ -8,14 +8,15 @@ require 'rake/testtask'
8
8
  require 'spec/rake/spectask'
9
9
  require 'fileutils'
10
10
 
11
- Merb.environment = ENV['Merb.environment'] if ENV['Merb.environment']
12
- $RAKE_ENV = true
13
-
14
11
  require File.dirname(__FILE__)+'/config/boot.rb'
15
12
  require Merb::framework_root+'/tasks'
16
- Merb.root = File.dirname(__FILE__)
17
13
  include FileUtils
18
14
 
15
+ # Set these before any dependencies load
16
+ # otherwise the ORM may connect to the wrong env
17
+ Merb.root = File.dirname(__FILE__)
18
+ Merb.environment = ENV['MERB_ENV'] if ENV['MERB_ENV']
19
+
19
20
  # Get Merb plugins and dependencies
20
21
  require File.dirname(__FILE__)+'/config/dependencies.rb'
21
22
  Merb::Plugins.rakefiles.each {|r| require r }
@@ -25,9 +26,9 @@ Merb::Plugins.rakefiles.each {|r| require r }
25
26
 
26
27
  desc "load merb_init.rb"
27
28
  task :merb_init do
28
- require 'merb'
29
- require File.dirname(__FILE__)+'/config/merb_init.rb'
30
- end
29
+ # deprecated - here for BC
30
+ Rake::Task['merb_env'].invoke
31
+ end
31
32
 
32
33
  task :uninstall => [:clean] do
33
34
  sh %{sudo gem uninstall #{NAME}}
@@ -13,4 +13,5 @@ puts "Loading Application..."
13
13
  Merb::BootLoader.load_application
14
14
 
15
15
  # Load environment-specific configuration
16
- require File.join(Merb.root, 'config', 'environments', Merb.environment)
16
+ environment_config = File.join(Merb.root, 'config', 'environments', Merb.environment)
17
+ require environment_config if File.exist?(environment_config)
@@ -1,6 +1,6 @@
1
- Merb.environment="test"
2
1
  $TESTING=true
3
2
  require File.join(File.dirname(__FILE__), "..", 'config', 'boot')
3
+ Merb.environment="test"
4
4
  require File.join(Merb.root, 'config', 'merb_init')
5
5
 
6
6
  require 'merb/test/helper'
@@ -69,12 +69,13 @@ module Merb
69
69
 
70
70
  # This is where Merb-global variables are set and held
71
71
  class << self
72
+
72
73
  def environment
73
74
  @environment
74
75
  end
75
76
 
76
77
  def environment=(value)
77
- @environment ||= value
78
+ @environment = value
78
79
  end
79
80
 
80
81
  def load_paths
@@ -133,7 +134,6 @@ module Merb
133
134
  @root ||= value
134
135
  end
135
136
 
136
-
137
137
  # Logger settings
138
138
  attr :logger, true
139
139
 
@@ -181,18 +181,6 @@ Merb.environment = Merb::Config[:environment] || ($TESTING ? 'test' : 'developm
181
181
  Merb.logger = Merb::Logger.new(Merb.log_path)
182
182
  Merb.logger.level = Merb::Logger.const_get(Merb::Config[:log_level].upcase) rescue Merb::Logger::INFO
183
183
 
184
- # If you don't use the JSON gem, disable auto-parsing of json params too
185
- if Merb::Config[:disable_json_gem]
186
- Merb::Request::parse_json_params = false
187
- else
188
- begin
189
- require 'json/ext'
190
- rescue LoadError
191
- puts "Using pure ruby JSON lib"
192
- require 'json/pure'
193
- end
194
- end
195
-
196
184
  if $TESTING
197
185
  test_files = File.join(Merb.lib_path, 'test', '*.rb')
198
186
  Dir[test_files].each { |file| require file }
@@ -148,8 +148,26 @@ module Merb
148
148
  load_controller_template_path_cache
149
149
  load_inline_helpers
150
150
  @app_loaded = true
151
+ load_libraries
151
152
  (@after_app_blocks || []).each { |b| b.call }
152
- require "sass/plugin" if File.directory?(Merb.root / "public" / "stylesheets" / "sass")
153
+ end
154
+
155
+ def load_libraries
156
+ # Load the Sass plugin of /public/stylesheets/sass exists
157
+ begin
158
+ require "sass/plugin" if File.directory?(Merb.root / "public" / "stylesheets" / "sass")
159
+ rescue LoadError
160
+ end
161
+ # If you don't use the JSON gem, disable auto-parsing of json params too
162
+ if Merb::Config[:disable_json_gem]
163
+ Merb::Request::parse_json_params = false
164
+ else
165
+ begin
166
+ require 'json/ext'
167
+ rescue LoadError
168
+ require 'json/pure'
169
+ end
170
+ end
153
171
  end
154
172
 
155
173
  def remove_constant(const)
@@ -162,10 +180,10 @@ module Merb
162
180
  end
163
181
 
164
182
  def reload
165
- return if !Merb::Config[:reloader] || !Object.const_defined?(:MERB_PATHS)
183
+ return if !Merb::Config[:reloader]
166
184
 
167
185
  # First we collect all files in the project (this will also grab newly added files)
168
- project_files = MERB_PATHS.map { |path| Dir[Merb.root + path] }.flatten.uniq
186
+ project_files = Merb.load_paths.map { |path| Dir[Merb.root + path] }.flatten.uniq
169
187
  partials = template_paths("_*.*").map { |path| Dir[path] }.flatten.uniq
170
188
  project_mtime = max_mtime(project_files + partials) # Latest changed time of all project files
171
189
 
@@ -20,7 +20,7 @@ module Merb
20
20
  end
21
21
 
22
22
  def [](key)
23
- (@configuration||{})[key]
23
+ (@configuration||={})[key]
24
24
  end
25
25
 
26
26
  def []=(key,val)
@@ -8,9 +8,9 @@ module Merb::InlinePartialMixin
8
8
  found_template = @web_controller._cached_partials["#{template}.#{@_template_format}"] ||=
9
9
  @web_controller.send(:find_partial, template, opts)
10
10
 
11
- template_method = found_template.gsub(/[^\.a-zA-Z0-9]/, "__").gsub(/\./, "_")
11
+ template_method = found_template && found_template.gsub(/[^\.a-zA-Z0-9]/, "__").gsub(/\./, "_")
12
12
 
13
- unless self.respond_to?(template_method)
13
+ unless template_method && self.respond_to?(template_method)
14
14
  return super
15
15
  end
16
16
 
@@ -1,10 +1,10 @@
1
1
  module Merb
2
- VERSION = '0.5.0' unless defined?(::Merb::VERSION)
2
+ VERSION = '0.5.1' unless defined?(::Merb::VERSION)
3
3
 
4
4
  class << self
5
5
  def svn_revision
6
6
  rev = if File.directory?('.git')
7
- `git log -1`[/git-svn-id.+@(\d+)/, 1]
7
+ `git svn log --limit 1`[/r(\d+)/, 1]
8
8
  elsif File.directory?('.svn')
9
9
  `svn info`[/Revision: (\d+)/, 1]
10
10
  end
@@ -48,7 +48,7 @@ desc "Setup the Merb Environment by requiring merb and loading your merb_init.rb
48
48
  task :merb_env do
49
49
  require 'rubygems'
50
50
  require 'merb'
51
- Merb::Config[:environment] = ENV['Merb.environment'] if ENV['Merb.environment']
52
- Merb.environment = Merb::Config[:environment].nil? ? 'development' : Merb::Config[:environment]
51
+ Merb::Config[:environment] = ENV['MERB_ENV'] if ENV['MERB_ENV']
52
+ Merb.environment = Merb::Config[:environment].nil? ? 'development' : Merb::Config[:environment]
53
53
  load Merb.root+'/config/merb_init.rb'
54
54
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: merb
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.0
7
- date: 2008-01-09 00:00:00 -08:00
6
+ version: 0.5.1
7
+ date: 2008-01-10 00:00:00 -08:00
8
8
  summary: Merb == Mongrel + Erb. Pocket rocket web framework.
9
9
  require_paths:
10
10
  - lib