class Flexdot::Tasks

Constants

Index

Attributes

dotfiles_dir[R]
home_dir[R]
output_colorize[R]

Public Class Methods

new(dotfiles_dir, home_dir, output_colorize) click to toggle source
# File lib/flexdot/tasks.rb, line 13
def initialize(dotfiles_dir, home_dir, output_colorize)
  @dotfiles_dir = Pathname.new(dotfiles_dir).expand_path
  @home_dir = Pathname.new(home_dir).expand_path
  @output_colorize = output_colorize
end

Public Instance Methods

install() click to toggle source
# File lib/flexdot/tasks.rb, line 19
def install
  desc 'Clear backups'
  task :clear_backups do
    Backup.clear_all
  end

  namespace :install do
    indexes.each do |index|
      desc "Install dotfiles for #{index.name}"
      task index.name do
        installer = Installer.new(
          index.name,
          dotfiles_dir,
          home_dir,
          output_colorize
        )
        installer.install(index.filename)
      end
    end
  end
end

Private Instance Methods

indexes() click to toggle source
# File lib/flexdot/tasks.rb, line 45
def indexes
  @indexes ||= Pathname.new(dotfiles_dir).glob('*.yml').map do |index_file|
    Index.new(name: index_file.basename('.*').to_s, filename: index_file)
  end
end