kyrbeis 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/kyrbeis +11 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da88a18c09ee4e01222da647be5ae5cb98716d6003c6236b2dbde32f8fb238ca
|
4
|
+
data.tar.gz: dffb967f3ead4e070b33f058a51fa72b95f34b1a91511437ce599cc5add5f553
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 782b7602ca67f5f7aa99886f68c1bffba51e2364a856091543ee8843fb462abd771af6b5210a32c94c55470c3a50b9cb5a88c4c5f048834c44525c6186474ed4
|
7
|
+
data.tar.gz: 699233fb35ff38a98f5807b3c077f51fb59aff749d7d215ea9c30c74655a5fcc5a891a5eefd1fd74f1b237bd2f6c09017306f334d8a2d4176237a52f28b260a3
|
data/bin/kyrbeis
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'fileutils'
|
3
|
+
require 'erb'
|
3
4
|
repo="#{ENV['HOME']}/dotfiles"
|
4
5
|
Dir.chdir(repo) do
|
5
6
|
Dir.glob("**/*").select { |f| File.file? f }.each do |path|
|
6
7
|
dotted_path = path.gsub "__", "."
|
7
|
-
|
8
|
-
|
8
|
+
erb = path.end_with?(".erb")
|
9
|
+
destination = File.join(ENV['HOME'], dotted_path).gsub(/\.erb$/, "")
|
10
|
+
if not erb and File.exists? destination
|
9
11
|
if not File.symlink? destination
|
10
12
|
puts "WARNING #{destination} already exists and is not a symlink"
|
11
13
|
end
|
12
14
|
else
|
13
15
|
FileUtils.mkdir_p File.join(File.dirname(destination))
|
14
|
-
|
15
|
-
|
16
|
+
if erb
|
17
|
+
File.write destination, ERB.new(File.read(path)).result(binding)
|
18
|
+
puts "INFO wrote #{destination} from ERB"
|
19
|
+
else
|
20
|
+
File.symlink File.join(repo, path), destination
|
21
|
+
puts "INFO linked #{destination}"
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|