Sha256: 3e692123032d254ee055c950275cf392e69ffe22e1613727f9cde8ba927764a9

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

namespace :succotash do
  desc "Create 'db/seeds/static.rb' and 'db/seeds/sample.rb'"
  task :install do
    spec = Gem::Specification.find_by_name 'succotash'

    puts "*** Creating seed dirs ***".green
    system("mkdir -p #{Rails.root}/db/seeds/{static,sample}") unless Dir.exist?("#{Rails.root}/db/seeds")
    system("mkdir -p #{Rails.root}/db/seeds/static") unless Dir.exist?("#{Rails.root}/db/seeds/static")
    system("mkdir -p #{Rails.root}/db/seeds/sample") unless Dir.exist?("#{Rails.root}/db/seeds/sample")

    unless File.exist?("#{Rails.root}/db/seeds/static.yml")
      system("cp #{spec.gem_dir}/lib/templates/static.yml #{Rails.root}/db/seeds/")
      puts "*** Settings up static.rb ***".green
    else
      puts "*** static.rb already exists ***".yellow
    end

    unless File.exist?("#{Rails.root}/db/seeds/sample.yml")
      system("cp #{spec.gem_dir}/lib/templates/sample.yml #{Rails.root}/db/seeds/")
      puts "*** Settings up sample.rb ***".green
    else
      puts "*** sample.rb already exists ***".yellow
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
succotash-1.0.1 lib/tasks/succotash.rake
succotash-1.0.0 lib/tasks/succotash.rake