kubs_cli 0.1.4 → 0.1.5
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/Gemfile.lock +1 -1
- data/lib/kubs_cli/pull.rb +26 -15
- data/lib/kubs_cli/version.rb +1 -1
- 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: dc2269e58e59c9351b94dcea2aea4522f97e20d754838e09799afc16443a2dfe
|
4
|
+
data.tar.gz: 47a83d348b667ccf522efd41122aa5cb8b7b412d28ac29a3787b70e44d8a7ebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfa60c3f2413585728f235f0fb17b97e4368fe0f56e0a8b1c7011572683bfb5907444398010319b4a4d867004531715e9ae8b61ea0a7671fdb0e3b44ad41558e
|
7
|
+
data.tar.gz: 0104f0c2263b4021dad843d0b00aaace21dc318243d5a41c72cd306452601719a7bd3f5ab595ae1f1c67d39b89b1b09a04934a0f5bcdba1c944ca05d0f98a4f9
|
data/Gemfile.lock
CHANGED
data/lib/kubs_cli/pull.rb
CHANGED
@@ -19,28 +19,39 @@ module KubsCLI
|
|
19
19
|
|
20
20
|
# Pulls dotfiles into your dotfiles inside your repo
|
21
21
|
def pull_dotfiles
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
local = @config.local_dir
|
23
|
+
remote = @config.dotfiles
|
24
|
+
same_files(local: local, remote: remote).each do |ary|
|
25
|
+
# local
|
26
|
+
l = ary[0]
|
27
|
+
# remote
|
28
|
+
r = ary[1]
|
25
29
|
|
26
|
-
|
27
|
-
|
30
|
+
unless File.directory?(local) || File.directory?(remote)
|
31
|
+
@fh.copy(from: l, to: r)
|
32
|
+
next
|
33
|
+
end
|
34
|
+
|
35
|
+
same_files(local: l, remote: r, prefix: '').each do |nested_ary|
|
36
|
+
nested_local = nested_ary[0]
|
37
|
+
nested_remote = nested_ary[1]
|
28
38
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
39
|
+
@fh.copy(from: nested_local, to: nested_remote)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
33
43
|
|
34
|
-
|
35
|
-
|
44
|
+
def same_files(local:, remote:, remote_prefix: '.')
|
45
|
+
ary = []
|
36
46
|
|
37
|
-
|
38
|
-
|
39
|
-
next if l_file != "
|
47
|
+
Dir.each_child(local) do |l_file|
|
48
|
+
Dir.each_child(remote) do |r_file|
|
49
|
+
next if l_file != "#{remote_prefix}#{r_file}"
|
40
50
|
|
41
|
-
|
51
|
+
ary << [l_file, r_file]
|
42
52
|
end
|
43
53
|
end
|
54
|
+
ary
|
44
55
|
end
|
45
56
|
|
46
57
|
def files_only(directory)
|
data/lib/kubs_cli/version.rb
CHANGED