class Rake::Funnel::Tasks::Paket

Attributes

bootstrapper[RW]
bootstrapper_args[RW]
name[RW]
paket[RW]
paket_args[RW]

Public Class Methods

new(*args, &task_block) click to toggle source
# File lib/rake/funnel/tasks/paket.rb, line 13
def initialize(*args, &task_block)
  setup_ivars(args)

  define(args, &task_block)
end

Private Instance Methods

bootstrapper_cmd() click to toggle source
# File lib/rake/funnel/tasks/paket.rb, line 44
def bootstrapper_cmd
  Mono.invocation(bootstrapper, bootstrapper_args)
end
define(args) { |*[self, task_args].slice(0, arity)| ... } click to toggle source
# File lib/rake/funnel/tasks/paket.rb, line 31
def define(args, &task_block)
  desc 'Restore packages' unless Rake.application.last_description

  task(name, *args) do |_, task_args|
    yield(*[self, task_args].slice(0, task_block.arity)) if task_block

    sh(*bootstrapper_cmd) unless File.exist?(paket)
    sh(*paket_cmd)
  end

  self
end
paket_cmd() click to toggle source
# File lib/rake/funnel/tasks/paket.rb, line 48
def paket_cmd
  Mono.invocation(paket, paket_args)
end
setup_ivars(args) click to toggle source
# File lib/rake/funnel/tasks/paket.rb, line 21
def setup_ivars(args)
  @name = args.shift || :paket

  @paket = File.join('.paket', 'paket.exe')
  @paket_args = 'restore'

  @bootstrapper = File.join('.paket', 'paket.bootstrapper.exe')
  @bootstrapper_args = nil
end