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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b830afd146bee9f410b320f4cf6f75163b63e35b5e2064f86e1f5c0cb00e945c
4
- data.tar.gz: 1b9e912e6f4df7dacf031a71c53fda417443e992ec4578d41f2a520ed57e9277
3
+ metadata.gz: 41dcb18c2b577d0639f0a2ab27356984c2ecc949c5c0362a86c34323b5b0f84d
4
+ data.tar.gz: 20f30d98f7df0c3f226f682b5a0b53262a4333ac6cda36157a3f961b51607cca
5
5
  SHA512:
6
- metadata.gz: 278b9b1b67ade728b66723bbf03d409491b864d27e92e710509f030e1ad74f39b0533a4d2640fb92082be3ed093d4c2cfede60c16e647485734bf0cd53e8aa35
7
- data.tar.gz: c31824845a69c4683576d74273c0c5b9179e53c1a454a13a2a061e4f7de3d1d2080da9fc9ceb4685171d96e2558e75647a2493285222faa4bf9e9e4b9ee441a3
6
+ metadata.gz: 3f9edf7674ad0ca2348c62bafac11911b3db109fb4da42ad08f1c50fb75e09bfe8eb616d085216551ce01e5c8f0c9413c6bb6f0881eca99086ead98a8d702c48
7
+ data.tar.gz: c054130c01c46ae3b331f0eb52486b7d415fa25add7793c32f14a5c5f362f597ccb53b95748435ad885bcfc149137333d358938ec08aa350c07362ece078c3af
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kubs_cli (0.1.6)
4
+ kubs_cli (0.1.7)
5
5
  rake (~> 10.0)
6
6
  thor (~> 0.20)
7
7
 
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
- 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]
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
- @fh.copy(from: nested_local, to: nested_remote)
40
- end
25
+ shared_dotfiles(dotfiles, local_dir) do |remote, local|
26
+ copy_files(local, remote)
41
27
  end
42
28
  end
43
29
 
44
- def same_files(local:, remote:, remote_prefix: '.')
45
- ary = []
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
- Dir.each_child(local) do |l_file|
48
- Dir.each_child(remote) do |r_file|
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
- ary << [l_file, r_file]
42
+ @fh.copy(from: o_file, to: n_file)
52
43
  end
53
44
  end
54
- ary
55
45
  end
56
46
 
57
- def files_only(directory)
58
- Dir["#{directory}/**/*"].reject { |f| File.directory?(f) }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubsCLI
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubs_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - paramagicdev