dao 0.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/README +35 -0
  2. data/Rakefile +6 -3
  3. data/TODO +37 -0
  4. data/dao.gemspec +30 -0
  5. data/db/dao.yml +8 -0
  6. data/lib/dao.rb +84 -5
  7. data/lib/dao/active_record.rb +76 -0
  8. data/lib/dao/api.rb +9 -0
  9. data/lib/dao/api/context.rb +38 -0
  10. data/lib/dao/api/dsl.rb +50 -0
  11. data/lib/dao/api/endpoints.rb +190 -0
  12. data/lib/dao/api/initializers.rb +71 -0
  13. data/lib/dao/api/modes.rb +85 -0
  14. data/lib/dao/blankslate.rb +5 -0
  15. data/lib/dao/data.rb +58 -0
  16. data/lib/dao/db.rb +183 -0
  17. data/lib/dao/endpoint.rb +16 -0
  18. data/lib/dao/engine.rb +7 -0
  19. data/lib/dao/errors.rb +238 -0
  20. data/lib/dao/exceptions.rb +2 -0
  21. data/lib/dao/form.rb +236 -0
  22. data/lib/dao/mode.rb +41 -0
  23. data/lib/dao/mongo_mapper.rb +70 -0
  24. data/lib/dao/params.rb +109 -0
  25. data/lib/dao/path.rb +149 -0
  26. data/lib/dao/rails.rb +15 -0
  27. data/lib/dao/rails/app/api.rb +55 -0
  28. data/lib/dao/rails/app/controllers/api_controller.rb +99 -0
  29. data/lib/dao/rails/lib/generators/dao/USAGE +9 -0
  30. data/lib/dao/rails/lib/generators/dao/api_generator.rb +3 -0
  31. data/lib/dao/rails/lib/generators/dao/dao_generator.rb +27 -0
  32. data/lib/dao/rails/lib/generators/dao/templates/api.rb +55 -0
  33. data/lib/dao/rails/lib/generators/dao/templates/api_controller.rb +99 -0
  34. data/lib/dao/result.rb +87 -0
  35. data/lib/dao/slug.rb +11 -0
  36. data/lib/dao/status.rb +223 -0
  37. data/lib/dao/stdext.rb +10 -0
  38. data/lib/dao/support.rb +62 -0
  39. data/lib/dao/validations.rb +115 -0
  40. data/sample/rails_app/Gemfile +33 -0
  41. data/sample/rails_app/Gemfile.lock +88 -0
  42. data/sample/rails_app/README +1 -0
  43. data/sample/rails_app/Rakefile +7 -0
  44. data/sample/rails_app/app/api.rb +55 -0
  45. data/sample/rails_app/app/controllers/api_controller.rb +99 -0
  46. data/sample/rails_app/app/controllers/application_controller.rb +3 -0
  47. data/sample/rails_app/app/helpers/application_helper.rb +2 -0
  48. data/sample/rails_app/app/views/layouts/application.html.erb +14 -0
  49. data/sample/rails_app/config.ru +4 -0
  50. data/sample/rails_app/config/application.rb +51 -0
  51. data/sample/rails_app/config/boot.rb +13 -0
  52. data/sample/rails_app/config/database.yml +22 -0
  53. data/sample/rails_app/config/environment.rb +5 -0
  54. data/sample/rails_app/config/environments/development.rb +26 -0
  55. data/sample/rails_app/config/environments/production.rb +49 -0
  56. data/sample/rails_app/config/environments/test.rb +35 -0
  57. data/sample/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  58. data/sample/rails_app/config/initializers/inflections.rb +10 -0
  59. data/sample/rails_app/config/initializers/mime_types.rb +5 -0
  60. data/sample/rails_app/config/initializers/secret_token.rb +7 -0
  61. data/sample/rails_app/config/initializers/session_store.rb +8 -0
  62. data/sample/rails_app/config/locales/en.yml +5 -0
  63. data/sample/rails_app/config/routes.rb +62 -0
  64. data/sample/rails_app/db/development.sqlite3 +0 -0
  65. data/sample/rails_app/db/seeds.rb +7 -0
  66. data/sample/rails_app/doc/README_FOR_APP +2 -0
  67. data/sample/rails_app/log/development.log +27 -0
  68. data/sample/rails_app/log/production.log +0 -0
  69. data/sample/rails_app/log/server.log +0 -0
  70. data/sample/rails_app/log/test.log +0 -0
  71. data/sample/rails_app/public/404.html +26 -0
  72. data/sample/rails_app/public/422.html +26 -0
  73. data/sample/rails_app/public/500.html +26 -0
  74. data/sample/rails_app/public/favicon.ico +0 -0
  75. data/sample/rails_app/public/images/rails.png +0 -0
  76. data/sample/rails_app/public/index.html +239 -0
  77. data/sample/rails_app/public/javascripts/application.js +2 -0
  78. data/sample/rails_app/public/javascripts/controls.js +965 -0
  79. data/sample/rails_app/public/javascripts/dragdrop.js +974 -0
  80. data/sample/rails_app/public/javascripts/effects.js +1123 -0
  81. data/sample/rails_app/public/javascripts/prototype.js +6001 -0
  82. data/sample/rails_app/public/javascripts/rails.js +175 -0
  83. data/sample/rails_app/public/robots.txt +5 -0
  84. data/sample/rails_app/script/rails +6 -0
  85. data/sample/rails_app/test/performance/browsing_test.rb +9 -0
  86. data/sample/rails_app/test/test_helper.rb +13 -0
  87. data/test/dao_test.rb +271 -0
  88. data/test/helper.rb +15 -0
  89. data/test/testing.rb +74 -0
  90. metadata +137 -9
data/test/helper.rb ADDED
@@ -0,0 +1,15 @@
1
+ class User < Map
2
+ def id() self[:id] end
3
+ def email() self[:email] end
4
+
5
+ def User.current
6
+ @current ||= User.new(:id => '42', :email => 'ara.t.howard@gmail.com')
7
+ end
8
+ end
9
+
10
+ module Kernel
11
+ private
12
+ def current_user()
13
+ User.current
14
+ end
15
+ end
data/test/testing.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'test/unit'
2
+
3
+ testdir = File.expand_path(File.dirname(__FILE__))
4
+ rootdir = File.dirname(testdir)
5
+ libdir = File.join(rootdir, 'lib')
6
+
7
+ STDOUT.sync = true
8
+
9
+ $:.unshift(testdir) unless $:.include?(testdir)
10
+ $:.unshift(libdir) unless $:.include?(libdir)
11
+ $:.unshift(rootdir) unless $:.include?(rootdir)
12
+
13
+ def Testing(*args, &block)
14
+ Class.new(Test::Unit::TestCase) do
15
+
16
+ def self.slug_for(*args)
17
+ string = args.flatten.compact.join('-')
18
+ words = string.to_s.scan(%r/\w+/)
19
+ words.map!{|word| word.gsub %r/[^0-9a-zA-Z_-]/, ''}
20
+ words.delete_if{|word| word.nil? or word.strip.empty?}
21
+ words.join('-').downcase
22
+ end
23
+
24
+ def self.testing_subclass_count
25
+ @@testing_subclass_count = '0' unless defined?(@@testing_subclass_count)
26
+ @@testing_subclass_count
27
+ end
28
+
29
+ self.testing_subclass_count.succ!
30
+ slug = slug_for(*args).gsub(%r/-/,'_')
31
+ name = ['TESTING', '%03d' % self.testing_subclass_count, slug].delete_if{|part| part.empty?}.join('_')
32
+ name = name.upcase!
33
+ const_set(:Name, name)
34
+ def self.name() const_get(:Name) end
35
+
36
+ def self.testno()
37
+ '%05d' % (@testno ||= 0)
38
+ ensure
39
+ @testno += 1
40
+ end
41
+
42
+ def self.testing(*args, &block)
43
+ method = ["test", testno, slug_for(*args)].delete_if{|part| part.empty?}.join('_')
44
+ define_method("test_#{ testno }_#{ slug_for(*args) }", &block)
45
+ end
46
+
47
+ alias_method '__assert__', 'assert'
48
+
49
+ def assert(*args, &block)
50
+ if block
51
+ label = "assert(#{ args.join(' ') })"
52
+ result = nil
53
+ assert_nothing_raised{ result = block.call }
54
+ __assert__(result, label)
55
+ result
56
+ else
57
+ result = args.shift
58
+ label = "assert(#{ args.join(' ') })"
59
+ __assert__(result, label)
60
+ result
61
+ end
62
+ end
63
+
64
+ def subclass_of exception
65
+ class << exception
66
+ def ==(other) super or self > other end
67
+ end
68
+ exception
69
+ end
70
+
71
+ module_eval &block
72
+ self
73
+ end
74
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dao
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
+ - 2
7
8
  - 0
8
9
  - 0
9
- - 0
10
- version: 0.0.0
10
+ version: 2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ara T. Howard
@@ -15,10 +15,51 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-16 00:00:00 -07:00
18
+ date: 2011-01-28 00:00:00 -07:00
19
19
  default_executable:
20
- dependencies: []
21
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: map
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: tagz
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: yajl-ruby
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
22
63
  description: "description: dao kicks the ass"
23
64
  email: ara.t.howard@gmail.com
24
65
  executables: []
@@ -28,10 +69,97 @@ extensions: []
28
69
  extra_rdoc_files: []
29
70
 
30
71
  files:
72
+ - dao.gemspec
73
+ - db/dao.yml
74
+ - lib/dao/active_record.rb
75
+ - lib/dao/api/context.rb
76
+ - lib/dao/api/dsl.rb
77
+ - lib/dao/api/endpoints.rb
78
+ - lib/dao/api/initializers.rb
79
+ - lib/dao/api/modes.rb
80
+ - lib/dao/api.rb
81
+ - lib/dao/blankslate.rb
82
+ - lib/dao/data.rb
83
+ - lib/dao/db.rb
84
+ - lib/dao/endpoint.rb
85
+ - lib/dao/engine.rb
86
+ - lib/dao/errors.rb
87
+ - lib/dao/exceptions.rb
88
+ - lib/dao/form.rb
89
+ - lib/dao/mode.rb
90
+ - lib/dao/mongo_mapper.rb
91
+ - lib/dao/params.rb
92
+ - lib/dao/path.rb
93
+ - lib/dao/rails/app/api.rb
94
+ - lib/dao/rails/app/controllers/api_controller.rb
95
+ - lib/dao/rails/lib/generators/dao/api_generator.rb
96
+ - lib/dao/rails/lib/generators/dao/dao_generator.rb
97
+ - lib/dao/rails/lib/generators/dao/templates/api.rb
98
+ - lib/dao/rails/lib/generators/dao/templates/api_controller.rb
99
+ - lib/dao/rails/lib/generators/dao/USAGE
100
+ - lib/dao/rails.rb
101
+ - lib/dao/result.rb
102
+ - lib/dao/slug.rb
103
+ - lib/dao/status.rb
104
+ - lib/dao/stdext.rb
105
+ - lib/dao/support.rb
106
+ - lib/dao/validations.rb
31
107
  - lib/dao.rb
32
108
  - Rakefile
109
+ - README
110
+ - sample/rails_app/app/api.rb
111
+ - sample/rails_app/app/controllers/api_controller.rb
112
+ - sample/rails_app/app/controllers/application_controller.rb
113
+ - sample/rails_app/app/helpers/application_helper.rb
114
+ - sample/rails_app/app/views/layouts/application.html.erb
115
+ - sample/rails_app/config/application.rb
116
+ - sample/rails_app/config/boot.rb
117
+ - sample/rails_app/config/database.yml
118
+ - sample/rails_app/config/environment.rb
119
+ - sample/rails_app/config/environments/development.rb
120
+ - sample/rails_app/config/environments/production.rb
121
+ - sample/rails_app/config/environments/test.rb
122
+ - sample/rails_app/config/initializers/backtrace_silencers.rb
123
+ - sample/rails_app/config/initializers/inflections.rb
124
+ - sample/rails_app/config/initializers/mime_types.rb
125
+ - sample/rails_app/config/initializers/secret_token.rb
126
+ - sample/rails_app/config/initializers/session_store.rb
127
+ - sample/rails_app/config/locales/en.yml
128
+ - sample/rails_app/config/routes.rb
129
+ - sample/rails_app/config.ru
130
+ - sample/rails_app/db/development.sqlite3
131
+ - sample/rails_app/db/seeds.rb
132
+ - sample/rails_app/doc/README_FOR_APP
133
+ - sample/rails_app/Gemfile
134
+ - sample/rails_app/Gemfile.lock
135
+ - sample/rails_app/log/development.log
136
+ - sample/rails_app/log/production.log
137
+ - sample/rails_app/log/server.log
138
+ - sample/rails_app/log/test.log
139
+ - sample/rails_app/public/404.html
140
+ - sample/rails_app/public/422.html
141
+ - sample/rails_app/public/500.html
142
+ - sample/rails_app/public/favicon.ico
143
+ - sample/rails_app/public/images/rails.png
144
+ - sample/rails_app/public/index.html
145
+ - sample/rails_app/public/javascripts/application.js
146
+ - sample/rails_app/public/javascripts/controls.js
147
+ - sample/rails_app/public/javascripts/dragdrop.js
148
+ - sample/rails_app/public/javascripts/effects.js
149
+ - sample/rails_app/public/javascripts/prototype.js
150
+ - sample/rails_app/public/javascripts/rails.js
151
+ - sample/rails_app/public/robots.txt
152
+ - sample/rails_app/Rakefile
153
+ - sample/rails_app/README
154
+ - sample/rails_app/script/rails
155
+ - sample/rails_app/test/performance/browsing_test.rb
156
+ - sample/rails_app/test/test_helper.rb
157
+ - test/dao_test.rb
158
+ - test/helper.rb
159
+ - test/testing.rb
160
+ - TODO
33
161
  has_rdoc: true
34
- homepage: http://github.com/ahoward/dao/tree/master
162
+ homepage: http://github.com/ahoward/dao
35
163
  licenses: []
36
164
 
37
165
  post_install_message:
@@ -60,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
188
  requirements: []
61
189
 
62
190
  rubyforge_project: codeforpeople
63
- rubygems_version: 1.3.7
191
+ rubygems_version: 1.4.2
64
192
  signing_key:
65
193
  specification_version: 3
66
194
  summary: dao