Sha256: 2d71b7321aaecf0748b3647ddb4f78a11f60320063dd5f9e2da152056a9f01d9

Contents?: true

Size: 1.16 KB

Versions: 18

Compression:

Stored size: 1.16 KB

Contents

require 'rake_factory'

module RakeDependencies
  module Tasks
    class Ensure < RakeFactory::Task
      default_name :ensure
      default_description ->(t) { "Ensure #{t.dependency} present" }

      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
          [clean, download, extract, install].compact.map(&:invoke)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rake_dependencies-1.16.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.15.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.14.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.13.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.12.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.11.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.10.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.9.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.8.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.7.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.6.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.5.0.pre.2 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.5.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.4.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.3.0.pre.1 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.2.0 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.1.0.pre.2 lib/rake_dependencies/tasks/ensure.rb
rake_dependencies-1.1.0.pre.1 lib/rake_dependencies/tasks/ensure.rb