rake

Don't Understand Bundler Interaction with Gems

冷暖自知 提交于 2019-12-11 03:42:49
问题 I thought I understood how Bundler works with gems, but after something that recently happened, I am not sure I have it right. I am developing an Rails application. To start off (and just so I would get familiar with the Rails environment which I haven't worked in before), I did not use an IDE. But, because I'm missing out on some of the advantages of an IDE, I just started using RubyMine. As part of the RubyMine setup, it asked to update all my gems for my existing project. After that, I

Could not find rake using whenever rails

心已入冬 提交于 2019-12-11 02:40:29
问题 Hello I have a strange problem, I'm trying to get rake task working in whenever, but have this problem Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound) . It's strange, because it searches this rake version in ruby 2.1.2 version /home/vyivrain/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/spec_set.rb:92 . However I'm using ruby 2.2.0 in rvm and the gem list is also using that version. It's a simple cron job: every 1.minute do rake 'process

Create Migration for Column with a Number in the Name

自古美人都是妖i 提交于 2019-12-11 02:23:18
问题 I'm porting an app into rails and a couple of the columns are named things like 2nd_phone 2nd_address When I try doing a migration using t.string :2nd_phone I get syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END Any ideas how to do this in rals? 回答1: In your migration file have this with quotes to support starting character as numeric one and then run rake db:migrate t.string :'2nd_phone' While doing this way if you want to create new

How to know if DB exists from within Rake task

混江龙づ霸主 提交于 2019-12-11 01:59:59
问题 How do i find out if the database exists from within a rake task? that is, i'd like to do something like: task :drop_and_create => :environment do Rails.env = "development" if (db_exists?) Rake::Task["db:drop"].invoke end Rake::Task["db:create"].invoke #more stuff... end how do i write the db_exists? condition? 回答1: How about instead doing a begin/rescue: task :drop_and_create => :environment do Rails.env = "development" if (db_exists?) begin Rake::Task["db:drop"].invoke rescue Exception => e

Can't Push To Heroku (Can't find Rake 10.3.2)

好久不见. 提交于 2019-12-11 01:58:33
问题 rails newbie here. I'm working through the tutorial on railstutorial.org on a Ubuntu 14.04 virtual machine. It's been pretty smooth sailing up until I got to heroku. When I want to push my app to heroku, it complains that it could not find rake-10.3.2. I checked heroku, and the application seems to be empty. However, I have rake-10.3.2 in my application, and if use "bundle show rake", it shows the correct version. brandon@brandon-virtualbox:~/rails_projects/first_app$ bundle show rake /home

rake task can't access rails.cache

点点圈 提交于 2019-12-11 01:47:27
问题 I want to call a rake task from a cron job that stores remote weather data in the rails cache. However, I must be doing something pretty wrong here because I cannot find any solution through countless fruitless searches. Say I define and call this task namespace :weather do desc "Store weather from remote source to cache" task :cache do Rails.cache.write('weather_data', Date.today) end end I get the error Anonymous modules have no name to be referenced by Which leads me to believe the rails

Don't know how to build rake db:migrate on Ubuntu natty?

大憨熊 提交于 2019-12-10 22:05:09
问题 I'm not sure how to deploy an application using Capistrano but I figured I'd try to at least load all the files I need on my deployment server, so I did a git pull on Github and installed all the dependencies using bundle install. I have RVM 1.6.32 running in Ruby 1.9.2p180 with Rails 3.0.9 and when I run rake db:migrate, I get rake aborted! Don't know how to build task 'db:migrate' I don't have the double semi-colon issue that other SO users have mentioned, so I'm genuinely confused. I have

Dynamic namespace rakes and parser classes with rails?

这一生的挚爱 提交于 2019-12-10 20:22:28
问题 I have a collection of parsers that differ significantly in logic, but have the exact same methods and outputs. I have devised somewhat of a master Rake and I am curious if what I have come up with could lead to some unexpected or weird behavior. Essentially my parse.rake looks something like: require 'app/models/provider' require 'config/environment.rb' Provider.all.each do |provider| require "lib/tasks/#{provider.name}.rb" Kernel.const_get(provider.name).provider = provider namespace

Rake Execute With Multiple Arguments

梦想的初衷 提交于 2019-12-10 19:38:57
问题 I'm calling a rake task within a task and I'm running into a roadblock when it comes to calling execute response = Rake::Task["stuff:sample"].execute[:match => "HELLO"] or response = Rake::Task["stuff:sample"].execute[:match => "HELLO",:freq=>'100'] Calling task task :sample, [:match,:freq] => :environment do |t, args| The error I get back is 'can't convert Hash into Integer' Any ideas? 回答1: I think the problem is in code you're not posting. Works fine for me: james@James-Moores-iMac:/tmp$

Rake aborted! Don't know how to build task 'doc:app'

谁说胖子不能爱 提交于 2019-12-10 19:35:39
问题 The official documentation indicates that I should be able to build documentation for my application using rake doc:app , but when I run the command in Rails 5 I get the following output: bwerth@bwerth-VirtualBox:~/rails/gep$ rake doc:app rake aborted! Don't know how to build task 'doc:app' (see --tasks) (See full trace by running task with --trace) 回答1: This functionality was removed from Rails in version 5 with the following justification: ...In our experience applications do not generate