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.

Revisions

  1. Sergey-B revised this gist Jul 19, 2013. 1 changed file with 23 additions and 6 deletions.
    29 changes: 23 additions & 6 deletions template1.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,12 @@
    # template1.rb
    application_name = ask("Please enter your application name:")
    # Rails template appication file for gem 'deployconfig' https://github.com/Sergey-B/deployconfig-generator
    #USAGE
    #rails new app_name -m template.rb

    gem 'deployconfig', '0.0.1', :path => '/home/sergey/documents/Projects/Rails/deployconfig'#:git => 'git@github.com:Sergey-B/deployconfig-generator.git'#
    #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
    @@ -10,19 +15,31 @@

    run 'bundle install'

    #create config/deploy.rb
    file 'config/deploy.rb', <<-CODE
    require '/home/sergey/documents/Projects/Rails/deployconfig/lib/deployconfig'
    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 .'
    run 'capify .'

    #create config/deploy/testing.rb and config/deploy/production.rb
    run 'rails g deploy'
    run 'rails g unicorn'

    #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'
  2. Sergey-B created this gist Jul 15, 2013.
    28 changes: 28 additions & 0 deletions template1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # template1.rb
    application_name = ask("Please enter your application name:")

    gem 'deployconfig', '0.0.1', :path => '/home/sergey/documents/Projects/Rails/deployconfig'#:git => 'git@github.com:Sergey-B/deployconfig-generator.git'#
    gem 'capistrano'
    gem 'capistrano-ext'
    gem_group :assets do
    gem 'therubyracer', :platforms => :ruby
    end

    run 'bundle install'

    file 'config/deploy.rb', <<-CODE
    require '/home/sergey/documents/Projects/Rails/deployconfig/lib/deployconfig'
    require 'capistrano/ext/multistage'
    set :application, "#{application_name}"
    CODE

    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 .'
    run 'rails g deploy'
    run 'rails g unicorn'