rake

Rake NoMethodError: undefined method 'scan' for Lexicon:Class

随声附和 提交于 2020-01-17 06:12:21
问题 I am receiving a NoMethodError: undefined method 'scan' for Lexicon:Class when I try to run a rake test with the following RakeFile. require './lib/ex48/lexicon.rb' require 'test/unit' class TestLexicon < Test::Unit::TestCase def test_directions assert_equal(Lexicon.scan('north'), [%w(direction north)]) end end I have a simple Lexicon class: class Lexicon def initialize @direction = %w(north south east west down up left right back) @verbs = %w(go stop kill eat) @stop_words = %w(the in of from

Rake Task with Cron Job

删除回忆录丶 提交于 2020-01-17 04:00:47
问题 I am trying to set up cron job to run a rake task daily. I currently have the following cron job (note, the time is all *'s because I want it to run every minute while testing) * * * * * cd /home/jon/thestockenator/lib/tasks/ && ./get_current_data.sh In the shell script I added the entire PATH to whatever the path is when cron runs it and call rake test_task. I set up a basic rake task that simply outputs some text (because my real one takes a while to run) task :test_task do puts "this is a

Rails, Rake aborted! undefined method 'active_record'

人走茶凉 提交于 2020-01-15 11:46:06
问题 I'm sure I miss some basic thing. I had a correctly working app in dev environment. Than I had some modifications that I cant correctly explain (with the migrations and tried to insert seed_dump gem). Now every rake command drops an error: C:\Programozas\Rails Apps\sorsveto>rake about rake aborted! undefined method `active_record' for #<Rails::Application::Configuration:0x3e482 98> Tasks: TOP => about => environment (See full trace by running task with --trace) or C:\Programozas\Rails Apps

Rails, Rake aborted! undefined method 'active_record'

淺唱寂寞╮ 提交于 2020-01-15 11:46:03
问题 I'm sure I miss some basic thing. I had a correctly working app in dev environment. Than I had some modifications that I cant correctly explain (with the migrations and tried to insert seed_dump gem). Now every rake command drops an error: C:\Programozas\Rails Apps\sorsveto>rake about rake aborted! undefined method `active_record' for #<Rails::Application::Configuration:0x3e482 98> Tasks: TOP => about => environment (See full trace by running task with --trace) or C:\Programozas\Rails Apps

How do I use transactions within custom capistrano tasks?

冷暖自知 提交于 2020-01-15 06:21:33
问题 I'm writing a custom capistrano task to minify my javascripts and want to handle the case where the minification fails by rolling back the deploy. I've been through the documentation and thought I'd figured out how to do it, but it's not working for me. Here's what I have: desc 'Minify all javascript files' task :bundle, :roles => :app, :except => { :no_release => true } do on_rollback do run "rm #{current_path}/public/javascripts/all.js" puts "ROLLBACK" end transaction do run "cd #{current

Crontab rake job is not working with whenever gem in ruby

情到浓时终转凉″ 提交于 2020-01-14 05:46:13
问题 This is my crontab file generated by whenever: * * * * * /bin/bash -l -c 'cd /var/apps/path && RAILS_ENV=production echo "Testing" >> /new * * * * * /bin/bash -l -c 'cd /var/apps/path && RAILS_ENV=production rake somegroup:rake_job --silent' The first line is for test only and works as expected. However the rake job in the other line has nothing to do at all. In /var/log/syslog, both jobs are executed. Also tried using the absolute path of rake (/usr/local/rvm/gems/ruby-1.9.2-p136/bin/rake),

How do you communicate between Rake tasks?

南笙酒味 提交于 2020-01-12 13:47:52
问题 Let's say I have a target who needs to compile some files. That target has another target as a prerequisite, one that obtains the files. Let's say this: task :obtain do # obtain files from somewhere end task :compile => :obtain do # do compilation end Let's say that the :obtain target doesn't always places the files in the same folder. How would I pass :compile the path that :obtain found? Environment variables? 回答1: Using ENV['something'] is in my opinion preferable, because if you do it

How do you communicate between Rake tasks?

与世无争的帅哥 提交于 2020-01-12 13:47:11
问题 Let's say I have a target who needs to compile some files. That target has another target as a prerequisite, one that obtains the files. Let's say this: task :obtain do # obtain files from somewhere end task :compile => :obtain do # do compilation end Let's say that the :obtain target doesn't always places the files in the same folder. How would I pass :compile the path that :obtain found? Environment variables? 回答1: Using ENV['something'] is in my opinion preferable, because if you do it

Rake not able to migrate

元气小坏坏 提交于 2020-01-11 13:21:14
问题 C:\Users\MEGHA\bbbb>rake db:migrate rake aborted! SyntaxError: C:/Users/MEGHA/bbbb/db/migrate/20140402130040_create_comments.rb:4: syntax error, unexpected tIDENTIFIER, expecting keyword_end C:65535:in `disable_ddl_transaction' Tasks: TOP => db:migrate (See full trace by running task with --trace) 20140402130040_create_comments.rb class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.string :post_id=integer t.text :body t.timestamps end end end 回答1: instead

Rake not able to migrate

﹥>﹥吖頭↗ 提交于 2020-01-11 13:21:10
问题 C:\Users\MEGHA\bbbb>rake db:migrate rake aborted! SyntaxError: C:/Users/MEGHA/bbbb/db/migrate/20140402130040_create_comments.rb:4: syntax error, unexpected tIDENTIFIER, expecting keyword_end C:65535:in `disable_ddl_transaction' Tasks: TOP => db:migrate (See full trace by running task with --trace) 20140402130040_create_comments.rb class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.string :post_id=integer t.text :body t.timestamps end end end 回答1: instead