act_as_releasable 0.0.4 → 0.0.5
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.md +50 -6
- data/act_as_releasable.gemspec +2 -2
- data/lib/act_as_releasable/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# ActAsReleasable
|
2
2
|
|
3
|
-
|
3
|
+
A simple way to manage approval of ActiveRecord models.
|
4
|
+
Using ActAsReleasable you can keep track of changed data by creating a candidate without modifying your current model.
|
5
|
+
When you need, you can just approve the changes and all data will be updated to your model.
|
6
|
+
|
7
|
+
## TL;DR
|
8
|
+
|
9
|
+
```.act_as_releasable :collections => [:name_if_any]``` on your model.
|
10
|
+
```#generate_new_candidate``` to apply changes to candidate(without saving).
|
11
|
+
```#release_candidate``` to get candidate from model.
|
12
|
+
```#release_version!``` to apply candidate changes to model.
|
13
|
+
```#has_changes_to_be_approved?``` to check if there is any candidate.
|
4
14
|
|
5
15
|
## Installation
|
6
16
|
|
@@ -8,17 +18,51 @@ Add this line to your application's Gemfile:
|
|
8
18
|
|
9
19
|
gem 'act_as_releasable'
|
10
20
|
|
11
|
-
And then execute:
|
21
|
+
And then execute (the second step is used to create the gem migrations):
|
12
22
|
|
13
23
|
$ bundle
|
24
|
+
$ rails generate act_as_releasable:install
|
14
25
|
|
15
|
-
|
26
|
+
## Usage
|
16
27
|
|
17
|
-
|
28
|
+
In order to make your model releasable, your must call the ```act_as_releasable``` method on your model, like this:
|
18
29
|
|
19
|
-
|
30
|
+
class Article
|
31
|
+
act_as_releasable
|
32
|
+
end
|
33
|
+
|
34
|
+
After created, any model who act as releasable is able to generate a candidate.
|
35
|
+
|
36
|
+
article = Article.find(5) # <Article id: 5, title: "Whoa! ActAsReleasable is live!", ...>
|
37
|
+
article.title = "ActAsRelesable just received some care :)"
|
38
|
+
article.generate_new_candidate
|
39
|
+
|
40
|
+
Every ActiveRecord::Base model will work as usual, unless you specify it to behave like releasable(I mean, no AR method is overrided).
|
41
|
+
|
42
|
+
After creating a new candidate, you can load it by doing the following.
|
43
|
+
|
44
|
+
article = Article.find(5) # <Article id: 5, title: "Whoa! ActAsReleasable is live!", ...>
|
45
|
+
# ...
|
46
|
+
article.release_candidate.title # "ActAsRelesable just received some care :)"
|
47
|
+
|
48
|
+
To approve a candidate, you should use the ```release_version!``` method.
|
49
|
+
|
50
|
+
article = Article.find(5) # <Article id: 5, title: "Whoa! ActAsReleasable is live!", ...>
|
51
|
+
# ...
|
52
|
+
article.release_version!
|
53
|
+
article = Article.find(5) # <Article id: 5, title: "ActAsRelesable just received some care :)", ...>
|
54
|
+
|
55
|
+
###The last but not the least:
|
56
|
+
|
57
|
+
You can have candidates for collections, by specifying them like this:
|
58
|
+
|
59
|
+
class Article
|
60
|
+
act_as_releasable :collections => [:comments]
|
61
|
+
end
|
62
|
+
|
63
|
+
And check if the model has any change to be approved.
|
20
64
|
|
21
|
-
|
65
|
+
article.has_changes_to_be_approved?
|
22
66
|
|
23
67
|
## Contributing
|
24
68
|
|
data/act_as_releasable.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ["Gregório Kusowski"]
|
6
6
|
gem.email = ["gregorio.kusowski@gmail.com"]
|
7
7
|
gem.description = %q{Make your models work with a release candidate that must be approved}
|
8
|
-
gem.summary =
|
9
|
-
gem.homepage = ""
|
8
|
+
gem.summary = "act_as_releasable-#{ActAsReleasable::VERSION}"
|
9
|
+
gem.homepage = "https://github.com/gregoriokusowski/act_as_releasable"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: act_as_releasable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -152,7 +152,7 @@ files:
|
|
152
152
|
- spec/release_spec.rb
|
153
153
|
- spec/spec_helper.rb
|
154
154
|
- spec/support/models.rb
|
155
|
-
homepage:
|
155
|
+
homepage: https://github.com/gregoriokusowski/act_as_releasable
|
156
156
|
licenses: []
|
157
157
|
post_install_message:
|
158
158
|
rdoc_options: []
|
@@ -175,7 +175,7 @@ rubyforge_project:
|
|
175
175
|
rubygems_version: 1.8.24
|
176
176
|
signing_key:
|
177
177
|
specification_version: 3
|
178
|
-
summary:
|
178
|
+
summary: act_as_releasable-0.0.5
|
179
179
|
test_files:
|
180
180
|
- spec/candidate_spec.rb
|
181
181
|
- spec/db/database.yml
|