spreader 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/spreader.rb +4 -1
  2. 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.open('db/seeds.rb', 'w') {|f| f.write(seeds.chop)}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: