Class: Flexdot::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/flexdot/installer.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, home_dir, dotfiles_dir, options) ⇒ Installer

Returns a new instance of Installer.



11
12
13
14
15
16
17
# File 'lib/flexdot/installer.rb', line 11

def initialize(name, home_dir, dotfiles_dir, options)
  @name = name
  @dotfiles_dir = dotfiles_dir
  @home_dir = home_dir
  @backup = Backup.new(options.keep_max_backup_count)
  @output = Output.new(@home_dir, colorize: options.output_colorize)
end

Instance Method Details

#install(index_file) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/flexdot/installer.rb', line 19

def install(index_file)
  index = Index.new(YAML.load_file(index_file.to_path))
  index.each do |dotfile_path:, home_file_path:|
    install_link(dotfile_path, home_file_path)
  end

  backup.finish!
  backup.remove_outdated!
end