Class: Builderator::Tasks::Vendor

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/builderator/tasks/vendor.rb

Overview

Tasks to fetch and clean up remote artifacts

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Thor::Actions

#run, #run_with_input, #run_without_bundler, #template, #thor_run

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/builderator/tasks/vendor.rb', line 15

def self.exit_on_failure?
  true
end

Instance Method Details

#allObject



20
21
22
# File 'lib/builderator/tasks/vendor.rb', line 20

def all
  Config.vendor.each { |name, _| fetch(name) }
end

#clean(name = nil) ⇒ Object



25
26
27
28
29
30
# File 'lib/builderator/tasks/vendor.rb', line 25

def clean(name = nil)
  ## Clean up all vendors
  return Config.vendor.each { |n, _| clean(n) } if name.nil?

  remove_dir Util.vendor(name)
end

#fetch(name = :default) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/builderator/tasks/vendor.rb', line 33

def fetch(name = :default)
  empty_directory Util::VENDOR

  path = Util.vendor(name)
  params = Config.vendor(name)

  if params.has?(:github)
    say_status :vendor, "#{ name } from GitHub repository #{ params.github }"
    _fetch_github(path, params)
  elsif params.has?(:git)
    say_status :vendor, "#{ name } from git repository #{ params.git }"
    _fetch_git(path, params)
  elsif params.has?(:path)
    say_status :vendor, "#{ name } from path #{ params.path }"
    _fetch_path(path, params)
  end

  ## Include any policies embedded in this vendor
  Config.recompile
end