boombera 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +54 -7
- data/VERSION +1 -1
- data/boombera.gemspec +1 -1
- data/lib/boombera.rb +4 -9
- data/lib/boombera/content_item.rb +30 -10
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,16 +1,63 @@
|
|
1
|
-
=
|
1
|
+
= Boombera
|
2
2
|
|
3
|
-
|
3
|
+
Boombera is a CouchDB-backed content repository aimed at multi-stage,
|
4
|
+
multi-tenant web applications. If your application supports multiple customers,
|
5
|
+
allows each customer to customize the content within their context, and goes
|
6
|
+
through a staged deployment process (alpha -> beta -> staging -> production,
|
7
|
+
etc.), then the Boombera content store can help you manage content that can be
|
8
|
+
inherited and possibly overridden down hierarchies of both customer and
|
9
|
+
environment.
|
4
10
|
|
5
|
-
==
|
11
|
+
== What Boombera Isn't
|
12
|
+
|
13
|
+
Boombera does not provide a GUI for managing content; it is *not* a CMS.
|
14
|
+
However, it does provide the code level interface for inserting content into the
|
15
|
+
database, so you could build a CMS on top of it.
|
16
|
+
|
17
|
+
Currently, Boombera does not attempt to understand the semantics of your
|
18
|
+
customer and deployment hierarchies. While you can map one content path to
|
19
|
+
another via the API, both your CMS and your consuming application must have
|
20
|
+
knowledge of these hierarchies and how they map to your content paths. This
|
21
|
+
hierarchy-awareness may be added to a future version of Boombera.
|
22
|
+
|
23
|
+
== Why Use Boombera
|
24
|
+
|
25
|
+
One of the major advantages of Boombera is CouchDB itself. CouchDB's excellent
|
26
|
+
replication makes it easy to have your CMS update content on it's local CouchDB
|
27
|
+
instance and have that content pushed out to replica databases on your
|
28
|
+
application servers. This means you don't need to communicate over the network
|
29
|
+
every time your application needs to fetch content.
|
30
|
+
|
31
|
+
Because CouchDB can replicate bi-directionally, it should also be possible to
|
32
|
+
support edit-in-place features within your application while still having that
|
33
|
+
content pushed back to your CMS and to any additional application servers.
|
34
|
+
Another application of this is to allow developers to work off-line, updating
|
35
|
+
content that is tied to the features they are working on, and then have that
|
36
|
+
updated content replicated back to the shared development infrastructure once
|
37
|
+
they are finished.
|
38
|
+
|
39
|
+
Boombera's content-mapping functionality reduces both the size of the database
|
40
|
+
and the necessary network traffic for database updates when much of the content
|
41
|
+
is identical between customers and/or deployment stages.
|
42
|
+
|
43
|
+
== Usage Examples
|
44
|
+
|
45
|
+
See the documentation on the Boombera class.
|
46
|
+
|
47
|
+
== Contributing to Boombera
|
6
48
|
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented
|
8
|
-
|
49
|
+
* Check out the latest master to make sure the feature hasn't been implemented
|
50
|
+
or the bug hasn't been fixed yet
|
51
|
+
* Check out the issue tracker to make sure someone already hasn't requested it
|
52
|
+
and/or contributed it
|
9
53
|
* Fork the project
|
10
54
|
* Start a feature/bugfix branch
|
11
55
|
* Commit and push until you are happy with your contribution
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a
|
13
|
-
|
56
|
+
* Make sure to add tests for it. This is important so I don't break it in a
|
57
|
+
future version unintentionally.
|
58
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to
|
59
|
+
have your own version, or is otherwise necessary, that is fine, but please
|
60
|
+
isolate to its own commit so I can cherry-pick around it.
|
14
61
|
|
15
62
|
== Copyright
|
16
63
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/boombera.gemspec
CHANGED
data/lib/boombera.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
$:.unshift(File.expand_path(File.dirname(__FILE__)))
|
2
2
|
require 'couchrest'
|
3
3
|
|
4
|
-
# Boombera constant is defined first as `Class.new` so that the definitions in
|
5
|
-
# the required files can use `class Boombera::Whatever` even with the `require`
|
6
|
-
# statements appearing before the actual class definition.
|
7
|
-
Boombera = Class.new
|
8
|
-
|
9
|
-
require 'boombera/content_item'
|
10
|
-
require 'boombera/information'
|
11
|
-
|
12
4
|
class Boombera
|
5
|
+
require 'boombera/content_item'
|
6
|
+
require 'boombera/information'
|
7
|
+
|
13
8
|
VersionMismatch = Class.new(StandardError)
|
14
9
|
InvalidMapping = Class.new(RuntimeError)
|
15
10
|
|
@@ -41,7 +36,7 @@ class Boombera
|
|
41
36
|
private
|
42
37
|
|
43
38
|
def check_database_version!
|
44
|
-
database_version
|
39
|
+
database_version = Boombera.database_version(db)
|
45
40
|
unless Boombera.version == database_version
|
46
41
|
msg = if database_version.nil?
|
47
42
|
"Database does not specify a Boombera version"
|
@@ -1,16 +1,36 @@
|
|
1
1
|
class Boombera::ContentItem < CouchRest::Document
|
2
|
-
class
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
class MapResolver
|
3
|
+
def initialize(path, database, options = {})
|
4
|
+
@path = path
|
5
|
+
@database = database
|
6
|
+
@final_attempt = options[:resolve_map] == false
|
7
|
+
end
|
8
|
+
|
9
|
+
def resolve
|
10
|
+
id, maps_to = content_map
|
11
|
+
return if id.nil?
|
12
|
+
if @final_attempt || maps_to == @path
|
13
|
+
Boombera::ContentItem.new(@database.get(id))
|
10
14
|
else
|
11
|
-
|
15
|
+
@path = maps_to
|
16
|
+
resolve
|
12
17
|
end
|
13
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def content_map
|
23
|
+
rows = @database.view('boombera/content_map', :key => @path)['rows']
|
24
|
+
return if rows.empty?
|
25
|
+
match = rows.first
|
26
|
+
[match['id'], match['value']]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class << self
|
31
|
+
def get(path, database, options = {})
|
32
|
+
MapResolver.new(path, database, options).resolve
|
33
|
+
end
|
14
34
|
end
|
15
35
|
|
16
36
|
attr_accessor :body
|
@@ -42,7 +62,7 @@ class Boombera::ContentItem < CouchRest::Document
|
|
42
62
|
|
43
63
|
def referenced_by
|
44
64
|
rows = @database.view('boombera/map_references', :key => path)['rows']
|
45
|
-
rows.map{ |
|
65
|
+
rows.map{ |row| row['value'] }.sort
|
46
66
|
end
|
47
67
|
|
48
68
|
# :nodoc:
|
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.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John Wilger
|
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
165
|
requirements:
|
166
166
|
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
hash: -
|
168
|
+
hash: -422599235011708873
|
169
169
|
segments:
|
170
170
|
- 0
|
171
171
|
version: "0"
|