rocking_chair 0.1.0 → 0.2.0
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/lib/rocking_chair.rb +12 -12
- data/lib/rocking_chair/couch_rest_http_adapter.rb +5 -5
- data/lib/rocking_chair/http_adapter.rb +35 -0
- metadata +20 -4
data/lib/rocking_chair.rb
CHANGED
@@ -16,31 +16,31 @@ require "rocking_chair/view"
|
|
16
16
|
require "rocking_chair/database"
|
17
17
|
require "rocking_chair/server"
|
18
18
|
require "rocking_chair/couch_rest_http_adapter"
|
19
|
+
require "rocking_chair/http_adapter"
|
20
|
+
|
19
21
|
|
20
22
|
module RockingChair
|
21
|
-
|
22
|
-
@_rocking_chair_enabled
|
23
|
+
|
24
|
+
@_rocking_chair_enabled = false
|
23
25
|
|
24
26
|
def self.enable
|
25
|
-
|
26
|
-
HttpAbstraction.extend(RockingChair::CouchRestHttpAdapter)
|
27
|
-
@_rocking_chair_enabled = true
|
28
|
-
end
|
27
|
+
@_rocking_chair_enabled = true
|
29
28
|
end
|
30
29
|
|
31
30
|
def self.disable
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
@_rocking_chair_enabled = false
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.enabled?
|
35
|
+
@_rocking_chair_enabled
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.enable_debug
|
39
|
-
|
39
|
+
RockingChair::CouchRestHttpAdapter.instance_variable_set("@_rocking_chair_debug", true)
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.disable_debug
|
43
|
-
|
43
|
+
RockingChair::CouchRestHttpAdapter.instance_variable_set("@_rocking_chair_debug", false)
|
44
44
|
end
|
45
45
|
|
46
46
|
end
|
@@ -4,7 +4,7 @@ module RockingChair
|
|
4
4
|
|
5
5
|
@_rocking_chair_debug = false
|
6
6
|
|
7
|
-
def get(uri, headers={})
|
7
|
+
def self.get(uri, headers={})
|
8
8
|
puts "GET: #{uri.inspect}: #{headers.inspect}" if @_rocking_chair_debug
|
9
9
|
url, parameters = RockingChair::Server.normalize_url(uri)
|
10
10
|
if url == ''
|
@@ -28,7 +28,7 @@ module RockingChair
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def post(uri, payload, headers={})
|
31
|
+
def self.post(uri, payload, headers={})
|
32
32
|
puts "POST: #{uri.inspect}: #{payload.inspect} #{headers.inspect}" if @_rocking_chair_debug
|
33
33
|
url, parameters = RockingChair::Server.normalize_url(uri)
|
34
34
|
if url.match(/\A(#{URL_PARAMETER})\/?\Z/)
|
@@ -40,7 +40,7 @@ module RockingChair
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def put(uri, payload, headers={})
|
43
|
+
def self.put(uri, payload, headers={})
|
44
44
|
puts "PUT: #{uri.inspect}: #{payload.inspect} #{headers.inspect}" if @_rocking_chair_debug
|
45
45
|
url, parameters = RockingChair::Server.normalize_url(uri)
|
46
46
|
if url.match(/\A(#{URL_PARAMETER})\Z/)
|
@@ -54,7 +54,7 @@ module RockingChair
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def delete(uri, headers={})
|
57
|
+
def self.delete(uri, headers={})
|
58
58
|
puts "DELETE: #{uri.inspect}: #{headers.inspect}" if @_rocking_chair_debug
|
59
59
|
url, parameters = RockingChair::Server.normalize_url(uri)
|
60
60
|
if url.match(/\A(#{URL_PARAMETER})\Z/)
|
@@ -68,7 +68,7 @@ module RockingChair
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
def copy(uri, headers)
|
71
|
+
def self.copy(uri, headers)
|
72
72
|
puts "COPY: #{uri.inspect}: #{headers.inspect}" if @_rocking_chair_debug
|
73
73
|
url, parameters = RockingChair::Server.normalize_url(uri)
|
74
74
|
if url.match(/\A(#{URL_PARAMETER})\/(#{URL_PARAMETER})\Z/)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module RockingChair
|
2
|
+
module HttpAdapter
|
3
|
+
|
4
|
+
def http_adapter
|
5
|
+
if RockingChair.enabled?
|
6
|
+
RockingChair::CouchRestHttpAdapter
|
7
|
+
else
|
8
|
+
RestClientAdapter::API
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def get(uri, headers=nil)
|
13
|
+
http_adapter.get(uri, headers)
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(uri, payload, headers=nil)
|
17
|
+
http_adapter.post(uri, payload, headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def put(uri, payload, headers=nil)
|
21
|
+
http_adapter.put(uri, payload, headers)
|
22
|
+
end
|
23
|
+
|
24
|
+
def delete(uri, headers=nil)
|
25
|
+
http_adapter.delete(uri, headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def copy(uri, headers)
|
29
|
+
http_adapter.copy(uri, headers)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
HttpAbstraction.extend(RockingChair::HttpAdapter)
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocking_chair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Jonathan Weiss
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-14 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: simply_stored
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 1
|
@@ -48,8 +51,17 @@ files:
|
|
48
51
|
- lib/rocking_chair/database.rb
|
49
52
|
- lib/rocking_chair/error.rb
|
50
53
|
- lib/rocking_chair/helper.rb
|
54
|
+
- lib/rocking_chair/http_adapter.rb
|
51
55
|
- lib/rocking_chair/server.rb
|
52
56
|
- lib/rocking_chair/view.rb
|
57
|
+
- test/couch_rest_test.rb
|
58
|
+
- test/database_test.rb
|
59
|
+
- test/extended_couch_rest_test.rb
|
60
|
+
- test/fixtures/extended_couch_rest_fixtures.rb
|
61
|
+
- test/fixtures/simply_stored_fixtures.rb
|
62
|
+
- test/simply_stored_test.rb
|
63
|
+
- test/test_helper.rb
|
64
|
+
- test/view_test.rb
|
53
65
|
has_rdoc: true
|
54
66
|
homepage: http://github.com/jweiss/rocking_chair
|
55
67
|
licenses: []
|
@@ -60,23 +72,27 @@ rdoc_options:
|
|
60
72
|
require_paths:
|
61
73
|
- lib
|
62
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
63
76
|
requirements:
|
64
77
|
- - ">="
|
65
78
|
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
66
80
|
segments:
|
67
81
|
- 0
|
68
82
|
version: "0"
|
69
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
70
85
|
requirements:
|
71
86
|
- - ">="
|
72
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
73
89
|
segments:
|
74
90
|
- 0
|
75
91
|
version: "0"
|
76
92
|
requirements: []
|
77
93
|
|
78
94
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.3.
|
95
|
+
rubygems_version: 1.3.7
|
80
96
|
signing_key:
|
81
97
|
specification_version: 3
|
82
98
|
summary: In-memory CouchDB for Couchrest and SimplyStored
|