ao_crudify 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE.md +21 -0
  4. data/README.md +93 -0
  5. data/Rakefile +11 -0
  6. data/ao_crudify.gemspec +26 -0
  7. data/config/locales/en.yml +8 -0
  8. data/config/locales/zh-cn.yml +8 -0
  9. data/lib/ao_crudify.rb +20 -0
  10. data/lib/ao_crudify/base.rb +43 -0
  11. data/lib/ao_crudify/class_methods.rb +137 -0
  12. data/lib/ao_crudify/hook_methods.rb +117 -0
  13. data/lib/ao_crudify/version.rb +3 -0
  14. data/spec/controllers/controller_hooks_spec.rb +1 -0
  15. data/spec/controllers/jellies_controller_spec.rb +156 -0
  16. data/spec/dummy-2-3-12/README +243 -0
  17. data/spec/dummy-2-3-12/Rakefile +10 -0
  18. data/spec/dummy-2-3-12/app/controllers/application_controller.rb +10 -0
  19. data/spec/dummy-2-3-12/app/controllers/jellies_controller.rb +6 -0
  20. data/spec/dummy-2-3-12/app/helpers/application_helper.rb +3 -0
  21. data/spec/dummy-2-3-12/app/models/jelly.rb +13 -0
  22. data/spec/dummy-2-3-12/config/boot.rb +114 -0
  23. data/spec/dummy-2-3-12/config/database.yml +22 -0
  24. data/spec/dummy-2-3-12/config/environment.rb +50 -0
  25. data/spec/dummy-2-3-12/config/environments/development.rb +17 -0
  26. data/spec/dummy-2-3-12/config/environments/production.rb +28 -0
  27. data/spec/dummy-2-3-12/config/environments/test.rb +28 -0
  28. data/spec/dummy-2-3-12/config/initializers/backtrace_silencers.rb +7 -0
  29. data/spec/dummy-2-3-12/config/initializers/cookie_verification_secret.rb +7 -0
  30. data/spec/dummy-2-3-12/config/initializers/inflections.rb +10 -0
  31. data/spec/dummy-2-3-12/config/initializers/mime_types.rb +5 -0
  32. data/spec/dummy-2-3-12/config/initializers/new_rails_defaults.rb +21 -0
  33. data/spec/dummy-2-3-12/config/initializers/session_store.rb +15 -0
  34. data/spec/dummy-2-3-12/config/locales/en.yml +5 -0
  35. data/spec/dummy-2-3-12/config/routes.rb +43 -0
  36. data/spec/dummy-2-3-12/db/seeds.rb +7 -0
  37. data/spec/dummy-2-3-12/public/404.html +30 -0
  38. data/spec/dummy-2-3-12/public/422.html +30 -0
  39. data/spec/dummy-2-3-12/public/500.html +30 -0
  40. data/spec/dummy-2-3-12/public/favicon.ico +0 -0
  41. data/spec/dummy-2-3-12/public/images/rails.png +0 -0
  42. data/spec/dummy-2-3-12/public/index.html +275 -0
  43. data/spec/dummy-2-3-12/public/javascripts/application.js +2 -0
  44. data/spec/dummy-2-3-12/public/javascripts/controls.js +963 -0
  45. data/spec/dummy-2-3-12/public/javascripts/dragdrop.js +973 -0
  46. data/spec/dummy-2-3-12/public/javascripts/effects.js +1128 -0
  47. data/spec/dummy-2-3-12/public/javascripts/prototype.js +4320 -0
  48. data/spec/dummy-2-3-12/public/robots.txt +5 -0
  49. data/spec/dummy-2-3-12/script/about +4 -0
  50. data/spec/dummy-2-3-12/script/console +3 -0
  51. data/spec/dummy-2-3-12/script/dbconsole +3 -0
  52. data/spec/dummy-2-3-12/script/destroy +3 -0
  53. data/spec/dummy-2-3-12/script/generate +3 -0
  54. data/spec/dummy-2-3-12/script/performance/benchmarker +3 -0
  55. data/spec/dummy-2-3-12/script/performance/profiler +3 -0
  56. data/spec/dummy-2-3-12/script/plugin +3 -0
  57. data/spec/dummy-2-3-12/script/runner +3 -0
  58. data/spec/dummy-2-3-12/script/server +3 -0
  59. data/spec/helper.rb +47 -0
  60. data/spec/models/ao_crudify_spec.rb +62 -0
  61. data/spec/spec.opts +5 -0
  62. data/spec/spec_helper.rb +31 -0
  63. metadata +193 -0
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../../config/boot', __FILE__)
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../../config/boot', __FILE__)
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/server'
@@ -0,0 +1,47 @@
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy-2-3-12/config/environment.rb", __FILE__)
5
+ #require "rails/test_help"
6
+ require "shoulda"
7
+
8
+ ActionMailer::Base.delivery_method = :test
9
+ ActionMailer::Base.perform_deliveries = true
10
+ ActionMailer::Base.default_url_options[:host] = "test.com"
11
+
12
+ Rails.backtrace_cleaner.remove_silencers!
13
+
14
+ # Configure capybara for integration testing
15
+ require "capybara/rails"
16
+ require "selenium/webdriver"
17
+
18
+ Capybara.default_driver = :selenium
19
+
20
+
21
+ # Include capybara and some extras into rails tests
22
+ module ActionController
23
+ class IntegrationTest
24
+
25
+ # turn off transactions for sqlite
26
+ self.use_transactional_fixtures = false
27
+
28
+ include Capybara
29
+
30
+ def assert_seen(text, opts={})
31
+ if opts[:within]
32
+ within(selector_for(opts[:within])) do
33
+ assert page.has_content?(text)
34
+ end
35
+ else
36
+ assert page.has_content?(text)
37
+ end
38
+ end
39
+
40
+ def assert_flash(key, text)
41
+ within("#flash_#{key}") do
42
+ assert_seen(text)
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,62 @@
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
+
3
+
4
+ describe AoCrudify do
5
+
6
+ before do
7
+
8
+ Jelly.connection.clear
9
+ 10.times{|i|
10
+ Jelly.create(:title => "Yummy Jelly #{i}", :name => "Sample #{i}")
11
+ }
12
+
13
+ @controller = JelliesController.new
14
+ @controller.params = {}
15
+ @controller.stub!(:paginate_options).and_return(
16
+ :page => 1,
17
+ :per_page => 3,
18
+ :order_by => :created_at,
19
+ :direction => :numdesc
20
+ )
21
+ @controller.stub!(:conditions).and_return({})
22
+ end
23
+
24
+ it "should have crud methods" do
25
+ [
26
+ :find_jelly,
27
+ :find_all_jellies,
28
+ :paginate_all_jellies,
29
+ ].each do |method|
30
+ @controller.methods.should include(method.to_s)
31
+ end
32
+ end
33
+
34
+ it "should have private hook methods" do
35
+ [
36
+ :before_create,
37
+ :before_update,
38
+ :successful_create,
39
+ :successful_update,
40
+ :successful_destroy,
41
+ :after_success,
42
+ :failed_create,
43
+ :failed_update,
44
+ :failed_destroy,
45
+ :after_fail
46
+ ].each do |method|
47
+ @controller.private_methods.should include(method.to_s)
48
+ end
49
+ end
50
+
51
+ it "should get collection" do
52
+ jellies = @controller.send(:find_all_jellies)
53
+ jellies.should have(10).items
54
+ end
55
+
56
+ it "should paginate collection" do
57
+ jellies = @controller.send(:paginate_all_jellies)
58
+
59
+ jellies.should have(3).items
60
+ end
61
+
62
+ end
@@ -0,0 +1,5 @@
1
+ --colour
2
+ --format n
3
+ --loadby mtime
4
+ --reverse
5
+ --drb
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'spork'
3
+
4
+ Spork.prefork do
5
+
6
+ end
7
+
8
+ Spork.each_run do
9
+
10
+ end
11
+
12
+ require 'rubygems'
13
+ ENV["RAILS_ENV"] ||= 'test'
14
+ require File.expand_path("../dummy-2-3-12/config/environment.rb", __FILE__)
15
+ require 'spec/autorun'
16
+ require 'spec/rails'
17
+ $:.unshift File.expand_path("../", __FILE__) unless $:.include?(File.expand_path("../", __FILE__))
18
+
19
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
20
+
21
+ Spec::Runner.configure do |config|
22
+
23
+ # support flash.now
24
+ config.before(:each, :behaviour_type => :controller) do
25
+ @controller.instance_eval { flash.stub!(:sweep) }
26
+ end
27
+ end
28
+
29
+ at_exit do
30
+ FileUtils.rm_rf Dir.glob(File.expand_path("../dummy-2-3-12/db/*.tct", __FILE__))
31
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ao_crudify
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - kame
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-03-30 00:00:00 +08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 27
30
+ segments:
31
+ - 2
32
+ - 3
33
+ - 12
34
+ version: 2.3.12
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: activeobject
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 0
48
+ - 3
49
+ - 4
50
+ version: 0.3.4
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 27
62
+ segments:
63
+ - 1
64
+ - 3
65
+ - 0
66
+ version: 1.3.0
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-rails
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 31
78
+ segments:
79
+ - 1
80
+ - 3
81
+ - 2
82
+ version: 1.3.2
83
+ type: :runtime
84
+ version_requirements: *id004
85
+ description: A dynamic resource controller for Rails > 2.3 and ActiveObject ORM that keeps your controllers nice and skinny.
86
+ email:
87
+ - kamechb@gmail.com
88
+ executables: []
89
+
90
+ extensions: []
91
+
92
+ extra_rdoc_files: []
93
+
94
+ files:
95
+ - .gitignore
96
+ - Gemfile
97
+ - LICENSE.md
98
+ - README.md
99
+ - Rakefile
100
+ - ao_crudify.gemspec
101
+ - config/locales/en.yml
102
+ - config/locales/zh-cn.yml
103
+ - lib/ao_crudify.rb
104
+ - lib/ao_crudify/base.rb
105
+ - lib/ao_crudify/class_methods.rb
106
+ - lib/ao_crudify/hook_methods.rb
107
+ - lib/ao_crudify/version.rb
108
+ - spec/controllers/controller_hooks_spec.rb
109
+ - spec/controllers/jellies_controller_spec.rb
110
+ - spec/dummy-2-3-12/README
111
+ - spec/dummy-2-3-12/Rakefile
112
+ - spec/dummy-2-3-12/app/controllers/application_controller.rb
113
+ - spec/dummy-2-3-12/app/controllers/jellies_controller.rb
114
+ - spec/dummy-2-3-12/app/helpers/application_helper.rb
115
+ - spec/dummy-2-3-12/app/models/jelly.rb
116
+ - spec/dummy-2-3-12/config/boot.rb
117
+ - spec/dummy-2-3-12/config/database.yml
118
+ - spec/dummy-2-3-12/config/environment.rb
119
+ - spec/dummy-2-3-12/config/environments/development.rb
120
+ - spec/dummy-2-3-12/config/environments/production.rb
121
+ - spec/dummy-2-3-12/config/environments/test.rb
122
+ - spec/dummy-2-3-12/config/initializers/backtrace_silencers.rb
123
+ - spec/dummy-2-3-12/config/initializers/cookie_verification_secret.rb
124
+ - spec/dummy-2-3-12/config/initializers/inflections.rb
125
+ - spec/dummy-2-3-12/config/initializers/mime_types.rb
126
+ - spec/dummy-2-3-12/config/initializers/new_rails_defaults.rb
127
+ - spec/dummy-2-3-12/config/initializers/session_store.rb
128
+ - spec/dummy-2-3-12/config/locales/en.yml
129
+ - spec/dummy-2-3-12/config/routes.rb
130
+ - spec/dummy-2-3-12/db/seeds.rb
131
+ - spec/dummy-2-3-12/log/test.log
132
+ - spec/dummy-2-3-12/public/404.html
133
+ - spec/dummy-2-3-12/public/422.html
134
+ - spec/dummy-2-3-12/public/500.html
135
+ - spec/dummy-2-3-12/public/favicon.ico
136
+ - spec/dummy-2-3-12/public/images/rails.png
137
+ - spec/dummy-2-3-12/public/index.html
138
+ - spec/dummy-2-3-12/public/javascripts/application.js
139
+ - spec/dummy-2-3-12/public/javascripts/controls.js
140
+ - spec/dummy-2-3-12/public/javascripts/dragdrop.js
141
+ - spec/dummy-2-3-12/public/javascripts/effects.js
142
+ - spec/dummy-2-3-12/public/javascripts/prototype.js
143
+ - spec/dummy-2-3-12/public/robots.txt
144
+ - spec/dummy-2-3-12/script/about
145
+ - spec/dummy-2-3-12/script/console
146
+ - spec/dummy-2-3-12/script/dbconsole
147
+ - spec/dummy-2-3-12/script/destroy
148
+ - spec/dummy-2-3-12/script/generate
149
+ - spec/dummy-2-3-12/script/performance/benchmarker
150
+ - spec/dummy-2-3-12/script/performance/profiler
151
+ - spec/dummy-2-3-12/script/plugin
152
+ - spec/dummy-2-3-12/script/runner
153
+ - spec/dummy-2-3-12/script/server
154
+ - spec/helper.rb
155
+ - spec/models/ao_crudify_spec.rb
156
+ - spec/spec.opts
157
+ - spec/spec_helper.rb
158
+ has_rdoc: true
159
+ homepage: http://github.com/kamechb/ao_crudify
160
+ licenses: []
161
+
162
+ post_install_message:
163
+ rdoc_options: []
164
+
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ hash: 3
173
+ segments:
174
+ - 0
175
+ version: "0"
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ hash: 3
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ requirements: []
186
+
187
+ rubyforge_project:
188
+ rubygems_version: 1.6.2
189
+ signing_key:
190
+ specification_version: 3
191
+ summary: A dynamic resource controller for Rails > 2.3 and ActiveObject ORM that keeps your controllers nice and skinny.
192
+ test_files: []
193
+