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 github.com/railsware/capistrano-multiconfig) TODO: find a way to remove this and still be compatible with capistrano 2.x
Class Method Summary collapse
- .check_stage_path(paths, path) ⇒ Object
- .checks_paths(paths) ⇒ Object
- .fetch_stages_paths ⇒ Object
- .sorted_paths(paths) ⇒ Object
- .stages ⇒ Object
- .stages_paths ⇒ Object
Class Method Details
.check_stage_path(paths, path) ⇒ Object
22 23 24 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 22 def check_stage_path(paths, path) paths.any? { |another| another != path && another.start_with?(path + ':') } end |
.checks_paths(paths) ⇒ Object
13 14 15 16 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 13 def checks_paths(paths) paths.reject! { |path| check_stage_path(paths, path) } sorted_paths(paths) end |
.fetch_stages_paths ⇒ Object
33 34 35 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 33 def fetch_stages_paths stages_paths.tap { |paths| yield paths if block_given? } end |
.sorted_paths(paths) ⇒ Object
18 19 20 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 18 def sorted_paths(paths) paths.present? ? paths.uniq.sort : paths end |
.stages ⇒ Object
7 8 9 10 11 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 7 def stages fetch_stages_paths do |paths| checks_paths(paths) end end |
.stages_paths ⇒ Object
26 27 28 29 30 31 |
# File 'lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb', line 26 def stages_paths stages_root = File.(File.join(detect_root, 'config/deploy')) Dir["#{stages_root}/**/*.rb"].map do |file| file.slice(stages_root.size + 1..-4).tr('/', ':') end end |