Aptana 3 executing a rake task from a ruble command - ruby

Im all new to this so I have no idea if its possible but all I want to do is execute a rake task from a ruble command in Aptana Studio 3.
The rakefile is located in the project folder and all it does in convert and minimize some sass code.
Anyone got any ideas?
Thanks

I would first look at http://wiki.appcelerator.org/display/tis/A+Simple+Command to get familiar with creating a command in a ruble.
If you wanted to add a rake task to a command in a ruble, I would then look at http://wiki.appcelerator.org/display/tis/Executing+an+External+Command
Inside the invoke block for the command, you can invoke an external rake task like:
rake your_rake_task

Related

Ruby: run rake task to execute ruby scripts

I have a bunch of Ruby scripts and I'd like to start them with a Rake task.
A simplified version to illustrate my issue:
export_stats.rake:
desc 'Export statistics'
task :export_stats do
puts "executing: export_stats.rb #{START_MONTH} #{END_MONTH} #{OUTPUT} #{ENVIRONMENT}"
ruby "export_stats.rb #{START_MONTH} #{END_MONTH} #{OUTPUT} #{ENVIRONMENT}"
end
rake aborted! elk-stack/export_stats.rake Don't know how to build task
'export_stats'
the export_stats.rb file is in same directory with export_stats.rake
the rake gem is installed and if I run
rake export_stats
I get an error:
rake aborted!
Don't know how to build task 'export_stats'
What am I missing?
If I understand you correctly you have a folder with some ruby scripts and you are trying to run a rake task that is located in the same folder. I assume you are not using any application framework like Rails (because you did tag the question only with "Ruby").
Do you have a Rakefile in same directory? If so does it contain a statement to load the specific files to run?
# Rakefile
#!/usr/bin/env rake
load 'export_stats.rake'
You have a typo.
The code says export_stats, and the error says exports_stats.
There's an extra s.
Read the error message carefully! ;)

Undefined Step Definitions when Running Cucumber scripts in command line

I was previously using RubyMine to run cucumber test scripts and it works just fine, but I am looking for an alternative to run those scripts from command line.
When I try to run a specific .feature file from cmd, I get an error stating that my Ruby step definitions are undefined. I am assuming this is because they are not located in the same directory as the .feature file that I am trying to run.
Here is my cmd output:
Undefined Steps error output
Any suggestions welcome! Thanks
If you're running cucumber from your_directory. Then your .feature files should be in your_directory/features and step definitions (.rb files) in your_directory/features/step_definitions Subfolders are supported.
Look at https://docs.cucumber.io/guides/10-minute-tutorial/
If you're running Win10, check WSL - makes your life better ;-)

Using DBDeploy.Net with Rake

We are trying to use DBDeploy.Net for managing our SQL Scripts in a .Net project. We also use a Rake script for automatic builds.
I am unable to find any documentation on how to use DBDeploy.Net with Rake. Is there a nice way of getting DBDeploy working with Rake? (I don't want to create a NAnt script for DBDeploy and call that from Rake)
Documentation for the command line execution of dbdeploy.NET has been added to https://github.com/brunomlopes/dbdeploy.net#command-line. A lot of new features have been added as well.
Does DbDeploy.net have a command line runner. If so check out the ExecTask from Albacore.
If you have just started working with DbDeploy.net and are open to options have a look at FluentMigrator. It has a command line runner.

How do I call a Cake file from a Rake file, or a Make file, or some combination of these?

So, I have a cake file for building my Coffeescript (thanks to https://github.com/krismolendyke/InstantJasmineCoffee). I also have a directory full of SCSS based on Compass, which I call with a quick "compass compile," which comes from a Ruby gem.
Is there a way to call "compass compile" from within my Cake file, or a way to call my Cake file from within a Rake file, or a Make file that can do both, or something else entirely? What's the easiest way to do all of my compilations?
As a Rakefile is just ruby source, you can use system, eg.
description "Compile"
task :compile do
system "compass compile"
end
radiospiel has shown how you could run compass or cake from a Rake file. To call compass or rake from a Cakefile, you'd write something like this:
{exec} = require 'child_process'
exec 'compass compile'
(Replace compass compile with whatever system command you want to run.) Note that this would, by default, suppress the output from the command; you should probably use a callback to log that output. See the Node docs on child_process.exec for details.

Is it possible to run a Ruby project via Rake?

I've got a Ruby project started with NetBeans, so the Rake file has been generated. Is there a way that I can run the project over the command line?
It runs fine when I use F6 through NetBeans, as does my automated test suite with Alt+F6. I'm essentially looking for something like...
$ rake run
Does this exist?
The goal of ruby programming is (generally) to either write a web application, or write a program that can be run from the command line.
For a web application a rake run option might be worthwhile, but really the most common web applicaition framework is Rails, and for rails, you can just run a dedicated webserver running your web app with script/server.
For a commandline program, just run whichever ruby file you have intended as the main file (the one with the code that runs at startup). Ruby doesn't have any of the difficulties that Java does (e.g. having a jar file with the right Main-class attribute, and getting the classpath right, etc...). So you don't really need a rake run target, because there's no complexity that needs to be hidden in the rakefile.
Although Ken's right, you can certainly make a rake task to run your program. In lib/tasks/project.rake:
namespace :project do
task :run do
call_your_code()
end
end
and then rake project:run will do what you want.

Resources