Class: Dotstrap::Configuration
- Inherits:
-
Object
- Object
- Dotstrap::Configuration
- Defined in:
- lib/dotstrap.rb
Instance Attribute Summary collapse
-
#repos ⇒ Object
Returns the value of attribute repos.
Instance Method Summary collapse
- #configure(dest_dir = Dotstrap.config_home, repos = @repos) ⇒ Object
-
#initialize(repos = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #install(dest_dir = Dotstrap.config_home, repos = @repos) ⇒ Object
-
#list(repos = @repos) ⇒ Object
TODO: return a data-structure from ‘list`, do not print out.
- #load_configs(repo_path) ⇒ Object
- #remove(repos = @repos) ⇒ Object
Constructor Details
#initialize(repos = nil) ⇒ Configuration
Returns a new instance of Configuration.
103 104 105 106 |
# File 'lib/dotstrap.rb', line 103 def initialize(repos = nil) @repos = repos unless repos.nil? FileUtils.mkdir_p(Dotstrap.config_home) end |
Instance Attribute Details
#repos ⇒ Object
Returns the value of attribute repos.
101 102 103 |
# File 'lib/dotstrap.rb', line 101 def repos @repos end |
Instance Method Details
#configure(dest_dir = Dotstrap.config_home, repos = @repos) ⇒ Object
118 119 120 121 122 123 124 125 |
# 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) ⇒ Object
108 109 110 111 112 113 114 115 116 |
# 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) ⇒ Object
TODO: return a data-structure from ‘list`, do not print out
137 138 139 140 141 142 143 144 145 146 147 |
# 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 |