benhoskings-hammock 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/LICENSE +24 -0
  2. data/Manifest.txt +42 -0
  3. data/README.rdoc +105 -0
  4. data/Rakefile +27 -0
  5. data/lib/hammock.rb +25 -0
  6. data/lib/hammock/ajaxinate.rb +152 -0
  7. data/lib/hammock/callbacks.rb +107 -0
  8. data/lib/hammock/canned_scopes.rb +121 -0
  9. data/lib/hammock/constants.rb +7 -0
  10. data/lib/hammock/controller_attributes.rb +66 -0
  11. data/lib/hammock/export_scope.rb +74 -0
  12. data/lib/hammock/hamlink_to.rb +47 -0
  13. data/lib/hammock/javascript_buffer.rb +63 -0
  14. data/lib/hammock/logging.rb +98 -0
  15. data/lib/hammock/model_attributes.rb +38 -0
  16. data/lib/hammock/model_logging.rb +30 -0
  17. data/lib/hammock/monkey_patches/action_pack.rb +32 -0
  18. data/lib/hammock/monkey_patches/active_record.rb +227 -0
  19. data/lib/hammock/monkey_patches/array.rb +73 -0
  20. data/lib/hammock/monkey_patches/hash.rb +49 -0
  21. data/lib/hammock/monkey_patches/logger.rb +28 -0
  22. data/lib/hammock/monkey_patches/module.rb +27 -0
  23. data/lib/hammock/monkey_patches/numeric.rb +25 -0
  24. data/lib/hammock/monkey_patches/object.rb +61 -0
  25. data/lib/hammock/monkey_patches/route_set.rb +200 -0
  26. data/lib/hammock/monkey_patches/string.rb +197 -0
  27. data/lib/hammock/overrides.rb +32 -0
  28. data/lib/hammock/resource_mapping_hooks.rb +28 -0
  29. data/lib/hammock/resource_retrieval.rb +115 -0
  30. data/lib/hammock/restful_actions.rb +170 -0
  31. data/lib/hammock/restful_rendering.rb +114 -0
  32. data/lib/hammock/restful_support.rb +167 -0
  33. data/lib/hammock/route_drawing_hooks.rb +22 -0
  34. data/lib/hammock/route_for.rb +58 -0
  35. data/lib/hammock/scope.rb +120 -0
  36. data/lib/hammock/suggest.rb +36 -0
  37. data/lib/hammock/utils.rb +42 -0
  38. data/misc/scaffold.txt +83 -0
  39. data/misc/template.rb +17 -0
  40. data/tasks/hammock_tasks.rake +5 -0
  41. data/test/hammock_test.rb +8 -0
  42. metadata +129 -0
data/misc/scaffold.txt ADDED
@@ -0,0 +1,83 @@
1
+ # GET /copies
2
+ # GET /copies.xml
3
+ def index
4
+ @copies = Copy.find(:all)
5
+
6
+ respond_to do |format|
7
+ format.html # index.html.erb
8
+ format.xml { render :xml => @copies }
9
+ end
10
+ end
11
+
12
+ # GET /copies/1
13
+ # GET /copies/1.xml
14
+ def show
15
+ @copy = Copy.find(params[:id])
16
+
17
+ respond_to do |format|
18
+ format.html # show.html.erb
19
+ format.xml { render :xml => @copy }
20
+ end
21
+ end
22
+
23
+ # GET /copies/new
24
+ # GET /copies/new.xml
25
+ def new
26
+ @copy = Copy.new
27
+
28
+ respond_to do |format|
29
+ format.html # new.html.erb
30
+ format.xml { render :xml => @copy }
31
+ end
32
+ end
33
+
34
+ # GET /copies/1/edit
35
+ def edit
36
+ @copy = Copy.find(params[:id])
37
+ end
38
+
39
+ # POST /copies
40
+ # POST /copies.xml
41
+ def create
42
+ @copy = Copy.new(params[:copy])
43
+
44
+ respond_to do |format|
45
+ if @copy.save
46
+ flash[:notice] = 'Copy was successfully created.'
47
+ format.html { redirect_to(@copy) }
48
+ format.xml { render :xml => @copy, :status => :created, :location => @copy }
49
+ else
50
+ format.html { render :action => "new" }
51
+ format.xml { render :xml => @copy.errors, :status => :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /copies/1
57
+ # PUT /copies/1.xml
58
+ def update
59
+ @copy = Copy.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @copy.update_attributes(params[:copy])
63
+ flash[:notice] = 'Copy was successfully updated.'
64
+ format.html { redirect_to(@copy) }
65
+ format.xml { head :ok }
66
+ else
67
+ format.html { render :action => "edit" }
68
+ format.xml { render :xml => @copy.errors, :status => :unprocessable_entity }
69
+ end
70
+ end
71
+ end
72
+
73
+ # DELETE /copies/1
74
+ # DELETE /copies/1.xml
75
+ def destroy
76
+ @copy = Copy.find(params[:id])
77
+ @copy.destroy
78
+
79
+ respond_to do |format|
80
+ format.html { redirect_to(copies_url) }
81
+ format.xml { head :ok }
82
+ end
83
+ end
data/misc/template.rb ADDED
@@ -0,0 +1,17 @@
1
+ module Hammock
2
+ module Lol
3
+ MixInto = Lol::Lul
4
+ # LoadFirst = false
5
+
6
+ def self.included base # :nodoc:
7
+ base.send :include, InstanceMethods
8
+ base.send :extend, ClassMethods
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ module InstanceMethods
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ desc "Regenerate the Manifest from the working tree"
2
+ task :git_to_manifest do
3
+ cmd = %Q(git ls-files -x '.*' > Manifest.txt)
4
+ `#{cmd}`; $? == 0
5
+ end
@@ -0,0 +1,8 @@
1
+ require 'test/unit'
2
+
3
+ class HammockTest < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_this_plugin
6
+ flunk
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: benhoskings-hammock
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
+ platform: ruby
6
+ authors:
7
+ - Ben Hoskings
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-26 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: benhoskings-ambitious-activerecord
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.3.4
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: newgem
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.3
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.8.0
44
+ version:
45
+ description: "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. Hammock enforces RESTful resource access by abstracting actions away from the controller in favour of a clean, model-like callback system. Hammock tackles the hard and soft sides of security at once with a scoping security system on your models. Specify who can verb what resources under what conditions once, and everything else - the actual security, link generation, index filtering - just happens. Hammock inspects your routes and resources to generate a routing tree for each resource. Parent resources in a nested route are handled transparently at every point - record retrieval, creation, and linking. It makes more sense when you see how it works though, so check out the screencast!"
46
+ email:
47
+ - ben@hoskings.net
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - Manifest.txt
54
+ - README.rdoc
55
+ - misc/scaffold.txt
56
+ files:
57
+ - LICENSE
58
+ - Manifest.txt
59
+ - README.rdoc
60
+ - Rakefile
61
+ - lib/hammock.rb
62
+ - lib/hammock/ajaxinate.rb
63
+ - lib/hammock/callbacks.rb
64
+ - lib/hammock/canned_scopes.rb
65
+ - lib/hammock/constants.rb
66
+ - lib/hammock/controller_attributes.rb
67
+ - lib/hammock/export_scope.rb
68
+ - lib/hammock/hamlink_to.rb
69
+ - lib/hammock/javascript_buffer.rb
70
+ - lib/hammock/logging.rb
71
+ - lib/hammock/model_attributes.rb
72
+ - lib/hammock/model_logging.rb
73
+ - lib/hammock/monkey_patches/action_pack.rb
74
+ - lib/hammock/monkey_patches/active_record.rb
75
+ - lib/hammock/monkey_patches/array.rb
76
+ - lib/hammock/monkey_patches/hash.rb
77
+ - lib/hammock/monkey_patches/logger.rb
78
+ - lib/hammock/monkey_patches/module.rb
79
+ - lib/hammock/monkey_patches/numeric.rb
80
+ - lib/hammock/monkey_patches/object.rb
81
+ - lib/hammock/monkey_patches/route_set.rb
82
+ - lib/hammock/monkey_patches/string.rb
83
+ - lib/hammock/overrides.rb
84
+ - lib/hammock/resource_mapping_hooks.rb
85
+ - lib/hammock/resource_retrieval.rb
86
+ - lib/hammock/restful_actions.rb
87
+ - lib/hammock/restful_rendering.rb
88
+ - lib/hammock/restful_support.rb
89
+ - lib/hammock/route_drawing_hooks.rb
90
+ - lib/hammock/route_for.rb
91
+ - lib/hammock/scope.rb
92
+ - lib/hammock/suggest.rb
93
+ - lib/hammock/utils.rb
94
+ - misc/scaffold.txt
95
+ - misc/template.rb
96
+ - tasks/hammock_tasks.rake
97
+ - test/hammock_test.rb
98
+ - test/test_hammock.rb
99
+ - test/test_helper.rb
100
+ has_rdoc: true
101
+ homepage: http://github.com/benhoskings/hammock
102
+ post_install_message:
103
+ rdoc_options:
104
+ - --main
105
+ - README.rdoc
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
113
+ version:
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
119
+ version:
120
+ requirements: []
121
+
122
+ rubyforge_project: hammock
123
+ rubygems_version: 1.2.0
124
+ signing_key:
125
+ specification_version: 2
126
+ summary: Hammock is a Rails plugin that eliminates redundant code in a very RESTful manner
127
+ test_files:
128
+ - test/test_hammock.rb
129
+ - test/test_helper.rb