rake

spec rake task for daily cron

I have a series of rspec tests which I use to make sure some web scraping services I wrote are still valid. I have all of these inside a GEM which my rails app requires and I'm not quite sure how to embed a rake task of spec for an external gem? I'm not sure that is at all clear, I have a gem w/rspecs: Gem w/rspecs MyApp I would lik...

Rake: Calling tasks with arguments in default task

I have been playing around with Rake and Albacore, to see if I can replace our existing MSBuild script that deploys software with something that isn't XML. I have a task that will change the debug value inside a web.config to false. The task takes the directory of the web.config as an argument, but I can't quite figure out the syntax n...

getc is obsolete; use STDIN.getc instead

When running rake gems:install I see this message: /opt/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:232: warning: getc is obsolete; use STDIN.getc instead How do I resolve the issue? ...

Can't rake db:migrate due to sqlite3_busy timeout

I'm running RVM with ruby 1.9.2 and rails 3.0.0rc and when I run rake db:migrate I get Expected argument 0 of type sqlite3 *, but got SWIG::TYPE_p_sqlite3 #<SWIG::TYPE_p_sqlite3:0x00000... in SWIG method 'sqlite3_busy_timeout' Has anyone run into this? And more importantly, has anyone fixed it and how? ...

Adding Growl notifications after Rake tasks are finished

Is there a way to add Growl notifications to the end of all Rake tasks? I initially thought of creating a task that Growls, and adding it as a dependency to tasks I want alerts from, but realized the dependencies get run before the task begins. Is there a way to add tasks to be run after certain Rake tasks are finished? It'd be really...

Running rake db:migrate without some initializers

I am trying to run jruby -S rake db:migrate, but I do not want to start up a daemon in config/initializers whenever I do a migrate. Is there a way to do this? Up until now, I have just been moving the daemon file to a file with a .bak extension so that rails doesn't load it when I do the migrate. I suspect that this is a stupid way of ...

how do i set up cron jobs with rails?

Hi, I have to implement a fairly database intensive task periodically. I am using rails for the application to which this task is related and thus for the sake of easiness and uniqueness in approach I want to know how can I best implement cron job with rails. I am aware that rake is one solution, but am totally unaware of how to use it....

Rake vs Thor for automation scripts?

I want to automate things like: Creating a new Rails app with pre-selected database, git initialize it, create heroku project, commit all files etc Upload all files in folder to another computer through ssh, but do not overwrite files Upgrade Ubuntu, install all basic packages through apt-get These kind of tasks. From what I have un...

Using Rake or Gem for building scripts?

I want to build scripts that automatize things for me. Here is an example of what I want to do: Create new rails app (rails new application_name --database=mysql) Jump to folder Initialize git (git init; git add .; git commit -m "first commit"; git remote add name address; git push name master) Create heroku project (heroku create; gi...

Use Capistrano for Rake tasks?

Is Capistrano only used for deploying Rails apps? Basically I want a scripting framework to handle all server/client scripting for me. Examples: Updating Ubuntu, installing gems with dependencies etc. Creating a new Rails app, Git initialize it and commit, create Heroku project and upload the app. Automatize basic file/folder operati...

Good practices for Integration Tests for my rails app external endpoints?

I'll keep it short, I've got a rails app which communicate with other apps, some using SOAP (non-rails apps of course...) and others with REST. I'm making integration tests to ensure that my endpoint wrapper classes have correct mappings and setup. However, they are executed by default by rake test which makes it slow and fragile. I wish...

What's the difference between lambda and begin block?

I am trying to verify if a text have been written to file (build.log) after executing a rake task which will throw an exception. Checkout both the code snippets below, the one with begin works whereas lambda throws a message saying it couldn't find the build.log file. Using begin to test.(works) begin Rake::Task['git:checkout'...

How to call ActiveSupport method inside rake task?

This is what I'm trying: require "active_support" desc "test" task :foo => [:environment] do parse(:categories) do |hash| # cleanup name hash[:name] = titlecase(hash[:name]) # ... end end This is the error I'm getting: undefined method `titlecase' main:Object I've also tried: ActiveSupport::Inflector::titlecase...

problem with rake task.

While running rake task with parameters i am getting this problem. C:\projects\Test1>rake test_rake_task csv_header csv_column (in C:/projects/CyncErp) ** Invoke annotate_models (first_time) ** Execute annotate_models krunal get_model_names model_name = csv_header model_name = csv_column rake aborted! Don't know how to build task 'csv_h...

how to pass multiple parameters to rake task.

I want to pass multiple parameter but don't know the numbers. Like model names. how to pass those parameters into rake task and how to access those parameters inside rake task. Like, rake test_rake_task[par1,par2,par3] ...

Can't find rake on Ruby Rails Install

Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C:\Windows\system32>gem install rake Successfully installed rake-0.8.7 1 gem installed Installing ri documentation for rake-0.8.7... Installing RDoc documentation for rake-0.8.7... C:\Windows\system32>rake C:/Program Files (x86)/Ruby192...

Rake and MSBuild error - error MSB3021: Unable to copy file

We're using Rake with Albacore for our build & deploy process in TeamCity but my latest solution is causing me problems when I compile. When I run msbuild I get the following error: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets(60,3): error MSB3021: Unable to copy file "bin...

rake not running unit tests

I've upgraded my app from using config.gem to a Gemfile with bundler and have noticed that my unit tests have now stopped running. It's a bit strange and I'm not entirely sure where to start looking. When I run rake test:units --trace I can see my environment being setup and it lists the files it intends to execute, but then it just re...

rake task on gem

I have a rake task for a series of rspecs as follows... require 'spec/rake/spectask' require 'joliscrapper' namespace :spec do desc "Web scraping files" task :scrapers => :environment do Spec::Rake::SpecTask.new do |t| t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""] t.spec_files = FileList['spec/scr...

Deploying rake task to server

I have a couple simple rake tasks hosted at github that I would like to push to a remote server. It's essentially just a directory with a few classes and a Rakefile. What would be the best and/or simplest approach for deployment? I'm thinking the simplest might be just to clone the repo on my server and do a git pull whenever there's an...