kubs_cli 0.1.4 → 0.1.5

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: 627345c319fd6dbe3a0a422e9cf4b43d7ee3603ecb400b7738c7e628fe777025
4
- data.tar.gz: 44919343c8685e4f1e3e8096e683f65721aaea89864616c94d18f3fb29ebab00
3
+ metadata.gz: dc2269e58e59c9351b94dcea2aea4522f97e20d754838e09799afc16443a2dfe
4
+ data.tar.gz: 47a83d348b667ccf522efd41122aa5cb8b7b412d28ac29a3787b70e44d8a7ebf
5
5
  SHA512:
6
- metadata.gz: 421e5654a1d1e192bee86e8594c5bf0a70b85a522eac7a0d48b1ab011631aedb447a3bd7b1b234cf8dfd35f47cf65b5ac4b70b06ee2d1e4fd1c1895dc6253a28
7
- data.tar.gz: b4eb9bc1c1639b60a3f39ff88d37681e8d86c336df1089372fc63a0681fd5dc28ec49dfdca0a4c6d3f43c4d3aa8ccff01b60036cc941cf9b6b3081f54e7fd042
6
+ metadata.gz: cfa60c3f2413585728f235f0fb17b97e4368fe0f56e0a8b1c7011572683bfb5907444398010319b4a4d867004531715e9ae8b61ea0a7671fdb0e3b44ad41558e
7
+ data.tar.gz: 0104f0c2263b4021dad843d0b00aaace21dc318243d5a41c72cd306452601719a7bd3f5ab595ae1f1c67d39b89b1b09a04934a0f5bcdba1c944ca05d0f98a4f9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kubs_cli (0.1.4)
4
+ kubs_cli (0.1.5)
5
5
  rake (~> 10.0)
6
6
  thor (~> 0.20)
7
7
 
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
- # Dir.each_child(@config.local_dir) do |local|
23
- # Dir.each_child(@config.dotfiles) do |remote|
24
- # next if local != ".#{remote}"
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
- # local = File.join(@config.local_dir, local)
27
- # remote = File.join(@config.dotfiles, remote)
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
- # @fh.copy(from: local, to: remote)
30
- # end
31
- # end
32
- # walk recursively
39
+ @fh.copy(from: nested_local, to: nested_remote)
40
+ end
41
+ end
42
+ end
33
43
 
34
- local_files = files_only(@config.local_dir)
35
- remote_files = files_only(@config.dotfiles)
44
+ def same_files(local:, remote:, remote_prefix: '.')
45
+ ary = []
36
46
 
37
- local_files.each do |l_file|
38
- remote_files.each do |r_file|
39
- next if l_file != ".#{r_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
- @fh.copy(from: local, to: remote)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubsCLI
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - paramagicdev