Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created June 16, 2015 03:05
Show Gist options
  • Select an option

  • Save makevoid/da2afa341fc9dd0eb531 to your computer and use it in GitHub Desktop.

Select an option

Save makevoid/da2afa341fc9dd0eb531 to your computer and use it in GitHub Desktop.
A good default Rakefile to start with - use rake to setup and run your ruby app
# task :default => [:hello]
task :default => [:setup_and_run]
# task :hello do
# puts "hello world"
# end
class Bundle
# ...
def self.install
puts `bundle install`
end
end
class Task
def self.run
popen_read "python -m SimpleHTTPServer 3001"
end
def self.setup
# Bundle.setup
Bundle.install
end
# private
def self.popen_read(cmd)
IO.popen cmd, 'r+' do |f|
puts f.gets
end
end
end
task(:run) { Task.run }
task(:setup) { Task.setup }
task :setup_and_run do
Task.setup
Task.run
end
@makevoid

Copy link
Copy Markdown
Author

I need to take a more generic approach maybe thanks to @alloy's handy code:

https://gist.github.com/alloy/f0292ff380647028e9b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment