central 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/central.rb +21 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32c1b221cc555abfdf1fca8f3f39de5614767049
|
4
|
+
data.tar.gz: 68ed3f15a8d2733429f28b2ddd8d2fd8ff2b195f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 851be63883d051ec8a528eb565ccd142f9c327677b1bb20f24b441ef2028ac33adaeb35ca96a0e9293bbee766e40262ee0244beb9ecc4dfef8753bbba3ab10a0
|
7
|
+
data.tar.gz: f17fe82282dd9e3f266cc7dc24c52b89d0a8f122dab02ec383c2ae7b5d00aa14c6fb32bf63693d3a49267c9920f46c89d4a18074983ebea521c3bc8e150019e8
|
data/lib/central.rb
CHANGED
@@ -187,19 +187,37 @@ def symlink(from,to)
|
|
187
187
|
end
|
188
188
|
|
189
189
|
# git clone url into a path
|
190
|
-
def git(url,path)
|
190
|
+
def git(url,path,branch=nil)
|
191
191
|
path = abs(path)
|
192
192
|
if dir_exists?(path) && dir_exists?("#{path}/.git")
|
193
193
|
cwd = pwd()
|
194
194
|
chdir path
|
195
|
-
out =
|
195
|
+
out = nil
|
196
|
+
if branch
|
197
|
+
out = sudo('git fetch')
|
198
|
+
if out.size > 0
|
199
|
+
puts out
|
200
|
+
end
|
201
|
+
out = sudo("git checkout #{branch}")
|
202
|
+
unless out.downcase.include? 'is now at'
|
203
|
+
puts out
|
204
|
+
end
|
205
|
+
out = sudo("git pull origin #{branch}")
|
206
|
+
else
|
207
|
+
out = sudo('git pull')
|
208
|
+
end
|
196
209
|
unless out.downcase.include? "already up-to-date"
|
197
210
|
puts out
|
198
211
|
puts "Git repository pulled: #{url} → #{path}"
|
199
212
|
end
|
200
213
|
chdir cwd
|
201
214
|
else
|
202
|
-
|
215
|
+
if branch
|
216
|
+
branch = "-b #{branch} "
|
217
|
+
else
|
218
|
+
branch = ''
|
219
|
+
end
|
220
|
+
out = sudo("git clone #{branch}#{url} \"#{path}\"")
|
203
221
|
puts out
|
204
222
|
puts "Git repository cloned: #{url} → #{path}"
|
205
223
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: central
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Geurkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: central dotfile management system
|
14
14
|
email: d.geurkov@gmail.com
|