photocopier 1.1.4 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7acf98b9b3a7861017f1db6fb4eb13638387a7c7
4
- data.tar.gz: 596b73b6e53f4d31e4e7b95722b7e0306b239014
3
+ metadata.gz: 0b3b9cc3cc86c153ef1c704c256048043f9f21a8
4
+ data.tar.gz: 306c1a3a7cf48f236f2e8ace351f07b66e5d76b7
5
5
  SHA512:
6
- metadata.gz: dea46a35116f91cf6c819185949b8092540f10432984e21a277886b990ec247712b24d023b611d7dbf8780ff98a3ed1d02a4d1a2d3ac40115bb9fb7621b8dc1b
7
- data.tar.gz: e99130e1ff1914c232b264dc6c3479a972aeefb9e7c1d8f624598e77aca2ad4231572773da3872b07576341d9687222ec852bd95d5d69b638e5e1f5f3594f5e0
6
+ metadata.gz: fd735bbe44ad3c88e03e55a45bcd8bc0424939e4c26fd34625e4a367548ab72acfd647129b0d56260ba07afd8928f97887b00e7b3a8d26c545ca93c39962b12d
7
+ data.tar.gz: 532d2583c6eb1a0fb225a3ef7b6b12ca3e1fb242e9bb6f72fcedffe4f4c7e92b28ff2918bf144a5134262443a4e9a8b703d42c91d1059478a569bbe62a73c282
data/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+ Copyright (c) 2012-2018 weLaika
1
2
  Copyright (c) 2012 Stefano Verna
2
3
 
3
4
  MIT License
data/README.md CHANGED
@@ -125,3 +125,9 @@ it from working. Install version 1.03 or 1.05.**
125
125
  ## Author
126
126
 
127
127
  made with ❤️ and ☕️ by [weLaika](http://dev.welaika.com)
128
+
129
+ ## License
130
+
131
+ (The MIT License)
132
+
133
+ Copyright © 2012-2018 [weLaika](https://dev.welaika.com)
@@ -1,6 +1,5 @@
1
1
  module Photocopier
2
2
  class SSH < Adapter
3
-
4
3
  attr_reader :gateway_options, :rsync_options
5
4
 
6
5
  def initialize(options = {})
@@ -25,15 +24,15 @@ module Photocopier
25
24
  exec!("rm -rf #{Shellwords.escape(remote_path)}")
26
25
  end
27
26
 
28
- def get_directory(remote_path, local_path, exclude = [])
27
+ def get_directory(remote_path, local_path, exclude = [], includes = [])
29
28
  FileUtils.mkdir_p(local_path)
30
29
  remote_path << "/" unless remote_path.end_with?("/")
31
- rsync ":#{remote_path}", local_path, exclude
30
+ rsync ":#{remote_path}", local_path, exclude, includes
32
31
  end
33
32
 
34
- def put_directory(local_path, remote_path, exclude = [])
33
+ def put_directory(local_path, remote_path, exclude = [], includes = [])
35
34
  local_path << "/" unless local_path.end_with?("/")
36
- rsync "#{local_path}", ":#{remote_path}", exclude
35
+ rsync local_path.to_s, ":#{remote_path}", exclude, includes
37
36
  end
38
37
 
39
38
  def exec!(cmd)
@@ -41,20 +40,20 @@ module Photocopier
41
40
  stderr = ""
42
41
  exit_code = nil
43
42
  session.open_channel do |channel|
44
- channel.exec(cmd) do |ch, success|
45
- channel.on_data do |ch, data|
43
+ channel.exec(cmd) do |_ch, _success|
44
+ channel.on_data do |_ch, data|
46
45
  stdout << data
47
46
  end
48
- channel.on_extended_data do |ch, type, data|
47
+ channel.on_extended_data do |_ch, _type, data|
49
48
  stderr << data
50
49
  end
51
- channel.on_request("exit-status") do |ch, data|
50
+ channel.on_request("exit-status") do |_ch, data|
52
51
  exit_code = data.read_long
53
52
  end
54
53
  end
55
54
  end
56
55
  session.loop
57
- [ stdout, stderr, exit_code ]
56
+ [stdout, stderr, exit_code]
58
57
  end
59
58
 
60
59
  private
@@ -80,15 +79,20 @@ module Photocopier
80
79
  "-rlpt",
81
80
  "--compress",
82
81
  "--omit-dir-times",
83
- "--delete",
82
+ "--delete"
84
83
  ]
85
84
  command.concat Shellwords.split(rsync_options).map(&:shellescape) if rsync_options
86
85
  command.compact
87
86
  end
88
87
 
89
- def rsync(source, destination, exclude = [])
88
+ def rsync(source, destination, exclude = [], includes = [])
90
89
  command = rsync_command
91
90
 
91
+ includes.each do |glob|
92
+ command << "--include"
93
+ command << Shellwords.escape(glob)
94
+ end
95
+
92
96
  exclude.each do |glob|
93
97
  command << "--exclude"
94
98
  command << Shellwords.escape(glob)
@@ -112,9 +116,8 @@ module Photocopier
112
116
  command << "-p #{opts[:port]} " if opts[:port].present?
113
117
  command << "#{opts[:user]}@" if opts[:user].present?
114
118
  command << opts[:host]
115
- if opts[:password]
116
- command = "sshpass -p #{opts[:password]} #{command}"
117
- end
119
+ command = "sshpass -p #{opts[:password]} #{command}" if opts[:password]
120
+
118
121
  command
119
122
  end
120
123
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_litterla: true
2
2
 
3
3
  module Photocopier
4
- VERSION = "1.1.4".freeze
4
+ VERSION = "1.2.0".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photocopier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-02-14 00:00:00.000000000 Z
13
+ date: 2018-05-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport