simply_stored 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -1
- data/lib/simply_stored/couch.rb +13 -0
- data/lib/simply_stored/rake.rb +11 -0
- data/lib/simply_stored.rb +2 -2
- data/test/instance_lifecycle_test.rb +9 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
Changelog
|
2
2
|
=============
|
3
3
|
|
4
|
-
0.5.
|
4
|
+
0.5.4
|
5
|
+
|
6
|
+
- Add Rake task to compact all views in a given database:
|
7
|
+
DATABASE=http://localhost:5984/my_db rake simply_stored:compact_design_documents
|
8
|
+
|
9
|
+
0.5.3
|
5
10
|
|
6
11
|
- Change implementation of all_documents_without_deleted view so that it can now be passed view parameters
|
7
12
|
|
data/lib/simply_stored/couch.rb
CHANGED
@@ -182,6 +182,19 @@ module SimplyStored
|
|
182
182
|
end
|
183
183
|
design_docs.size
|
184
184
|
end
|
185
|
+
|
186
|
+
def self.compact_all_design_documents(database)
|
187
|
+
db = CouchRest.database(database)
|
188
|
+
db.info # ensure DB exists
|
189
|
+
design_docs = CouchRest.get("#{database}/_all_docs?startkey=%22_design%22&endkey=%22_design0%22")['rows'].map do |row|
|
190
|
+
[row['id'], row['value']['rev']]
|
191
|
+
end
|
192
|
+
design_docs.each do |doc_id, rev|
|
193
|
+
puts "#{database}/_compact/#{doc_id.gsub("_design/",'')}"
|
194
|
+
CouchRest.post("#{database}/_compact/#{doc_id.gsub("_design/",'')}")
|
195
|
+
end
|
196
|
+
design_docs.size
|
197
|
+
end
|
185
198
|
|
186
199
|
end
|
187
200
|
end
|
data/lib/simply_stored/rake.rb
CHANGED
@@ -9,4 +9,15 @@ namespace :simply_stored do
|
|
9
9
|
puts "please specify which database to clear: DATABASE=http://localhost:5984/simply_stored rake simply_stored:delete_design_documents"
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
desc "compact all design documents"
|
14
|
+
task :compact_design_documents do
|
15
|
+
require File.dirname(__FILE__) + "/couch"
|
16
|
+
if database = ENV['DATABASE']
|
17
|
+
compacted = SimplyStored::Couch.compact_all_design_documents(database)
|
18
|
+
puts "triggered compaction of #{compacted} design documents in #{database}"
|
19
|
+
else
|
20
|
+
puts "please specify which database to clear: DATABASE=http://localhost:5984/simply_stored rake simply_stored:delete_design_documents"
|
21
|
+
end
|
22
|
+
end
|
12
23
|
end
|
data/lib/simply_stored.rb
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path(File.dirname(__FILE__) + '/simply_stored/storage')
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/simply_stored/class_methods_base')
|
5
5
|
|
6
6
|
module SimplyStored
|
7
|
-
VERSION = '0.5.
|
7
|
+
VERSION = '0.5.4'
|
8
8
|
class Error < RuntimeError; end
|
9
9
|
class RecordNotFound < RuntimeError; end
|
10
10
|
end
|
11
11
|
|
12
|
-
require File.expand_path(File.dirname(__FILE__) + '/simply_stored/couch')
|
12
|
+
require File.expand_path(File.dirname(__FILE__) + '/simply_stored/couch')
|
@@ -17,6 +17,15 @@ class InstanceLifecycleTest < Test::Unit::TestCase
|
|
17
17
|
user.posts
|
18
18
|
assert_equal 1, SimplyStored::Couch.delete_all_design_documents(db)
|
19
19
|
end
|
20
|
+
|
21
|
+
should "compact all" do
|
22
|
+
db = "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
|
23
|
+
assert_equal 0, SimplyStored::Couch.compact_all_design_documents(db)
|
24
|
+
user = User.create
|
25
|
+
Post.create(:user => user)
|
26
|
+
user.posts
|
27
|
+
assert_equal 1, SimplyStored::Couch.compact_all_design_documents(db)
|
28
|
+
end
|
20
29
|
end
|
21
30
|
|
22
31
|
context "when creating instances" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simply_stored
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 4
|
10
|
+
version: 0.5.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mathias Meyer, Jonathan Weiss
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-14 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|