Created
June 16, 2015 03:05
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to take a more generic approach maybe thanks to @alloy's handy code:
https://gist.github.com/alloy/f0292ff380647028e9b1