Class: Flexdot::Tasks

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/flexdot/tasks.rb

Defined Under Namespace

Classes: Index

Instance Method Summary collapse

Constructor Details

#initialize(home_dir, options) ⇒ Tasks

Returns a new instance of Tasks.



13
14
15
16
17
# File 'lib/flexdot/tasks.rb', line 13

def initialize(home_dir, options)
  @home_dir = Pathname.new(home_dir).expand_path
  @dotfiles_dir = Pathname.new(options.dotfiles_dir).expand_path
  @options = options
end

Instance Method Details

#installObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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,
          home_dir,
          dotfiles_dir,
          options
        )
        installer.install(index.filename)
      end
    end
  end
end