dorian-dot 0.3.1 → 0.4.0

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/dot +10 -11
  3. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2310c29f3888978a5e3f64ff476b9447f1cd32409d67392818bbdec49d464bd
4
- data.tar.gz: 921ca088c54483fdf6b5d49df3491da557bb5a71f455513b4c92631b45b6adee
3
+ metadata.gz: 516009c7030eabc74e5027d4efb78f5156e022adfe6e8c9466bd5a87bc5aa3ec
4
+ data.tar.gz: 463f3c351fea361c17b64da52b3d58ac528c5800fab9d297af6bd858d5a6df01
5
5
  SHA512:
6
- metadata.gz: 60e19d35d61eb49f034bf8d1efb0501ebff70ee91b36a3b0d4c70caaec4dad25cd91e58cacceed421699abd34a31c224cf20af26338a715a1ebe3e28d3a159d0
7
- data.tar.gz: a30214f3bb296e8f1734b2ffa06074df74dc20a607f8fb99908cc8b05b66a3809806bd41859ca896aad2e95b052eb65c31a8552e692e00404bb81332a2d5c932
6
+ metadata.gz: a1e7359918da3ab54594a5aa91622cb99bb27d63417c917a0b0075a96eedbdf65ab5458920fdabbfc0556f18c83124a531b84940e1155bc2d9b791a34caddc5f
7
+ data.tar.gz: 84148ac9561f2fd25f105ba291a99de58b7109e73fb26f29d393b29320d191e2a99b6204aa80643331bc77287f0852b88b5a2b6f1a666e05c4d9b41d3ea85256
data/bin/dot CHANGED
@@ -2,20 +2,19 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "fileutils"
5
+ require "git"
5
6
 
6
7
  if ARGV.size != 1
7
8
  puts "USAGE: dot DIRECTORY"
8
9
  exit
9
10
  end
10
11
 
11
- dir = ARGV[0]
12
- files = Dir.glob("#{dir}/**/*", File::FNM_DOTMATCH)
13
- files = files.grep_v(%r{/\.git/})
14
- files = files.select { |file| File.file?(file) }
15
- files.each do |file|
16
- file = file.gsub("//", "/")
17
- barefile = file.gsub(dir, "").gsub(%r{^/}, "")
18
- homefile = "#{Dir.home}/#{barefile}".gsub("//", "/")
19
- File.delete(homefile) if File.exist?(homefile) || File.symlink?(homefile)
20
- FileUtils.ln_s(File.expand_path(file), homefile, verbose: true)
21
- end
12
+ Git
13
+ .open(ARGV.first)
14
+ .ls_files
15
+ .map(&:first)
16
+ .each do |file|
17
+ homefile = "#{Dir.home}/#{file}"
18
+ File.delete(homefile) if File.exist?(homefile) || File.symlink?(homefile)
19
+ FileUtils.ln_s(File.expand_path(file), homefile, verbose: true)
20
+ end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-dot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: git
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
13
27
  description: |-
14
28
  Links dot files e.g. `dot ~/src/dotfiles`
15
29