Class: RubyInstaller::Build::ComponentsInstaller

Inherits:
Rake::Application
  • Object
show all
Defined in:
lib/ruby_installer/build/components_installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ComponentsInstaller.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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_componentsObject (readonly)

Returns the value of attribute installable_components.



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

def installable_components
  @installable_components
end

#msysObject

Returns the value of attribute msys.



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

def msys
  @msys
end

#pacman_argsObject

Returns the value of attribute pacman_args.



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

def pacman_args
  @pacman_args
end

Instance Method Details

#install(component_names) ⇒ Object



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

def install(component_names)
  collect_command_line_tasks(component_names)
  top_level
end

#reloadObject



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

def reload
  clear
  define_tasks
end