couchdb 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,6 +36,10 @@ module CouchDB
36
36
  delete! if exists?
37
37
  end
38
38
 
39
+ def compact!
40
+ Transport::JSON.request :post, "#{url}/_compact", authentication_options.merge(:expected_status_code => 202, :body => { })
41
+ end
42
+
39
43
  def information
40
44
  Transport::JSON.request :get, url, authentication_options.merge(:expected_status_code => 200)
41
45
  end
@@ -33,6 +33,24 @@ describe "database management" do
33
33
 
34
34
  end
35
35
 
36
+ describe "compacting a database" do
37
+
38
+ before :each do
39
+ @database.delete_if_exists!
40
+ @database.create_if_missing!
41
+
42
+ @document = CouchDB::Document.new @database, "_id" => "test_document_1", "test" => "test value"
43
+ @document.save
44
+ @document.destroy
45
+ end
46
+
47
+ it "should remove destroyed documents" do
48
+ @database.compact!
49
+ @database.information["compact_running"].should be_true
50
+ end
51
+
52
+ end
53
+
36
54
  describe "fetching information about a database" do
37
55
 
38
56
  before :each do
@@ -102,6 +102,20 @@ describe CouchDB::Database do
102
102
 
103
103
  end
104
104
 
105
+ describe "compact!" do
106
+
107
+ it "should compact the database" do
108
+ Transport::JSON.should_receive(:request).with(
109
+ :post,
110
+ "http://host:1234/test/_compact",
111
+ :expected_status_code => 202,
112
+ :body => { }
113
+ )
114
+ @database.compact!
115
+ end
116
+
117
+ end
118
+
105
119
  describe "information" do
106
120
 
107
121
  it "should request database information" do
metadata CHANGED
@@ -1,77 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: couchdb
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
11
6
  platform: ruby
12
- authors:
13
- - "Philipp Br\xC3\xBCll"
7
+ authors:
8
+ - Philipp Brüll
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-10 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-19 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: transport
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &8895720 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 21
30
- segments:
31
- - 1
32
- - 0
33
- - 1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
34
21
  version: 1.0.1
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *8895720
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &8890840 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 7
46
- segments:
47
- - 2
48
- version: "2"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
49
33
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: reek
53
34
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *8890840
36
+ - !ruby/object:Gem::Dependency
37
+ name: reek
38
+ requirement: &8888160 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 11
60
- segments:
61
- - 1
62
- - 2
63
- version: "1.2"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '1.2'
64
44
  type: :development
65
- version_requirements: *id003
66
- description: A straight-forward client for CouchDB REST API. The resources exposed by the API are simply wrapped into classes.
45
+ prerelease: false
46
+ version_requirements: *8888160
47
+ description: A straight-forward client for CouchDB REST API. The resources exposed
48
+ by the API are simply wrapped into classes.
67
49
  email: b.phifty@gmail.com
68
50
  executables: []
69
-
70
51
  extensions: []
71
-
72
- extra_rdoc_files:
52
+ extra_rdoc_files:
73
53
  - README.rdoc
74
- files:
54
+ files:
75
55
  - README.rdoc
76
56
  - LICENSE
77
57
  - Rakefile
@@ -100,41 +80,31 @@ files:
100
80
  - spec/acceptance/server_spec.rb
101
81
  - spec/acceptance/database_security_spec.rb
102
82
  - spec/acceptance/document_handling_spec.rb
103
- has_rdoc: true
104
83
  homepage: http://github.com/phifty/couchdb
105
84
  licenses: []
106
-
107
85
  post_install_message:
108
86
  rdoc_options: []
109
-
110
- require_paths:
87
+ require_paths:
111
88
  - lib
112
- required_ruby_version: !ruby/object:Gem::Requirement
89
+ required_ruby_version: !ruby/object:Gem::Requirement
113
90
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 3
118
- segments:
119
- - 0
120
- version: "0"
121
- required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
96
  none: false
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- hash: 3
127
- segments:
128
- - 0
129
- version: "0"
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
130
101
  requirements: []
131
-
132
102
  rubyforge_project: couchdb
133
- rubygems_version: 1.6.2
103
+ rubygems_version: 1.8.10
134
104
  signing_key:
135
105
  specification_version: 3
136
106
  summary: A straight-forward client for CouchDB REST API.
137
- test_files:
107
+ test_files:
138
108
  - spec/lib/couchdb/row_spec.rb
139
109
  - spec/lib/couchdb/database_spec.rb
140
110
  - spec/lib/couchdb/document_spec.rb