Sha256: 2e65ca679d6c3ea619e69510ff56188b4c33e5ba2345f3db6dd13fb66c3a6f15

Contents?: true

Size: 529 Bytes

Versions: 2

Compression:

Stored size: 529 Bytes

Contents

# frozen_string_literal: true

require 'capistrano/ops/helper'

module TaskLoader
  extend Capistrano::Ops::Helper

  def self.load_tasks_if_gem_present(gem_name, task_path, warning_message)
    unless gem_in_gemfile?(gem_name)
      warn warning_message
      return
    end

    base_path = File.expand_path(__dir__)
    task_files = Dir.glob("#{base_path}/#{task_path}/**/*.rake")

    task_files.each do |file|
      load file
    rescue StandardError => e
      puts "Failed to load #{file}: #{e.message}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-ops-1.0.4 lib/capistrano/ops/task_loader.rb
capistrano-ops-1.0.3 lib/capistrano/ops/task_loader.rb