hammock 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/hammock.gemspec +2 -2
- data/lib/hammock/callbacks.rb +0 -1
- data/lib/hammock/constants.rb +2 -2
- data/lib/hammock/monkey_patches/module.rb +0 -1
- data/lib/hammock/resource_mapping_hooks.rb +1 -0
- data/lib/hammock/restful_support.rb +2 -0
- data/lib/hammock/route_drawing_hooks.rb +1 -0
- data/lib/hammock.rb +29 -22
- data/misc/template.rb +1 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.3.7 2009-06-05
|
2
|
+
Rewrote hammock loading code to use nestable dependencies instead of the LoadFirst constant.
|
3
|
+
Replaced Hammock::Aliases with the Hammock:LambdaAlias component.
|
4
|
+
|
5
|
+
|
1
6
|
== 0.3.6 2009-06-04
|
2
7
|
Call initialize_for_load after requiring components, so Hammock::Aliases is defined.
|
3
8
|
Replaced MixInto reference with more appropriate base reference in Hammock::ActiveRecord.included.
|
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.
|
5
|
+
s.version = "0.3.7"
|
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-
|
9
|
+
s.date = %q{2009-06-05}
|
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
|
|
data/lib/hammock/callbacks.rb
CHANGED
data/lib/hammock/constants.rb
CHANGED
@@ -2,9 +2,9 @@ module Hammock
|
|
2
2
|
PleaseFileABug = "Ack, that shouldn't have happened. Please email the full stacktrace to <ben@hoskings.net>, so the problem you uncovered can be addressed. Thanks!"
|
3
3
|
|
4
4
|
module Constants
|
5
|
-
|
5
|
+
|
6
6
|
ImpliedVerbs = [:index, :create, :show, :update, :destroy]
|
7
7
|
ImpliedUnsafeActions = [:new, :edit, :destroy]
|
8
|
-
|
8
|
+
|
9
9
|
end
|
10
10
|
end
|
data/lib/hammock.rb
CHANGED
@@ -4,11 +4,12 @@ require 'ambition'
|
|
4
4
|
require 'ambition/adapters/active_record'
|
5
5
|
|
6
6
|
module Hammock
|
7
|
-
VERSION = '0.3.
|
7
|
+
VERSION = '0.3.7'
|
8
|
+
IncludeTarget = ActionController::Base
|
8
9
|
|
9
10
|
def self.included base # :nodoc:
|
10
|
-
puts "Loading Hammock from #{loaded_from_gem? ? 'gem' : 'plugin'}"
|
11
|
-
load_hammock_components
|
11
|
+
puts "Loading Hammock #{Hammock::VERSION} from #{loaded_from_gem? ? 'gem' : 'plugin'}"
|
12
|
+
load_hammock_components
|
12
13
|
end
|
13
14
|
|
14
15
|
def self.loaded_from_gem?
|
@@ -32,14 +33,9 @@ module Hammock
|
|
32
33
|
|
33
34
|
private
|
34
35
|
|
35
|
-
def self.
|
36
|
-
Hammock::Aliases.alias_lambda
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.load_hammock_components base
|
36
|
+
def self.load_hammock_components
|
40
37
|
require_hammock_components
|
41
|
-
|
42
|
-
mixin_hammock_components base
|
38
|
+
mixin_hammock_components
|
43
39
|
end
|
44
40
|
|
45
41
|
def self.require_hammock_components
|
@@ -48,20 +44,31 @@ module Hammock
|
|
48
44
|
}
|
49
45
|
end
|
50
46
|
|
51
|
-
def self.mixin_hammock_components
|
52
|
-
Hammock.constants.
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
47
|
+
def self.mixin_hammock_components
|
48
|
+
Hammock.constants.each &method(:mixin_hammock_component)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.mixin_hammock_component mod
|
52
|
+
(get_constant_from(mod, :Deps) || []).each &method(:mixin_hammock_component)
|
53
|
+
do_module_mixin module_for mod
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.do_module_mixin mod
|
57
|
+
(get_constant_from(mod, :MixInto) || IncludeTarget).send :include, mod unless mod.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.module_for obj
|
61
|
+
const = obj.is_a?(Module) ? obj : const_get(obj)
|
62
|
+
const if const.is_a?(Module) && !const.is_a?(Class)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.get_constant_from module_name, constant_name
|
66
|
+
unless (mod = module_for module_name).nil?
|
67
|
+
mod.const_get constant_name.to_s if mod.constants.include?(constant_name.to_s)
|
68
|
+
end
|
62
69
|
end
|
63
70
|
|
64
71
|
end
|
65
72
|
|
66
73
|
# This is done in init.rb when Hammock is loaded as a plugin.
|
67
|
-
|
74
|
+
Hammock::IncludeTarget.send :include, Hammock if Hammock.loaded_from_gem?
|
data/misc/template.rb
CHANGED
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.
|
4
|
+
version: 0.3.7
|
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-
|
12
|
+
date: 2009-06-05 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|