dm-rest-adapter 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +2 -0
- data/Manifest.txt +3 -0
- data/Rakefile +18 -38
- data/TODO +0 -1
- data/fixtures/book_service/config/boot.rb +1 -1
- data/lib/rest_adapter.rb +8 -6
- data/lib/rest_adapter/version.rb +2 -4
- data/spec/spec_helper.rb +9 -1
- data/stories/crud/create +7 -7
- data/stories/crud/read +6 -6
- data/stories/crud/update +6 -6
- data/stories/helper.rb +16 -6
- data/tasks/install.rb +13 -0
- data/tasks/spec.rb +25 -0
- data/tasks/stories.rb +5 -0
- metadata +10 -16
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,45 +1,25 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'spec'
|
3
|
-
require 'spec/rake/spectask'
|
4
1
|
require 'pathname'
|
2
|
+
require 'rubygems'
|
5
3
|
|
6
|
-
ROOT
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
EMAIL = "potomac-ruby-hackers@googlegroups.com"
|
11
|
-
GEM_NAME = "dm-rest-adapter"
|
12
|
-
GEM_VERSION = DataMapper::More::RestAdapter::VERSION
|
13
|
-
GEM_DEPENDENCIES = [["dm-core", GEM_VERSION]]
|
14
|
-
GEM_CLEAN = ["log", "pkg"]
|
15
|
-
GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO ] }
|
16
|
-
|
17
|
-
PROJECT_NAME = "datamapper"
|
18
|
-
PROJECT_URL = "http://github.com/pjb3/dm-more/tree/master/adapters/dm-rest-adapter"
|
19
|
-
PROJECT_DESCRIPTION = PROJECT_SUMMARY = "REST Adapter for DataMapper"
|
20
|
-
|
21
|
-
require ROOT.parent.parent + 'tasks/hoe'
|
4
|
+
ROOT = Pathname(__FILE__).dirname.expand_path
|
5
|
+
JRUBY = RUBY_PLATFORM =~ /java/
|
6
|
+
WINDOWS = Gem.win_platform?
|
7
|
+
SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS'])
|
22
8
|
|
23
|
-
|
9
|
+
require ROOT + 'lib/rest_adapter/version'
|
24
10
|
|
25
|
-
|
26
|
-
|
11
|
+
AUTHOR = 'Potomac Ruby Hackers'
|
12
|
+
EMAIL = 'potomac-ruby-hackers [a] googlegroups [d] com'
|
13
|
+
GEM_NAME = 'dm-rest-adapter'
|
14
|
+
GEM_VERSION = DataMapper::RestAdapter::VERSION
|
15
|
+
GEM_DEPENDENCIES = [['dm-core', "~>#{GEM_VERSION}"]]
|
16
|
+
GEM_CLEAN = %w[ log pkg coverage ]
|
17
|
+
GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO History.txt ] }
|
27
18
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
desc 'Run specifications'
|
34
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
35
|
-
if File.exists?('spec/spec.opts')
|
36
|
-
t.spec_opts << '--options' << 'spec/spec.opts'
|
37
|
-
end
|
38
|
-
t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
|
39
|
-
end
|
19
|
+
PROJECT_NAME = 'datamapper'
|
20
|
+
PROJECT_URL = "http://github.com/sam/dm-more/tree/master/adapters/#{GEM_NAME}"
|
21
|
+
PROJECT_DESCRIPTION = PROJECT_SUMMARY = 'REST Adapter for DataMapper'
|
40
22
|
|
41
|
-
|
42
|
-
|
43
|
-
# TODO Re-migrate the book service or else you won't have test data!
|
44
|
-
ruby "stories/all.rb --colour --format plain"
|
23
|
+
[ ROOT, ROOT.parent.parent ].each do |dir|
|
24
|
+
Pathname.glob(dir.join('tasks/**/*.rb').to_s).each { |f| require f }
|
45
25
|
end
|
@@ -60,7 +60,7 @@ module Rails
|
|
60
60
|
else
|
61
61
|
gem 'rails'
|
62
62
|
end
|
63
|
-
rescue
|
63
|
+
rescue LoadError => load_error
|
64
64
|
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
65
65
|
exit 1
|
66
66
|
end
|
data/lib/rest_adapter.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
require '
|
1
|
+
require 'net/http'
|
2
2
|
require 'pathname'
|
3
|
-
require
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'rubygems'
|
4
5
|
|
5
|
-
gem 'dm-core',
|
6
|
+
gem 'dm-core', '~>0.9.8'
|
6
7
|
require 'dm-core'
|
7
8
|
|
8
|
-
gem 'extlib', '~>0.9.
|
9
|
+
gem 'extlib', '~>0.9.9'
|
9
10
|
require 'extlib'
|
10
11
|
|
12
|
+
#gem 'dm-serializer', '~>0.9.8'
|
11
13
|
require 'dm-serializer'
|
12
|
-
|
13
|
-
require '
|
14
|
+
|
15
|
+
require Pathname(__FILE__).dirname + 'rest_adapter/version'
|
14
16
|
|
15
17
|
# TODO: Abstract XML support out from the protocol
|
16
18
|
# TODO: Build JSON support
|
data/lib/rest_adapter/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
require 'pathname'
|
2
|
-
require
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
ROOT = Pathname(__FILE__).dirname.parent.expand_path
|
5
|
+
|
6
|
+
# use local dm-serializer if running from dm-more directly
|
7
|
+
lib = ROOT.parent.parent.join('dm-serializer', 'lib').expand_path
|
8
|
+
$LOAD_PATH.unshift(lib) if lib.directory?
|
9
|
+
|
10
|
+
require ROOT + 'lib/rest_adapter'
|
3
11
|
|
4
12
|
DataMapper.setup(:default, {
|
5
13
|
:adapter => 'rest',
|
data/stories/crud/create
CHANGED
@@ -2,36 +2,36 @@ Story: remote app wants to create a resource
|
|
2
2
|
As a remote app
|
3
3
|
I want to create a resource
|
4
4
|
So that I can store some data about a particular item
|
5
|
-
|
6
|
-
Scenario: remote app supplies a new valid Resource
|
5
|
+
|
6
|
+
Scenario: remote app supplies a new valid Resource
|
7
7
|
Given a valid DataMapper::Resource
|
8
8
|
When I try to save the Resource
|
9
9
|
Then the Resource should save
|
10
10
|
|
11
|
-
Scenario: remote app supplies a new invalid Resource
|
11
|
+
Scenario: remote app supplies a new invalid Resource
|
12
12
|
Given a valid DataMapper::Resource
|
13
13
|
When I make invalid changes to that Resource
|
14
14
|
When I try to save the Resource
|
15
15
|
Then the Resource should not save
|
16
|
-
|
16
|
+
|
17
17
|
Scenario: remote app supplies a new valid Resource associated with another new valid Resource
|
18
18
|
Given a new Resource
|
19
19
|
And another new Resource associated with the first
|
20
20
|
When I try to save the first Resource
|
21
21
|
Then both Resources should save
|
22
|
-
|
22
|
+
|
23
23
|
Scenario: remote app supplies a new invalid Resource associated with another new valid Resource
|
24
24
|
Given a new invalid Resouce
|
25
25
|
And another new Resource associated with the first
|
26
26
|
When I try to save the first Resource
|
27
27
|
Neither Resource should save
|
28
|
-
|
28
|
+
|
29
29
|
Scenario: remote app supplies a new valid Resource associated with another new invalid Resource
|
30
30
|
Given a new Resource
|
31
31
|
And another new invalid Resource associated with the first
|
32
32
|
When I try to save the first Resource
|
33
33
|
Neither Resource should save
|
34
|
-
|
34
|
+
|
35
35
|
Scenario: remote app supplies a new invalid Resource associated with another new invalid Resource
|
36
36
|
Given a new invalid Resource
|
37
37
|
And another new invalid Resource associated with the first
|
data/stories/crud/read
CHANGED
@@ -7,30 +7,30 @@ Story: remote app wants to access one or more Resources
|
|
7
7
|
Given a type of Resource
|
8
8
|
When I request all of the Resources of that type
|
9
9
|
Then I should not receive an empty list
|
10
|
-
|
10
|
+
|
11
11
|
Scenario: GET <resource>/<id>
|
12
12
|
Given a type of Resource
|
13
13
|
And the ID of an existing Resource
|
14
14
|
When I request the Resource
|
15
15
|
Then I should receive that Resource
|
16
|
-
|
16
|
+
|
17
17
|
Scenario: GET <resource>/<invalid id>
|
18
18
|
Given a type of Resource
|
19
19
|
And the ID of a nonexistent Resource
|
20
20
|
When I request the Resource
|
21
21
|
Then I should get nothing in return
|
22
|
-
|
22
|
+
|
23
23
|
Scenario: GET <nested resource>/<id>
|
24
24
|
Given a Resource that returns associated resources
|
25
25
|
And the ID of an existing Resource that has associated Resources
|
26
|
-
And I have all of the necessary class definitions
|
26
|
+
And I have all of the necessary class definitions
|
27
27
|
When I GET <nested resource>/<id>
|
28
28
|
Then I should get the Resource
|
29
29
|
And the Resource will have associated Resources
|
30
|
-
|
30
|
+
|
31
31
|
Scenario: GET <nested resource>/<id> but we are missing some class definitions
|
32
32
|
Given a Resource that returns associated resources
|
33
33
|
And the ID of an existing Resource that has associated Resources
|
34
|
-
And I do not have all of the necessary class definitions
|
34
|
+
And I do not have all of the necessary class definitions
|
35
35
|
When I GET <nested resource>/<id>
|
36
36
|
Then I should get an Exception
|
data/stories/crud/update
CHANGED
@@ -7,28 +7,28 @@ Story: remote app wants to update a resource
|
|
7
7
|
Given a local representation of a remote Resource
|
8
8
|
When I make valid changes to that Resource
|
9
9
|
And I try to save the Resource
|
10
|
-
Then the Resource should save
|
11
|
-
|
10
|
+
Then the Resource should save
|
11
|
+
|
12
12
|
Scenario: remote app updates with invalid changes to a resource's state
|
13
13
|
Given a local representation of a remote Resource
|
14
14
|
When I make invalid changes to that Resource
|
15
15
|
And I try to save the Resource
|
16
16
|
Then the Resource should not save
|
17
|
-
|
17
|
+
|
18
18
|
Scenario: remote app updates with changes to an object and one of its children
|
19
19
|
Given a local representation of a remote Resource
|
20
20
|
And a local representation of one of that Resource's child Resources
|
21
21
|
When I make valid changes to the parent Resource
|
22
22
|
And I make valid changes to the child Resource
|
23
23
|
Then both Resources should save
|
24
|
-
|
24
|
+
|
25
25
|
Scenario: remote app updates with valid changes to an object and invalid changes to one of its children
|
26
26
|
Given a local representation of a remote Resource
|
27
27
|
And a local representation of one of that Resource's child Resources
|
28
28
|
When I make valid changes to the parent Resource
|
29
29
|
And I make invalid changes to the child Resource
|
30
30
|
Then neither Resource should save
|
31
|
-
|
31
|
+
|
32
32
|
Scenario: remote app updates with invalid changes to an object and valid changes to one of its children
|
33
33
|
Given a local representation of a remote Resource
|
34
34
|
And a local representation of one of that Resource's child Resources
|
@@ -36,7 +36,7 @@ Story: remote app wants to update a resource
|
|
36
36
|
And I make valid changes to the child Resource
|
37
37
|
Then neither Resource should save
|
38
38
|
|
39
|
-
Scenario: remote app updates with invalid changes to an object and invalid changes to one of its children
|
39
|
+
Scenario: remote app updates with invalid changes to an object and invalid changes to one of its children
|
40
40
|
Given a local representation of a remote Resource
|
41
41
|
And a local representation of one of that Resource's child Resources
|
42
42
|
When I make invalid changes to the parent Resource
|
data/stories/helper.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
-
|
1
|
+
require 'pathname'
|
2
2
|
require 'rubygems'
|
3
|
-
require 'spec'
|
4
3
|
require 'tempfile'
|
4
|
+
|
5
|
+
gem 'dm-core', '~>0.9.8'
|
5
6
|
require 'dm-core'
|
6
|
-
|
7
|
-
|
8
|
-
require
|
9
|
-
|
7
|
+
|
8
|
+
gem 'rspec', '~>1.1.11'
|
9
|
+
require 'spec'
|
10
|
+
|
11
|
+
ROOT = Pathname(__FILE__).dirname.parent.expand_path
|
12
|
+
|
13
|
+
# use local dm-serializer if running from dm-more directly
|
14
|
+
lib = ROOT.parent.parent.join('dm-serializer', 'lib').expand_path
|
15
|
+
$LOAD_PATH.unshift(lib) if lib.directory?
|
16
|
+
|
17
|
+
require ROOT + 'lib/rest_adapter'
|
18
|
+
require ROOT + 'stories/resources/helpers/story_helper'
|
19
|
+
require ROOT + 'stories/resources/steps/using_rest_adapter'
|
data/tasks/install.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
def sudo_gem(cmd)
|
2
|
+
sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
|
3
|
+
end
|
4
|
+
|
5
|
+
desc "Install #{GEM_NAME} #{GEM_VERSION}"
|
6
|
+
task :install => [ :package ] do
|
7
|
+
sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
|
11
|
+
task :uninstall => [ :clobber ] do
|
12
|
+
sudo_gem "uninstall #{GEM_NAME} -v#{GEM_VERSION} -Ix"
|
13
|
+
end
|
data/tasks/spec.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rspec', '~>1.1.11'
|
3
|
+
require 'spec'
|
4
|
+
require 'spec/rake/spectask'
|
5
|
+
|
6
|
+
task :default => [ :spec ]
|
7
|
+
|
8
|
+
desc 'Run specifications'
|
9
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
10
|
+
t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
|
11
|
+
t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
|
12
|
+
|
13
|
+
begin
|
14
|
+
gem 'rcov', '~>0.8'
|
15
|
+
t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
|
16
|
+
t.rcov_opts << '--exclude' << 'spec'
|
17
|
+
t.rcov_opts << '--text-summary'
|
18
|
+
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
19
|
+
rescue LoadError
|
20
|
+
# rcov not installed
|
21
|
+
end
|
22
|
+
end
|
23
|
+
rescue LoadError
|
24
|
+
# rspec not installed
|
25
|
+
end
|
data/tasks/stories.rb
ADDED
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.8
|
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-12-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -18,23 +18,13 @@ dependencies:
|
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.9.
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: hoe
|
27
|
-
type: :development
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.8.2
|
23
|
+
version: 0.9.8
|
34
24
|
version:
|
35
25
|
description: REST Adapter for DataMapper
|
36
26
|
email:
|
37
|
-
- potomac-ruby-hackers
|
27
|
+
- potomac-ruby-hackers [a] googlegroups [d] com
|
38
28
|
executables: []
|
39
29
|
|
40
30
|
extensions: []
|
@@ -43,6 +33,7 @@ extra_rdoc_files:
|
|
43
33
|
- README.txt
|
44
34
|
- LICENSE
|
45
35
|
- TODO
|
36
|
+
- History.txt
|
46
37
|
files:
|
47
38
|
- History.txt
|
48
39
|
- LICENSE
|
@@ -141,8 +132,11 @@ files:
|
|
141
132
|
- stories/resources/helpers/story_helper.rb
|
142
133
|
- stories/resources/steps/read.rb
|
143
134
|
- stories/resources/steps/using_rest_adapter.rb
|
135
|
+
- tasks/install.rb
|
136
|
+
- tasks/spec.rb
|
137
|
+
- tasks/stories.rb
|
144
138
|
has_rdoc: true
|
145
|
-
homepage: http://github.com/
|
139
|
+
homepage: http://github.com/sam/dm-more/tree/master/adapters/dm-rest-adapter
|
146
140
|
post_install_message:
|
147
141
|
rdoc_options:
|
148
142
|
- --main
|