Skip to content

Instantly share code, notes, and snippets.

@phlco
Last active December 25, 2015 00:19
Show Gist options
  • Select an option

  • Save phlco/6887308 to your computer and use it in GitHub Desktop.

Select an option

Save phlco/6887308 to your computer and use it in GitHub Desktop.
sinatra rake tasks
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