couch_publish 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. data/VERSION +1 -0
  2. data/readme.markdown +67 -0
  3. metadata +26 -12
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.3
@@ -0,0 +1,67 @@
1
+ # Introduction
2
+
3
+ Powerful, easy-to-use publishing logic, for couchdb documents. Relies on the `memories` gem for versioning.
4
+
5
+ ## Installation
6
+
7
+ This be a gem. Install it.
8
+
9
+ # gem install couch_publish
10
+
11
+ Then, include `CouchPublish` in your `CouchRest::Model::Base` derived classes.
12
+
13
+ class Article < CouchRest::Model::Base
14
+ include CouchPublish
15
+
16
+ property :title
17
+ property :author
18
+ property :body
19
+ end
20
+ ## Publishing
21
+
22
+ Wanna publish a document? Awesome. There's a `publish!` method. First, save your document, then `publish!` it!
23
+
24
+ @article = Article.create :title => 'Publishing made simple!', :author => 'moonmaster9000', :body => 'CouchPublish makes publishing simple'
25
+ @article.publish!
26
+
27
+ Wanna know if the current version of your document is published? Simple!
28
+
29
+ @article.published? #==> true, since the current version is published
30
+
31
+ ## Drafts
32
+
33
+ So you've published a document. Now you want to make some more changes, but your not ready to publish those. Simple!
34
+
35
+ @article.title = 'Publishing gets simpler'
36
+ @article.save
37
+ @article.draft? #==> true
38
+ @article.previously_published? # ==> true
39
+
40
+ ## Drafts are cool, but how do I go back to the published version?
41
+
42
+ But, you ask, how do you access the last published version of your document? Simple!
43
+
44
+ @article.last_published_version #==> an instance of the last published version
45
+
46
+ But, you ask, how do you access an array of all the published versions of your document? Simple!
47
+
48
+ @article.published_versions #==> an array of Memories::MilestoneProxy's of all the published versions.
49
+ @article.published_versions.first.revision #==> 'rev-2-jklfdsjklfdsjalkfdsa'
50
+ @article.published_versions.first.version_number #==> 2
51
+ @article.published_versions.first.instance #==> an instance of the first published version
52
+
53
+ ## Accessing the old published version is nice, but I want to discard the draft and revert back to the last published version
54
+
55
+ Discard the working draft, you say? Simple!
56
+
57
+ @article.discard_draft! #==> reverts the document back to the last published state and saves
58
+ @article.published? # ==> true, since the current version is now published
59
+
60
+ But, you say, what if I want to discard the working draft and revert back to the last published state, but I want to save it on my own, and optionally publish the reversion? Simple!
61
+
62
+ @article.discard_draft #==> reverts the document back to the last published state, but doesn't save
63
+ @article.published? # ==> false, since the current version, though reverted, has not been saved
64
+ @article.save
65
+ @article.published? # ==> false! it's up to you now to decide if/when you publish this reversion.
66
+
67
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_publish
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 25
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Parker
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-17 00:00:00 -05:00
19
- default_executable:
18
+ date: 2011-07-26 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: memories
@@ -26,14 +25,28 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 21
28
+ hash: 31
30
29
  segments:
31
30
  - 0
32
31
  - 3
33
- - 3
34
- version: 0.3.3
32
+ - 6
33
+ version: 0.3.6
35
34
  type: :runtime
36
35
  version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :development
49
+ version_requirements: *id002
37
50
  description: Rides on top of the `memories` gem to add simple publishing functionality with rollback and preview support.
38
51
  email: moonmaster9000@gmail.com
39
52
  executables: []
@@ -43,11 +56,12 @@ extensions: []
43
56
  extra_rdoc_files: []
44
57
 
45
58
  files:
46
- - lib/couch_publish.rb
47
59
  - lib/couch_publish/couch_publish.rb
60
+ - lib/couch_publish.rb
61
+ - VERSION
62
+ - readme.markdown
48
63
  - spec/lib/couch_publish_spec.rb
49
64
  - spec/spec_helper.rb
50
- has_rdoc: true
51
65
  homepage: http://github.com/moonmaster9000/couch_publish
52
66
  licenses: []
53
67
 
@@ -77,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
91
  requirements: []
78
92
 
79
93
  rubyforge_project:
80
- rubygems_version: 1.3.7
94
+ rubygems_version: 1.8.5
81
95
  signing_key:
82
96
  specification_version: 3
83
97
  summary: Publishing functionality for couchdb documents.