Sha256: aea53537780ad480a05d7db7eba1d6d76b71c13fe2bebc3f008448c3c67a8971

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require_relative './core_helper'
require_relative './internal_helper'
require_relative './stages_helper'
module CapistranoMulticonfigParallel
  # class that holds the options that are configurable for this gem
  module ApplicationHelper
    include CapistranoMulticonfigParallel::InternalHelper
    include CapistranoMulticonfigParallel::CoreHelper
    include CapistranoMulticonfigParallel::StagesHelper

  module_function

    def strip_characters_from_string(value)
      return unless value.present?
      value = value.delete("\r\n").delete("\n")
      value = value.gsub(/\s+/, ' ').strip if value.present?
      value
    end

    def parse_task_string(string) # :nodoc:
      /^([^\[]+)(?:\[(.*)\])$/ =~ string.to_s

      name           = Regexp.last_match(1)
      remaining_args = Regexp.last_match(2)

      return string, [] unless name
      return name,   [] if     remaining_args.empty?

      args = []

      loop do
        /((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args

        remaining_args = Regexp.last_match(2)
        args << Regexp.last_match(1).gsub(/\\(.)/, '\1')
        break if remaining_args.blank?
      end

      [name, args]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano_multiconfig_parallel-0.19.2 lib/capistrano_multiconfig_parallel/helpers/application_helper.rb
capistrano_multiconfig_parallel-0.19.1 lib/capistrano_multiconfig_parallel/helpers/application_helper.rb
capistrano_multiconfig_parallel-0.19.0 lib/capistrano_multiconfig_parallel/helpers/application_helper.rb
capistrano_multiconfig_parallel-0.18.2 lib/capistrano_multiconfig_parallel/helpers/application_helper.rb