plant 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -4
- data/lib/plant/version.rb +1 -1
- data/lib/tasks/plant_tasks.rake +15 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc34f83987f032647f5fd8685def8fd32dc718e
|
4
|
+
data.tar.gz: e8ad1c5536f32347603df3a111d26a945c19a0d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57ebd7b8f39fa729eecb8597621e3f7fe4f95a6f02706758007471b2d4661f94e4724ecd3db4757a92cbacd075a82878809c88008aa2fd4fafe4c59819b10283
|
7
|
+
data.tar.gz: 76dd1321e3607ad8efb0df2453f66c9d6ff112e24398f994c5c8afe8e2c5b225f6b3925aaa1ce2e10819b3b58b972fbf3839e272b8d04a977f8c054834fa73b2
|
data/README.md
CHANGED
@@ -30,6 +30,9 @@ With some content added run:
|
|
30
30
|
You can run this as many times as you like and the content will be
|
31
31
|
replaced with tah in your yaml file.
|
32
32
|
|
33
|
+
Or you can run the import for an individual yaml file:
|
34
|
+
`rake plant:specific_seed[path/to/file.yml]`
|
35
|
+
|
33
36
|
No to output it onto your page, simply use the helper:
|
34
37
|
|
35
38
|
= plant_content_for('any.path.blah.key', { scenario: current_user })
|
@@ -74,16 +77,25 @@ To work with capistrano include:
|
|
74
77
|
in your Capfile. This is not tested yet. Otherwise take a look at
|
75
78
|
lib/capistrano/tasks/plant.rake on how to run rake task on deploy
|
76
79
|
|
80
|
+
### Guard
|
81
|
+
There is a guard watcher fro this gem, just include it in your gemfile:
|
82
|
+
|
83
|
+
gem 'guard-plant'
|
84
|
+
|
85
|
+
Then run `guard init plant`. This will run the import task whenever you
|
86
|
+
change any of the content files.
|
87
|
+
|
77
88
|
## Development
|
78
89
|
|
79
90
|
To get started, clone the repo and run `bundle install`. This will get
|
80
91
|
all the stuff that you need. Then a simple `bundle exec guard` will
|
81
|
-
start the guard runner, which watches on rubocop and specs.
|
92
|
+
start the guard runner, which watches on rubocop and specs.
|
82
93
|
If you add functionality, please add tests.
|
83
94
|
|
84
|
-
Before pushing back to the repo, make sure that all tests pass.
|
95
|
+
Before pushing back to the repo, make sure that all tests pass.
|
85
96
|
|
86
97
|
## Future features / Wish list
|
87
98
|
- Use git to find diffs so don't have to load all content every time
|
88
|
-
-
|
89
|
-
|
99
|
+
- merge seed and specific seed, detect args
|
100
|
+
|
101
|
+
(c) AHC
|
data/lib/plant/version.rb
CHANGED
data/lib/tasks/plant_tasks.rake
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
namespace :plant do
|
2
|
-
desc 'Puts the content from the YAML files into the database'
|
2
|
+
desc 'Puts the content from the YAML files in app/content into the database'
|
3
3
|
task seed: :environment do
|
4
4
|
count = 0
|
5
5
|
Plant::Utils.load_all_yaml_files.each do |full_node, value|
|
6
|
-
|
7
|
-
content_obj.content = value.chomp
|
8
|
-
content_obj.save!
|
6
|
+
add_object(full_node, value)
|
9
7
|
count += 1
|
10
8
|
end
|
11
9
|
puts "Planted #{count} seeds."
|
12
10
|
end
|
13
11
|
|
14
12
|
task seeds: :seed
|
13
|
+
|
14
|
+
desc 'puts the content from yaml_file.yml into the database. Usage: rake plant:specific_seed[yaml_file.yml]'
|
15
|
+
task :specific_seed, [:yaml_path] => :environment do |_, args|
|
16
|
+
Plant::Utils.load_yaml_file(args[:yaml_path]).each do |full_node, value|
|
17
|
+
add_object(full_node, value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_object(full_node, value)
|
23
|
+
content_obj = Plant::Content.find_or_initialize_by(node_id: full_node)
|
24
|
+
content_obj.content = value.chomp
|
25
|
+
content_obj.save!
|
15
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yule
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|