dm-rest-adapter 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +71 -0
- data/fixtures/book_service/README +256 -0
- data/fixtures/book_service/Rakefile +10 -0
- data/fixtures/book_service/app/controllers/application.rb +15 -0
- data/fixtures/book_service/app/controllers/books_controller.rb +85 -0
- data/fixtures/book_service/app/controllers/shelves_controller.rb +89 -0
- data/fixtures/book_service/app/helpers/application_helper.rb +3 -0
- data/fixtures/book_service/app/helpers/books_helper.rb +2 -0
- data/fixtures/book_service/app/helpers/shelf_helper.rb +2 -0
- data/fixtures/book_service/app/models/book.rb +6 -0
- data/fixtures/book_service/app/models/shelf.rb +5 -0
- data/fixtures/book_service/app/views/books/edit.html.erb +20 -0
- data/fixtures/book_service/app/views/books/index.html.erb +22 -0
- data/fixtures/book_service/app/views/books/new.html.erb +19 -0
- data/fixtures/book_service/app/views/books/show.html.erb +13 -0
- data/fixtures/book_service/app/views/layouts/books.html.erb +17 -0
- data/fixtures/book_service/app/views/shelves/edit.html.erb +16 -0
- data/fixtures/book_service/app/views/shelves/index.html.erb +20 -0
- data/fixtures/book_service/app/views/shelves/new.html.erb +15 -0
- data/fixtures/book_service/app/views/shelves/show.html.erb +7 -0
- data/fixtures/book_service/config/boot.rb +109 -0
- data/fixtures/book_service/config/database.yml +19 -0
- data/fixtures/book_service/config/environment.rb +67 -0
- data/fixtures/book_service/config/environments/development.rb +17 -0
- data/fixtures/book_service/config/environments/production.rb +22 -0
- data/fixtures/book_service/config/environments/test.rb +22 -0
- data/fixtures/book_service/config/initializers/inflections.rb +10 -0
- data/fixtures/book_service/config/initializers/mime_types.rb +5 -0
- data/fixtures/book_service/config/initializers/new_rails_defaults.rb +15 -0
- data/fixtures/book_service/config/routes.rb +44 -0
- data/fixtures/book_service/db/development.sqlite3 +0 -0
- data/fixtures/book_service/db/migrate/20080608165526_create_books.rb +15 -0
- data/fixtures/book_service/db/migrate/20080621171551_create_shelves.rb +13 -0
- data/fixtures/book_service/db/migrate/20080629143033_create_fake_books_and_shelves.rb +20 -0
- data/fixtures/book_service/db/schema.rb +28 -0
- data/fixtures/book_service/public/404.html +30 -0
- data/fixtures/book_service/public/422.html +30 -0
- data/fixtures/book_service/public/500.html +30 -0
- data/fixtures/book_service/public/dispatch.cgi +10 -0
- data/fixtures/book_service/public/dispatch.fcgi +24 -0
- data/fixtures/book_service/public/dispatch.rb +10 -0
- data/fixtures/book_service/public/favicon.ico +0 -0
- data/fixtures/book_service/public/images/rails.png +0 -0
- data/fixtures/book_service/public/index.html +274 -0
- data/fixtures/book_service/public/javascripts/application.js +2 -0
- data/fixtures/book_service/public/javascripts/controls.js +963 -0
- data/fixtures/book_service/public/javascripts/dragdrop.js +972 -0
- data/fixtures/book_service/public/javascripts/effects.js +1120 -0
- data/fixtures/book_service/public/javascripts/prototype.js +4225 -0
- data/fixtures/book_service/public/robots.txt +5 -0
- data/fixtures/book_service/public/stylesheets/scaffold.css +53 -0
- data/fixtures/book_service/script/about +3 -0
- data/fixtures/book_service/script/console +3 -0
- data/fixtures/book_service/script/dbconsole +3 -0
- data/fixtures/book_service/script/destroy +3 -0
- data/fixtures/book_service/script/generate +3 -0
- data/fixtures/book_service/script/performance/benchmarker +3 -0
- data/fixtures/book_service/script/performance/profiler +3 -0
- data/fixtures/book_service/script/performance/request +3 -0
- data/fixtures/book_service/script/plugin +3 -0
- data/fixtures/book_service/script/process/inspector +3 -0
- data/fixtures/book_service/script/process/reaper +3 -0
- data/fixtures/book_service/script/process/spawner +3 -0
- data/fixtures/book_service/script/runner +3 -0
- data/fixtures/book_service/script/server +3 -0
- data/fixtures/book_service/test/fixtures/books.yml +9 -0
- data/fixtures/book_service/test/fixtures/shelves.yml +7 -0
- data/fixtures/book_service/test/functional/books_controller_test.rb +45 -0
- data/fixtures/book_service/test/functional/shelf_controller_test.rb +8 -0
- data/fixtures/book_service/test/test_helper.rb +38 -0
- data/fixtures/book_service/test/unit/book_test.rb +8 -0
- data/fixtures/book_service/test/unit/shelf_test.rb +8 -0
- data/lib/rest_adapter.rb +3 -3
- data/lib/rest_adapter/version.rb +1 -1
- metadata +76 -5
@@ -0,0 +1,53 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
.fieldWithErrors {
|
20
|
+
padding: 2px;
|
21
|
+
background-color: red;
|
22
|
+
display: table;
|
23
|
+
}
|
24
|
+
|
25
|
+
#errorExplanation {
|
26
|
+
width: 400px;
|
27
|
+
border: 2px solid red;
|
28
|
+
padding: 7px;
|
29
|
+
padding-bottom: 12px;
|
30
|
+
margin-bottom: 20px;
|
31
|
+
background-color: #f0f0f0;
|
32
|
+
}
|
33
|
+
|
34
|
+
#errorExplanation h2 {
|
35
|
+
text-align: left;
|
36
|
+
font-weight: bold;
|
37
|
+
padding: 5px 5px 5px 15px;
|
38
|
+
font-size: 12px;
|
39
|
+
margin: -7px;
|
40
|
+
background-color: #c00;
|
41
|
+
color: #fff;
|
42
|
+
}
|
43
|
+
|
44
|
+
#errorExplanation p {
|
45
|
+
color: #333;
|
46
|
+
margin-bottom: 0;
|
47
|
+
padding: 5px;
|
48
|
+
}
|
49
|
+
|
50
|
+
#errorExplanation ul li {
|
51
|
+
font-size: 12px;
|
52
|
+
list-style: square;
|
53
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BooksControllerTest < ActionController::TestCase
|
4
|
+
def test_should_get_index
|
5
|
+
get :index
|
6
|
+
assert_response :success
|
7
|
+
assert_not_nil assigns(:books)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_should_get_new
|
11
|
+
get :new
|
12
|
+
assert_response :success
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_should_create_book
|
16
|
+
assert_difference('Book.count') do
|
17
|
+
post :create, :book => { }
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_redirected_to book_path(assigns(:book))
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_should_show_book
|
24
|
+
get :show, :id => books(:one).id
|
25
|
+
assert_response :success
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_should_get_edit
|
29
|
+
get :edit, :id => books(:one).id
|
30
|
+
assert_response :success
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_update_book
|
34
|
+
put :update, :id => books(:one).id, :book => { }
|
35
|
+
assert_redirected_to book_path(assigns(:book))
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_should_destroy_book
|
39
|
+
assert_difference('Book.count', -1) do
|
40
|
+
delete :destroy, :id => books(:one).id
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_redirected_to books_path
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class Test::Unit::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
#
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
22
|
+
self.use_transactional_fixtures = true
|
23
|
+
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
28
|
+
# then set this back to true.
|
29
|
+
self.use_instantiated_fixtures = false
|
30
|
+
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
+
#
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
+
# -- they do not yet inherit this setting
|
35
|
+
fixtures :all
|
36
|
+
|
37
|
+
# Add more helper methods to be used by all tests here...
|
38
|
+
end
|
data/lib/rest_adapter.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'pathname'
|
3
3
|
require Pathname(__FILE__).dirname + 'rest_adapter/version'
|
4
|
+
|
4
5
|
gem 'dm-core', DataMapper::More::RestAdapter::VERSION
|
5
6
|
require 'dm-core'
|
6
7
|
|
7
|
-
gem 'extlib', '
|
8
|
+
gem 'extlib', '~>0.9.8'
|
8
9
|
require 'extlib'
|
9
10
|
|
10
11
|
require 'dm-serializer'
|
@@ -193,8 +194,7 @@ module DataMapper
|
|
193
194
|
resource[:values] = []
|
194
195
|
entity_element.elements.each do |field_element|
|
195
196
|
attribute = dm_model_class.properties(repository.name).find do |property|
|
196
|
-
|
197
|
-
property.name.to_s == Inflection.underscore(field_element.name.to_s)
|
197
|
+
property.name.to_s == field_element.name.to_s.tr('-', '_')
|
198
198
|
end
|
199
199
|
if attribute
|
200
200
|
resource[:values] << field_element.text
|
data/lib/rest_adapter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-rest-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Potomac Ruby Hackers
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-18 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.
|
23
|
+
version: 0.9.7
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.8.2
|
34
34
|
version:
|
35
35
|
description: REST Adapter for DataMapper
|
36
36
|
email:
|
@@ -50,6 +50,77 @@ files:
|
|
50
50
|
- README.txt
|
51
51
|
- Rakefile
|
52
52
|
- TODO
|
53
|
+
- fixtures/book_service/README
|
54
|
+
- fixtures/book_service/Rakefile
|
55
|
+
- fixtures/book_service/app/controllers/application.rb
|
56
|
+
- fixtures/book_service/app/controllers/books_controller.rb
|
57
|
+
- fixtures/book_service/app/controllers/shelves_controller.rb
|
58
|
+
- fixtures/book_service/app/helpers/application_helper.rb
|
59
|
+
- fixtures/book_service/app/helpers/books_helper.rb
|
60
|
+
- fixtures/book_service/app/helpers/shelf_helper.rb
|
61
|
+
- fixtures/book_service/app/models/book.rb
|
62
|
+
- fixtures/book_service/app/models/shelf.rb
|
63
|
+
- fixtures/book_service/app/views/books/edit.html.erb
|
64
|
+
- fixtures/book_service/app/views/books/index.html.erb
|
65
|
+
- fixtures/book_service/app/views/books/new.html.erb
|
66
|
+
- fixtures/book_service/app/views/books/show.html.erb
|
67
|
+
- fixtures/book_service/app/views/layouts/books.html.erb
|
68
|
+
- fixtures/book_service/app/views/shelves/edit.html.erb
|
69
|
+
- fixtures/book_service/app/views/shelves/index.html.erb
|
70
|
+
- fixtures/book_service/app/views/shelves/new.html.erb
|
71
|
+
- fixtures/book_service/app/views/shelves/show.html.erb
|
72
|
+
- fixtures/book_service/config/boot.rb
|
73
|
+
- fixtures/book_service/config/database.yml
|
74
|
+
- fixtures/book_service/config/environment.rb
|
75
|
+
- fixtures/book_service/config/environments/development.rb
|
76
|
+
- fixtures/book_service/config/environments/production.rb
|
77
|
+
- fixtures/book_service/config/environments/test.rb
|
78
|
+
- fixtures/book_service/config/initializers/inflections.rb
|
79
|
+
- fixtures/book_service/config/initializers/mime_types.rb
|
80
|
+
- fixtures/book_service/config/initializers/new_rails_defaults.rb
|
81
|
+
- fixtures/book_service/config/routes.rb
|
82
|
+
- fixtures/book_service/db/development.sqlite3
|
83
|
+
- fixtures/book_service/db/migrate/20080608165526_create_books.rb
|
84
|
+
- fixtures/book_service/db/migrate/20080621171551_create_shelves.rb
|
85
|
+
- fixtures/book_service/db/migrate/20080629143033_create_fake_books_and_shelves.rb
|
86
|
+
- fixtures/book_service/db/schema.rb
|
87
|
+
- fixtures/book_service/public/404.html
|
88
|
+
- fixtures/book_service/public/422.html
|
89
|
+
- fixtures/book_service/public/500.html
|
90
|
+
- fixtures/book_service/public/dispatch.cgi
|
91
|
+
- fixtures/book_service/public/dispatch.fcgi
|
92
|
+
- fixtures/book_service/public/dispatch.rb
|
93
|
+
- fixtures/book_service/public/favicon.ico
|
94
|
+
- fixtures/book_service/public/images/rails.png
|
95
|
+
- fixtures/book_service/public/index.html
|
96
|
+
- fixtures/book_service/public/javascripts/application.js
|
97
|
+
- fixtures/book_service/public/javascripts/controls.js
|
98
|
+
- fixtures/book_service/public/javascripts/dragdrop.js
|
99
|
+
- fixtures/book_service/public/javascripts/effects.js
|
100
|
+
- fixtures/book_service/public/javascripts/prototype.js
|
101
|
+
- fixtures/book_service/public/robots.txt
|
102
|
+
- fixtures/book_service/public/stylesheets/scaffold.css
|
103
|
+
- fixtures/book_service/script/about
|
104
|
+
- fixtures/book_service/script/console
|
105
|
+
- fixtures/book_service/script/dbconsole
|
106
|
+
- fixtures/book_service/script/destroy
|
107
|
+
- fixtures/book_service/script/generate
|
108
|
+
- fixtures/book_service/script/performance/benchmarker
|
109
|
+
- fixtures/book_service/script/performance/profiler
|
110
|
+
- fixtures/book_service/script/performance/request
|
111
|
+
- fixtures/book_service/script/plugin
|
112
|
+
- fixtures/book_service/script/process/inspector
|
113
|
+
- fixtures/book_service/script/process/reaper
|
114
|
+
- fixtures/book_service/script/process/spawner
|
115
|
+
- fixtures/book_service/script/runner
|
116
|
+
- fixtures/book_service/script/server
|
117
|
+
- fixtures/book_service/test/fixtures/books.yml
|
118
|
+
- fixtures/book_service/test/fixtures/shelves.yml
|
119
|
+
- fixtures/book_service/test/functional/books_controller_test.rb
|
120
|
+
- fixtures/book_service/test/functional/shelf_controller_test.rb
|
121
|
+
- fixtures/book_service/test/test_helper.rb
|
122
|
+
- fixtures/book_service/test/unit/book_test.rb
|
123
|
+
- fixtures/book_service/test/unit/shelf_test.rb
|
53
124
|
- lib/rest_adapter.rb
|
54
125
|
- lib/rest_adapter/version.rb
|
55
126
|
- spec/create_spec.rb
|
@@ -93,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
164
|
requirements: []
|
94
165
|
|
95
166
|
rubyforge_project: datamapper
|
96
|
-
rubygems_version: 1.
|
167
|
+
rubygems_version: 1.3.1
|
97
168
|
signing_key:
|
98
169
|
specification_version: 2
|
99
170
|
summary: REST Adapter for DataMapper
|