Sha256: 3b59b6c88ac029d0d4da0ad8d800ef2f97d3ed93909d47622fbc06e27c380701

Contents?: true

Size: 730 Bytes

Versions: 36

Compression:

Stored size: 730 Bytes

Contents

module Capistrano
  module DSL
    module Stages
      RESERVED_NAMES = %w(deploy doctor install).freeze
      private_constant :RESERVED_NAMES

      def stages
        names = Dir[stage_definitions].map { |f| File.basename(f, ".rb") }
        assert_valid_stage_names(names)
        names
      end

      def stage_definitions
        stage_config_path.join("*.rb")
      end

      def stage_set?
        !!fetch(:stage, false)
      end

      private

      def assert_valid_stage_names(names)
        invalid = names.find { |n| RESERVED_NAMES.include?(n) }
        return if invalid.nil?

        raise t("error.invalid_stage_name", name: invalid, path: stage_config_path.join("#{invalid}.rb"))
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
capistrano-3.19.2 lib/capistrano/dsl/stages.rb
capistrano-3.19.1 lib/capistrano/dsl/stages.rb
capistrano-3.19.0 lib/capistrano/dsl/stages.rb
capistrano-3.18.1 lib/capistrano/dsl/stages.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/capistrano-3.18.0/lib/capistrano/dsl/stages.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/capistrano-3.18.0/lib/capistrano/dsl/stages.rb
capistrano-3.18.0 lib/capistrano/dsl/stages.rb
capistrano-3.17.3 lib/capistrano/dsl/stages.rb
capistrano-3.17.2 lib/capistrano/dsl/stages.rb
capistrano-3.17.1 lib/capistrano/dsl/stages.rb
capistrano-3.17.0 lib/capistrano/dsl/stages.rb
capistrano-3.16.0 lib/capistrano/dsl/stages.rb
capistrano-3.15.0 lib/capistrano/dsl/stages.rb
capistrano-3.14.1 lib/capistrano/dsl/stages.rb
capistrano-3.14.0 lib/capistrano/dsl/stages.rb
capistrano-3.13.0 lib/capistrano/dsl/stages.rb
capistrano-3.12.1 lib/capistrano/dsl/stages.rb
capistrano-3.12.0 lib/capistrano/dsl/stages.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/capistrano-3.11.0/lib/capistrano/dsl/stages.rb
capistrano-3.11.2 lib/capistrano/dsl/stages.rb