Skip to content

Instantly share code, notes, and snippets.

@kaineer
Created January 19, 2011 06:46
Show Gist options
  • Save kaineer/785790 to your computer and use it in GitHub Desktop.
Save kaineer/785790 to your computer and use it in GitHub Desktop.
Rake task for copying files from previous sinatra project
desc "Call this when creating new project"
task :bootstrap do
# Clean just edited rakefile ;)
sh( "rm *~" ) unless Dir[ "*~" ].empty?
# Directories..
@prev = ENV[ "PREV" ] || "azsservice"
sh( "mkdir -p app/controllers" )
sh( "mkdir -p app/views" )
sh( "mkdir -p app/models" )
sh( "mkdir config" )
%w( main models ).each do |filename|
sh( "cp ../#{@prev}/app/#{filename}.rb app/" )
end
# ..and models
@models = ENV[ "MODELS" ].to_s.split( "," )
@models.each do |model|
sh( "cp ../#{@prev}/app/models/#{model}.rb app/models" )
end
### public directory
sh( "mkdir -p public/stylesheets" )
sh( "touch public/stylesheets/app.css" )
sh( "cp ../#{@prev}/public/stylesheets/jquery-ui.css public/stylesheets/" )
sh( "mkdir -p public/stylesheets/images/" )
sh( "cp ../#{@prev}/public/stylesheets/images/* public/stylesheets/images/" )
sh( "mkdir -p public/javascripts" )
sh( "mkdir -p public/images" )
# Git repository
sh( "git init" )
sh( "git add ." )
sh( "cp ../#{@prev}/.git/info/exclude ./.git/info/" )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment