plant 0.6.0 → 0.6.1
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.
- checksums.yaml +4 -4
- data/README.md +87 -0
- data/lib/capistrano/plant.rb +1 -1
- data/lib/plant/version.rb +1 -1
- data/lib/tasks/plant_tasks.rake +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1942967aeeab9dd650cedace8e56a62da4af213
|
4
|
+
data.tar.gz: 631ab72e1d8a5cb473c106637dfd37b2566fef77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e52cc5327cd5d737bcf11d07325abc62d37b33ca817d617c8a227a1ddc478818fc5b0d4c50e9449e8746797cc823ad6dc927aaf0b027d8eb485de7dc6cc2618
|
7
|
+
data.tar.gz: a6634e55098fd04029326430c5f24f548c757257f3f58ff485a1f734b464886f5e160627b38cc39eabc16151217a013fed50b99bd0d83affef84a0347fbfa302
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Plant
|
2
|
+
|
3
|
+
## Dont just seed, plant.
|
4
|
+
|
5
|
+
This gem allows you to define your content in yaml files, then to be
|
6
|
+
loaded into the database by a rake task. You then get source control on
|
7
|
+
your yml files, with the flexibility of being able to use a databse
|
8
|
+
searching engine to search for content.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add to your gem file:
|
13
|
+
|
14
|
+
gem 'plant'
|
15
|
+
|
16
|
+
run `bundle install`
|
17
|
+
|
18
|
+
Then copy the migrations over and run them
|
19
|
+
`rake plant:install:migrations `
|
20
|
+
`rake db:migrate`
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Add your content to app/content/any/path/blah.yml, plant will pick
|
25
|
+
up on any yml files in app/content.
|
26
|
+
|
27
|
+
With some content added run:
|
28
|
+
`rake plant:seed`
|
29
|
+
|
30
|
+
You can run this as many times as you like and the content will be
|
31
|
+
replaced with tah in your yaml file.
|
32
|
+
|
33
|
+
No to output it onto your page, simply use the helper:
|
34
|
+
|
35
|
+
= plant_content_for('any.path.blah.key', { scenario: current_user })
|
36
|
+
|
37
|
+
You can pass any argument as the scenario argument, plant will call
|
38
|
+
`.scenario` on it. So if you define a method in your user model called
|
39
|
+
scenario, this will be appended to the node search string:
|
40
|
+
|
41
|
+
```
|
42
|
+
class User
|
43
|
+
def scenario
|
44
|
+
'fish'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
=> plant_content_for('red.buses', scenario: current_user)
|
50
|
+
will return the content for 'red.buses.fish' if it exists, if not will
|
51
|
+
return 'red.buses' or 'red.buses.main'
|
52
|
+
|
53
|
+
### Interpolation
|
54
|
+
|
55
|
+
When defining content that needs a parameter, you can use standard ruby
|
56
|
+
interpolation i.e. #{name} but with SINGLE quotes, otherwise the
|
57
|
+
interpolation will be injected at yaml load time, which will be nil,
|
58
|
+
rather than at run time. If a content is defined as:
|
59
|
+
sample:
|
60
|
+
foo: 'Say hello to #{name}'
|
61
|
+
Calling plant_content_for('sample.foo', name: 'George') will return 'Say
|
62
|
+
hello to George'
|
63
|
+
|
64
|
+
### HTML
|
65
|
+
|
66
|
+
If you want to include HTML in your content, you can. But when outputing
|
67
|
+
on to the page, you need to pass in html_safe.
|
68
|
+
=> plant_content_for('sample.link', html_safe: true)
|
69
|
+
|
70
|
+
### Capistrano
|
71
|
+
|
72
|
+
To work with capistrano include:
|
73
|
+
`require 'capistrano/plant'`
|
74
|
+
in your Capfile. This is not tested yet. Otherwise take a look at
|
75
|
+
lib/capistrano/tasks/plant.rake on how to run rake task on deploy
|
76
|
+
|
77
|
+
## Development
|
78
|
+
|
79
|
+
To get started, clone the repo and run `bundle install`. This will get
|
80
|
+
all the stuff that you need. Then a simple `bundle exec guard` will
|
81
|
+
start the guard runner, which watches on rubocop and specs.
|
82
|
+
If you add functionality, please add tests.
|
83
|
+
|
84
|
+
Before pushing back to the repo, make sure that all tests pass.
|
85
|
+
|
86
|
+
## Future features / Wish list
|
87
|
+
- Use git to find diffs so don't have to load all content every time
|
data/lib/capistrano/plant.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
load File.expand_path(
|
1
|
+
load File.expand_path('../tasks/plant.rake', __FILE__)
|
data/lib/plant/version.rb
CHANGED
data/lib/tasks/plant_tasks.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yule
|
@@ -171,6 +171,7 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
+
- README.md
|
174
175
|
- Rakefile
|
175
176
|
- app/helpers/plant/plant_helper.rb
|
176
177
|
- app/models/plant/content.rb
|
@@ -183,7 +184,7 @@ files:
|
|
183
184
|
- lib/plant/utils.rb
|
184
185
|
- lib/plant/version.rb
|
185
186
|
- lib/tasks/plant_tasks.rake
|
186
|
-
homepage:
|
187
|
+
homepage: https://rubygems.org/gems/plant
|
187
188
|
licenses:
|
188
189
|
- MIT
|
189
190
|
metadata: {}
|