david-merb_resourceful 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_resourceful"
8
- GEM_VERSION = "0.0.1"
8
+ GEM_VERSION = "0.0.2"
9
9
  AUTHOR = "David Leal"
10
10
  EMAIL = "dgleal@gmail.com"
11
11
  HOMEPAGE = "http://github.com/david/merb_resourceful"
@@ -23,10 +23,9 @@ spec = Gem::Specification.new do |s|
23
23
  s.author = AUTHOR
24
24
  s.email = EMAIL
25
25
  s.homepage = HOMEPAGE
26
- s.add_dependency('merb', '>= 1.0')
26
+ s.add_dependency('merb', '~> 1.0')
27
27
  s.require_path = 'lib'
28
28
  s.files = %w(LICENSE README.textile Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
29
-
30
29
  end
31
30
 
32
31
  Rake::GemPackageTask.new(spec) do |pkg|
@@ -1,4 +1,7 @@
1
- require 'english/style_orm'
1
+ require 'rubygems'
2
+ gem 'merb-core'
3
+ gem 'extlib'
4
+
2
5
  require File.join(File.dirname(__FILE__), 'merb_resourceful/builder')
3
6
  require File.join(File.dirname(__FILE__), 'merb_resourceful/orms/datamapper_resource')
4
7
 
@@ -1,6 +1,6 @@
1
+ require 'extlib/inflection'
1
2
  require File.expand_path(File.join(File.dirname(__FILE__), 'controller'))
2
3
 
3
-
4
4
  module Merb
5
5
  module Plugins
6
6
  module Resourceful
@@ -10,10 +10,9 @@ module Merb
10
10
  def initialize(controller_class, options)
11
11
  @controller_class = controller_class
12
12
  @options = options
13
- @resource_class = @controller_class.name.demodulize.singularize
14
- @resource_plural = @controller_class.name.demodulize.underscore
13
+ @resource_class = Extlib::Inflection.singularize(Extlib::Inflection.demodulize(@controller_class.name))
14
+ @resource_plural = Extlib::Inflection.underscore(Extlib::Inflection.demodulize(@controller_class.name))
15
15
  @resource_name = @resource_plural.singularize
16
-
17
16
  end
18
17
 
19
18
  def build(&block)
@@ -111,7 +110,7 @@ module Merb
111
110
  if r.save
112
111
  resource_created(r)
113
112
  else
114
- message[:error] = "#{self.class::RESOURCE_NAME.humanize} failed to be created"
113
+ message[:error] = "#{Extlib::Inflection.humanize(self.class::RESOURCE_NAME)} failed to be created"
115
114
  render :new, render_options_for_create
116
115
  end
117
116
  end
@@ -155,7 +154,7 @@ module Merb
155
154
  if r.update(params[self.class::RESOURCE_NAME].merge!(resource_params_for_update))
156
155
  resource_updated(r)
157
156
  else
158
- message[:error] = "#{RESOURCE_NAME.humanize} failed to be updated"
157
+ message[:error] = "#{Extlib::Inflection.humanize(RESOURCE_NAME)} failed to be updated"
159
158
  render :edit, render_options_for_update
160
159
  end
161
160
  end
@@ -167,7 +166,7 @@ module Merb
167
166
  end
168
167
 
169
168
  def resource_updated_message(resrc)
170
- "#{self.class::RESOURCE_NAME.humanize} updated successfully."
169
+ "#{Extlib::Inflection.humanize(self.class::RESOURCE_NAME)} updated successfully."
171
170
  end
172
171
  end
173
172
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: david-merb_resourceful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Leal
@@ -17,7 +17,7 @@ dependencies:
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - ">="
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
22
  version: "1.0"
23
23
  version: