Questions tagged [rakefile]

1

votes
4

answer
2.3k

Views

Rails don't know how to build task

I am attempting to scrape data from a website. I am running rake from index.html.erb I have it defined in a .rb file. Here is article.rb require 'rake' require 'rubygems' #load './lib/tasks/article_task.rake' class Article < ActiveRecord::Base def self.run_rake(fetch_games) Rails.root + 'lib/tasks/a...
Lilspree
1

votes
1

answer
1.1k

Views

rake db:migrate returns “rake: Is a directory”?

I've been searching for the answer to this question for a week, but haven't found one. I'm running Mac OS 10.5.8 if that's relevant. I'm trying to do the Peepcode tutorial 'Meet Rails 3' but when I run the command line user$ rake db:migrate I get the following error message: /usr/local/lib/ruby/ge...
Josh
1

votes
1

answer
210

Views

rake - how does the “directory” keyword work?

It's been stated in several places that 'directory' keyword can be used as a shorthand. Apparently, it can be indicated as a dependency, so that it will be created if not already present. http://onestepback.org/articles/buildingwithrake/directorydependencies.html The idea is to specify destination d...
dragon
1

votes
1

answer
304

Views

Why can't i run rake -f?

I really have no idea what im doing. I'm trying to get rake to work so I can run rake workers:start but without having to have the working directory be the same as the folder of the rake file. for example if i'm in my app directory, the above command works fine, but if i run rake -f ~/Code/my-app/Ra...
Tallboy
1

votes
1

answer
961

Views

How to get fileutils calls to output their actions in a Rakefile?

I have a Rakefile which, on my own-built Ruby 1.9.3 installation, correctly outputs the Unix shell equivalent when I use a FileUtils method such as cp, mkdir etc. However, on the stock Ruby that ships with Mac OS X (specifically 10.5), which is version 1.8.6, they don't do this. I'd like them to out...
David Kendal
1

votes
1

answer
80

Views

Detect bundler installed groups

We're using bundler, and on deploy server application is installed without some gems bundler install --without test In this case some code should be deactivated (like loading rspec && cucumber task into Rakefile) Is there some simple methods like Bundler.installed?(:test) то detect this case?
Meredian
1

votes
1

answer
589

Views

Error with rake rdoc

I have been working on a rails 4 app. Everything was working- it was deployed -I was styling it but heroku wasn't compiling the assets so I started rake assets:precompile. The style changes were pushed and the live site was fine. At some point rake got messed up. Because now when I try to run a rail...
user2714458
1

votes
3

answer
461

Views

how Do I structure/compile my ruby project [closed]

im brand new to Ruby and I just finished coding a program. the program has about 350 lines of code, 6 methods but no classes. it uses constants and global variables. Is it convention to, for example, have the global variables/constants in a seperate file? should I split all the methods into differen...
tony_landoza
1

votes
1

answer
845

Views

Run all rake tasks?

How can I run all rake tasks? task :a do # stuff end task :b do # stuff end task :c do # stuff end task :all do # Run all other tasks? end I know I can just do task :all => [:a, :b, :c] do end but if I add new task, I also need to add it to :all dependencies. I would like to avoid the need to do it...
graywolf
1

votes
1

answer
278

Views

Overriding rake tasks and rake task dependencies?

I'm using a build system which defines a number of rake targets, including this one: task :test => [:all] This seems incorrect to me, and so I defined my own rake tasks like so: task :test => [:spec] task :all => [:test, :build] task :release => [:all] task :default => [:release] However, now I'm ge...
Dasmowenator
1

votes
1

answer
33

Views

Custom Rake task unable to be called twice in same Rakefile unike Rake::TestTask

I recently read an 'older', 2009, article about how to make a Custom Rake tasks. So far it works for the first iteration, but I saw that Rake::TestTask can be called twice, so I figured I could do it, however my name attr_accessor is not picking up the symbol I'm passing to it. require 'rake' requi...
Pred
1

votes
1

answer
0

Views

Can a rake task know about the other tasks in the invocation chain?

Rake (like make) is able to have many targets/tasks specified on invocation. Is it possible for a rake task to access the list of tasks the user invoked, in order to do its job? Scenario: Consider a Rake-based build tool. A help task would like to know what tasks were also specified in order to prin...
andrewdotnich
1

votes
1

answer
0

Views

Rakefile rule output generation problem

i have a Rakefile with a rule like this : rule '.so' => '.cc' do |t| puts '@ Compiling #{t.source}' output = t.source.ext('so') output['stdlib'] = 'build' sh 'mkdir -p #{File.dirname(output)}' sh '#{CXX} #{t.source} -o#{output} #{STDLIB_CFLAGS} #{STDLIB_LFLAGS}' end As you can see, it generates many...
1

votes
1

answer
0

Views

Rakefile rules in c++ project

I'm converting Makefile to Rakefile for small C++ project. I have src dir with *.h and *.cpp files and obj dir where all *.o goes (I don't want them in src). How to do it with Rake rules? This works fine but I want to have a generic rule. rule('#{OBJ_DIR}hello.o' => '#{SRC_DIR}hello.cpp') do |target...
Nazgob
1

votes
1

answer
0

Views

Build C files in my RubyGem

I'm trying to package my ruby application as a RubyGem (using Jeweler and Rake). I've some C source which I need to build on the target machine where the gem is to be installed and then place the output in the gem's bin directory so that my ruby code can use it. Is there any hook by which I can exe...
arrac
1

votes
1

answer
0

Views

Ruby on Rails: Rake: rake stats didn't add my field to the correct value?

Before my rake stats modification +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+ | Controllers | 5037 | 3936 |...
NullVoxPopuli
1

votes
2

answer
0

Views

Exclude files from FileList on Ruby

i have a rakefile with the following SRC = FileList['md/*.md'] but i want to exclude some files I have tried SRC = FileList['md/*.md'].exclude('md/header.md') SRC = FileList['md/*.md'].exclude(/header/) SRC = FileList['md/*.md'].exclude(/header.md$/) But it doesn't work, always list me all files a e...
rkmax
1

votes
1

answer
145

Views

How to break up rakefile?

I'm trying to add some rake tasks to an Octopress Rakefile, and I'd like to put the tasks in another child rakefile, but when I import the child rakefiles, they can't access the constants at the top of the rakefile. I'm importing the child rakefile with: Dir.glob('rakefiles/*.rake').each { |r| impor...
justingordon
1

votes
1

answer
457

Views

Test a specific group of testcases with rake testtask

Some tests require internet connection and some other don't. So they are divided into two test groups with different file name patterns. How to update below Rakefile so that they can be run separately with different rake tasks? It seems the question/answer here doesn't help in this case. And the ra...
canoe
1

votes
2

answer
458

Views

How can I call Rake methods from a module

I have a lot of utility functions in my rake files, some of which create rake tasks. I want to move these utility functions into a module to avoid name clashes, but when I do the rake methods are no longer available. require 'rake' directory 'exampledir1' module RakeUtilityFunctions module_function...
Eoghan
1

votes
2

answer
605

Views

How to pass an option to a Rake task?

I would to know if it was possible to pass an option from the commande line to the task without having the Rakefile taking option for itself. Here is my task: task :task do args = ARGV.drop(1) system('ruby test/batch_of_test.rb #{args.join(' ')}') args.each { |arg| task arg.to_sym do ; end } end Her...
Elie Teyssedou
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
2

answer
1.2k

Views

Specifying file prerequisites for Rake task

I've got a helper class that scans my entire project directory and collects a list of source files and the corresponding (target) object files. The dependencies on the compile task is defined after scanning the source directory as shown below. CLEAN.include(FileList[obj_dir + '**/*.o']) CLOBBER.incl...
thegreendroid
1

votes
2

answer
296

Views

Rake equivalent of make -j (--jobs)

The make commands allows a -j (--jobs) options documented as such: -j [jobs], --jobs[=jobs] Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the numb...
William Entriken
2

votes
2

answer
783

Views

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 Ra...
funkymunky
5

votes
2

answer
2k

Views

Check if rake task exists from within Rakefile

I'm looking for a way to be able to check if a certain rake task exists from within the Rakefile. I have a task dependency that I only want to include as a dependency if that task is available. In this particular case, the task is only available in a Rails project, but I want my rake tasks to work i...
conorliv
5

votes
1

answer
1.4k

Views

Load rake tasks from ruby gem

I'm writing a gem and I want to have an access to the gem rake tasks from my rails app. To do this I use Railties. I have lib/frontrockets-rails/railtie.rb with require 'frontrockets-rails' require 'rails' module FrontrocketsRails class Railtie < Rails::Railtie railtie_name :frontrockets rake_tasks...
Maxim Abramchuk
5

votes
3

answer
3.8k

Views

Generate Rake test tasks dynamically (based on existing test files) in a Rakefile

I'm generating test tasks dynamically based on existing test files in a Rakefile. Consider you have various unit test files named after the pattern test_.rb. So what I'm doing is creating a task named after the file name inside the 'test' namespace. With the code below I can then call all the tests...
jasoares
6

votes
2

answer
5k

Views

Using rake import (calling other rakefiles)

Here's my primary rake file subrake = 'subrake' task :init => [subrake] do #call subrake.build end import subrake I see documentation on how the above steps work, but I can't figure out how to call tasks in the other subrake file. BTW, those tasks may have the same name as mine, is this an issue?
Drew
5

votes
1

answer
339

Views

Rake task outside of namespace

I have a rake file set up like so: require 'rake' namespace :setup do puts 'I'm in setup' task :create do puts 'I'm in create' end end task :run do puts 'I'm in run' end If I run rake setup:create I get the expected: I'm in setup I'm in create However, if I run rake run I get: I'm in setup I'm in ru...
Anthony
22

votes
1

answer
931

Views

Building a C++ project using rake in Eclipse

I have a C++ project that I build using rake rather than a make. To set this up in Eclipse I disabled the CDT and Scanner builders and created a rake builder pointing to the rake executable. This causes the project to be built correctly with Ctrl-B. However the C++ error parser don't seem to be kick...
Sasha
2

votes
1

answer
1.2k

Views

<echo> ant task equivalent in rakefile?

What is the equivilent to the ant task in a ruby rake file?
leeand00
2

votes
1

answer
108

Views

Remove sensitive information from a Rakefile

What are the recommended procedures for removing sensitive information from a Rakefile? For example, my project's Rakefile looks like: # -*- coding: utf-8 -*- $:.unshift('/Library/RubyMotion/lib') require 'motion/project' require 'bubble-wrap' Motion::Project::App.setup do |app| # Use `rake config'...
Zach Latta
2

votes
1

answer
426

Views

Rails error Uninitialized constant importing csv

This is my first time importing a csv file to my rails app. I have the code below in /lib/tasks/import.rake require 'csv' CSV.foreach('lib/articles.csv', headers: true, encoding: 'ISO8859-1') do |row| Article.new(title: row['Title'], body: row['Body'], user: User.find(1)) end When I run rake impor...
jgrant
1

votes
1

answer
477

Views

Don't know how to build task 'recipe_test.rb'

I know same question is asked before but those were totally different scenarios than mine . I have a .rb file in my rails_app/test/integration recipe_test.rb require 'test_helper' class RecipeFlowsTest < ActionDispatch::IntegrationTest fixtures :recipes test 'create recipes' do https! # sign in emul...
ImranNaqvi
3

votes
2

answer
2.2k

Views

Is it possible to use in a Rakefile tasks from another one?

I have some Rake tasks I'd like to use in my Rakefiles. Is it possible to include tasks defined in one rakefile from another rakefile?
Geo
2

votes
1

answer
166

Views

Rake's rule does not check timestamp

The following Rakefile is for a simple program which needs a.c and a.h. # Rakefile task :default => 'a.out' file 'a.o' => 'a.h' file 'a.out' => 'a.o' do |t| sh 'gcc -o #{t.name} #{t.prerequisite_tasks.collect(&:name).join(' ')}' end rule '.o' => '.c' do |t| sh 'gcc -c -o #{t.name} #{t.source}' end I...
kukyakya
2

votes
1

answer
1.2k

Views

bin stub - missing dependencies from gem (executing rake tasks within gem)

I've written a gem elastic-beanstalk which is to be used inside a rails project file structure, as well as in a standalone CI environment where the rails dir and files are not available (without unzipping etc). i.e. the Bamboo build process running eb:package will yield one primary artifact app.zip...
kross
2

votes
2

answer
293

Views

Command to display all descriptions of rakefile tasks?

I know in Ant / Nant you can pass an argument like -projecthelp to get a list of avaialbe targets with descriptions. Is there a similar command-line argument for doing this with a rakefile's tasks? Also is there a way to generate documentation from the rakefile itself?
leeand00
4

votes
1

answer
2.5k

Views

heroku run rake db:migrate … rake aborted! No Rakefile found

When I run heroku run rake db:migrate, I receive the following error: $ heroku run rake db:migrate Running `rake db:migrate` attached to terminal... up, run.8507 rake aborted! No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb) /usr/local/lib/ruby/1.9.1/rake.rb:2367:in `raw...
Joe Morano

View additional questions