Sha256: e9bfad1b936c7f98d0cc7e7dc596d29a8bd8d152cf25ebc1c93a7be97fcaecd6
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
TEMPLATES_DIR = 'http://github.com/80beans/beans_rails/raw/master/templates/' class Rails::TemplateRunner def app_name File.basename(root) end def template_file(template, replace = {}) replace = {:app_name => app_name}.merge(replace) contents = open(File.join(TEMPLATES_DIR, template)).read replace.keys.each { |key| contents.gsub!("{{#{key.to_s}}}", replace[key]) } file(template, contents) end end # removing unnecessary files ['README', 'doc/*', 'test', 'public/index.html', 'public/images/rails.png'].each { |file| run "rm -rf #{file}" } # add the required gems to the environment file and install gem 'bundler' rake "gems:install", :sudo => true run 'gem bundle' # copy the .gitignore, database.yml and files needed for bundler to the app ['.gitignore', 'Gemfile', 'config/database.yml', 'config/preinitializer.rb'].each { |file| template_file(file) } # copy the .gitignore and database.yml to the app ['.gitignore', 'config/database.yml'].each { |file| template_file(file) } # generating rspec stuff generate :rspec # capistrano if yes?('Add capistrano configuration?') # create the needed directories ['config/deploy', 'config/deploy/config', 'config/deploy/templates', 'recipes'].each { |dir| run "mkdir #{dir}"} # move the templates to the app [ 'Capfile', 'config/deploy.rb', 'config/deploy/production.rb', 'config/deploy/staging.rb', 'config/deploy/config/staging.yml', 'config/deploy/templates/database.erb', 'config/deploy/templates/public_keys.txt', 'config/deploy/templates/staging_vhost.erb', 'recipes/beans_server.rb' ].each { |file| template_file(file) } end # git git :init git :add => "." git :commit => "-a -m 'Initial commit'" if yes?("Push to remote git repository? (The repository #{app_name} must be configured in Gitosis)") then git :remote => "add origin git@git.80beans.net:#{app_name}.git" git :push => 'origin master:refs/heads/master' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
beans_rails-0.1.1 | beans_rails.rb |