Skip to content

Instantly share code, notes, and snippets.

@metaskills metaskills/mytask.rake
Last active Aug 29, 2015

Embed
What would you like to do?
Using Thor Actions In Rake Tasks
require 'thor'
namespace :myns do
class Hammer < Thor
include Thor::Actions
end
desc "Some task."
task :cleanup_files do
assets = Rails.root.join 'vendor/assets'
hammer :gsub_file, assets.join('some.file'), /garbage/, 'gmoney'
end
private
def hammer(*args)
Hammer.new.send *args
end
end
@metaskills

This comment has been minimized.

Copy link
Owner Author

commented Jan 29, 2014

I like using Rake and did not want to make a new thor setup and have to remember which actions are tasks in Rake vs Thor. Besdies, my Spring binstubs are for rails and rake only and I even have rake completions all setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.