Sha256: 99604811acbd1f95d900bd588c20ec51a9c411442a75fa1e549680feaffebc71

Contents?: true

Size: 905 Bytes

Versions: 7

Compression:

Stored size: 905 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'

module Bankai
  module Generators
    # :nodoc:
    class DeployGenerator < Base
      def install_capistrano
        Bundler.with_clean_env { run 'bundle exec cap install' }
      end

      def configure_capfile
        inject_into_file(
          'Capfile',
          capistrano_plugins,
          after: "# require \"capistrano/passenger\"\n"
        )
      end

      def replace_deploy_config
        template 'deploy.rb.erb', 'config/deploy.rb', force: true
      end

      protected

      def repo_url
        res = `git remote get-url origin`
        return 'git@example.com:me/my_repo.git' if res.blank?

        res
      end

      private

      def capistrano_plugins
        <<-RUBY
  require "capistrano/bundler"
  require "capistrano/rails/assets"
  require "capistrano/rails/migrations"
        RUBY
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bankai-0.3.1 lib/bankai/generators/deploy_generator.rb
bankai-0.3.0 lib/bankai/generators/deploy_generator.rb
bankai-0.2.3 lib/bankai/generators/deploy_generator.rb
bankai-0.2.2 lib/bankai/generators/deploy_generator.rb
bankai-0.2.1 lib/bankai/generators/deploy_generator.rb
bankai-0.2.0 lib/bankai/generators/deploy_generator.rb
bankai-0.1.0 lib/bankai/generators/deploy_generator.rb