merb_datamapper 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
 
4
4
  PLUGIN = "merb_datamapper"
5
5
  NAME = "merb_datamapper"
6
- VERSION = "0.4.2"
6
+ VERSION = "0.4.3"
7
7
  AUTHOR = "Jason Toy"
8
8
  EMAIL = "jtoy@rubynow.com"
9
9
  HOMEPAGE = "http://merbivore.com"
@@ -21,7 +21,7 @@ spec = Gem::Specification.new do |s|
21
21
  s.email = EMAIL
22
22
  s.homepage = HOMEPAGE
23
23
  s.add_dependency('merb', '>= 0.4.0')
24
- s.add_dependency('datamapper')
24
+ s.add_dependency('datamapper', '>= 0.2.3')
25
25
  s.require_path = 'lib'
26
26
  s.autorequire = PLUGIN
27
27
  s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs,datamapper_generators}/**/*")
@@ -4,6 +4,7 @@ class ResourceControllerGenerator < Merb::GeneratorHelpers::ControllerGeneratorB
4
4
 
5
5
 
6
6
  def initialize(*args)
7
+ puts args.inspect
7
8
  runtime_options = args.last.is_a?(Hash) ? args.pop : {}
8
9
  name, *actions = args.flatten
9
10
  runtime_options[:actions] = %w[index show new edit]
@@ -4,23 +4,24 @@ class <%= class_name %> < Application
4
4
  provides :xml, :js, :yaml
5
5
 
6
6
  def index
7
- @<%= ivar %>s = <%= klass %>.all
8
- render @<%= ivar %>s
7
+ @<%= ivar.pluralize %> = <%= klass %>.all
8
+ render @<%= ivar.pluralize %>
9
9
  end
10
10
 
11
11
  def show(id)
12
12
  @<%= ivar %> = <%= klass %>[id]
13
+ raise BadRequest unless @<%= ivar %>
13
14
  render @<%= ivar %>
14
15
  end
15
16
 
16
- def new(<%= ivar %>)
17
+ def new
17
18
  only_provides :html
18
- @<%= ivar %> = <%= klass %>.new(<%= ivar %>)
19
+ @<%= ivar %> = <%= klass %>.new
19
20
  render @<%= ivar %>
20
21
  end
21
22
 
22
23
  def create(<%= ivar %>)
23
- @<%= ivar %> = <%= klass %>.new()
24
+ @<%= ivar %> = <%= klass %>.new(<%= ivar %>)
24
25
  if @<%= ivar %>.save
25
26
  redirect url(:<%= ivar %>, @<%= ivar %>)
26
27
  else
@@ -28,14 +29,16 @@ class <%= class_name %> < Application
28
29
  end
29
30
  end
30
31
 
31
- def edit
32
+ def edit(id)
32
33
  only_provides :html
33
- @<%= ivar %> = <%= klass %>.find(params[:id])
34
+ @<%= ivar %> = <%= klass %>[id]
35
+ raise BadRequest unless @<%= ivar %>
34
36
  render
35
37
  end
36
38
 
37
39
  def update(id, <%= ivar %>)
38
40
  @<%= ivar %> = <%= klass %>[id]
41
+ raise BadRequest unless @<%= ivar %>
39
42
  if @<%= ivar %>.update_attributes(<%= ivar %>)
40
43
  redirect url(:<%= ivar %>, @<%= ivar %>)
41
44
  else
@@ -45,8 +48,9 @@ class <%= class_name %> < Application
45
48
 
46
49
  def destroy(id)
47
50
  @<%= ivar %> = <%= klass %>[id]
51
+ raise BadRequest unless @<%= ivar %>
48
52
  if @<%= ivar %>.destroy!
49
- redirect url(:<%= ivar %>s)
53
+ redirect url(:<%= ivar.pluralize %>)
50
54
  else
51
55
  raise BadRequest
52
56
  end
@@ -1,5 +1,5 @@
1
1
  module Merb
2
- module <%= class_name %>Helper
2
+ module <%= class_name.pluralize %>Helper
3
3
 
4
4
  end
5
5
  end
@@ -2,9 +2,9 @@ require 'fileutils'
2
2
 
3
3
  namespace :dm do
4
4
  namespace :db do
5
- desc "Perform migration using migrations in schema/migrations"
6
- task :migrate => :merb_env do
7
- #Sequel::Migrator.apply(Merb::Orms::Sequel.connect, "schema/migrations", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
5
+ desc "Perform automigration"
6
+ task :automigrate => :merb_env do
7
+ DataMapper::Base.auto_migrate!
8
8
  end
9
9
  end
10
10
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: merb_datamapper
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.2
7
- date: 2007-11-06 00:00:00 -06:00
6
+ version: 0.4.3
7
+ date: 2007-11-08 00:00:00 -06:00
8
8
  summary: Merb plugin that provides DataMapper support for Merb
9
9
  require_paths:
10
10
  - lib
@@ -95,7 +95,7 @@ dependencies:
95
95
  version_requirement:
96
96
  version_requirements: !ruby/object:Gem::Version::Requirement
97
97
  requirements:
98
- - - ">"
98
+ - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 0.0.0
100
+ version: 0.2.3
101
101
  version: