Skip to content

Commit 7ae55ef

Browse files
committed
Redid the whole app with the new 0.9 gem
1 parent 3d68958 commit 7ae55ef

30 files changed

Lines changed: 148 additions & 427 deletions

Rakefile

Lines changed: 13 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -7,98 +7,37 @@ require 'rake/rdoctask'
77
require 'rake/testtask'
88
require 'spec/rake/spectask'
99
require 'fileutils'
10+
require 'merb-core'
11+
require 'rubigen'
1012

11-
require File.dirname(__FILE__)+'/config/boot.rb'
12-
require Merb::framework_root+'/tasks'
13-
include FileUtils
13+
$RAKE_ENV = true
1414

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']
15+
init_file = File.join(File.dirname(__FILE__) / "config" / "init")
1916

20-
# Get Merb plugins and dependencies
21-
require File.dirname(__FILE__)+'/config/dependencies.rb'
17+
Merb.load_dependencies(init_file)
18+
19+
include FileUtils
20+
# # # Get Merb plugins and dependencies
2221
Merb::Plugins.rakefiles.each {|r| require r }
2322

23+
#
2424
#desc "Packages up Merb."
2525
#task :default => [:package]
2626

2727
desc "load merb_init.rb"
2828
task :merb_init do
29-
# deprecated - here for BC
30-
Rake::Task['merb_env'].invoke
31-
end
29+
require 'merb-core'
30+
require File.dirname(__FILE__)+'/config/init.rb'
31+
end
3232

3333
task :uninstall => [:clean] do
3434
sh %{sudo gem uninstall #{NAME}}
3535
end
3636

37-
desc 'Run unit tests'
38-
Rake::TestTask.new('test_unit') do |t|
39-
t.libs << 'test'
40-
t.pattern = 'test/unit/*_test.rb'
41-
t.verbose = true
42-
end
43-
44-
desc 'Run functional tests'
45-
Rake::TestTask.new('test_functional') do |t|
46-
t.libs << 'test'
47-
t.pattern = 'test/functional/*_test.rb'
48-
t.verbose = true
49-
end
50-
51-
desc 'Run all tests'
52-
Rake::TestTask.new('test') do |t|
53-
t.libs << 'test'
54-
t.pattern = 'test/**/*_test.rb'
55-
t.verbose = true
56-
end
57-
58-
desc "Run all specs"
59-
Spec::Rake::SpecTask.new('specs') do |t|
60-
t.spec_opts = ["--format", "specdoc", "--colour"]
61-
t.spec_files = Dir['spec/**/*_spec.rb'].sort
62-
end
63-
64-
desc "Run all model specs"
65-
Spec::Rake::SpecTask.new('model_specs') do |t|
66-
t.spec_opts = ["--format", "specdoc", "--colour"]
67-
t.spec_files = Dir['spec/models/**/*_spec.rb'].sort
68-
end
69-
70-
desc "Run all controller specs"
71-
Spec::Rake::SpecTask.new('controller_specs') do |t|
72-
t.spec_opts = ["--format", "specdoc", "--colour"]
73-
t.spec_files = Dir['spec/controllers/**/*_spec.rb'].sort
74-
end
75-
76-
desc "Run a specific spec with TASK=xxxx"
77-
Spec::Rake::SpecTask.new('spec') do |t|
78-
t.spec_opts = ["--format", "specdoc", "--colour"]
79-
t.libs = ['lib', 'server/lib' ]
80-
t.spec_files = ["spec/merb/#{ENV['TASK']}_spec.rb"]
81-
end
82-
83-
desc "Run all specs output html"
84-
Spec::Rake::SpecTask.new('specs_html') do |t|
85-
t.spec_opts = ["--format", "html"]
86-
t.libs = ['lib', 'server/lib' ]
87-
t.spec_files = Dir['spec/**/*_spec.rb'].sort
88-
end
89-
90-
desc "RCov"
91-
Spec::Rake::SpecTask.new('rcov') do |t|
92-
t.spec_opts = ["--format", "specdoc", "--colour"]
93-
t.spec_files = Dir['spec/**/*_spec.rb'].sort
94-
t.libs = ['lib', 'server/lib' ]
95-
t.rcov = true
96-
end
97-
9837
desc 'Run all tests, specs and finish with rcov'
9938
task :aok do
10039
sh %{rake rcov}
101-
sh %{rake spec}
40+
sh %{rake specs}
10241
end
10342

10443
unless Gem.cache.search("haml").empty?

app/controllers/application.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
# all your other controllers should inherit from this one to share code.
21
class Application < Merb::Controller
3-
end
2+
end

app/helpers/article_helper.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/helpers/global_helper.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/mailers/views/layout/application.html.erb

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/mailers/views/layout/application.text.erb

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/models/article.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
class Article
1+
class Article < DataMapper::Base
22
end

app/parts/views/layout/application.html.erb

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/views/exceptions/internal_server_error.html.erb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html>
22
<head>
3-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
4-
<title><%= @exception.name.humanize %></title>
3+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
4+
<title><%= @exception_name %></title>
55
<style type="text/css" media="screen">
66
body {
77
font-family:arial;
@@ -129,34 +129,34 @@
129129
<div class="internalError">
130130

131131
<div class="header">
132-
<h1><%= @exception.name.humanize %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1>
132+
<h1><%= @exception_name %> <sup class="error_<%= @exception.class::STATUS %>"><%= @exception.class::STATUS %></sup></h1>
133133
<% if show_details = ::Merb::Config[:exception_details] -%>
134-
<h2><%== @exception.message %></h2>
134+
<h2><%= @exception.message %></h2>
135135
<% else -%>
136136
<h2>Sorry about that...</h2>
137137
<% end -%>
138138
<h3>Parameters</h3>
139139
<ul>
140-
<% controller.params[:original_params].each do |param, value| %>
140+
<% params[:original_params].each do |param, value| %>
141141
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
142142
<% end %>
143-
<%= "<li>None</li>" if controller.params[:original_params].empty? %>
143+
<%= "<li>None</li>" if params[:original_params].empty? %>
144144
</ul>
145145

146146
<h3>Session</h3>
147147
<ul>
148-
<% controller.params[:original_session].each do |param, value| %>
148+
<% params[:original_session].each do |param, value| %>
149149
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
150150
<% end %>
151-
<%= "<li>None</li>" if controller.params[:original_session].empty? %>
151+
<%= "<li>None</li>" if params[:original_session].empty? %>
152152
</ul>
153153

154154
<h3>Cookies</h3>
155155
<ul>
156-
<% controller.params[:original_cookies].each do |param, value| %>
156+
<% params[:original_cookies].each do |param, value| %>
157157
<li><strong><%= param %>:</strong> <%= value.inspect %></li>
158158
<% end %>
159-
<%= "<li>None</li>" if controller.params[:original_cookies].empty? %>
159+
<%= "<li>None</li>" if params[:original_cookies].empty? %>
160160
</ul>
161161
</div>
162162

Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,55 @@
1-
<div id="container">
2-
<div id="header-container">
3-
<img src="/images/merb.jpg">
4-
<!-- <h1>Mongrel + Erb</h1> -->
5-
<h2>pocket rocket web framework</h2>
6-
<hr />
7-
</div>
8-
9-
<div id="left-container">
10-
<h3>Exception:</h3>
11-
<p><%= params[:exception] %></p>
12-
</div>
13-
14-
<div id="main-container">
15-
<h3>Why am I seeing this page?</h3>
16-
<p>Merb couldn't find an appropriate content_type to return,
17-
based on what you said was available via provides() and
18-
what the client requested. For more information, visit
19-
http://merbivore.com/fixing_406_issues
20-
</p>
21-
22-
<h3>Where can I find help?</h3>
23-
<p>If you have any questions or if you can't figure something out, please take a
24-
look at our <a href="http://merb.devjavu.com/"> project development page</a> or,
25-
feel free to come chat at irc.freenode.net, channel #merb.</p>
26-
27-
<h3>How do I edit this page?</h3>
28-
<p>You can change what people see when this happens byy editing <tt>app/views/exceptions/not_found.html.erb</tt>.</p>
29-
30-
</div>
31-
32-
<div id="footer-container">
33-
<hr />
34-
<div class="left"></div>
35-
<div class="right">&copy; 2007 the merb dev team</div>
36-
<p>&nbsp;</p>
37-
</div>
1+
<div id="container">
2+
<div id="header-container">
3+
<img src="/images/merb.jpg" />
4+
<!-- <h1>Mongrel + Erb</h1> -->
5+
<h2>pocket rocket web framework</h2>
6+
<hr />
387
</div>
8+
9+
<div id="left-container">
10+
<h3>Exception:</h3>
11+
<p><%= params[:exception] %></p>
12+
</div>
13+
14+
<div id="main-container">
15+
<h3>Why am I seeing this page?</h3>
16+
<p>Merb couldn't find an appropriate content_type to return,
17+
based on what you said was available via provides() and
18+
what the client requested.</p>
19+
20+
<h3>How to add a mime-type</h3>
21+
<pre><code>
22+
Merb.add_mime_type :pdf, :to_pdf, %w[application/pdf], &quot;Content-Encoding&quot; =&gt; &quot;gzip&quot;
23+
</code></pre>
24+
<h3>What this means is:</h3>
25+
<ul>
26+
<li>Add a mime-type for :pdf</li>
27+
<li>Register the method for converting objects to PDF as <code>#to_pdf</code>.</li>
28+
<li>Register the incoming mime-type "Accept" header as <code>application/pdf</code>.</li>
29+
<li>Specify a new header for PDF types so it will set <code>Content-Encoding</code> to gzip.</li>
30+
</ul>
31+
32+
<h3>You can then do:</h3>
33+
<pre><code>
34+
class Foo &lt; Application
35+
provides :pdf
36+
end
37+
</code></pre>
38+
39+
<h3>Where can I find help?</h3>
40+
<p>If you have any questions or if you can't figure something out, please take a
41+
look at our <a href="http://merb.devjavu.com/"> project development page</a> or,
42+
feel free to come chat at irc.freenode.net, channel #merb.</p>
43+
44+
<h3>How do I edit this page?</h3>
45+
<p>You can change what people see when this happens byy editing <tt>app/views/exceptions/not_found.html.erb</tt>.</p>
46+
47+
</div>
48+
49+
<div id="footer-container">
50+
<hr />
51+
<div class="left"></div>
52+
<div class="right">&copy; 2007 the merb dev team</div>
53+
<p>&nbsp;</p>
54+
</div>
55+
</div>

0 commit comments

Comments
 (0)