durable_decorator_rails 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -4
- data/durable_decorator_rails.gemspec +1 -1
- data/lib/durable_decorator_rails/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -17,14 +17,30 @@ Or install it yourself as:
|
|
17
17
|
$ gem install durable_decorator_rails
|
18
18
|
|
19
19
|
## Usage
|
20
|
+
This gem will generate the correct file structure, place (or append to) the correct decorator and even insert the correct seal for you. Use:
|
21
|
+
```shell
|
22
|
+
rails g durable_decorator:decorator [SUBDIR] [FULL_METHOD_NAME]
|
23
|
+
```
|
24
|
+
|
25
|
+
For example, let us decorate the an existing ```#deleted?``` instance method from the gem that is namespaced under ```Spree``` in a file that is a *model* called ```Product```. Just run:
|
26
|
+
```shell
|
27
|
+
rails g durable_decorator:decorator models Spree::Product#deleted?
|
28
|
+
```
|
29
|
+
|
30
|
+
The gem will create the ```app/models/spree/product_decorator.rb``` file for you to start with, and it will have the following contents:
|
31
|
+
```ruby
|
32
|
+
Spree::Product.class_eval do
|
20
33
|
|
21
|
-
|
34
|
+
durably_decorate :deleted?, mode: 'strict', sha: '9dc99742ed3ebbdd5b2cbd7c3c93d730e5244e72' do
|
35
|
+
end
|
22
36
|
|
23
|
-
|
37
|
+
end
|
38
|
+
|
39
|
+
```
|
24
40
|
|
41
|
+
Otherwise, you may access the SHA of any method in memory with:
|
25
42
|
```shell
|
26
|
-
rake durable_decorator:determine_sha[
|
27
|
-
7c62cf476a2458d5eb401588d6f10db8bbecc8a6
|
43
|
+
rake durable_decorator:determine_sha[Spree::Product#deleted?]
|
28
44
|
```
|
29
45
|
|
30
46
|
## Contributing
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "durable_decorator", "~> 0.
|
21
|
+
spec.add_dependency "durable_decorator", "~> 0.2.0"
|
22
22
|
spec.add_dependency "rails"
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
24
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: durable_decorator_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
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: 2013-
|
12
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: durable_decorator
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.2.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|