Questions tagged [rake]

1

votes
1

answer
35

Views

Rails rake db:migrate option to not overwrite existing tables

Is there a rake db:migrate option to prevent rake from overwriting existing tables if they have the same schema? I will also accept an option that prevents overwriting existing tables regardless of the schema. I would have thought not overwriting would be the default and would require a --force flag...
user8897013
0

votes
0

answer
2

Views

Heroku rake aborted (PG::ConnectionBad: could not connect to server: No such file or directory)

I am developing Telegram bot using Ruby Telegram Bot boilerplate It is implemented on Ruby-off-Rails using Active Record and works fine locally on development. I decided to deploy it on Heroku. Previously I run $ heroku buildpacks:set heroku/ruby After pushing to Heroku I need to make db:migrate. An...
mechnicov
0

votes
0

answer
5

Views

Include / require common lib file in rake task

I tried these things suggested in this post and nothing worked I give up, I've tried everything and back again and for the life of me I can't include / require my common methods file in my rake task. First I thought that if you added a file in the lib folder and made sure it was in the load path tha...
ToddT
1

votes
1

answer
184

Views

calling gnu makefiles from ruby script?

calling the command 'make' within a directory where a gnu makefile is placed is done easily within a batch script using just the command: make Is there a way to execute the command 'make' from a ruby script?
JohnDoe
1

votes
1

answer
490

Views

How to define a Rake task with arguments and dependencies

I hunted for this high and low, specifically for a RSpec rake task with both dependencies and task arguments - found answer and helping the future generations Basically I want to do filter the tests by tag, and pass in a trigger I use for some app-specific behaviour. bundle exec rake spec[some_tag,s...
Leif
1

votes
1

answer
100

Views

Calling a ruby script using a shell command fails at 'load_rakefile'

I have run into a problem with using a shell command that calls a Ruby script, which then invokes Rake. I have built a test automation framework that does the following when run from the command line (I'm on OSX Yosemite): Calls a Ruby script which sets a bunch of Environment Variables It then invok...
Brett
1

votes
2

answer
957

Views

how devise db:migrate works on production

I'm doing my first project on RoR I decided to use Devise gem for the authentication everything is working fine in Localhost, right now i'm able to sing_up, log_in, reset pass and some other default features that comes with devise. What I don't understand is how everything gets setup once i push t...
Cessna
1

votes
1

answer
52

Views

Can --silent be set in the Rakefile?

I want --silent in the Rakefile, because I am requiring rake, not invoking it from the command line, and I want it to shut up about the directory it is in: (in some/directory) ^^ stop that, Rake. It is annoying. Don't you have better things to do? Is it possible to set --silent in the Rakefile? How?
Jim Flood
1

votes
1

answer
1.6k

Views

Cannot push to Heroku: “Could not find rake-11.1.2 in any of the sources”

I'm having trouble pushing my project to Heroku it's telling me I'm missing a gem rake 11.1.2 yet running gem list rake tells me I do have rake 11.1.2 installed.
Edward
1

votes
2

answer
45

Views

How to add PostgreSQL comments on objects with rails/rake?

I would like to add comments on objects such as database itself, tables, etc while using rake. For example, when I issue rake db:create I'd like to automagically add a comment via PostgreSQL extended SQL statement (if the adapter doesn't support this directly), like COMMENT ON DATABASE myapp_develo...
mlt
1

votes
1

answer
177

Views

Difference between pattern syntax in RSpec::Core::RakeTask and Pathname/Dir.glob

If I do a .glob('**/spec') then the recursive part guarantees that a directory named spec in the current directory will be captured. If I do a task.pattern = '**/spec/**/*_spec.rb' with RSpec::Core::RakeTask then tests inside spec in the current directory are not executed. They will be if the patter...
Matt Schuchard
1

votes
1

answer
124

Views

Rails 4 rake db:migrate causes invalid route error after Devise install

I ran into a problem while doing the Authentication tutorial in the Authentication with Rails 4 in Action book. I added gem 'devise', '~> 3.4.1' to my Gemfile, ran bundle, and ran the generator rails g devise:install. Then I generetated users like it was written in book with: rails g devise user....
fafal
1

votes
2

answer
2.1k

Views

rake error cannot find rake file

Hello I am working on a rails application and every time I try to run any rake command I get this error /usr/local/bin/rake:22:in load': cannot load such file -- /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake (LoadError) from /usr/local/bin/rake:22:in' I am not sure what it means and...
seanbrhn3
1

votes
2

answer
707

Views

rake command not running from cron job but works otherwise

Operating System: Ubuntu installed on a docker and a normal ubuntu installed on my personal laptop. I am running this cron job: */5 * * * * /bin/bash -l -c 'cd /home/deploy/railsapp && rake spec >> cron.log 2>&1' I have tried it with bundle exec rake spec, without /bin/bash, with whenever gem, with...
user1735921
1

votes
3

answer
836

Views

Why can't bundler find rake when it's obviously installed?

I'm trying to migrate a version of Redmine from backup to a new server; I'm migrating from Redmine 3.2.3 to 3.3.0. I installed the new version of Redmine (from Bitnami Stack) on my new server and everything loads properly. When I move my old database into the new version, I have to run bundle exec...
Brandon
1

votes
2

answer
1.2k

Views

Ubuntu 14.04 LTS: `apt-get install rake` -> “ImportError: No module named rake”

I used 'sudo apt-get install rake'. >>> import rake but Fails with error Traceback (most recent call last): File '', line 1, in ImportError: No module named rake Why this happened?I'm missing something.
Yogesh Nikam
1

votes
1

answer
3k

Views

Keyword Extraction in Python_RAKE

I am a novice user and puzzled over the following otherwise simple 'loop' problem. I have a local dir with x number of files (about 500 .txt files). I would like to extract the corresponding keywords from each unique file using RAKE for Python. I've reviewed the documentation for RAKE; however, the...
Panoid
1

votes
1

answer
33

Views

How can I get around-hook-like behavior for rake tasks?

I have a number of rake tasks for which I would like to implement around-hook-like behavior. Specifically, I'm looking for a way to ensure that all of my Rake tasks execute in a particular (complicated, derived) Time.use_zone block. For analogy, I have this in my ApplicationController: around_filter...
wmjbyatt
1

votes
2

answer
110

Views

IntelliJ IDEA / RubyMine - Run multiple rake tasks at once?

In a terminal, I can run multiple rake tasks one after another in a single line: rake grunt war app_server:start I can't seem to get this to work in IntelliJ IDEA when trying to create a Configuration to do it. I'm able to fill in the 'Task Name' field as above, but when I run the configuration, I g...
Argus9
1

votes
1

answer
826

Views

Rails: Log rake task

I am trying to log the output of a rake task to a new logger. Ideally the solution would work in development and production. Here is my task: task :clients, [:field] => [:setup_logger] do |t, args| clients = Client.all problems = [] group = clients.group_by { |client| client[args[:field]] } unique_...
Jeremy Thomas
1

votes
2

answer
35

Views

updating the linked commit ID in a plugin path used in rake build process

In a build system based on rake, someone has linked in specific commits. In the code directory on github this shows up as a directory leading to nowhere, but interestingly, github seems to understand the commit ID, as it is shown after the filename with @ [commit-id], see the screenshot below. How...
Michel Müller
1

votes
2

answer
89

Views

loop through newly created array in ruby rake

I have yet another question on Ruby. What I want to do is to: Create a subfile from a file using grep Create a new empty array called ARRAY Push each line of the subfile as an element in ARRAY Loop through each element of ARRAY and create one file per element (#{element}.txt). What I have so far: de...
Agathe
1

votes
2

answer
3.3k

Views

Add `gem 'pg'` to your Gemfile and ensure its version is at the minimum required by ActiveRecord

I am trying to install a ruby script in heroku. I run bundle install, rake db:create, rake db:migrate when I tried to deploy it to heroku it throws an error, Here is the Error : Counting objects: 858, done. Delta compression using up to 2 threads. Compressing objects: 100% (366/366), done. Writing...
Bsde
0

votes
0

answer
2

Views

ERROR: Service 'web' failed to build: The command '/bin/sh -c gem install --no-ri --no-rdoc bundler foreman' returned a non-zero code: 1

I have a problem when I run the sudo docker-compose run web rake db: setup Starting gurupiorg_db_1 ... done Building web Step 1/9 : from ruby:1.9.3 ---> fdc96adae46d Step 2/9 : env DEBIAN_FRONTEND noninteractive ---> Using cache ---> b6a8b5d38925 Step 3/9 : run sed -i '/deb-src/d' /etc/apt/sources.l...
Hemershon Silva
1

votes
1

answer
923

Views

Change a RDoc template for generating Rails app documentation

I have just added some documentation to my Rails 3.2.13 app. I can generate the documentation just fine (running RDoc 3.12.2) by using a rake task: # lib/tasks/documentation.rake Rake::Task['doc:app'].clear Rake::Task['doc/app'].clear Rake::Task['doc/app/index.html'].clear namespace :doc do RDoc::Ta...
1

votes
3

answer
79

Views

Ruby on Rails - Change column value in rake task

I have a rake task that sends an email if MailCourseWarn.where(needs_warned: true). I want that after email is delivered, the needs_warned be false and not true. Rake task: namespace :course_available do desc 'Disparando e-mail de curso disponível' task :warn_user => :environment do |t, args| MailC...
Felipe Marcon
1

votes
1

answer
42

Views

Rails: How to run code when server starts up, but not when running a rake task or the console?

Before, I added code to a file called config/initializers/remote_publishers.rb which set up a connection to RabbitMQ using the Bunny gem on server startup. However, this is now also executed when running rails c, rails g model SomeModel foo:integer, rails db:migrate etc. For this app, the RabbitMQ-c...
Qqwy
1

votes
2

answer
74

Views

Running rake tasks from crontab

I have run into a problem that I can't imagine a solution for, and has had me stuck for a week. I have the following two lines in sudo crontab -e. * * * * * echo 'crontab can log to reports' >> /var/log/mazer-reports.log * * * * * /bin/bash -l -c 'cd /home/deploy/shopify_pull_and_store && /home/depl...
Colin Brogan
1

votes
1

answer
866

Views

Rake string replace in file

Does Rake have anything built in for replacing strings inside files and such or is it best to use bash commands inside 'sh', or use Ruby's own file manipulation functionality? Regards, Chris
ChrisInCambo
1

votes
2

answer
536

Views

Why does initation of [rake db:migrate] run syntax check on rake tasks in the lib/tasks directory?

I have a rake task file for a RubyOnRails app which resides in the lib/tasks directory. Running [rake db:migrate VERSION=0] seems to force the compiler to check syntax in the lib/tasks files. If there is a file with bad syntax then [rake db:migrate] does not run. Why? So what if I have a bad fil...
fooledbyprimes
1

votes
3

answer
329

Views

What is the best way for having a ruby service on rails?

I need to run a ruby-script as a service. The script needs access to the ActiveRecords of a rails-app. What would be the best way? A rake task? How can it be started as a service on both windows and linux?
Zoran Zaric
1

votes
1

answer
153

Views

Maintaining Persistence When Using Rake Tasks

I'm running some basic continuous integration scripts in the form of rake tasks, using cron to automate their running. I'd like to be able to maintain some form of state between tasks however. I've considered just writing information to a file and reading it back in. Is there a more 'ruby' way of...
Michael
1

votes
3

answer
699

Views

CruiseControl.rb: running cruise rake task with current revision as parameter

when CruiseControl.rb wants to perform an integration test it looks for a rake task called 'cruise' within the project and executes it. Is there a way to hand over the current revision number to that task? I'm deploying an app using capistrano on a remote machine after integration tests. Because ca...
krautsalat
1

votes
1

answer
1.2k

Views

How do I get TeamCity to pick up my NUnit tests run from Rake?

When I run this: sh '#{MBUNIT_PATH}Gallio.Echo.exe /no-echo-results src/#{dll}/bin/Debug/#{dll}.dll' in my rakefile, Gallio runs my mbunit tests, and TeamCity picks up the results :D But this: sh '#{NUNIT_PATH}nunit-console.exe /nologo src/#{dll}/bin/Debug/#{dll}.dll' does run my tests, but TeamCity...
Andrew Bullock
1

votes
1

answer
442

Views

Ideas For Version Number Control

Here's the development environment we're looking at: Primarily .NET (C# mostly) Development in Visual Studio 2008 Source control in SVN (VisualSVN server, Tortoise client) Deployments with MSBuild/MSDeploy controlled by Rake scripts What we'd like to start having is some kind of tracking of version...
David
1

votes
2

answer
868

Views

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
AndrewVos
1

votes
1

answer
169

Views

Ruby not selecting correct overloaded method

Ive got a simple Nunit runner for a rake script i have: module NUnitRunner @NUnitPath = '#{RootDir}/tools/nunit/nunit-console.exe'; def self.RunTests(testFile) system('\'#{@NUnitPath}\' ? \'#{testFile}\'') end def self.RunTests(testFile, runArgs) system('\'#{@NUnitPath}\' ? \'#{testFile}\' #{runArgs...
Grofit
1

votes
2

answer
1k

Views

Segfault when I rake (Ruby on Rails)

EDIT: Here's the solution (in case the thread linked to below disappears): Install ruby 1.8.6 (down from 1.8.7) gem install rails -v=2.3.8 (same as before) gem install mysql (version 2.8.1, same as before) Download libmysql.dll from http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/Instan...
JellicleCat
1

votes
3

answer
1.3k

Views

uninitialized constant MysqlCompat::MysqlRes

I am getting uninitialized constant MysqlCompat::MysqlRes when I run rake db:migrate. So here is my story. I upgraded my system to snow leopard and I had an existing project, which was running fine. I was trying to upgrade some stuff, one of which was mysql to 64 bit. That is when everything went w...
jdog
1

votes
2

answer
6.7k

Views

Issue installing Nokogiri Gem w/ Rails: “Could not find ”Nokogiri…"

Nokogiri is in my gem file. Bundle install returns the expected output: Using nokogiri (1.4.4) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. When trying to execute db:create:all I get the following error: rake db:create:all Could not find nokogiri-1.4...
Max

View additional questions