rake

How do I make Rake tasks run under my Sinantra app/environment?

I'm using Sinatra, and I wanted to set up some of the convenience rake tasks that Rails has, specifically rake db:seed. My first pass was this: namespace :db do desc 'Load the seed data from db/seeds.rb' task :seed do seed_file = File.join(File.dirname(__FILE__), 'db', 'seeds.rb') system("racksh < #{seed_file}") end end ...

rake tasks are not discovered in rails 3

Hi, I have trouble getting started with rails 3.0.0, because it just doesn't load the rake tasks rake gems:install rake aborted! Don't know how to build task 'gems:install' rake -T rake about # List versions of all Rails frameworks and the environment rake db:create # Create the database from config/database.ym...

passing configure options to rake gems:build

On the server (where I am not root), I have compiled libxslt into /home/foo/sw. So I can install my gem like so: gem install nokogiri -- --with-xslt-dir=/home/foo/sw However, this same technique doesn't work with rake: $ rake gems:build -- --with-xslt-dir=/home/foo/sw (in /home/foo/fooapp/releases/20100915071151) If I try to forc...

Is there a way to run a rake task without running the prerequisites?

Is there a command line switch I'm missing? At the moment I'm having to do this: #task :install => :build do task :install do end ...

Passenger rake not found! Ubuntu (10.04)

Okay, so I installed rvm and everything as root. Then I installed Ruby Enterprise Edition with rvm. Now I've been having a TON of issues with rake and rvm so far and I'm not too sure as to why. I had to manually create links in my /usr/local/bin to rake to get rake working. But when I passenger-install-nginx-module Welcome to the Ph...

Why am I getting a NoMethodError for an attribute that exists in my model?

This is the error I get: ContactPostalcardsController#skip (NoMethodError) "undefined method `status=' for #<ContactPostalcard:0x2b21433d64b0>" This is the code calling it and trying to assign a value to the status attribute for ContactPostalcard (the Model): def skip @contact_postalcard = ContactPostalcard.new(params[:contact...

How to use simple-numbered migrations versions in Rails?

I'm using NetBeans + Rails 2.3.8. I notice that whenever I generate a model, the migration filename for it includes the date and time: Model Name: User Migration File Name : 20100916172053_create_users.rb But when I see books (like Agile Web Development with Rails), the (rake-generated examples int it) all show simple numbers like 0...

How to install Passenger when using RVM?

I'm using RVM and would like to install Phusion Passenger on Snow Leopard. After installing the Passenger gem (version 2.2.15) I try run the Apache module installer script passenger-install-apache2-module. But it compains that it can't find rake: ... * RubyGems... found * Rake... not found * rack... found ... There is alrea...

Why did Rails ignore my user_id field?

I tried creating a DB migration in Rails that looked something like this: ruby script/generate scaffold post user_id:int title:string content:text Looking at the resulting .rb file, sure enough, I saw everything I'd entered: class CreatePosts < ActiveRecord::Migration def self.up create_table :posts do |t| t.int :user_id...

Rails 3 > Rendering views in rake task

Hello there, I'm stuck with a rake task that need to prepare a newsletter for Mailchimp. Using rails 2.x stuff googled I now have this code: desc "Sends newsletter to Mailchimp list" task :send_newsletter => :environment do begin # get render helpers av = ActionView::Base.new(Rails::Application::Configuration.new(Rai...

How to explicitly fail a task in ruby rake?

Hi, Let's say I have a rakefile like this: file 'file1' => some_dependencies do sh 'external tool I do not have control over, which sometimes fail to create the file' ??? end task :default => 'file1' do puts "everything's OK" end Now if I put nothing in place of ???, I get the OK message, even if the external tool fails to ge...

rake db:migrate produces "rake aborted! could not find table" error

I'm new to Rails and I'm building a simple project-tracking app for my employer. I've been developing the app on my Mac and pushing it to github. I just managed to clone my github repo to a windows box behind my company's firewall in hopes of letting colleagues try the app out. But when I go to rake db:migrate to initialize the database...

Rake db:migrate syntax error

trying to setup webistrano and getting the following error: rake db:migrate (in /var/www/html/webistrano) rake aborted! /var/www/html/webistrano/vendor/rails/activesupport/lib/active_support/inflector.rb:273: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' when 1: "#{number}st" ^ /var/w...

Simple database migration error in Rails

Hi, I am not able to create database columns when i use t.string or t.number. When i did rake db:migrate i got this C:\Ruby\joker\chapter3>rake db:migrate (in C:/Ruby/joker/chapter3) == CreateComicBooks: migrating =============================================== -- create_table(:comic_books) -> 0.0630s == CreateComicBooks: migrate...

Rake task to add default data

I have seen some apps that have a few rake tasks included to load data. I am not talking about seed data, I know about db/seeds.rb, instead I am referring to data such as default users and basic records that help me fill my application with something to look at. I don't want to use db:fixtures:load because I don't have any control over...

Rake on Rails 3 problem

Hi, I moved a Rails 2.3 application to Rails 3. The application actually works perfectly, but I have issue with rake tasks. It looks like the config in the environment file is not initialized correctly. the error I get is: rake aborted! undefined method `cache_classes=' for #<Hash:0x3c3e850> /var/www/apps/nzar3/config/environments/devel...

Invoking Rake::Task in rails causes "Don't know how to build task..."

Trying to integrate some friendly_id gem functionality on a controller method. Essentially, I have a Market object, which has its URL created based on a custom method. Since it's based on a custom method, friendly_id won't update the URL when the Market object gets updated. Friendly_id does offer a redo_slugs rake task, but when I cal...

Are there 3 forms to invoke production, staging, etc in Ruby on Rails for rails server, rails console, and rake?

The forms I know of are: For Rails 3.0: for rails server: rails server -e production for rails console rails console production for rake rake db:migrate RAILS_ENV=production Is that it? I know for rails runner and rails dbconsole, it is -e production as well. Are there more forms and what are other ones that use -e vs just ...

Segmentation Error in Rails

Hi, I am working on Windows XP machine. I have started to create an application in rails but I am getting Segmentation fault error. Below are the ruby & rails version I am using. C:\Ruby>ruby -v ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32] C:\Ruby>rails -v Rails 2.3.8 When ever I run the server, I am getting this error. C...

How I can call specified first app's rake task from second one.

How can I call specified 1st app's rake task from second one. Case: User on baseapp.com (RoR), fills up the reg.form BaseApp validates and stores data Than, with delayed_job/resque I should call subapp's rake db:bootstrap FORM_PARAM1 FORM_PARAM2 ... FORM_PARAM3 ...