dotstrap 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0ccd6c31b5b1e94988783114e9913c1a407354f
4
- data.tar.gz: 6b7703c9ac39592e8f334160e8d523d387c248de
3
+ metadata.gz: 06b5a3debbd877e85d7b1c418dd75cb7e0a29f30
4
+ data.tar.gz: 0b0fd86545433c553c8be7e9c7cec3f68f530d3e
5
5
  SHA512:
6
- metadata.gz: 6b9890ddd3308ea41aceab5b77c08de8a29df6b0e597c4ac37a6dab8e9c1515401391c5e9e1af866c25939fba15edd8bafcdb7251ba37c1d443c156028e45f67
7
- data.tar.gz: 0621d62ce0124555940e435aa5bf59f1e0f0665ab6d39e5107a8508478d39cafd5a77580266147fc38dd21b103dc6b041d14b29e1ccc1f5bb9eeed3b59c6d736
6
+ metadata.gz: 95cccf83f393fe078fa1b6c219f4f5ef233bf28be19283eda275a4cff9ecb668e84cea290fdaa3f6933df1b3e350edf39ede3223964d573f53155946b8e433cd
7
+ data.tar.gz: 022ddb81f1a5b47d8c354c9fae1e0ff4ec15419e4a86974cf0883ba6980d0ee83f4270438dbf514398ff067eeefd5d3754ac81094f0af74926d18f17039df39e
data/bin/dotstrap CHANGED
@@ -72,24 +72,14 @@ module Dotstrap
72
72
  Download all the repositories listed in the file ~/.config/repos.txt
73
73
  \x5 $ ds install ~/.config/repos.txt
74
74
  LONGDESC
75
+ option :no_fetch, :type => :boolean
75
76
  def install(repo, *args)
76
77
  args << repo # so thor will not complain when you call `install` with no args
77
- repos = []
78
- args.each do |repo|
79
- if File.exist?(repo)
80
- File.open(repo).each do |line|
81
- # FIXME: strip everything afer '#' until newline (repo # comment)
82
- repos << line.strip unless line.start_with?('#')
83
- end
84
- else
85
- repos << repo
86
- end
87
- end
88
- repos = repos.reject(&:empty?)
89
-
78
+ repos = __determine_repos(args)
90
79
  __set_log_level
91
80
  $LOG.debug { "REPO ARGS:#{repos}" }
92
- Dotstrap::Configuration.new(repos).configure
81
+ ds = Dotstrap::Configuration.new(repos)
82
+ options[:no_fetch] ? ds.configure : ds.install
93
83
  end
94
84
 
95
85
  desc 'uninstall REPO...', 'Remove specified REPO'
@@ -101,18 +91,7 @@ module Dotstrap
101
91
  LONGDESC
102
92
  def uninstall(repo, *args)
103
93
  args << repo # so thor will complain when you call `uninstall` with no args
104
- repos = []
105
- args.each do |repo|
106
- if File.exist?(repo)
107
- File.open(repo).each do |line|
108
- args << line.strip unless line.start_with?('#')
109
- end
110
- else
111
- repos << repo
112
- end
113
- end
114
- repos = repos.reject(&:empty?)
115
-
94
+ repos = __determine_repos(args)
116
95
  __set_log_level
117
96
  $LOG.debug { "REPO ARGS:#{repos}" }
118
97
  Dotstrap::Configuration.new(repos).remove
@@ -128,30 +107,33 @@ module Dotstrap
128
107
  #{__repo_format_desc}
129
108
  LONGDESC
130
109
  def list(*args)
131
- repos = []
132
110
  if args.empty?
133
111
  Dotstrap::Configuration.new(Dotstrap.installed_repos).list
134
112
  return
135
113
  end
114
+ repos = __determine_repos(args)
115
+ __set_log_level
116
+ $LOG.debug { "REPO ARGS:#{repos}" }
117
+ Dotstrap::Configuration.new(repos).list
118
+ end
119
+
120
+ private
136
121
 
137
- args.each do |repo|
122
+ def __determine_repos(cli_args)
123
+ repos = []
124
+ cli_args.each do |repo|
138
125
  if File.exist?(repo)
139
126
  File.open(repo).each do |line|
140
- args << line.strip unless line.start_with?('#')
127
+ # FIXME: strip everything afer '#' until newline (repo # comment)
128
+ repos << line.strip unless line.start_with?('#')
141
129
  end
142
130
  else
143
131
  repos << repo
144
132
  end
145
133
  end
146
134
  repos = repos.reject(&:empty?)
147
-
148
- __set_log_level
149
- $LOG.debug { "REPO ARGS:#{repos}" }
150
- Dotstrap::Configuration.new(repos).list
151
135
  end
152
136
 
153
- private
154
-
155
137
  def __set_log_level(level = nil)
156
138
  # $LOG.close; return if options[:quiet]
157
139
  unless level
data/dotstrap.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: dotstrap 0.2.0 ruby lib
5
+ # stub: dotstrap 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "dotstrap"
9
- s.version = "0.2.0"
9
+ s.version = "0.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.metadata = { "documentation" => "http://www.rubydoc.info/github/mkwmms/dotstrap/master/Dotstrap", "source_code" => "http://github.com/mkwmms/dotstrap" } if s.respond_to? :metadata=
data/lib/dotstrap/git.rb CHANGED
@@ -18,9 +18,7 @@ module Dotstrap
18
18
  # FIXME: if user is not logged in to Git the prompt for username/password
19
19
  # is mangled because the threads are not synchronized
20
20
  def clone(url = @url, repo_path = @repo_path, repo = @repo)
21
- if Dir.exist?(repo_path)
22
- return pull(repo_path)
23
- end
21
+ return pull(repo_path) if Dir.exist?(repo_path)
24
22
  return false unless system('git', 'clone', *git_verbosity, url, repo_path)
25
23
  $LOG.debug { "CLONE #{repo} #{url} #{repo_path}" }
26
24
  $LOG.unknown { "#{'=> '.colorize(:blue)}#{repo}\nupdated" }
data/lib/dotstrap.rb CHANGED
@@ -8,7 +8,7 @@ require_relative 'dotstrap/shell'
8
8
  module Dotstrap
9
9
  NAME = 'dotstrap'
10
10
  EXE_NAME = 'dotstrap'
11
- VERSION = '0.2.0'
11
+ VERSION = '0.3.0'
12
12
  AUTHOR = 'William Myers'
13
13
  HOMEPAGE = 'http://github.com/mkwmms/dotstrap'
14
14
  SOURCE_URL = 'http://github.com/mkwmms/dotstrap'
@@ -105,13 +105,8 @@ module Dotstrap
105
105
  FileUtils.mkdir_p(Dotstrap.config_home)
106
106
  end
107
107
 
108
- def configure(dest_dir = Dotstrap.config_home, repos = @repos)
109
- if Dotstrap.shell_name == 'fish'
110
- fish_config_home = Dotstrap.shell_config_home('fish')
111
- FileUtils.mkdir_p(File.join(fish_config_home, 'functions'))
112
- FileUtils.mkdir_p(File.join(fish_config_home, 'completions'))
113
- end
114
-
108
+ def install(dest_dir = Dotstrap.config_home, repos = @repos)
109
+ initialize_fish_dirs if Dotstrap.shell_name == 'fish'
115
110
  Parallel.map(repos, in_threads: 16) do |r|
116
111
  bundle = Dotstrap::Git.new(r, dest_dir)
117
112
  path = bundle.clone
@@ -120,6 +115,15 @@ module Dotstrap
120
115
  end
121
116
  end
122
117
 
118
+ def configure(dest_dir = Dotstrap.config_home, repos = @repos)
119
+ initialize_fish_dirs if Dotstrap.shell_name == 'fish'
120
+ Parallel.map(repos, in_threads: 16) do |r|
121
+ path = Dotstrap::Git.new(r, dest_dir).repo_path
122
+ puts path
123
+ load_configs([path]) if path
124
+ end
125
+ end
126
+
123
127
  def remove(repos = @repos)
124
128
  repos.each do |repo|
125
129
  bundle = Dotstrap::Git.new(repo)
@@ -144,9 +148,16 @@ module Dotstrap
144
148
 
145
149
  def load_configs(repo_path)
146
150
  repo_path.each do |r|
147
- shell = Dotstrap::Shell.new(r)
148
- shell.configure(repo_path)
151
+ Dotstrap::Shell.new(r).configure(repo_path)
149
152
  end
150
153
  end
154
+
155
+ private
156
+
157
+ def initialize_fish_dirs
158
+ fish_config_home = Dotstrap.shell_config_home('fish')
159
+ FileUtils.mkdir_p(File.join(fish_config_home, 'functions'))
160
+ FileUtils.mkdir_p(File.join(fish_config_home, 'completions'))
161
+ end
151
162
  end
152
163
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Myers