Sha256: 0246ca26cb024ea4d32dffb66519b6c5a0978a1cdbc50f3843e16078dd715642

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'orats/commands/common'
require 'orats/commands/new/ansible'
require 'orats/commands/new/rails'
require 'orats/commands/new/foreman'

module Orats
  module Commands
    module New
      class Exec < Commands::Common
        include Ansible
        include Rails
        include Foreman

        def initialize(target_path = '', options = {})
          super

          @active_path = services_path
        end

        def init
          rails_template 'base' do
            gsub_postgres_info
            gsub_redis_info unless @options[:redis_password].empty?
            gsub_project_path

            bundle_install
            bundle_binstubs
            spring_binstub

            create_and_migrate_database
          end

          if @options[:auth]
            rails_template 'auth', '--skip ' do
              run_rake 'db:migrate db:seed'
            end
          end

          ansible_extras unless @options[:skip_extras]

          custom_rails_template unless @options[:template].empty?

          foreman_start unless @options[:skip_foreman_start]
        end

        private

        def services_path
          @options[:skip_extras] ?  @target_path : "#{@target_path}/services/#{File.basename @target_path}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
orats-0.6.2 lib/orats/commands/new/exec.rb
orats-0.6.1 lib/orats/commands/new/exec.rb
orats-0.6.0 lib/orats/commands/new/exec.rb