merb_sequel 0.0.4 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -1
- data/Rakefile +8 -3
- data/sequel_generators/migration/USAGE +5 -0
- data/sequel_generators/migration/migration_generator.rb +14 -0
- data/sequel_generators/migration/templates/new_migration.erb +17 -0
- data/sequel_generators/model/USAGE +0 -0
- data/sequel_generators/model/model_generator.rb +16 -0
- data/sequel_generators/model/templates/sequel_model_template.erb +2 -0
- data/sequel_generators/resource_controller/USAGE +0 -0
- data/sequel_generators/resource_controller/resource_controller_generator.rb +26 -0
- data/sequel_generators/resource_controller/templates/controller.rb +54 -0
- data/sequel_generators/resource_controller/templates/edit.html.erb +1 -0
- data/sequel_generators/resource_controller/templates/helper.rb +5 -0
- data/sequel_generators/resource_controller/templates/index.html.erb +1 -0
- data/sequel_generators/resource_controller/templates/new.html.erb +1 -0
- data/sequel_generators/resource_controller/templates/show.html.erb +1 -0
- metadata +37 -9
data/README
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
merb_sequel
|
2
2
|
=================
|
3
3
|
|
4
|
-
A plugin for the Merb framework that provides
|
4
|
+
A plugin for the Merb framework that provides Sequel access
|
5
|
+
|
6
|
+
After you install the plugin, you have access to the sequel_migration generator in your merb projects
|
7
|
+
example: /merb/root/script/generate sequel_migration new_migration
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
|
|
3
3
|
|
4
4
|
PLUGIN = "merb_sequel"
|
5
5
|
NAME = "merb_sequel"
|
6
|
-
VERSION = "0.0
|
6
|
+
VERSION = "0.4.0"
|
7
7
|
AUTHOR = "Duane Johnson"
|
8
8
|
EMAIL = "canadaduane@gmail.com"
|
9
9
|
HOMEPAGE = "http://merb-plugins.rubyforge.org/merb_sequel/"
|
@@ -20,12 +20,17 @@ spec = Gem::Specification.new do |s|
|
|
20
20
|
s.author = AUTHOR
|
21
21
|
s.email = EMAIL
|
22
22
|
s.homepage = HOMEPAGE
|
23
|
-
s.
|
23
|
+
s.add_dependency('merb', '>= 0.4.0')
|
24
24
|
s.require_path = 'lib'
|
25
25
|
s.autorequire = PLUGIN
|
26
|
-
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
|
26
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs,sequel_generators}/**/*")
|
27
27
|
end
|
28
28
|
|
29
29
|
Rake::GemPackageTask.new(spec) do |pkg|
|
30
30
|
pkg.gem_spec = spec
|
31
|
+
end
|
32
|
+
|
33
|
+
task :install do
|
34
|
+
sh %{rake package}
|
35
|
+
sh %{sudo gem install pkg/#{NAME}-#{VERSION}}
|
31
36
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'merb/generators/merb_generator_helpers'
|
2
|
+
|
3
|
+
class MigrationGenerator < Merb::GeneratorHelpers::MigrationGeneratorBase
|
4
|
+
|
5
|
+
def initialize( *args )
|
6
|
+
super( *args )
|
7
|
+
@migration_template_name = "new_migration.erb"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.superclass
|
11
|
+
RubiGen::Base
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class <%= class_name.snake_case.camel_case %> < Sequel::Migration
|
2
|
+
def up
|
3
|
+
<%= "create_table :#{table_name} do" if table_name %>
|
4
|
+
<% for attribute in table_attributes -%>
|
5
|
+
<%= attribute.type %> :<%= attribute.name %>
|
6
|
+
<% end -%>
|
7
|
+
<%= "end" if table_name %>
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
<% if table_name -%>
|
12
|
+
execute 'DROP TABLE <%= table_name %>'
|
13
|
+
<% end -%>
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'merb/generators/merb_generator_helpers'
|
2
|
+
|
3
|
+
class ModelGenerator < Merb::GeneratorHelpers::ModelGeneratorBase
|
4
|
+
|
5
|
+
def initialize( *args )
|
6
|
+
super( *args )
|
7
|
+
@model_template_name = "sequel_model_template.erb"
|
8
|
+
@migration_generator_name = "migration"
|
9
|
+
@model_test_generator_name = "merb_model_test"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.superclass
|
13
|
+
RubiGen::Base
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'merb/generators/merb_generator_helpers'
|
2
|
+
|
3
|
+
class ResourceControllerGenerator < Merb::GeneratorHelpers::ControllerGeneratorBase
|
4
|
+
|
5
|
+
def initialize(*args)
|
6
|
+
runtime_options = args.last.is_a?(Hash) ? args.pop : {}
|
7
|
+
name, *actions = args.flatten
|
8
|
+
runtime_options[:actions] = %w[index show new edit]
|
9
|
+
runtime_options[:test_stub_generator] = "merb_controller_test"
|
10
|
+
super( [name], runtime_options )
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.superclass
|
14
|
+
RubiGen::Base
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
def banner
|
19
|
+
<<-EOS
|
20
|
+
Creates a Merb controller, views and specs using Sequel Models
|
21
|
+
|
22
|
+
USAGE: #{$0} #{spec.name} resource_name"
|
23
|
+
EOS
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<% klass = class_name.singularize -%>
|
2
|
+
<% ivar = class_name.snake_case.singularize -%>
|
3
|
+
class <%= class_name %> < Application
|
4
|
+
provides :xml, :js, :yaml
|
5
|
+
|
6
|
+
def index
|
7
|
+
@<%= ivar %>s = <%= klass %>.all
|
8
|
+
render @<%= ivar %>s
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@<%= ivar %> = <%= klass %>[:id => params[:id]]
|
13
|
+
render @<%= ivar %>
|
14
|
+
end
|
15
|
+
|
16
|
+
def new
|
17
|
+
only_provides :html
|
18
|
+
@<%= ivar %> = <%= klass %>.new(params[:<%= ivar %>])
|
19
|
+
render
|
20
|
+
end
|
21
|
+
|
22
|
+
def create
|
23
|
+
@<%= ivar %> = <%= klass %>.new(params[:<%= ivar %>])
|
24
|
+
if @<%= ivar %>.save
|
25
|
+
redirect url(:<%= ivar %>, @<%= ivar %>)
|
26
|
+
else
|
27
|
+
render :action => :new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def edit
|
32
|
+
only_provides :html
|
33
|
+
@<%= ivar %> = <%= klass %>[:id => params[:id]]
|
34
|
+
render
|
35
|
+
end
|
36
|
+
|
37
|
+
def update
|
38
|
+
@<%= ivar %> = <%= klass %>[:id => params[:id]]
|
39
|
+
if @<%= ivar %>.update(params[:<%= ivar %>])
|
40
|
+
redirect url(:<%= ivar %>, @<%= ivar %>)
|
41
|
+
else
|
42
|
+
raise BadRequest
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def destroy
|
47
|
+
@<%= ivar %> = <%= klass %>[:id => params[:id]]
|
48
|
+
if @<%= ivar %>.destroy
|
49
|
+
redirect url(:<%= ivar %>s)
|
50
|
+
else
|
51
|
+
raise BadRequest
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Edit for <%= class_name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Index for <%= class_name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
New for <%= class_name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Show for <%= class_name %>
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: merb_sequel
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date: 2007-
|
6
|
+
version: 0.4.0
|
7
|
+
date: 2007-11-05 00:00:00 -08:00
|
8
8
|
summary: Merb plugin that provides support for the Sequel database object
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,17 +34,37 @@ files:
|
|
34
34
|
- Rakefile
|
35
35
|
- TODO
|
36
36
|
- lib/merb
|
37
|
-
- lib/merb_sequel.rb
|
38
|
-
- lib/merbtasks.rb
|
39
37
|
- lib/merb/orms
|
40
|
-
- lib/merb/session
|
41
38
|
- lib/merb/orms/sequel
|
42
39
|
- lib/merb/orms/sequel/connection.rb
|
43
40
|
- lib/merb/orms/sequel/database.sample.yml
|
41
|
+
- lib/merb/session
|
44
42
|
- lib/merb/session/001_add_sessions_table.rb
|
45
43
|
- lib/merb/session/sequel_session.rb
|
44
|
+
- lib/merb_sequel.rb
|
45
|
+
- lib/merbtasks.rb
|
46
46
|
- specs/merb_sequel_spec.rb
|
47
47
|
- specs/spec_helper.rb
|
48
|
+
- sequel_generators/migration
|
49
|
+
- sequel_generators/migration/migration_generator.rb
|
50
|
+
- sequel_generators/migration/templates
|
51
|
+
- sequel_generators/migration/templates/new_migration.erb
|
52
|
+
- sequel_generators/migration/USAGE
|
53
|
+
- sequel_generators/model
|
54
|
+
- sequel_generators/model/model_generator.rb
|
55
|
+
- sequel_generators/model/templates
|
56
|
+
- sequel_generators/model/templates/sequel_model_template.erb
|
57
|
+
- sequel_generators/model/USAGE
|
58
|
+
- sequel_generators/resource_controller
|
59
|
+
- sequel_generators/resource_controller/resource_controller_generator.rb
|
60
|
+
- sequel_generators/resource_controller/templates
|
61
|
+
- sequel_generators/resource_controller/templates/controller.rb
|
62
|
+
- sequel_generators/resource_controller/templates/edit.html.erb
|
63
|
+
- sequel_generators/resource_controller/templates/helper.rb
|
64
|
+
- sequel_generators/resource_controller/templates/index.html.erb
|
65
|
+
- sequel_generators/resource_controller/templates/new.html.erb
|
66
|
+
- sequel_generators/resource_controller/templates/show.html.erb
|
67
|
+
- sequel_generators/resource_controller/USAGE
|
48
68
|
test_files: []
|
49
69
|
|
50
70
|
rdoc_options: []
|
@@ -57,7 +77,15 @@ executables: []
|
|
57
77
|
|
58
78
|
extensions: []
|
59
79
|
|
60
|
-
requirements:
|
61
|
-
- merb
|
62
|
-
dependencies: []
|
80
|
+
requirements: []
|
63
81
|
|
82
|
+
dependencies:
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: merb
|
85
|
+
version_requirement:
|
86
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.4.0
|
91
|
+
version:
|