rake

Rails - Update attributes using rake task. Need help troubleshooting model method code

心已入冬 提交于 2020-01-06 18:08:22
问题 I am trying to use a rake task that will run every night (using Heroku Scheduler) and update some attributes if some certain criteria is met. A little logic about the application: The application allows users to "take the challenge" and read a book a week over the course of a year. It's pretty simple: users sign up, create the first book that they will read for their first week, then can enter what they're going to read next week. After they've "queued" up next week's book, that form is then

rake aborted! cannot load such file — indirizzo

情到浓时终转凉″ 提交于 2020-01-06 14:09:41
问题 I tried running rake db:reset in my rails application after bundle install. The following message is displayed rake aborted! cannot load such file -- indirizzo /home/xyz/Desktop/Signup4/app/models/concerns/address_validation.rb:2:in `<module:AddressValidation>' /home/xyz/Desktop/Signup4/app/models/concerns/address_validation.rb:1:in `<top (required)>' /home/xyz/Desktop/Signup4/app/models/location.rb:2:in `<class:Location>' /home/xyz/Desktop/Signup4/app/models/location.rb:1:in `<top (required)

Having issues with rake

守給你的承諾、 提交于 2020-01-06 12:26:18
问题 I am running Rails 3.1.1 and getting this error when running this command. Obviously new to Rails, any help appreciated: rake aborted! undefined method `prerequisites' for nil:NilClass /Users/220040168/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/rspec-rails-2.6.0/lib/rspec/rails/tasks/rspec.rake:3:in `<top (required)>' /Users/220040168/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/rspec-rails-2.6.0/lib/rspec-rails.rb:10:in `load' /Users/220040168/.rvm/gems/ruby-1.9.2-p290@rails3tutorial

Rake “no such file to load — java” even when `which ruby` -> jruby

拈花ヽ惹草 提交于 2020-01-04 09:35:06
问题 I am a Ruby noob (rube?) and am having trouble configuring my environment to get rake to build something with a Java dependency. I run $ PATH=/tmp/jruby-dodge:"$PATH" rake and get /opt/local/bin/ruby -S rspec spec/contextual_spec.rb /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- java (LoadError) from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Users/msamuel/work/igrigorik/contextual

Rake “no such file to load — java” even when `which ruby` -> jruby

杀马特。学长 韩版系。学妹 提交于 2020-01-04 09:34:01
问题 I am a Ruby noob (rube?) and am having trouble configuring my environment to get rake to build something with a Java dependency. I run $ PATH=/tmp/jruby-dodge:"$PATH" rake and get /opt/local/bin/ruby -S rspec spec/contextual_spec.rb /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- java (LoadError) from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Users/msamuel/work/igrigorik/contextual

how to detect if --quiet option is specified with rake

别来无恙 提交于 2020-01-04 03:52:08
问题 how to detect of if --quiet option is specified with rake. Intention is to filter custom messages based on category. class Category INFO = 1 WARNING = 2 ERROR = 3 end @trace = true task :silent do @trace = false end def trace(msg, category=Category::INFO) return if (@trace == nil) return if ((@trace == false) && (category == Category::INFO)) puts msg end In this case I would like to add one more case to filter out trace if --quiet option is specified. 回答1: Rake.verbose provides option to

How do I code a rake task that runs the Rails db:migrate task?

佐手、 提交于 2020-01-04 02:07:10
问题 I would like to run db:migrate VERSION=0 and then db:migrate inside of my own rake task. I am confused about how to do this. Do I need a special require statement? My rake task will reside in the lib/tasks directory of a Rails app. Thanks. 回答1: Is your task just dependent on having a clean db? If that's the case then you can do: task :my_task => [:environment, 'db:reset'] 回答2: EDIT: Rake::Task[] won't accept parameters, you have to set it in ENV. In addition, you have to reenable the task to

junit gives error java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache

主宰稳场 提交于 2020-01-03 16:53:37
问题 I'm trying to run a simple unit test to my project at https://github.com/cdwijayarathna/oj4j. I added both junit-4.12.jar and ant-junit4.jar to the lib folder. But when I ran "rake run_tests", I'm getting following error at the report location I have given. java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass

How do I run rake rake tasks in a rails app which is served by tomcat with jruby war deployment?

泄露秘密 提交于 2020-01-03 02:51:14
问题 I have a rails application deployed to tomcat, the code has been compiled to java classes and packed to a war file. And I'm wondering, is there a way for me to run rake tasks as I always did ? 回答1: I'd like a convenient way of doing this too, although I'm not sure it's possible. From the exploded (unzipped) WAR, you can get somewhere with this kind of thing: java -cp WEB-INF/lib/jruby-core-1.6.4.jar -S rake 回答2: java -jar WEB-INF/lib/jruby-core-1.6.4.jar -S rake This worked for me. Possibly

Rake and Uninitialized Constants

筅森魡賤 提交于 2020-01-02 18:25:01
问题 I have spent hours upon days trying to resolve this. Rake is throwing the following error: dcarpenter$ rake rake aborted! uninitialized constant ActionView::Helpers::JavaScriptProxy I can't seem to find anyone who has had this issue on Google, this site or elsewhere. What steps should I take to resolve this and what do I need to know? rake --trace yields: /Users/dcarpenter/Dropbox/workspace/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing' /Users/dcarpenter/Dropbox/workspace/gems