class Dotstrap::Configuration
Attributes
repos[RW]
Public Class Methods
new(repos = nil)
click to toggle source
# File lib/dotstrap.rb, line 103 def initialize(repos = nil) @repos = repos unless repos.nil? FileUtils.mkdir_p(Dotstrap.config_home) end
Public Instance Methods
configure(dest_dir = Dotstrap.config_home, repos = @repos)
click to toggle source
# File lib/dotstrap.rb, line 118 def configure(dest_dir = Dotstrap.config_home, repos = @repos) initialize_fish_dirs if Dotstrap.shell_name == 'fish' Parallel.map(repos, in_threads: 16) do |r| path = Dotstrap::Git.new(r, dest_dir).repo_path puts path load_configs([path]) if path end end
install(dest_dir = Dotstrap.config_home, repos = @repos)
click to toggle source
# File lib/dotstrap.rb, line 108 def install(dest_dir = Dotstrap.config_home, repos = @repos) initialize_fish_dirs if Dotstrap.shell_name == 'fish' Parallel.map(repos, in_threads: 16) do |r| bundle = Dotstrap::Git.new(r, dest_dir) path = bundle.clone puts path load_configs([path]) if path end end
list(repos = @repos)
click to toggle source
TODO: return a data-structure from ‘list`, do not print out
# File lib/dotstrap.rb, line 137 def list(repos = @repos) repos.each do |repo| bundle = Dotstrap::Git.new(repo) next unless Dir.exist?(bundle.repo_path) puts "#{'=>'.colorize(:blue)} #{repo}" puts bundle.url puts bundle.repo_path # TODO: only output all associated files on --verbose puts "\n" end end
load_configs(repo_path)
click to toggle source
# File lib/dotstrap.rb, line 149 def load_configs(repo_path) repo_path.each do |r| Dotstrap::Shell.new(r).configure(repo_path) end end
remove(repos = @repos)
click to toggle source
# File lib/dotstrap.rb, line 127 def remove(repos = @repos) repos.each do |repo| bundle = Dotstrap::Git.new(repo) repo_path = bundle.repo_path shell = Dotstrap::Shell.new(repo_path) shell.unconfigure(repo_path) end end
Private Instance Methods
initialize_fish_dirs()
click to toggle source
# File lib/dotstrap.rb, line 157 def initialize_fish_dirs fish_config_home = Dotstrap.shell_config_home('fish') FileUtils.mkdir_p(File.join(fish_config_home, 'functions')) FileUtils.mkdir_p(File.join(fish_config_home, 'completions')) end