boombera 0.2.2 → 0.2.3
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/README.rdoc +4 -0
- data/VERSION +1 -1
- data/boombera.gemspec +1 -1
- data/lib/boombera.rb +10 -10
- data/spec/lib/boombera_spec.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -40,6 +40,10 @@ Boombera's content-mapping functionality reduces both the size of the database
|
|
40
40
|
and the necessary network traffic for database updates when much of the content
|
41
41
|
is identical between customers and/or deployment stages.
|
42
42
|
|
43
|
+
== Installation
|
44
|
+
|
45
|
+
gem install boombera
|
46
|
+
|
43
47
|
== Usage Examples
|
44
48
|
|
45
49
|
See the documentation on the Boombera class.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/boombera.gemspec
CHANGED
data/lib/boombera.rb
CHANGED
@@ -3,7 +3,7 @@ require 'couchrest'
|
|
3
3
|
|
4
4
|
# This is the main interface to the Boombera content repository.
|
5
5
|
#
|
6
|
-
# Usage examples:
|
6
|
+
# == Usage examples:
|
7
7
|
#
|
8
8
|
# # install/update the CouchDB design document
|
9
9
|
# Boombera.install_design_doc!('my_database')
|
@@ -61,16 +61,16 @@ class Boombera
|
|
61
61
|
# Exception is raised when connecting to a Boombera CouchDB database that
|
62
62
|
# expects a different version of the Boombera library than the one currently
|
63
63
|
# being used.
|
64
|
-
VersionMismatch
|
64
|
+
class VersionMismatch < StandardError; end
|
65
65
|
|
66
66
|
# Exception is raised when attempting to create a content mapping and the
|
67
67
|
# source document doesn't exist.
|
68
|
-
InvalidMapping
|
68
|
+
class InvalidMapping < RuntimeError; end
|
69
69
|
|
70
70
|
extend Boombera::Information
|
71
71
|
|
72
72
|
# The CouchRest::Database instance
|
73
|
-
attr_reader :
|
73
|
+
attr_reader :database
|
74
74
|
|
75
75
|
# Connects to the CouchDB server and verifies the database version.
|
76
76
|
#
|
@@ -81,7 +81,7 @@ class Boombera
|
|
81
81
|
#
|
82
82
|
# raises:: VersionMismatch
|
83
83
|
def initialize(database_name)
|
84
|
-
@
|
84
|
+
@database = CouchRest.database!(database_name)
|
85
85
|
check_database_version!
|
86
86
|
end
|
87
87
|
|
@@ -111,7 +111,7 @@ class Boombera
|
|
111
111
|
# +path+:: should be a String with /-separated tokens (i.e. "/foo/bar/baz").
|
112
112
|
def put(path, body)
|
113
113
|
content_item = get_pointer(path) and content_item.body = body
|
114
|
-
content_item ||= ContentItem.new(path, body,
|
114
|
+
content_item ||= ContentItem.new(path, body, database)
|
115
115
|
content_item.save
|
116
116
|
end
|
117
117
|
|
@@ -119,7 +119,7 @@ class Boombera
|
|
119
119
|
# is found. If +path+ is mapped to another ContentItem, the resolved
|
120
120
|
# ContentItem will be returned.
|
121
121
|
def get(path)
|
122
|
-
ContentItem::MapResolver.new(path,
|
122
|
+
ContentItem::MapResolver.new(path, database).resolve
|
123
123
|
end
|
124
124
|
|
125
125
|
# Creates a content mapping so that two paths can reference the same content
|
@@ -131,7 +131,7 @@ class Boombera
|
|
131
131
|
#
|
132
132
|
# raises:: InvalidMapping
|
133
133
|
def map(path, source_path)
|
134
|
-
content_map = get_pointer(path) || ContentItem.new(path, nil,
|
134
|
+
content_map = get_pointer(path) || ContentItem.new(path, nil, database)
|
135
135
|
content_map.map_to source_path
|
136
136
|
content_map.save
|
137
137
|
end
|
@@ -139,11 +139,11 @@ class Boombera
|
|
139
139
|
private
|
140
140
|
|
141
141
|
def get_pointer(path)
|
142
|
-
ContentItem::MapResolver.new(path,
|
142
|
+
ContentItem::MapResolver.new(path, database, :resolve_map => false).resolve
|
143
143
|
end
|
144
144
|
|
145
145
|
def check_database_version!
|
146
|
-
database_version = Boombera.database_version(
|
146
|
+
database_version = Boombera.database_version(database)
|
147
147
|
unless Boombera.version == database_version
|
148
148
|
msg = if database_version.nil?
|
149
149
|
"Database does not specify a Boombera version"
|
data/spec/lib/boombera_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe Boombera do
|
|
21
21
|
.with("my_db") \
|
22
22
|
.and_return(db)
|
23
23
|
boombera = Boombera.new('my_db')
|
24
|
-
boombera.
|
24
|
+
boombera.database.should == db
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'raises a VersionMismatch error with expected version if the database does not match VERSION' do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: boombera
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John Wilger
|
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
hash:
|
169
|
+
hash: 2561778337164614726
|
170
170
|
segments:
|
171
171
|
- 0
|
172
172
|
version: "0"
|