gardener 1.1.5 → 1.2.0
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.rdoc +4 -4
- data/lib/gardener.rb +8 -9
- metadata +10 -5
data/README.rdoc
CHANGED
@@ -6,7 +6,7 @@ Gardener is intended to be used from the rails console, although I suppose you c
|
|
6
6
|
|
7
7
|
==Usage
|
8
8
|
Put
|
9
|
-
|
9
|
+
gem 'gardener'
|
10
10
|
in your gemfile and gardener gets right to work.
|
11
11
|
|
12
12
|
He's there behind the scenes and you can call on him in several ways.
|
@@ -14,8 +14,8 @@ He's there behind the scenes and you can call on him in several ways.
|
|
14
14
|
==Instance Methods
|
15
15
|
|
16
16
|
===plant_seed
|
17
|
-
|
18
|
-
|
17
|
+
c = Content.first
|
18
|
+
c.plant_seed
|
19
19
|
|
20
20
|
This is the use case I wrote Gardener to solve.
|
21
21
|
|
@@ -97,7 +97,7 @@ You can add 'z' to any of the above responses and Gardener will apply that respo
|
|
97
97
|
|
98
98
|
|
99
99
|
===sow
|
100
|
-
|
100
|
+
User.sow
|
101
101
|
Will plant all the User records in the garden, which you can commit to your (D)VCS and deploy wherever.
|
102
102
|
|
103
103
|
|
data/lib/gardener.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Gardener
|
2
|
-
|
2
|
+
|
3
3
|
|
4
4
|
def self.included(base)
|
5
5
|
base.extend(ClassMethods)
|
@@ -8,8 +8,8 @@ module Gardener
|
|
8
8
|
module ClassMethods
|
9
9
|
|
10
10
|
attr_accessor :infinite_choice
|
11
|
-
|
12
|
-
# Deletes the file associated with this class, so you can plant new seeds. Should be done once per growing season.
|
11
|
+
|
12
|
+
# Deletes the file associated with this class, so you can plant new seeds. Should be done once per growing season.
|
13
13
|
def harrow
|
14
14
|
File.delete(garden_path)
|
15
15
|
end
|
@@ -29,7 +29,7 @@ module Gardener
|
|
29
29
|
def garden_path
|
30
30
|
File.join([Rails.root, 'db', 'garden', "#{self.to_s.underscore.pluralize}.yml"] )
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# Loads each yaml representation of an object up into an array, so you can play with them individually.
|
34
34
|
def secret_garden
|
35
35
|
instance_eval "attr_accessor :abra"
|
@@ -42,7 +42,7 @@ module Gardener
|
|
42
42
|
end
|
43
43
|
str << line
|
44
44
|
end
|
45
|
-
@abra << str unless str.blank?
|
45
|
+
@abra << str unless str.blank?
|
46
46
|
end
|
47
47
|
|
48
48
|
# Take the things that were dumped to a file and put them in the database.
|
@@ -168,10 +168,9 @@ module Gardener
|
|
168
168
|
{"#{self.class.to_s.underscore}_#{self.id}" => self.attributes}.to_yaml
|
169
169
|
end
|
170
170
|
|
171
|
-
# Workaround for DelayedJob which has
|
172
|
-
#
|
173
|
-
#
|
174
|
-
# please let me know, I want us all to get along. Hopefully we'll all get the refinements thing working soon
|
171
|
+
# Workaround for DelayedJob which has an unfriendly monkey patch on ActiveRecord::Base.
|
172
|
+
# If you notice that my patch to unfuck the DJ patch is causing problems please let me know,
|
173
|
+
# I want us all to get along. Hopefully we'll get refinements working soon :P
|
175
174
|
# and stop stepping on each others toes.
|
176
175
|
if ActiveRecord::Base.respond_to? :yaml_new
|
177
176
|
class ActiveRecord::Base
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Bob Larrick
|
@@ -14,11 +14,16 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-04-18 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
21
|
+
description: |-
|
22
|
+
A Ruby on Rails Plugin to help you create seed data. Useful when you want to move a few records from one database or environment to another.
|
23
|
+
|
24
|
+
# staging foo = Model.find(id); foo.plant_seed;
|
25
|
+
|
26
|
+
# production Model.reap;
|
22
27
|
email: larrick@gmail.com
|
23
28
|
executables: []
|
24
29
|
|