Skip to content

Instantly share code, notes, and snippets.

@Sergey-B
Last active December 19, 2015 18:29
Show Gist options
  • Select an option

  • Save Sergey-B/5999118 to your computer and use it in GitHub Desktop.

Select an option

Save Sergey-B/5999118 to your computer and use it in GitHub Desktop.
Template for use deployconfig gem (works local)
# Rails template appication file for gem 'deployconfig' https://github.com/Sergey-B/deployconfig-generator
#USAGE
#rails new app_name -m template.rb
#Application name from command-line arguments 'rails new application_name'
application_name = ARGV[0]
#Gemfile
gem 'deployconfig', '0.0.1', :git => 'sh://git@git.snpdev.ru:42204/deployconfig.git'
gem 'capistrano'
gem 'capistrano-ext'
gem_group :assets do
gem 'therubyracer', :platforms => :ruby
end
run 'bundle install'
#create config/deploy.rb
file 'config/deploy.rb', <<-CODE
require 'deploy_config'
require 'capistrano/ext/multistage'
set :application, "#{application_name}"
set :use_sudo, false
default_run_options[:pty] = true
CODE
#write to Capfile "load 'deploy/assets'"
file 'Capfile',<<-CODE
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
CODE
run 'capify .'
#create config/deploy/testing.rb and config/deploy/production.rb
run 'rails g deploy'
#create unicorn.rb in config/deploy/
run 'rails g unicorn'
#install gem from git, because bundler not install it from Gemfile
run 'cd .. && git clone sh://git@git.snpdev.ru:42204/deployconfig.git && cd deployconfig-generator && rake install && cd - && cd -'
run 'gem sources -a http://gems.github.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment