hammock 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.3.9 2009-06-18
2
+ Improved logging in find_record_on_create.
3
+ Enabled :indicate_current support in #hamlink_to, using RouteStep#matches?.
4
+ Added RouteStep#matches?, to check if the receiving RouteStep represents the given request.
5
+
6
+
1
7
  == 0.3.8 2009-06-05
2
8
  Added LambdaAlias dep to RouteDrawingHooks, for Hammock.load_models.
3
9
  Added LambdaComposition component.
data/hammock.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hammock}
5
- s.version = "0.3.8"
5
+ s.version = "0.3.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Hoskings"]
9
- s.date = %q{2009-06-05}
9
+ s.date = %q{2009-06-18}
10
10
  s.description = %q{Hammock is a Rails plugin that eliminates redundant code in a very RESTful manner. It does this in lots in lots of different places, but in one manner: it encourages specification in place of implementation.
11
11
 
12
12
 
@@ -19,7 +19,7 @@ Hammock inspects your routes and resources to generate a routing tree for each r
19
19
  It makes more sense when you see how it works though. There's a screencast coming soon.}
20
20
  s.email = ["ben@hoskings.net"]
21
21
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc", "misc/scaffold.txt"]
22
- s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "hammock.gemspec", "lib/hammock.rb", "lib/hammock/ajaxinate.rb", "lib/hammock/callback.rb", "lib/hammock/callbacks.rb", "lib/hammock/canned_scopes.rb", "lib/hammock/constants.rb", "lib/hammock/controller_attributes.rb", "lib/hammock/export_scope.rb", "lib/hammock/hamlink_to.rb", "lib/hammock/javascript_buffer.rb", "lib/hammock/logging.rb", "lib/hammock/model_attributes.rb", "lib/hammock/model_logging.rb", "lib/hammock/monkey_patches/action_pack.rb", "lib/hammock/monkey_patches/active_record.rb", "lib/hammock/monkey_patches/array.rb", "lib/hammock/monkey_patches/hash.rb", "lib/hammock/monkey_patches/logger.rb", "lib/hammock/monkey_patches/module.rb", "lib/hammock/monkey_patches/numeric.rb", "lib/hammock/monkey_patches/object.rb", "lib/hammock/monkey_patches/route_set.rb", "lib/hammock/monkey_patches/string.rb", "lib/hammock/overrides.rb", "lib/hammock/resource_mapping_hooks.rb", "lib/hammock/resource_retrieval.rb", "lib/hammock/restful_actions.rb", "lib/hammock/restful_rendering.rb", "lib/hammock/restful_support.rb", "lib/hammock/route_drawing_hooks.rb", "lib/hammock/route_for.rb", "lib/hammock/route_node.rb", "lib/hammock/route_step.rb", "lib/hammock/scope.rb", "lib/hammock/suggest.rb", "lib/hammock/utils.rb", "misc/scaffold.txt", "misc/template.rb", "tasks/hammock_tasks.rake", "test/hammock_test.rb"]
22
+ s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "hammock.gemspec", "init.rb", "lib/hammock.rb", "lib/hammock/ajaxinate.rb", "lib/hammock/callback.rb", "lib/hammock/callbacks.rb", "lib/hammock/canned_scopes.rb", "lib/hammock/constants.rb", "lib/hammock/controller_attributes.rb", "lib/hammock/export_scope.rb", "lib/hammock/hamlink_to.rb", "lib/hammock/javascript_buffer.rb", "lib/hammock/lambda_alias.rb", "lib/hammock/lambda_composition.rb", "lib/hammock/logging.rb", "lib/hammock/model_attributes.rb", "lib/hammock/model_logging.rb", "lib/hammock/monkey_patches/action_pack.rb", "lib/hammock/monkey_patches/active_record.rb", "lib/hammock/monkey_patches/array.rb", "lib/hammock/monkey_patches/hash.rb", "lib/hammock/monkey_patches/logger.rb", "lib/hammock/monkey_patches/module.rb", "lib/hammock/monkey_patches/numeric.rb", "lib/hammock/monkey_patches/object.rb", "lib/hammock/monkey_patches/route_set.rb", "lib/hammock/monkey_patches/string.rb", "lib/hammock/mutex.rb", "lib/hammock/overrides.rb", "lib/hammock/resource_mapping_hooks.rb", "lib/hammock/resource_retrieval.rb", "lib/hammock/restful_actions.rb", "lib/hammock/restful_rendering.rb", "lib/hammock/restful_support.rb", "lib/hammock/route_drawing_hooks.rb", "lib/hammock/route_for.rb", "lib/hammock/route_node.rb", "lib/hammock/route_step.rb", "lib/hammock/scope.rb", "lib/hammock/suggest.rb", "lib/hammock/utils.rb", "misc/scaffold.txt", "misc/template.rb", "tasks/hammock_tasks.rake", "test/hammock_test.rb"]
23
23
  s.homepage = %q{http://github.com/benhoskings/hammock}
24
24
  s.rdoc_options = ["--main", "README.rdoc"]
25
25
  s.require_paths = ["lib"]
@@ -34,18 +34,18 @@ It makes more sense when you see how it works though. There's a screencast comin
34
34
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
35
35
  s.add_runtime_dependency(%q<rails>, ["~> 2.2"])
36
36
  s.add_runtime_dependency(%q<benhoskings-ambitious-activerecord>, ["~> 0.1.3.7"])
37
- s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
37
+ s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
38
38
  s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
39
39
  else
40
40
  s.add_dependency(%q<rails>, ["~> 2.2"])
41
41
  s.add_dependency(%q<benhoskings-ambitious-activerecord>, ["~> 0.1.3.7"])
42
- s.add_dependency(%q<newgem>, [">= 1.3.0"])
42
+ s.add_dependency(%q<newgem>, [">= 1.4.1"])
43
43
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
44
44
  end
45
45
  else
46
46
  s.add_dependency(%q<rails>, ["~> 2.2"])
47
47
  s.add_dependency(%q<benhoskings-ambitious-activerecord>, ["~> 0.1.3.7"])
48
- s.add_dependency(%q<newgem>, [">= 1.3.0"])
48
+ s.add_dependency(%q<newgem>, [">= 1.4.1"])
49
49
  s.add_dependency(%q<hoe>, [">= 1.8.0"])
50
50
  end
51
51
  end
@@ -24,7 +24,7 @@ module Hammock
24
24
  if can_verb_entity?(verb, entity)
25
25
  route = route_for *args.push(opts.dragnet(:nest, :format))
26
26
 
27
- # opts[:class] = ['current', opts[:class]].squash.join(' ') if opts[:indicate_current] && (route == controller.current_route)
27
+ opts[:class] = ['current', opts[:class]].squash.join(' ') if opts[:indicate_current] && route.matches?(request)
28
28
  opts[:class] = [link_class_for(route.verb, entity), opts[:class]].squash.join(' ')
29
29
 
30
30
  text = opts.delete(:text) || opts.delete(:text_or_else)
@@ -130,10 +130,10 @@ module Hammock
130
130
  def find_record_on_create
131
131
  if findable_on_create?
132
132
  if record = mdl.ambition_context.within(current_nest_scope).find(:first, :conditions => params_for(mdl.symbolize))
133
- log "suitable record already exists: #{record}"
133
+ log "Suitable #{record.class}<#{record.id}> already exists."
134
134
  assign_entity record
135
135
  else
136
- log "couldn't find a suitable record, proceeding with creation."
136
+ log "Couldn't find a suitable #{mdl}, proceeding with creation."
137
137
  end
138
138
  end
139
139
  end
@@ -31,6 +31,11 @@ module Hammock
31
31
  !@entity.nil?
32
32
  end
33
33
 
34
+ def matches? request
35
+ (path == request.path) &&
36
+ (http_method == request.method)
37
+ end
38
+
34
39
  def path params = nil
35
40
  raise_unless_setup_while_trying_to 'render a path'
36
41
 
data/lib/hammock.rb CHANGED
@@ -4,7 +4,7 @@ require 'ambition'
4
4
  require 'ambition/adapters/active_record'
5
5
 
6
6
  module Hammock
7
- VERSION = '0.3.8'
7
+ VERSION = '0.3.9'
8
8
  IncludeTarget = ActionController::Base
9
9
 
10
10
  def self.included base # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hoskings
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-05 00:00:00 +10:00
12
+ date: 2009-06-18 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.3.0
43
+ version: 1.4.1
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: hoe