public
Description: blerb running on merb-core
Clone URL: git://github.com/hornbeck/blerb-core.git
jw - applying buffington patch
jwhitmire (author)
Fri Jan 25 15:06:14 -0800 2008
commit  8c1d2b656e433578c8f873d86f9fde5e54857a40
tree    0d0c469963c2f6194b106a41987a8327ea35a4df
parent  208424ba50668a35b5d3d1ff60d0b4cbb8eb6a4b
...
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
 
13
14
 
 
 
 
 
15
16
17
...
21
22
23
24
25
26
 
 
 
27
28
29
...
56
57
58
 
 
 
 
 
 
 
 
 
 
 
 
59
60
61
...
84
85
86
 
 
 
 
 
 
 
 
 
 
 
 
 
87
88
89
...
1
2
3
4
5
6
7
8
9
 
 
 
10
11
 
 
12
13
14
15
16
17
18
19
20
21
22
...
26
27
28
 
 
 
29
30
31
32
33
34
...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
0
@@ -1,17 +1,22 @@
0
+require 'rubygems'
0
+Gem.clear_paths
0
+Gem.path.unshift(File.join(File.dirname(__FILE__), "gems"))
0
+
0
 require 'rake'
0
 require 'rake/rdoctask'
0
 require 'rake/testtask'
0
 require 'spec/rake/spectask'
0
 require 'fileutils'
0
-require 'rubygems'
0
-
0
-MERB_ENV = ENV['MERB_ENV'] if ENV['MERB_ENV']
0
 
0
 require File.dirname(__FILE__)+'/config/boot.rb'
0
-require MERB_FRAMEWORK_ROOT+'/tasks'
0
-MERB_ROOT = File.dirname(__FILE__)
0
+require Merb::framework_root+'/tasks'
0
 include FileUtils
0
 
0
+# Set these before any dependencies load
0
+# otherwise the ORM may connect to the wrong env
0
+Merb.root = File.dirname(__FILE__)
0
+Merb.environment = ENV['MERB_ENV'] if ENV['MERB_ENV']
0
+
0
 # Get Merb plugins and dependencies
0
 require File.dirname(__FILE__)+'/config/dependencies.rb'
0
 Merb::Plugins.rakefiles.each {|r| require r }
0
@@ -21,9 +26,9 @@ Merb::Plugins.rakefiles.each {|r| require r }
0
 
0
 desc "load merb_init.rb"
0
 task :merb_init do
0
- require 'merb'
0
- require File.dirname(__FILE__)+'/config/merb_init.rb'
0
-end
0
+ # deprecated - here for BC
0
+ Rake::Task['merb_env'].invoke
0
+end
0
 
0
 task :uninstall => [:clean] do
0
   sh %{sudo gem uninstall #{NAME}}
0
@@ -56,6 +61,18 @@ Spec::Rake::SpecTask.new('specs') do |t|
0
   t.spec_files = Dir['spec/**/*_spec.rb'].sort
0
 end
0
 
0
+desc "Run all model specs"
0
+Spec::Rake::SpecTask.new('model_specs') do |t|
0
+ t.spec_opts = ["--format", "specdoc", "--colour"]
0
+ t.spec_files = Dir['spec/models/**/*_spec.rb'].sort
0
+end
0
+
0
+desc "Run all controller specs"
0
+Spec::Rake::SpecTask.new('controller_specs') do |t|
0
+ t.spec_opts = ["--format", "specdoc", "--colour"]
0
+ t.spec_files = Dir['spec/controllers/**/*_spec.rb'].sort
0
+end
0
+
0
 desc "Run a specific spec with TASK=xxxx"
0
 Spec::Rake::SpecTask.new('spec') do |t|
0
   t.spec_opts = ["--format", "specdoc", "--colour"]
0
@@ -84,6 +101,19 @@ task :aok do
0
   sh %{rake spec}
0
 end
0
 
0
+unless Gem.cache.search("haml").empty?
0
+ namespace :haml do
0
+ desc "Compiles all sass files into CSS"
0
+ task :compile_sass do
0
+ gem 'haml'
0
+ require 'sass'
0
+ puts "*** Updating stylesheets"
0
+ Sass::Plugin.update_stylesheets
0
+ puts "*** Done"
0
+ end
0
+ end
0
+end
0
+
0
 ##############################################################################
0
 # SVN
0
 ##############################################################################
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,5 +1,5 @@
0
 module Merb
0
   module GlobalHelper
0
- # helpers deinfed here available to all views.
0
+ # helpers defined here available to all views.
0
   end
0
 end
0
\ No newline at end of file
...
6
7
8
9
 
10
11
...
6
7
8
 
9
10
11
0
@@ -6,6 +6,6 @@ class Comment < DataMapper::Base
0
   
0
   belongs_to :article
0
   
0
- validates_presence_of :post_id, :email
0
+ validates_presence_of :article_id, :email
0
 end
0
 
...
130
131
132
133
 
134
135
136
...
130
131
132
 
133
134
135
136
0
@@ -130,7 +130,7 @@
0
     
0
     <div class="header">
0
       <h1><%= @exception.name.humanize %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1>
0
- <% if show_details = ::Merb::Server.config[:exception_details] -%>
0
+ <% if show_details = ::Merb::Config[:exception_details] -%>
0
         <h2><%= @exception.message %></h2>
0
       <% else -%>
0
         <h2>Sorry about that...</h2>
...
3
4
5
6
 
7
8
9
...
3
4
5
 
6
7
8
9
0
@@ -3,7 +3,7 @@
0
   <head>
0
     <title>Fresh Merb App</title>
0
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
0
- <link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" />
0
+ <link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8">
0
   </head>
0
   <body>
0
     <%= catch_content :layout %>
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 frozen_framework_path = File.join(File.dirname(__FILE__), "..", "framework")
0
 
0
-unless defined?(MERB_FRAMEWORK_ROOT)
0
+unless defined?(Merb::framework_root)
0
   if File.directory?(frozen_framework_path)
0
     $:.unshift frozen_framework_path
0
     require File.join(frozen_framework_path, "merb")
...
2
3
4
5
 
6
7
8
9
10
11
12
 
13
14
15
...
2
3
4
 
5
6
7
8
9
10
11
 
12
13
14
15
0
@@ -2,14 +2,14 @@
0
 # This is a sample database file for the DataMapper ORM
0
 :development: &defaults
0
   :adapter: mysql
0
- :database: blog_development
0
+ :database: blerb_development
0
   :username: root
0
   :password:
0
   :host: localhost
0
 
0
 :test:
0
   <<: *defaults
0
- :database: blog_test
0
+ :database: blerb_test
0
 
0
 :production:
0
   <<: *defaults
...
1
2
3
 
4
5
6
 
7
8
9
...
34
35
36
37
 
38
39
40
...
1
2
 
3
4
5
 
6
7
8
9
...
34
35
36
 
37
38
39
40
0
@@ -1,9 +1,9 @@
0
 # Make the app's "gems" directory a place where gems are loaded from
0
 Gem.clear_paths
0
-Gem.path.unshift(MERB_ROOT / "gems")
0
+Gem.path.unshift(Merb.root / "gems")
0
 
0
 # Make the app's "lib" directory a place where ruby files get "require"d from
0
-$LOAD_PATH.unshift(MERB_ROOT / "lib")
0
+$LOAD_PATH.unshift(Merb.root / "lib")
0
 
0
 ### Merb doesn't come with database support by default. You need
0
 ### an ORM plugin. Install one, and uncomment one of the following lines,
0
@@ -34,7 +34,7 @@ use_test :rspec
0
 # OR
0
 # dependencies "RedCloth" => "> 3.0", "ruby-aes-cext" => "= 1.0"
0
 
0
-Merb::Server.after_app_loads do
0
+Merb::BootLoader.after_app_loads do
0
   ### Add dependencies here that must load after the application loads:
0
 
0
   # dependency "magic_admin" # this gem uses the app's model classes
...
21
22
23
24
 
25
26
27
...
32
33
34
 
 
 
 
 
 
 
 
 
35
36
 
37
38
39
...
61
62
63
64
65
 
 
 
 
 
 
 
 
 
66
...
21
22
23
 
24
25
26
27
...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
71
72
73
 
74
75
76
77
78
79
80
81
82
83
84
0
@@ -21,7 +21,7 @@
0
 
0
 # A secret key is required when using the 'cookie' session store (default),
0
 # change this value to something unique to your application and keep it private
0
-:session_secret_key: /USERS/HORNBECK/CODE/MERB/BLOG8167
0
+:session_secret_key: /USERS/JEFF/DEV/PROJECTS/BLERB6404
0
 
0
 # Uncomment to use the merb upload progress. The 'path match' will be treated as
0
 # a regex for any URLs that should be considered for upload monitoring.
0
@@ -32,8 +32,18 @@
0
 # automatically in production mode.
0
 #:cache_templates: true
0
 
0
+# Uncomment to bundle assets in dev mode. Assets are automatically bundled in
0
+# production mode.
0
+#:bundle_assets: true
0
+
0
+# this is true if you want mongrel to emulate the X-Sendfile header internally,
0
+# false if you want it to fall thru to apache or whatever front end server you use.
0
+# true by default
0
+#:mongrel_x_sendfile: false
0
+
0
 # Uncomment and set this if you want to run a drb server for upload progress
0
 # or other drb services.
0
+#:start_drb: true
0
 #:drb_server_port: 32323
0
 
0
 # If you want to protect some or all of your app with HTTP basic auth then
0
@@ -61,4 +71,12 @@
0
 # It is often useful to use a differant layout from 'application' for errors
0
 # set this to the layout template (or :none) that you want to use by default
0
 #:exception_layout: :none
0
-
0
\ No newline at end of file
0
+
0
+# You can override settings for specific environments by creating a yaml
0
+# file for that environment in config/environments. For example, to
0
+# change the configuration only for development create
0
+# config/environments/development.yml
0
+
0
+# If you don't intend to parse JSON, use ActiveSupport, or want to roll your own
0
+# set this to true, to disable the loading of the JSON gem
0
+# :disable_json_gem: true
0
\ No newline at end of file
...
4
5
6
7
 
8
9
10
11
12
13
 
14
15
16
 
 
...
4
5
6
 
7
8
9
10
11
12
 
13
14
15
 
16
17
0
@@ -4,13 +4,14 @@ puts "Started merb_init.rb ..."
0
 
0
 # Your app's dependencies, including your database layer (if any) are defined
0
 # in config/dependencies.rb
0
-require File.join(MERB_ROOT, 'config', 'dependencies')
0
+require File.join(Merb.root, 'config', 'dependencies')
0
 
0
 # Here's where your controllers, helpers, and models, etc. get loaded. If you
0
 # need to change the order of things, just move the call to 'load_application'
0
 # around this file.
0
 puts "Loading Application..."
0
-Merb::Server.load_application
0
+Merb::BootLoader.load_application
0
 
0
 # Load environment-specific configuration
0
-require File.join(MERB_ROOT, 'config', 'environments', MERB_ENV)
0
+environment_config = File.join(Merb.root, 'config', 'environments', Merb.environment)
0
+require environment_config if File.exist?(environment_config)
...
1
2
3
 
 
 
4
5
6
...
1
2
3
4
5
6
7
8
9
0
@@ -1,6 +1,9 @@
0
 #!/usr/bin/env ruby
0
 APP_ROOT = File.join(File.dirname(__FILE__), '..')
0
 
0
+def at_exit
0
+end
0
+
0
 begin
0
   require 'rubigen'
0
 rescue LoadError
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@ rescue LoadError
0
 end
0
 
0
 require File.join(File.dirname(__FILE__), "..", 'config', 'boot')
0
-require (APP_ROOT / "config" / "merb_init" )
0
+require File.join(Merb.root, 'config', 'dependencies')
0
 module Kernel
0
   undef dependency if defined?(Kernel.dependency)
0
 end
...
1
2
3
4
 
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
 
 
21
 
 
 
...
 
1
2
 
3
4
5
6
7
8
 
 
 
 
 
 
 
 
 
 
 
 
9
10
11
12
13
14
15
0
@@ -1,21 +1,15 @@
0
-MERB_ENV="test" unless Object.const_defined?('MERB_ENV')
0
 $TESTING=true
0
 require File.join(File.dirname(__FILE__), "..", 'config', 'boot')
0
-require File.join(MERB_ROOT, 'config', 'merb_init')
0
+Merb.environment="test"
0
+require File.join(Merb.root, 'config', 'merb_init')
0
 
0
 require 'merb/test/helper'
0
 require 'merb/test/rspec'
0
 
0
-DataMapper::Base.auto_migrate!
0
-### METHODS BELOW THIS LINE SHOULD BE EXTRACTED TO MERB ITSELF
0
-
0
-def fake_render(template, ivars={})
0
- dummy = Object.new
0
- ivars.each do |key, value|
0
- dummy.instance_variable_set "@#{key.to_s}", value
0
- end
0
- template = "#{MERB_VIEW_ROOT}/#{template}"
0
- engine = Merb::Template.engine_for(template)
0
- view_context = Merb::ViewContext.new dummy
0
- engine.transform(:file => template, :view_context => view_context)
0
+Spec::Runner.configure do |config|
0
+ config.include(Merb::Test::Helper)
0
+ config.include(Merb::Test::RspecMatchers)
0
 end
0
+
0
+
0
+### METHODS BELOW THIS LINE SHOULD BE EXTRACTED TO MERB ITSELF
...
4
5
6
7
 
8
9
10
11
 
12
13
14
...
4
5
6
 
7
8
9
10
11
12
13
14
15
0
@@ -4,10 +4,11 @@ $TESTING=true
0
 
0
 require 'rubygems'
0
 require 'test/unit'
0
-require File.join(MERB_ROOT, 'config', 'merb_init')
0
+require File.join(Merb.root, 'config', 'merb_init')
0
 
0
 require 'merb/test/helper'
0
 
0
 class Test::Unit::TestCase
0
+ include Merb::Test::Helper
0
   # Add more helper methods to be used by all tests here...
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.