thorero-gen 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README +21 -0
- data/Rakefile +65 -0
- data/TODO +13 -0
- data/bin/merb-gen +10 -0
- data/lib/merb-gen.rb +37 -0
- data/lib/merb-gen/controller.rb +69 -0
- data/lib/merb-gen/freezer.rb +19 -0
- data/lib/merb-gen/generator.rb +55 -0
- data/lib/merb-gen/helper.rb +53 -0
- data/lib/merb-gen/merb.rb +27 -0
- data/lib/merb-gen/merb/merb_flat.rb +31 -0
- data/lib/merb-gen/merb/merb_full.rb +35 -0
- data/lib/merb-gen/merb/merb_very_flat.rb +33 -0
- data/lib/merb-gen/merb_plugin.rb +33 -0
- data/lib/merb-gen/migration.rb +69 -0
- data/lib/merb-gen/model.rb +67 -0
- data/lib/merb-gen/part_controller.rb +55 -0
- data/lib/merb-gen/resource.rb +32 -0
- data/lib/merb-gen/resource_controller.rb +91 -0
- data/lib/merb-gen/session_migration.rb +44 -0
- data/lib/merb-gen/slice.rb +25 -0
- data/lib/merb-gen/slice/full.rb +31 -0
- data/lib/merb-gen/slice/thin.rb +31 -0
- data/lib/merb-gen/slice/very_thin.rb +31 -0
- data/spec/controller_spec.rb +94 -0
- data/spec/merb_spec.rb +28 -0
- data/spec/migration_spec.rb +47 -0
- data/spec/model_spec.rb +95 -0
- data/spec/resource_controller_spec.rb +98 -0
- data/spec/spec_helper.rb +7 -0
- data/templates/application/merb/Rakefile +76 -0
- data/templates/application/merb/app/controllers/application.rb +2 -0
- data/templates/application/merb/app/controllers/exceptions.rb +13 -0
- data/templates/application/merb/app/helpers/global_helpers.rb +5 -0
- data/templates/application/merb/app/views/exceptions/internal_server_error.html.erb +216 -0
- data/templates/application/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
- data/templates/application/merb/app/views/exceptions/not_found.html.erb +47 -0
- data/templates/application/merb/app/views/layout/application.html.erb +11 -0
- data/templates/application/merb/autotest/discover.rb +1 -0
- data/templates/application/merb/autotest/merb.rb +149 -0
- data/templates/application/merb/autotest/merb_rspec.rb +166 -0
- data/templates/application/merb/config/environments/development.rb +7 -0
- data/templates/application/merb/config/environments/production.rb +7 -0
- data/templates/application/merb/config/environments/rake.rb +7 -0
- data/templates/application/merb/config/environments/test.rb +6 -0
- data/templates/application/merb/config/init.rb +164 -0
- data/templates/application/merb/config/rack.rb +12 -0
- data/templates/application/merb/config/router.rb +35 -0
- data/templates/application/merb/public/images/merb.jpg +0 -0
- data/templates/application/merb/public/merb.fcgi +22 -0
- data/templates/application/merb/public/stylesheets/master.css +119 -0
- data/templates/application/merb/spec/spec.opts +0 -0
- data/templates/application/merb/spec/spec_helper.rb +13 -0
- data/templates/application/merb/test/test_helper.rb +14 -0
- data/templates/application/merb_flat/README.txt +10 -0
- data/templates/application/merb_flat/application.rb +15 -0
- data/templates/application/merb_flat/config/framework.rb +7 -0
- data/templates/application/merb_flat/config/init.rb +18 -0
- data/templates/application/merb_flat/views/foo.html.erb +3 -0
- data/templates/application/merb_plugin/LICENSE +20 -0
- data/templates/application/merb_plugin/README +4 -0
- data/templates/application/merb_plugin/Rakefile +59 -0
- data/templates/application/merb_plugin/TODO +5 -0
- data/templates/application/merb_plugin/lib/%base_name%.rb +18 -0
- data/templates/application/merb_plugin/lib/%base_name%/merbtasks.rb +6 -0
- data/templates/application/merb_plugin/spec/%base_name%_spec.rb +7 -0
- data/templates/application/merb_plugin/spec/spec_helper.rb +2 -0
- data/templates/application/merb_plugin/test/%base_name%_test.rb +0 -0
- data/templates/application/merb_plugin/test/test_helper.rb +2 -0
- data/templates/application/merb_very_flat/application.rbt +17 -0
- data/templates/application/slice/full/LICENSE +20 -0
- data/templates/application/slice/full/README +170 -0
- data/templates/application/slice/full/Rakefile +48 -0
- data/templates/application/slice/full/TODO +15 -0
- data/templates/application/slice/full/app/controllers/application.rb +5 -0
- data/templates/application/slice/full/app/controllers/main.rb +7 -0
- data/templates/application/slice/full/app/helpers/application_helper.rb +64 -0
- data/templates/application/slice/full/app/views/layout/%underscored_base_name%.html.erb +16 -0
- data/templates/application/slice/full/app/views/main/index.html.erb +1 -0
- data/templates/application/slice/full/lib/%base_name%.rb +78 -0
- data/templates/application/slice/full/lib/%base_name%/merbtasks.rb +166 -0
- data/templates/application/slice/full/lib/%base_name%/slicetasks.rb +18 -0
- data/templates/application/slice/full/public/javascripts/master.js +0 -0
- data/templates/application/slice/full/public/stylesheets/master.css +2 -0
- data/templates/application/slice/full/spec/%base_name%_spec.rb +130 -0
- data/templates/application/slice/full/spec/controllers/main_spec.rb +61 -0
- data/templates/application/slice/full/spec/spec_helper.rb +44 -0
- data/templates/application/slice/full/stubs/app/controllers/application.rb +2 -0
- data/templates/application/slice/full/stubs/app/controllers/main.rb +2 -0
- data/templates/application/slice/thin/LICENSE +20 -0
- data/templates/application/slice/thin/README +130 -0
- data/templates/application/slice/thin/Rakefile +46 -0
- data/templates/application/slice/thin/TODO +7 -0
- data/templates/application/slice/thin/application.rb +36 -0
- data/templates/application/slice/thin/lib/%base_name%.rb +93 -0
- data/templates/application/slice/thin/lib/%base_name%/merbtasks.rb +106 -0
- data/templates/application/slice/thin/lib/%base_name%/slicetasks.rb +18 -0
- data/templates/application/slice/thin/public/javascripts/master.js +0 -0
- data/templates/application/slice/thin/public/stylesheets/master.css +2 -0
- data/templates/application/slice/thin/stubs/application.rb +9 -0
- data/templates/application/slice/thin/views/layout/%underscored_base_name%.html.erb +16 -0
- data/templates/application/slice/thin/views/main/index.html.erb +1 -0
- data/templates/application/slice/very_thin/LICENSE +20 -0
- data/templates/application/slice/very_thin/README +110 -0
- data/templates/application/slice/very_thin/Rakefile +46 -0
- data/templates/application/slice/very_thin/TODO +7 -0
- data/templates/application/slice/very_thin/application.rb +36 -0
- data/templates/application/slice/very_thin/lib/%base_name%.rb +89 -0
- data/templates/application/slice/very_thin/lib/%base_name%/merbtasks.rb +106 -0
- data/templates/application/slice/very_thin/lib/%base_name%/slicetasks.rb +18 -0
- data/templates/component/controller/app/controllers/%file_name%.rb +11 -0
- data/templates/component/controller/app/views/%file_name%/index.html.erb +1 -0
- data/templates/component/controller/spec/controllers/%file_name%_spec.rb +7 -0
- data/templates/component/controller/test/controllers/%file_name%_test.rb +17 -0
- data/templates/component/freezer/script/frozen_merb +43 -0
- data/templates/component/helper/app/helpers/%file_name%_helper.rb +7 -0
- data/templates/component/helper/spec/helpers/%file_name%_helper_spec.rb +5 -0
- data/templates/component/migration/activerecord/schema/migrations/%file_name%.rb +19 -0
- data/templates/component/migration/datamapper/schema/migrations/%file_name%.rb +7 -0
- data/templates/component/migration/sequel/schema/migrations/%file_name%.rb +24 -0
- data/templates/component/model/activerecord/app/models/%file_name%.rb +2 -0
- data/templates/component/model/datamapper/app/models/%file_name%.rb +6 -0
- data/templates/component/model/none/app/models/%file_name%.rb +5 -0
- data/templates/component/model/rspec/spec/models/%file_name%_spec.rb +7 -0
- data/templates/component/model/sequel/app/models/%file_name%.rb +2 -0
- data/templates/component/model/test_unit/test/models/%file_name%_test.rb +9 -0
- data/templates/component/part_controller/app/parts/%file_name%_part.rb +9 -0
- data/templates/component/part_controller/app/parts/views/%file_name%_part/index.html.erb +3 -0
- data/templates/component/resource_controller/activerecord/app/controllers/%file_name%.rb +57 -0
- data/templates/component/resource_controller/activerecord/app/views/%file_name%/edit.html.erb +3 -0
- data/templates/component/resource_controller/activerecord/app/views/%file_name%/index.html.erb +3 -0
- data/templates/component/resource_controller/activerecord/app/views/%file_name%/new.html.erb +3 -0
- data/templates/component/resource_controller/activerecord/app/views/%file_name%/show.html.erb +3 -0
- data/templates/component/resource_controller/datamapper/app/controllers/%file_name%.rb +59 -0
- data/templates/component/resource_controller/datamapper/app/views/%file_name%/edit.html.erb +21 -0
- data/templates/component/resource_controller/datamapper/app/views/%file_name%/index.html.erb +24 -0
- data/templates/component/resource_controller/datamapper/app/views/%file_name%/new.html.erb +20 -0
- data/templates/component/resource_controller/datamapper/app/views/%file_name%/show.html.erb +14 -0
- data/templates/component/resource_controller/none/app/controllers/%file_name%.rb +36 -0
- data/templates/component/resource_controller/none/app/views/%file_name%/edit.html.erb +3 -0
- data/templates/component/resource_controller/none/app/views/%file_name%/index.html.erb +3 -0
- data/templates/component/resource_controller/none/app/views/%file_name%/new.html.erb +3 -0
- data/templates/component/resource_controller/none/app/views/%file_name%/show.html.erb +3 -0
- data/templates/component/resource_controller/sequel/app/controllers/%file_name%.rb +59 -0
- data/templates/component/resource_controller/sequel/app/views/%file_name%/edit.html.erb +3 -0
- data/templates/component/resource_controller/sequel/app/views/%file_name%/index.html.erb +3 -0
- data/templates/component/resource_controller/sequel/app/views/%file_name%/new.html.erb +3 -0
- data/templates/component/resource_controller/sequel/app/views/%file_name%/show.html.erb +3 -0
- data/templates/component/session_migration/activerecord/schema/migrations/%version%_sessions.rb +12 -0
- data/templates/component/session_migration/sequel/schema/migrations/%version%_sessions.rb +16 -0
- metadata +362 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
# use PathPrefix Middleware if :path_prefix is set in Merb::Config
|
|
3
|
+
if prefix = ::Merb::Config[:path_prefix]
|
|
4
|
+
use Merb::Rack::PathPrefix, prefix
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# comment this out if you are running merb behind a load balancer
|
|
8
|
+
# that serves static files
|
|
9
|
+
use Merb::Rack::Static, Merb.dir_for(:public)
|
|
10
|
+
|
|
11
|
+
# this is our main merb application
|
|
12
|
+
run Merb::Rack::Application.new
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Merb::Router is the request routing mapper for the merb framework.
|
|
2
|
+
#
|
|
3
|
+
# You can route a specific URL to a controller / action pair:
|
|
4
|
+
#
|
|
5
|
+
# r.match("/contact").
|
|
6
|
+
# to(:controller => "info", :action => "contact")
|
|
7
|
+
#
|
|
8
|
+
# You can define placeholder parts of the url with the :symbol notation. These
|
|
9
|
+
# placeholders will be available in the params hash of your controllers. For example:
|
|
10
|
+
#
|
|
11
|
+
# r.match("/books/:book_id/:action").
|
|
12
|
+
# to(:controller => "books")
|
|
13
|
+
#
|
|
14
|
+
# Or, use placeholders in the "to" results for more complicated routing, e.g.:
|
|
15
|
+
#
|
|
16
|
+
# r.match("/admin/:module/:controller/:action/:id").
|
|
17
|
+
# to(:controller => ":module/:controller")
|
|
18
|
+
#
|
|
19
|
+
# You can also use regular expressions, deferred routes, and many other options.
|
|
20
|
+
# See merb/specs/merb/router.rb for a fairly complete usage sample.
|
|
21
|
+
|
|
22
|
+
Merb.logger.info("Compiling routes...")
|
|
23
|
+
Merb::Router.prepare do |r|
|
|
24
|
+
# RESTful routes
|
|
25
|
+
# r.resources :posts
|
|
26
|
+
|
|
27
|
+
# This is the default route for /:controller/:action/:id
|
|
28
|
+
# This is fine for most cases. If you're heavily using resource-based
|
|
29
|
+
# routes, you may want to comment/remove this line to prevent
|
|
30
|
+
# clients from calling your create or destroy actions with a GET
|
|
31
|
+
r.default_routes
|
|
32
|
+
|
|
33
|
+
# Change this for your home page to be available at /
|
|
34
|
+
# r.match('/').to(:controller => 'whatever', :action =>'index')
|
|
35
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'merb-core'
|
|
5
|
+
|
|
6
|
+
# this is Merb.root, change this if you have some funky setup.
|
|
7
|
+
merb_root = File.expand_path(File.dirname(__FILE__) / '../')
|
|
8
|
+
|
|
9
|
+
# If the fcgi process runs as apache, make sure
|
|
10
|
+
# we have an inlinedir set for Rubyinline action-args to work
|
|
11
|
+
unless ENV["INLINEDIR"] || ENV["HOME"]
|
|
12
|
+
tmpdir = merb_root / "tmp"
|
|
13
|
+
unless File.directory?(tmpdir)
|
|
14
|
+
Dir.mkdir(tmpdir)
|
|
15
|
+
end
|
|
16
|
+
ENV["INLINEDIR"] = tmpdir
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# start merb with the fcgi adapter, add options or change the log dir here
|
|
20
|
+
Merb.start(:adapter => 'fcgi',
|
|
21
|
+
:merb_root => merb_root,
|
|
22
|
+
:log_file => merb_root /'log'/'merb.log')
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
body {
|
|
2
|
+
font-family: Arial, Verdana, sans-serif;
|
|
3
|
+
font-size: 12px;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
}
|
|
6
|
+
* {
|
|
7
|
+
margin: 0px;
|
|
8
|
+
padding: 0px;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
}
|
|
11
|
+
html {
|
|
12
|
+
height: 100%;
|
|
13
|
+
margin-bottom: 1px;
|
|
14
|
+
}
|
|
15
|
+
#container {
|
|
16
|
+
width: 80%;
|
|
17
|
+
text-align: left;
|
|
18
|
+
background-color: #fff;
|
|
19
|
+
margin-right: auto;
|
|
20
|
+
margin-left: auto;
|
|
21
|
+
}
|
|
22
|
+
#header-container {
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding-top: 15px;
|
|
25
|
+
}
|
|
26
|
+
#header-container h1, #header-container h2 {
|
|
27
|
+
margin-left: 6px;
|
|
28
|
+
margin-bottom: 6px;
|
|
29
|
+
}
|
|
30
|
+
.spacer {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 15px;
|
|
33
|
+
}
|
|
34
|
+
hr {
|
|
35
|
+
border: 0px;
|
|
36
|
+
color: #ccc;
|
|
37
|
+
background-color: #cdcdcd;
|
|
38
|
+
height: 1px;
|
|
39
|
+
width: 100%;
|
|
40
|
+
text-align: left;
|
|
41
|
+
}
|
|
42
|
+
h1 {
|
|
43
|
+
font-size: 28px;
|
|
44
|
+
color: #c55;
|
|
45
|
+
background-color: #fff;
|
|
46
|
+
font-family: Arial, Verdana, sans-serif;
|
|
47
|
+
font-weight: 300;
|
|
48
|
+
}
|
|
49
|
+
h2 {
|
|
50
|
+
font-size: 15px;
|
|
51
|
+
color: #999;
|
|
52
|
+
font-family: Arial, Verdana, sans-serif;
|
|
53
|
+
font-weight: 300;
|
|
54
|
+
background-color: #fff;
|
|
55
|
+
}
|
|
56
|
+
h3 {
|
|
57
|
+
color: #4d9b12;
|
|
58
|
+
font-size: 15px;
|
|
59
|
+
text-align: left;
|
|
60
|
+
font-weight: 300;
|
|
61
|
+
padding: 5px;
|
|
62
|
+
margin-top: 5px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#left-container {
|
|
66
|
+
float: left;
|
|
67
|
+
width: 250px;
|
|
68
|
+
background-color: #FFFFFF;
|
|
69
|
+
color: black;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#left-container h3 {
|
|
73
|
+
color: #c55;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#main-container {
|
|
77
|
+
margin: 5px 5px 5px 260px;
|
|
78
|
+
padding: 15px;
|
|
79
|
+
border-left: 1px solid silver;
|
|
80
|
+
min-height: 400px;
|
|
81
|
+
}
|
|
82
|
+
p {
|
|
83
|
+
color: #000;
|
|
84
|
+
background-color: #fff;
|
|
85
|
+
line-height: 20px;
|
|
86
|
+
padding: 5px;
|
|
87
|
+
}
|
|
88
|
+
a {
|
|
89
|
+
color: #4d9b12;
|
|
90
|
+
background-color: #fff;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
}
|
|
93
|
+
a:hover {
|
|
94
|
+
color: #4d9b12;
|
|
95
|
+
background-color: #fff;
|
|
96
|
+
text-decoration: underline;
|
|
97
|
+
}
|
|
98
|
+
#footer-container {
|
|
99
|
+
clear: both;
|
|
100
|
+
font-size: 12px;
|
|
101
|
+
font-family: Verdana, Arial, sans-serif;
|
|
102
|
+
}
|
|
103
|
+
.right {
|
|
104
|
+
float: right;
|
|
105
|
+
font-size: 100%;
|
|
106
|
+
margin-top: 5px;
|
|
107
|
+
color: #999;
|
|
108
|
+
background-color: #fff;
|
|
109
|
+
}
|
|
110
|
+
.left {
|
|
111
|
+
float: left;
|
|
112
|
+
font-size: 100%;
|
|
113
|
+
margin-top: 5px;
|
|
114
|
+
color: #999;
|
|
115
|
+
background-color: #fff;
|
|
116
|
+
}
|
|
117
|
+
#main-container ul {
|
|
118
|
+
margin-left: 3.0em;
|
|
119
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'merb-core'
|
|
3
|
+
require 'spec' # Satisfies Autotest and anyone else not using the Rake tasks
|
|
4
|
+
|
|
5
|
+
# this loads all plugins required in your init file so don't add them
|
|
6
|
+
# here again, Merb will do it for you
|
|
7
|
+
Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')
|
|
8
|
+
|
|
9
|
+
Spec::Runner.configure do |config|
|
|
10
|
+
config.include(Merb::Test::ViewHelper)
|
|
11
|
+
config.include(Merb::Test::RouteHelper)
|
|
12
|
+
config.include(Merb::Test::ControllerHelper)
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
$TESTING=true
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'merb-core'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# TODO: Boot Merb, via the Test Rack adapter
|
|
7
|
+
Merb.start :environment => (ENV['MERB_ENV'] || 'test'),
|
|
8
|
+
:merb_root => File.join(File.dirname(__FILE__), ".." )
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Test::Unit::TestCase
|
|
12
|
+
include Merb::Test::RequestHelper
|
|
13
|
+
# Add more helper methods to be used by all tests here...
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class Foo < Merb::Controller
|
|
2
|
+
|
|
3
|
+
def _template_location(action, type = nil, controller = controller_name)
|
|
4
|
+
controller == "layout" ? "layout.#{action}.#{type}" : "#{action}.#{type}"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
"Hello"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def foo
|
|
12
|
+
render
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Move this to application.rb if you want it to be reloadable in dev mode.
|
|
2
|
+
Merb::Router.prepare do |r|
|
|
3
|
+
r.match('/').to(:controller => 'foo', :action =>'index')
|
|
4
|
+
r.default_routes
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Merb::Config.use { |c|
|
|
8
|
+
c[:environment] = 'production',
|
|
9
|
+
c[:framework] = {},
|
|
10
|
+
c[:log_level] = 'debug',
|
|
11
|
+
c[:use_mutex] = false,
|
|
12
|
+
c[:session_store] = 'cookie',
|
|
13
|
+
c[:session_id_key] = '_session_id',
|
|
14
|
+
c[:session_secret_key] = '<%= SHA1.new(rand(100000000000).to_s).to_s %>',
|
|
15
|
+
c[:exception_details] = true,
|
|
16
|
+
c[:reload_classes] = true,
|
|
17
|
+
c[:reload_time] = 0.5
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) <%= Time.now.year %> YOUR NAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake/gempackagetask'
|
|
3
|
+
require 'rubygems/specification'
|
|
4
|
+
require 'date'
|
|
5
|
+
require 'merb-core/version'
|
|
6
|
+
require 'merb-core/tasks/merb_rake_helper'
|
|
7
|
+
|
|
8
|
+
NAME = "<%= base_name %>"
|
|
9
|
+
GEM_VERSION = "0.0.1"
|
|
10
|
+
AUTHOR = "Your Name"
|
|
11
|
+
EMAIL = "Your Email"
|
|
12
|
+
HOMEPAGE = "http://merbivore.com/"
|
|
13
|
+
SUMMARY = "Merb plugin that provides ..."
|
|
14
|
+
|
|
15
|
+
spec = Gem::Specification.new do |s|
|
|
16
|
+
s.rubyforge_project = 'merb'
|
|
17
|
+
s.name = NAME
|
|
18
|
+
s.version = GEM_VERSION
|
|
19
|
+
s.platform = Gem::Platform::RUBY
|
|
20
|
+
s.has_rdoc = true
|
|
21
|
+
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
|
22
|
+
s.summary = SUMMARY
|
|
23
|
+
s.description = s.summary
|
|
24
|
+
s.author = AUTHOR
|
|
25
|
+
s.email = EMAIL
|
|
26
|
+
s.homepage = HOMEPAGE
|
|
27
|
+
s.add_dependency('merb', '>= <%= Merb::VERSION %>')
|
|
28
|
+
s.require_path = 'lib'
|
|
29
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec<%= bin ? ',bin' : '' %>}/**/*")
|
|
30
|
+
<% if bin %>
|
|
31
|
+
s.bindir = "bin"
|
|
32
|
+
s.executables = [NAME]
|
|
33
|
+
<% end %>
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
|
37
|
+
pkg.gem_spec = spec
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
desc "install the plugin locally"
|
|
41
|
+
task :install => [:package] do
|
|
42
|
+
sh %{#{sudo} gem install #{install_home} pkg/#{NAME}-#{GEM_VERSION} --no-update-sources}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
desc "create a gemspec file"
|
|
46
|
+
task :make_spec do
|
|
47
|
+
File.open("#{NAME}.gemspec", "w") do |file|
|
|
48
|
+
file.puts spec.to_ruby
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
namespace :jruby do
|
|
53
|
+
|
|
54
|
+
desc "Run :package and install the resulting .gem with jruby"
|
|
55
|
+
task :install => :package do
|
|
56
|
+
sh %{#{sudo} jruby -S gem install #{install_home} pkg/#{NAME}-#{GEM_VERSION}.gem --no-rdoc --no-ri}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# make sure we're running inside Merb
|
|
2
|
+
if defined?(Merb::Plugins)
|
|
3
|
+
|
|
4
|
+
# Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
|
|
5
|
+
Merb::Plugins.config[:<%= base_name %>] = {
|
|
6
|
+
:chickens => false
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
Merb::BootLoader.before_app_loads do
|
|
10
|
+
# require code that must be loaded before the application
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Merb::BootLoader.after_app_loads do
|
|
14
|
+
# code that can be required after the application loads
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Merb::Plugins.add_rakefiles "<%= base_name %>/merbtasks"
|
|
18
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# run very flat apps with merb -I <app file>.
|
|
2
|
+
|
|
3
|
+
Merb::Config.use { |c|
|
|
4
|
+
c[:framework] = { :public => [Merb.root / "public", nil] },
|
|
5
|
+
c[:session_store] = 'none',
|
|
6
|
+
c[:exception_details] = true
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
Merb::Router.prepare do |r|
|
|
10
|
+
r.match('/').to(:controller => '<%= app_name %>', :action =>'index')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class <%= class_name %> < Merb::Controller
|
|
14
|
+
def index
|
|
15
|
+
"hi"
|
|
16
|
+
end
|
|
17
|
+
end
|