Sha256: 212fec2fc43745333422cb9f4dfc71946466fe0ba9cc0d7faf4a8534bf53feaf

Contents?: true

Size: 1.66 KB

Versions: 7

Compression:

Stored size: 1.66 KB

Contents

module Shipit
  class DeploySpec
    class FileSystem < DeploySpec
      include PypiDiscovery
      include RubygemsDiscovery
      include CapistranoDiscovery
      include BundlerDiscovery

      def initialize(app_dir, env)
        @app_dir = Pathname(app_dir)
        @env = env
      end

      def cacheable
        DeploySpec.new(cacheable_config)
      end

      private

      def cacheable_config
        (config || {}).deep_merge(
          'ci' => {
            'hide' => hidden_statuses,
            'allow_failures' => soft_failing_statuses,
            'require' => required_statuses,
          },
          'machine' => {'environment' => machine_env, 'directory' => directory},
          'review' => {
            'checklist' => review_checklist,
            'monitoring' => review_monitoring,
            'checks' => review_checks,
          },
          'plugins' => plugins,
          'dependencies' => {'override' => dependencies_steps},
          'deploy' => {'override' => deploy_steps, 'variables' => deploy_variables.map(&:to_h)},
          'rollback' => {'override' => rollback_steps},
          'fetch' => fetch_deployed_revision_steps,
          'tasks' => cacheable_tasks,
        )
      end

      def cacheable_tasks
        (config('tasks') || {}).map { |k, c| [k, coerce_task_definition(c)] }.to_h
      end

      def config(*)
        @config ||= load_config
        super
      end

      def load_config
        read_config(file("shipit.#{@env}.yml")) || read_config(file('shipit.yml'))
      end

      def read_config(path)
        SafeYAML.load(path.read) if path.exist?
      end

      def file(path)
        @app_dir.join(path)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
shipit-engine-0.8.0 app/models/shipit/deploy_spec/file_system.rb
shipit-engine-0.7.0 app/models/shipit/deploy_spec/file_system.rb
shipit-engine-0.6.4 app/models/shipit/deploy_spec/file_system.rb
shipit-engine-0.6.3 app/models/shipit/deploy_spec/file_system.rb
shipit-engine-0.6.2 app/models/shipit/deploy_spec/file_system.rb
shipit-engine-0.6.1 app/models/shipit/deploy_spec/file_system.rb
shipit-engine-0.6.0 app/models/shipit/deploy_spec/file_system.rb