Sha256: 7ed047cce3428efaa72d61adbbb2f1a9b8a94a7832cdad8807f096c7b9c300ff

Contents?: true

Size: 1.37 KB

Versions: 9

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

require 'eac_templates/core_ext'
require 'avm/eac_webapp_base0/deploy'
require 'avm/instances/entry_keys'

module Avm
  module EacRailsBase0
    class Deploy < ::Avm::EacWebappBase0::Deploy
      set_callback :assert_instance_branch, :after do
        bundle_install
        assert_database
        database_migrate
        compile_assets
        restart_tasks_scheduler
        touch_restart_file
      end

      def assert_database
        infom 'Asserting database...'
        instance.pg.assert
      end

      def bundle_install
        infom 'Running "bundle install"...'
        instance.bundle('install').system!
      end

      def compile_assets
        infom 'Compiling assets...'
        instance.rake('assets:clean', 'assets:precompile').system!
      end

      def database_migrate
        infom 'Running database migrations...'
        instance.rake('db:migrate').system!
      end

      def restart_tasks_scheduler
        infom 'Restarting Tasks Scheduler\'s daemon...'
        instance.bundle('exec', 'tasks_scheduler', 'restart').system!
      end

      def touch_restart_file
        infom 'Touching restart file...'
        instance.host_env.command(
          'touch', ::File.join(instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH),
                               'tmp', 'restart.txt')
        ).system!
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
eac_tools-0.31.1 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.31.0 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.30.0 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.29.0 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.28.0 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.27.2 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.27.1 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb
avm-eac_rails_base0-0.8.0 lib/avm/eac_rails_base0/deploy.rb
eac_tools-0.27.0 sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/deploy.rb