Module: CapistranoMulticonfigParallel::StagesHelper
- Included in:
- ApplicationHelper
- Defined in:
- lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb
Overview
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
Class Method Summary collapse
- .check_stage_path(paths, path) ⇒ Object
- .checks_paths(paths) ⇒ Object
- .fetch_stages ⇒ Object
- .fetch_stages_paths ⇒ Object
- .stages_paths ⇒ Object
Class Method Details
.check_stage_path(paths, path) ⇒ Object
18 19 20 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 18 def check_stage_path(paths, path) paths.any? { |another| another != path && another.start_with?(path + ':') } end |
.checks_paths(paths) ⇒ Object
14 15 16 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 14 def checks_paths(paths) paths.reject! { |path| check_stage_path(paths, path) }.uniq.sort end |
.fetch_stages ⇒ Object
8 9 10 11 12 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 8 def fetch_stages fetch_stages_paths do |paths| checks_paths(paths) end end |
.fetch_stages_paths ⇒ Object
29 30 31 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 29 def fetch_stages_paths stages_paths.tap { |paths| yield paths if block_given? } end |
.stages_paths ⇒ Object
22 23 24 25 26 27 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 22 def stages_paths stages_root = 'config/deploy' Dir["#{stages_root}/**/*.rb"].map do |file| file.slice(stages_root.size + 1..-4).tr('/', ':') end end |