Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Last active December 18, 2015 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrishunt/5724738 to your computer and use it in GitHub Desktop.
Save chrishunt/5724738 to your computer and use it in GitHub Desktop.
Wrap your amazing Rakefile in a gem
$ bundle gem wrake
$ cd wrake
$ vi wrake.gemspec
  - Fill in TODOs on description and summary
  - Add 'rake' runtime depedency at the bottom
    - spec.add_runtime_dependency "rake"

$ vi lib/wrake/Rakefile
# lib/wrake/Rakefile
desc "Prints 'hello'"
task :hello do
  puts 'hello'
end

task default: :hello
$ mkdir bin
$ vi bin/wrake
#!/usr/bin/env ruby
# bin/wrake

require 'wrake'

rakefile = File.join(
  File.expand_path(File.join(File.dirname(__FILE__), '..')),
  'lib', 'wrake', 'Rakefile'
)

puts `rake -f #{rakefile} #{ARGV.join ' '}`
$ git add --all && git commit -m 'Initial commit'
$ bundle exec rake install
$ wrake -T
  # rake hello  # Prints 'hello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment