kyrbeis 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/kyrbeis +11 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f156b76a549c83b897a8431b1c83f6294c71073f9cb1367ae01defdb6eced4b
4
- data.tar.gz: 281be40ad0a73ce393826894df38ca1d88ba3487e7c24e4441cec9699a3eef2f
3
+ metadata.gz: da88a18c09ee4e01222da647be5ae5cb98716d6003c6236b2dbde32f8fb238ca
4
+ data.tar.gz: dffb967f3ead4e070b33f058a51fa72b95f34b1a91511437ce599cc5add5f553
5
5
  SHA512:
6
- metadata.gz: 4a592073348cd3afbcfb0e405ff0c82c8c33079429a94c4bcb4ee42abd66c62a9a030328cfe55462f6daecacbbc6c396087744f4f92d23c137f84cdccc571c3c
7
- data.tar.gz: 6d9ff21a543e615efd430590ad646c9b7cb5845b9aa2f1733ba36d221b8c0e1042c6c9045afe11686fe50385f00a0a11c545866ce1d14660e94f83cf2901a5c5
6
+ metadata.gz: 782b7602ca67f5f7aa99886f68c1bffba51e2364a856091543ee8843fb462abd771af6b5210a32c94c55470c3a50b9cb5a88c4c5f048834c44525c6186474ed4
7
+ data.tar.gz: 699233fb35ff38a98f5807b3c077f51fb59aff749d7d215ea9c30c74655a5fcc5a891a5eefd1fd74f1b237bd2f6c09017306f334d8a2d4176237a52f28b260a3
@@ -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
- destination = File.join(ENV['HOME'], dotted_path)
8
- if File.exists? destination
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
- File.symlink File.join(repo, path), destination
15
- puts "INFO linked #{destination}"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kyrbeis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Abdesselam