kubs_cli 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kubs_cli/pull.rb +26 -27
- 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: 41dcb18c2b577d0639f0a2ab27356984c2ecc949c5c0362a86c34323b5b0f84d
|
4
|
+
data.tar.gz: 20f30d98f7df0c3f226f682b5a0b53262a4333ac6cda36157a3f961b51607cca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f9edf7674ad0ca2348c62bafac11911b3db109fb4da42ad08f1c50fb75e09bfe8eb616d085216551ce01e5c8f0c9413c6bb6f0881eca99086ead98a8d702c48
|
7
|
+
data.tar.gz: c054130c01c46ae3b331f0eb52486b7d415fa25add7793c32f14a5c5f362f597ccb53b95748435ad885bcfc149137333d358938ec08aa350c07362ece078c3af
|
data/Gemfile.lock
CHANGED
data/lib/kubs_cli/pull.rb
CHANGED
@@ -19,45 +19,44 @@ module KubsCLI
|
|
19
19
|
|
20
20
|
# Pulls dotfiles into your dotfiles inside your repo
|
21
21
|
def pull_dotfiles
|
22
|
-
|
23
|
-
|
24
|
-
same_files(local: local, remote: remote).each do |ary|
|
25
|
-
# local
|
26
|
-
l = ary[0]
|
27
|
-
# remote
|
28
|
-
r = ary[1]
|
29
|
-
|
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, remote_prefix: '').each do |nested_ary|
|
36
|
-
nested_local = nested_ary[0]
|
37
|
-
nested_remote = nested_ary[1]
|
22
|
+
dotfiles = @config.dotfiles
|
23
|
+
local_dir = @config.local_dir
|
38
24
|
|
39
|
-
|
40
|
-
|
25
|
+
shared_dotfiles(dotfiles, local_dir) do |remote, local|
|
26
|
+
copy_files(local, remote)
|
41
27
|
end
|
42
28
|
end
|
43
29
|
|
44
|
-
def
|
45
|
-
|
30
|
+
def copy_files(orig_file, new_file)
|
31
|
+
unless File.directory?(orig_file) || File.directory?(new_file)
|
32
|
+
return @fh.copy(from: orig_file, to: new_file)
|
33
|
+
end
|
34
|
+
|
35
|
+
Dir.each_child(orig_file) do |o_file|
|
36
|
+
Dir.each_child(new_file) do |n_file|
|
37
|
+
next unless o_file == n_file
|
46
38
|
|
47
|
-
|
48
|
-
|
49
|
-
next if l_file != "#{remote_prefix}#{r_file}"
|
39
|
+
o_file = File.join(File.expand_path(orig_file), o_file)
|
40
|
+
n_file = File.expand_path(new_file)
|
50
41
|
|
51
|
-
|
42
|
+
@fh.copy(from: o_file, to: n_file)
|
52
43
|
end
|
53
44
|
end
|
54
|
-
ary
|
55
45
|
end
|
56
46
|
|
57
|
-
def
|
58
|
-
Dir
|
47
|
+
def shared_dotfiles(dotfiles, local_dir)
|
48
|
+
Dir.each_child(dotfiles) do |remote_file|
|
49
|
+
Dir.each_child(local_dir) do |local_file|
|
50
|
+
next unless local_file == ".#{remote_file}"
|
51
|
+
|
52
|
+
remote_file = File.join(dotfiles, remote_file)
|
53
|
+
local_file = File.join(local_dir, local_file)
|
54
|
+
yield(remote_file, local_file)
|
55
|
+
end
|
56
|
+
end
|
59
57
|
end
|
60
58
|
|
59
|
+
|
61
60
|
# Pulls gnome_terminal_settings into your dotfiles inside your repo
|
62
61
|
def pull_gnome_terminal_settings
|
63
62
|
# This is where dconf stores gnome terminal
|
data/lib/kubs_cli/version.rb
CHANGED