class RubyInstaller::Build::ComponentsInstaller

Attributes

installable_components[R]
msys[RW]
pacman_args[RW]

Public Class Methods

new(msys: nil, pacman_args: ["--needed", "--noconfirm"]) click to toggle source
Calls superclass method
# File lib/ruby_installer/build/components_installer.rb, line 10
def initialize(msys: nil, pacman_args: ["--needed", "--noconfirm"])
  super()
  @msys = msys
  @pacman_args = pacman_args

  @task_consts = Dir[File.expand_path("../components/??_*.rb", __FILE__)].sort.map do |comppath|
    require comppath

    idx, tname = File.basename(comppath, ".rb").split("_", 2)
    const_name = tname.sub(/^[a-z\d]*/) { |match| match.capitalize }
            .gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
    [idx.to_i, tname, Components.const_get(const_name)]
  end

  define_tasks
end

Public Instance Methods

install(component_names) click to toggle source
# File lib/ruby_installer/build/components_installer.rb, line 32
def install(component_names)
  collect_command_line_tasks(component_names)
  top_level
end
reload() click to toggle source
# File lib/ruby_installer/build/components_installer.rb, line 27
def reload
  clear
  define_tasks
end

Private Instance Methods

define_tasks() click to toggle source
# File lib/ruby_installer/build/components_installer.rb, line 39
def define_tasks
  @installable_components = @task_consts.map do |idx, tname, task_const|
    t = define_task(task_const, tname => task_const.depends)
    t.task_index = idx
    t.msys = msys
    t.pacman_args = pacman_args
    t
  end

  # Do nothing if nothing is requested
  define_task(Rake::Task, :default)
end