Last active
December 25, 2015 00:19
-
-
Save phlco/6887308 to your computer and use it in GitHub Desktop.
sinatra rake tasks
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
| namespace :sinatra do | |
| desc "This makes a Sinatra app" | |
| task :create do | |
| puts "Project Name?" | |
| project = STDIN.gets.chomp | |
| unless Dir.exists?("#{project}_app") | |
| Dir.mkdir("#{project}_app") | |
| Dir.mkdir("#{project}_app/views") | |
| # add public folder | |
| f = File.open("#{project}_app/main.rb", "w+") | |
| f.puts("require 'sinatra'") | |
| # add require reloader | |
| # add pry and pg gems | |
| f.puts("\n") | |
| f.puts("get '/' do\nend") | |
| f.close | |
| else | |
| puts "Project already exists" | |
| end | |
| end | |
| desc "sing it" | |
| task :sing do | |
| puts "doobee doobee doo" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment