Sha256: e071e40c831664f8ddb84d16f7e692fba377c0301d1f42ea0abf8e3416a7dcb5
Contents?: true
Size: 1.07 KB
Versions: 20
Compression:
Stored size: 1.07 KB
Contents
module CapistranoMulticonfigParallel # module used to fetch the stages (code taken from https://github.com/railsware/capistrano-multiconfig) # TODO: find a way to do this without copying code. Can't currently use gem specification to require that gem # because that is only compatible with capistrano version 3 module StagesHelper module_function def fetch_stages fetch_stages_paths do |paths| checks_paths(paths) end end def checks_paths(paths) paths.reject! { |path| check_stage_path(paths, path) } sorted_paths(paths) end def sorted_paths(paths) paths.present? ? paths.uniq.sort : paths end def check_stage_path(paths, path) paths.any? { |another| another != path && another.start_with?(path + ':') } end def stages_paths stages_root = 'config/deploy' Dir["#{stages_root}/**/*.rb"].map do |file| file.slice(stages_root.size + 1..-4).tr('/', ':') end end def fetch_stages_paths stages_paths.tap { |paths| yield paths if block_given? } end end end
Version data entries
20 entries across 20 versions & 1 rubygems