Sha256: f4336f0db48cec6b6239c2d0a2d35474771968da175f9563ec09ff5f134d9ab1

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

module Capistrano
  module Multiconfig
    module DSL
      def stages_root
        fetch(:stages_root, 'config/deploy')
      end

      # Build stages with nested configurations
      #
      # @example simple stages
      #
      #   config
      #   ├── deploy
      #   │   ├── production.rb
      #   │   └── staging.rb
      #   └── deploy.rb
      #
      # * cap production
      # * cap staging
      #
      # @example stages with nested configurations
      #
      #   config
      #   ├── deploy
      #   │   ├── soa
      #   │   │   ├── blog
      #   │   │   │   ├── production.rb
      #   │   │   │   └── staging.rb
      #   │   │   └── wiki
      #   │   │       └── qa.rb
      #   │   └── soa.rb
      #   └── deploy.rb
      #
      # * cap soa:blog:production
      # * cap soa:blog:staging
      # * cap soa:wiki:qa
      def stages
        Dir["#{stages_root}/**/*.rb"].map { |file|
          file.slice(stages_root.size + 1 .. -4).tr('/', ':')
        }.tap { |paths|
          paths.reject! { |path|
            paths.any? { |another| another != path && another.start_with?(path) }
          }
        }.sort
      end
    end
  end
end

self.extend Capistrano::Multiconfig::DSL

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano-multiconfig-3.0.7 lib/capistrano/multiconfig/dsl.rb
capistrano-multiconfig-3.0.5 lib/capistrano/multiconfig/dsl.rb
capistrano-multiconfig-3.0.4 lib/capistrano/multiconfig/dsl.rb
capistrano-multiconfig-3.0.3 lib/capistrano/multiconfig/dsl.rb