Created
November 11, 2011 05:32
-
-
Save ne-sachirou/1357277 to your computer and use it in GitHub Desktop.
Rakefile generate_sinatra_project
This file contains 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
function generate_sinatra_project(){ | |
rake -f /home/ne_Sachirou/default.rake generate_sinatra_project\[$1\] | |
} |
This file contains 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
#encoding = utf-8 | |
desc 'Generate Sinatra Project' | |
task :generate_sinatra_project, [:tamplate_engine] do |task_obj, args| | |
template_engine = args.template_engine || 'erubis' | |
text_gitignore = <<'GITIGNORE' | |
.bundle | |
vendor/bundler | |
*~ | |
*.swp | |
*.swo | |
GITIGNORE | |
text_configru = <<'CONFIGRU' | |
require './main' | |
run Sinatra::Application | |
CONFIGRU | |
text_gemfile = <<"GEMFILE" | |
source :gemcutter | |
gem 'sinatra' | |
gem '#{template_engine}' | |
GEMFILE | |
text_mainrb = <<"MAINRB" | |
#encoding = utf-8 | |
require 'sinatra' | |
require '#{template_engine}' | |
helpers do | |
end | |
get '/' do | |
end | |
MAINRB | |
text_rakefile = <<'RAKEFILE' | |
#encoding = utf-8 | |
RAKEFILE | |
sh 'mkdir public' | |
sh 'mkdir public/style' | |
sh 'mkdir public/script' | |
sh 'mkdir public/image' | |
sh 'mkdir views' | |
open('.gitignore', 'w'){|file| file.write text_gitignore} | |
open('Gemfile', 'w'){|file| file.write text_gemfile} | |
open('main.rb', 'w'){|file| file.write text_mainrb} | |
open('Rakefile', 'w'){|file| file.write text_rakefile} | |
sh 'bundle install --path vendor/bundler' | |
sh 'git init' | |
end | |
task :default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment