Sha256: 83c6a5ce032105e39568e74f9d21f0e44b0c0b0cd78697a135dbba95adce5817
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 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 'capistrano' gem 'capistrano-ext', :lib => 'capistrano' gem 'haml' gem 'paperclip' gem 'rspec' gem 'rspec-rails', :lib => 'spec' gem 'will_paginate' rake "gems:install", :sudo => true # 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.0 | beans_rails.rb |