Sha256: 2a943d5969e924f83300fbbaf6fa24ac8b1e39734e6b5ce6afd9ac2668a272fb

Contents?: true

Size: 1.26 KB

Versions: 17

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require 'rake_factory'

module RakeDependencies
  module Tasks
    class Ensure < RakeFactory::Task
      default_name :ensure
      default_description(RakeFactory::DynamicValue.new do |t|
        "Ensure #{t.dependency} present"
      end)

      parameter :dependency, required: true
      parameter :version
      parameter :path, required: true

      parameter :binary_directory, default: 'bin'

      parameter :needs_fetch, default: true

      parameter :clean_task_name, default: :clean
      parameter :download_task_name, default: :download
      parameter :extract_task_name, default: :extract
      parameter :install_task_name, default: :install

      action do |t|
        clean = Rake::Task[t.scope.path_with_task_name(t.clean_task_name)]
        download = Rake::Task[t.scope.path_with_task_name(t.download_task_name)]
        extract = Rake::Task[t.scope.path_with_task_name(t.extract_task_name)]

        install_name = t.scope.path_with_task_name(t.install_task_name)
        install = if Rake::Task.task_defined?(install_name)
                    Rake::Task[install_name]
                  end

        if needs_fetch.call(t)
          [clean, download, extract, install].compact.map(&:invoke)
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rake_dependencies-3.10.0.pre.2 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.10.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.9.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.8.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.7.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.6.0.pre.8 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.6.0.pre.4 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.6.0.pre.3 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.6.0.pre.2 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.6.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.5.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.4.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.3.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.2.0.pre.7 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.2.0.pre.6 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.2.0.pre.5 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-3.2.0.pre.4 lib/rake_dependencies/tasks/ensure.rb