123456789_123456789_123456789_123456789_123456789_

Class: RubyInstaller::Build::ComponentsInstaller

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Rake::Application
Instance Chain:
self, Rake::Application
Inherits: Rake::Application
  • Object
Defined in: lib/ruby_installer/build/components_installer.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(msys: nil, pacman_args: ["--needed", "--noconfirm"], builtin_packages_dir: File.join(RbConfig::TOPDIR, "packages")) ⇒ ComponentsInstaller

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 10

def initialize(msys: nil, pacman_args: ["--needed", "--noconfirm"], builtin_packages_dir: File.join(RbConfig::TOPDIR, "packages"))
  super()
  @msys = msys
  @pacman_args = pacman_args
  @builtin_packages_dir = builtin_packages_dir

  @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

Instance Attribute Details

#installable_components (readonly)

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 6

attr_reader :installable_components

#msys (rw)

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 7

attr_accessor :msys

#pacman_args (rw)

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 8

attr_accessor :pacman_args

Instance Method Details

#define_tasks (private)

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 40

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.builtin_packages_dir = @builtin_packages_dir
    t
  end

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

#install(component_names)

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 33

def install(component_names)
  collect_command_line_tasks(component_names)
  top_level
end

#reload

[ GitHub ]

  
# File 'lib/ruby_installer/build/components_installer.rb', line 28

def reload
  clear
  define_tasks
end