merb-gen 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README +10 -0
- data/Rakefile +47 -0
- data/TODO +4 -0
- data/app_generators/merb/USAGE +0 -0
- data/app_generators/merb/merb_generator.rb +36 -0
- data/app_generators/merb/templates/Rakefile +126 -0
- data/app_generators/merb/templates/app/controllers/application.rb +2 -0
- data/app_generators/merb/templates/app/controllers/exceptions.rb +13 -0
- data/app_generators/merb/templates/app/helpers/global_helpers.rb +5 -0
- data/app_generators/merb/templates/app/views/exceptions/internal_server_error.html.erb +216 -0
- data/app_generators/merb/templates/app/views/exceptions/not_acceptable.html.erb +55 -0
- data/app_generators/merb/templates/app/views/exceptions/not_found.html.erb +39 -0
- data/app_generators/merb/templates/app/views/layout/application.html.erb +11 -0
- data/app_generators/merb/templates/autotest/discover.rb +1 -0
- data/app_generators/merb/templates/autotest/merb.rb +149 -0
- data/app_generators/merb/templates/autotest/merb_rspec.rb +202 -0
- data/app_generators/merb/templates/config/environments/development.rb +6 -0
- data/app_generators/merb/templates/config/environments/production.rb +5 -0
- data/app_generators/merb/templates/config/environments/rake.rb +7 -0
- data/app_generators/merb/templates/config/environments/test.rb +5 -0
- data/app_generators/merb/templates/config/init.rb +58 -0
- data/app_generators/merb/templates/config/rack.rb +1 -0
- data/app_generators/merb/templates/config/router.rb +35 -0
- data/app_generators/merb/templates/public/images/merb.jpg +0 -0
- data/app_generators/merb/templates/public/merb.fcgi +22 -0
- data/app_generators/merb/templates/public/stylesheets/master.css +119 -0
- data/app_generators/merb/templates/spec/spec.opts +0 -0
- data/app_generators/merb/templates/spec/spec_helper.rb +11 -0
- data/app_generators/merb/templates/test/test_helper.rb +14 -0
- data/app_generators/merb_flat/merb_flat_generator.rb +22 -0
- data/app_generators/merb_flat/templates/README.txt +10 -0
- data/app_generators/merb_flat/templates/application.rb +15 -0
- data/app_generators/merb_flat/templates/config/framework.rb +5 -0
- data/app_generators/merb_flat/templates/config/init.rb +19 -0
- data/app_generators/merb_flat/templates/views/foo.html.erb +3 -0
- data/app_generators/merb_plugin/merb_plugin_generator.rb +22 -0
- data/app_generators/merb_plugin/templates/LICENSE +20 -0
- data/app_generators/merb_plugin/templates/README +4 -0
- data/app_generators/merb_plugin/templates/Rakefile +44 -0
- data/app_generators/merb_plugin/templates/TODO +5 -0
- data/app_generators/merb_plugin/templates/lib/%base_name%.rb +18 -0
- data/app_generators/merb_plugin/templates/lib/%base_name%/merbtasks.rb +6 -0
- data/app_generators/merb_plugin/templates/spec/%base_name%_spec.rb +7 -0
- data/app_generators/merb_plugin/templates/spec/spec_helper.rb +2 -0
- data/app_generators/merb_plugin/templates/test/%base_name%_test.rb +0 -0
- data/app_generators/merb_plugin/templates/test/test_helper.rb +2 -0
- data/app_generators/merb_very_flat/merb_very_flat_generator.rb +37 -0
- data/app_generators/merb_very_flat/templates/%app_file_name%.rb +15 -0
- data/app_generators/merb_very_flat/templates/README.txt +9 -0
- data/bin/merb-gen +103 -0
- data/lib/merb-gen.rb +38 -0
- data/lib/merb-gen/base.rb +62 -0
- data/lib/merb-gen/helpers.rb +108 -0
- data/merb_default_generators/model/USAGE +0 -0
- data/merb_default_generators/model/model_generator.rb +40 -0
- data/merb_default_generators/model/templates/app/models/%model_file_name%.rb +5 -0
- data/merb_default_generators/resource_controller/USAGE +0 -0
- data/merb_default_generators/resource_controller/resource_controller_generator.rb +74 -0
- data/merb_default_generators/resource_controller/templates/app/controllers/%controller_file_name%.rb +46 -0
- data/merb_default_generators/resource_controller/templates/app/helpers/%controller_file_name%_helper.rb +16 -0
- data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/delete.html.erb +3 -0
- data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/edit.html.erb +3 -0
- data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/index.html.erb +3 -0
- data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/new.html.erb +3 -0
- data/merb_default_generators/resource_controller/templates/app/views/%controller_file_name%/show.html.erb +3 -0
- data/merb_generators/controller/USAGE +0 -0
- data/merb_generators/controller/controller_generator.rb +59 -0
- data/merb_generators/controller/templates/app/controllers/%controller_file_name%.rb +18 -0
- data/merb_generators/controller/templates/app/helpers/%controller_file_name%_helper.rb +16 -0
- data/merb_generators/controller/templates/app/views/%controller_file_name%/index.html.erb +1 -0
- data/merb_generators/freezer/USAGE +0 -0
- data/merb_generators/freezer/freezer_generator.rb +25 -0
- data/merb_generators/freezer/templates/script/frozen-merb +43 -0
- data/merb_generators/part_controller/USAGE +0 -0
- data/merb_generators/part_controller/part_controller_generator.rb +58 -0
- data/merb_generators/part_controller/templates/app/helpers/%controller_file_name%_part_helper.rb +16 -0
- data/merb_generators/part_controller/templates/app/parts/%controller_file_name%_part.rb +18 -0
- data/merb_generators/part_controller/templates/app/parts/views/%controller_file_name%_part/index.html.erb +3 -0
- data/merb_generators/resource/USAGE +0 -0
- data/merb_generators/resource/resource_generator.rb +48 -0
- data/rspec_generators/merb_controller_test/merb_controller_test_generator.rb +49 -0
- data/rspec_generators/merb_controller_test/templates/spec/controllers/%controller_full_file_path%_spec.rb +7 -0
- data/rspec_generators/merb_controller_test/templates/spec/helpers/%controller_full_file_path%_helper_spec.rb +5 -0
- data/rspec_generators/merb_model_test/merb_model_test_generator.rb +35 -0
- data/rspec_generators/merb_model_test/templates/spec/models/%model_file_name%_spec.rb +7 -0
- data/rspec_generators/merb_resource_controller_test/merb_resource_controller_test_generator.rb +49 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/controllers/%controller_full_file_path%_spec.rb +7 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/helpers/%controller_full_file_path%_helpers.rb +5 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/delete.html.erb_spec.rb +1 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/edit.html.erb_spec.rb +1 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/index.html.erb_spec.rb +1 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/new.html.erb_spec.rb +1 -0
- data/rspec_generators/merb_resource_controller_test/templates/spec/views/%controller_full_file_path%/show.html.erb_spec.rb +1 -0
- data/test_unit_generators/merb_controller_test/merb_controller_test_generator.rb +47 -0
- data/test_unit_generators/merb_controller_test/templates/test/functional/%controller_full_file_path%_test.rb +17 -0
- data/test_unit_generators/merb_model_test/merb_model_test_generator.rb +34 -0
- data/test_unit_generators/merb_model_test/templates/test/unit/%model_file_name%_test.rb +9 -0
- data/test_unit_generators/merb_resource_controller_test/merb_resource_controller_test_generator.rb +31 -0
- metadata +253 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
# Make the app's "gems" directory a place where gems are loaded from
|
2
|
+
Gem.clear_paths
|
3
|
+
Gem.path.unshift(Merb.root / "gems")
|
4
|
+
|
5
|
+
# Make the app's "lib" directory a place where ruby files get "require"d from
|
6
|
+
$LOAD_PATH.unshift(Merb.root / "lib")
|
7
|
+
|
8
|
+
<% require 'sha1' %>
|
9
|
+
Merb::Config.use do |c|
|
10
|
+
|
11
|
+
### Sets up a custom session id key, if you want to piggyback sessions of other applications
|
12
|
+
### with the cookie session store. If not specified, defaults to '_session_id'.
|
13
|
+
# c[:session_id_key] = '_session_id'
|
14
|
+
|
15
|
+
c[:session_secret_key] = '<%= SHA1.new(rand(100000000000).to_s).to_s %>'
|
16
|
+
c[:session_store] = 'cookie'
|
17
|
+
end
|
18
|
+
|
19
|
+
### Merb doesn't come with database support by default. You need
|
20
|
+
### an ORM plugin. Install one, and uncomment one of the following lines,
|
21
|
+
### if you need a database.
|
22
|
+
|
23
|
+
### Uncomment for DataMapper ORM
|
24
|
+
<%= "# " unless default_orm?(:datamapper) %>use_orm :datamapper
|
25
|
+
|
26
|
+
### Uncomment for ActiveRecord ORM
|
27
|
+
<%= "# " unless default_orm?(:activerecord) %>use_orm :activerecord
|
28
|
+
|
29
|
+
### Uncomment for Sequel ORM
|
30
|
+
<%= "# " unless default_orm?(:sequel) %>use_orm :sequel
|
31
|
+
|
32
|
+
|
33
|
+
### This defines which test framework the generators will use
|
34
|
+
### rspec is turned on by default
|
35
|
+
###
|
36
|
+
### Note that you need to install the merb_rspec if you want to ue
|
37
|
+
### rspec and merb_test_unit if you want to use test_unit.
|
38
|
+
### merb_rspec is installed by default if you did gem install
|
39
|
+
### merb.
|
40
|
+
###
|
41
|
+
<%= "# " unless default_test_suite?(:test) %>use_test :test_unit
|
42
|
+
<%= "# " unless default_test_suite?(:spec) %>use_test :rspec
|
43
|
+
|
44
|
+
### Add your other dependencies here
|
45
|
+
|
46
|
+
# These are some examples of how you might specify dependencies.
|
47
|
+
#
|
48
|
+
# dependencies "RedCloth", "merb_helpers"
|
49
|
+
# OR
|
50
|
+
# dependency "RedCloth", "> 3.0"
|
51
|
+
# OR
|
52
|
+
# dependencies "RedCloth" => "> 3.0", "ruby-aes-cext" => "= 1.0"
|
53
|
+
|
54
|
+
Merb::BootLoader.after_app_loads do
|
55
|
+
### Add dependencies here that must load after the application loads:
|
56
|
+
|
57
|
+
# dependency "magic_admin" # this gem uses the app's model classes
|
58
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
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,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'merb-core'
|
3
|
+
require 'spec' # Satiates Autotest and anyone else not using the Rake tasks
|
4
|
+
|
5
|
+
Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')
|
6
|
+
|
7
|
+
Spec::Runner.configure do |config|
|
8
|
+
config.include(Merb::Test::ViewHelper)
|
9
|
+
config.include(Merb::Test::RouteHelper)
|
10
|
+
config.include(Merb::Test::ControllerHelper)
|
11
|
+
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,22 @@
|
|
1
|
+
require "merb-gen/helpers"
|
2
|
+
require "merb-gen/base"
|
3
|
+
|
4
|
+
class MerbFlatGenerator < Merb::GeneratorBase
|
5
|
+
|
6
|
+
def initialize(args, runtime_options = {})
|
7
|
+
@base = File.dirname(__FILE__)
|
8
|
+
@name = args.first
|
9
|
+
super
|
10
|
+
@destination_root = @name
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
def banner
|
15
|
+
<<-EOS.split("\n").map{|x| x.strip}.join("\n")
|
16
|
+
Creates a flat Merb application stub.
|
17
|
+
|
18
|
+
USAGE: #{spec.name} path --flat"
|
19
|
+
EOS
|
20
|
+
end
|
21
|
+
|
22
|
+
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,19 @@
|
|
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
|
+
<% require 'sha1' %>
|
8
|
+
Merb::Config.use { |c|
|
9
|
+
c[:environment] = 'production',
|
10
|
+
c[:framework] = {},
|
11
|
+
c[:log_level] = 'debug',
|
12
|
+
c[:use_mutex] = false,
|
13
|
+
c[:session_store] = 'cookie',
|
14
|
+
c[:session_id_key] = '_session_id',
|
15
|
+
c[:session_secret_key] = '<%= SHA1.new(rand(100000000000).to_s).to_s %>',
|
16
|
+
c[:exception_details] = true,
|
17
|
+
c[:reload_classes] = true,
|
18
|
+
c[:reload_time] = 0.5
|
19
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "merb-gen/helpers"
|
2
|
+
require "merb-gen/base"
|
3
|
+
|
4
|
+
class MerbPluginGenerator < Merb::GeneratorBase
|
5
|
+
|
6
|
+
def initialize(args, runtime_options = {})
|
7
|
+
@base = File.dirname(__FILE__)
|
8
|
+
@name = args.first
|
9
|
+
super
|
10
|
+
@destination_root = @name
|
11
|
+
end
|
12
|
+
|
13
|
+
protected
|
14
|
+
def banner
|
15
|
+
<<-EOS.split("\n").map{|x| x.strip}.join("\n")
|
16
|
+
Creates a Merb plugin stub.
|
17
|
+
|
18
|
+
USAGE: #{spec.name} --generate-plugin path"
|
19
|
+
EOS
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -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,44 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
|
4
|
+
PLUGIN = "<%= base_name %>"
|
5
|
+
NAME = "<%= base_name %>"
|
6
|
+
VERSION = "0.0.1"
|
7
|
+
AUTHOR = "Your Name"
|
8
|
+
EMAIL = "Your Email"
|
9
|
+
HOMEPAGE = "http://merb-plugins.rubyforge.org/<%= base_name %>/"
|
10
|
+
SUMMARY = "Merb plugin that provides ..."
|
11
|
+
|
12
|
+
spec = Gem::Specification.new do |s|
|
13
|
+
s.name = NAME
|
14
|
+
s.version = VERSION
|
15
|
+
s.platform = Gem::Platform::RUBY
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
18
|
+
s.summary = SUMMARY
|
19
|
+
s.description = s.summary
|
20
|
+
s.author = AUTHOR
|
21
|
+
s.email = EMAIL
|
22
|
+
s.homepage = HOMEPAGE
|
23
|
+
s.add_dependency('merb', '>= 0.4.0')
|
24
|
+
s.require_path = 'lib'
|
25
|
+
s.autorequire = PLUGIN
|
26
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
|
27
|
+
end
|
28
|
+
|
29
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
30
|
+
pkg.gem_spec = spec
|
31
|
+
end
|
32
|
+
|
33
|
+
task :install => [:package] do
|
34
|
+
sh %{sudo gem install pkg/#{NAME}-#{VERSION}}
|
35
|
+
end
|
36
|
+
|
37
|
+
namespace :jruby do
|
38
|
+
|
39
|
+
desc "Run :package and install the resulting .gem with jruby"
|
40
|
+
task :install => :package do
|
41
|
+
sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|