Sha256: 8faedb8f2e60e840c016b1af71826b272fea97a3cf5f7e77e980dede69fab90f
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 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 seems to not work properly after capistrano/all is required. It seems to only work in Capfile if is required. # Still investigating how to make that work. module StagesHelper module_function def 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 = File.expand_path(File.join(detect_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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capistrano_multiconfig_parallel-0.22.0 | lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb |