1. Put in Gemfile: gem "seedbank" 2. Install $ bundle install 3. Create the specific seed file: $ vi db/seeds/performance_translations.seeds.rb translations = [ ["r-high-0001","1-read high-generation"], ["r-high-0008","8-read high-generation"], ["r-high-0016","16-read high-generation"] ] translations.each do |int, ext| PerformanceTranslation.find_or_create_by_internal(internal: int, external: ext) end 4. Run via rake $ rake db:seed:performance_translations
Showing posts with label rake. Show all posts
Showing posts with label rake. Show all posts
10.01.2014
Rails - Separate Seeds Using Seedbank
Seedbank gives your Rails seed data a little structure. Create seeds for each environment, share seeds between environments and specify dependencies to load your seeds in order. All nicely integrated with simple rake tasks.
This is how I quickly used it:
6.05.2014
Schedule rake using cron on rvm environment
Little tricky to get this going. The key is knowing rvm environment.
$ rvm env --path /auto/home3/delacs/.rvm/environments/ruby-2.0.0-p353@RailsDevFor rvm, basic command line tools like gem, rake and ruby are in the wrappers directory.
$ crontab -l SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/auto/home3/delacs RAILS_ENV=development 0 7 * * * /bin/bash -l -c 'source ~/.bash_profile' && cd $HOME/Documents/projects/monweb_management && $HOME/.rvm/wrappers/ruby-2.0.0-p353@RailsDev/rake perfdb:get_baselines >> $HOME/logs/db.import.log 2>&1 5 7 * * * /bin/bash -l -c 'source ~/.bash_profile' && cd $HOME/Documents/projects/monweb_management && $HOME/.rvm/wrappers/ruby-2.0.0-p353@RailsDev/rake perfdb:get_published_runs >> $HOME/logs/db.import.log 2>&1
Subscribe to:
Posts (Atom)