rake

Is there a better way to run a capistrano task from within rake?

江枫思渺然 提交于 2019-12-22 08:49:17
问题 I have a set of rake tasks where I need to invoke capistrano at some point. Edwin Goei's blog suggests shelling out to capistrano via "sh". Is there a simpler way? It would seem you should be able to call the appropriate tasks programmatically. Thanks in advance. 回答1: Yes, Capistrano has programmatic access to the command-line components. If you want to call them from a rake task, though, you need to do a little extra work. task :deploy require 'rubygems' require 'capistrano' require

Is there a rake task for backing up the data in your database?

一世执手 提交于 2019-12-22 08:05:22
问题 Is there a rake task for backing up the data in your database? I already have my schema backed up, but I want to make a backup of the data. It's a small MySQL database. 回答1: The below script is a simplified version taken from eycap, specifically from this file. set :dbuser "user" set :dbhost "host" set :database "db" namespace :db do desc "Get the database password from user" task :get_password do set(:dbpass) do Capistrano::CLI.ui.ask "Enter mysql password: " end end task :backup_name, :only

Is there a rake task for backing up the data in your database?

99封情书 提交于 2019-12-22 08:05:10
问题 Is there a rake task for backing up the data in your database? I already have my schema backed up, but I want to make a backup of the data. It's a small MySQL database. 回答1: The below script is a simplified version taken from eycap, specifically from this file. set :dbuser "user" set :dbhost "host" set :database "db" namespace :db do desc "Get the database password from user" task :get_password do set(:dbpass) do Capistrano::CLI.ui.ask "Enter mysql password: " end end task :backup_name, :only

Rake task executing twice when only called once

人盡茶涼 提交于 2019-12-22 06:59:33
问题 I've written a very simple rake task to try and locate the source of this problem. namespace :foo do task bar: :environment do puts 'RUNNING' end end When executed in the console rake foo:bar the output is: RUNNING RUNNING This occurs when I execute any rake task. Has anyone encountered anything like this before? EDIT The above rake task is all that is written in that .rake file. Here is the Rakefile currently being used. require File.expand_path('../config/application', __FILE__) OurApp:

Missing the Rails 2.3.4 gem. Even though it's installed!

我怕爱的太早我们不能终老 提交于 2019-12-22 04:42:17
问题 Running Snow Leopard. Tried uninstalling, and re-installing. Still getting the same error whenever I run a rake task. mbpro:redmine shereef$ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0] mbpro:redmine shereef$ rails -v Rails 2.3.4 mbpro:redmine shereef$ which rails /usr/local/bin/rails mbpro:redmine shereef$ gem -v 1.3.5 mbpro:redmine shereef$ which gem /usr/local/bin/gem mbpro:redmine shereef$ rake -v (in /Users/shereef/Documents/Code/BetterMeans/redmine) Missing the

Ssetting up rspec2 task in Rakefile

蓝咒 提交于 2019-12-22 04:33:26
问题 I have a Rakefile that looks like this: require 'rspec/core/rake_task' desc "Run all RSpec tests" RSpec::Core::RakeTask.new(:spec) This isn't working though. For example, if I try to run "rake -T", I get: code/projects/bellybuster[master]% rake -T --trace (in /Users/craig/code/projects/bellybuster) rake aborted! no such file to load -- rspec/core/rake_task /Users/craig/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /Users/craig/.rvm/rubies/ruby

Rails: rake db:test:prepare Vs rake test:prepare

↘锁芯ラ 提交于 2019-12-22 04:06:45
问题 AS the guides, the command used to prepare test database is bundle exec rake db:test:prepare However, I have found that following command also works & created the test db for me. bundle exec rake test:prepare Wanted to know if this is a valid command, if yes. Where can I find the documentation. tested on rails 3.2.8 回答1: According to github and the source code task 'test:prepare' => 'db:test:prepare' is mentioned at the bottom. Hence it's a shortcut, wrapper, whatever you want to call it.

How to execute commands within Rake tasks?

老子叫甜甜 提交于 2019-12-22 01:27:22
问题 I have the rake tasks in my rails application. i want to run a commandline commands with in rake task. how can i do this. i tried by the following but fails desc "Sending the newsletter to all the users" task :sending_mail do run "cd #{RAILS_ROOT} && ar_sendmail -o -t NewsLetters -v" system "cd #{RAILS_ROOT} && ar_sendmail -o -t NewsLetters -v &" end The above run command throws run method undefined & System command not throwing any errors but not executed. 回答1: This links may help you run

ln: /usr/lib/libmysqlclient.18.dylib: File exists

淺唱寂寞╮ 提交于 2019-12-21 23:52:28
问题 rake aborted! dlopen(/Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib Referenced from: /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle Reason: image not found - /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle` Ran the following to resolve: $ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib \ /usr/lib/libmysqlclient.18.dylib ln

On heroku, rake db:migrate fails with “database configuration does not specify adapter”

若如初见. 提交于 2019-12-21 20:47:20
问题 I've followed the Rails Tutorial up to the linked point. Here's the shell output: jrhorn424 at hook in ~/Learning/rails/rails-tutorial/demo_app on master $ heroku run rake db:migrate Running rake db:migrate attached to terminal... up, run.2 ### Snip ### Migrating to CreateUsers (20120310145100) Migrating to CreateMicroposts (20120311052021) rake aborted! database configuration does not specify adapter Tasks: TOP => db:schema:dump (See full trace by running task with --trace) I've consulted