Sha256: 962b8e79e61ebc144b6562e66ca70e609118dadfcf5eb06a8c2030970474ecfc

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require "forwardable"

module Capistrano
  module DSL
    module Env
      extend Forwardable
      def_delegators :env,
                     :configure_backend, :fetch, :set, :set_if_empty, :delete,
                     :ask, :role, :server, :primary, :validate, :append,
                     :remove, :dry_run?, :install_plugin

      def is_question?(key)
        env.is_question?(key)
      end

      def any?(key)
        env.any?(key)
      end

      def roles(*names)
        env.roles_for(names.flatten)
      end

      def role_properties(*names, &block)
        env.role_properties_for(names, &block)
      end

      def release_roles(*names)
        if names.last.is_a? Hash
          names.last[:exclude] = :no_release
        else
          names << { exclude: :no_release }
        end
        roles(*names)
      end

      def env
        Configuration.env
      end

      def release_timestamp
        env.timestamp.strftime("%Y%m%d%H%M%S")
      end

      def asset_timestamp
        env.timestamp.strftime("%Y%m%d%H%M.%S")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capistrano-3.6.1 lib/capistrano/dsl/env.rb
capistrano-3.6.0 lib/capistrano/dsl/env.rb
capistrano-3.5.0 lib/capistrano/dsl/env.rb