spreader 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spreader.rb +4 -1
- metadata +1 -1
data/lib/spreader.rb
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
# http://visual.merriam-webster.com/plants-gardening/gardening/seeding-planting-tools_2.php
|
10
10
|
# http://stackoverflow.com/questions/2741260/can-ruby-access-output-from-shell-commands-as-it-appears
|
11
11
|
# http://www.wallpaperama.com/forums/how-to-count-the-number-of-lines-in-a-file-in-linux-shell-command-t1084.html
|
12
|
+
# http://www.techotopia.com/index.php/Working_with_Files_in_Ruby
|
12
13
|
|
13
14
|
class Spreader
|
14
15
|
#require 'rubygems'
|
@@ -53,7 +54,9 @@ class Spreader
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def load(seeds)
|
56
|
-
File.
|
57
|
+
empty = File.zero?('db/seeds.rb')
|
58
|
+
File.open('db/seeds.rb', 'a') {|f| f.write("\n" + seeds.chop)} if !empty
|
59
|
+
File.open('db/seeds.rb', 'a') {|f| f.write(seeds.chop)} if empty
|
57
60
|
# File.open('../test/fixtures/things.yml', 'w') {|f| f.write(seeds.chop.chop)}
|
58
61
|
system('rake db:seed')
|
59
62
|
end
|