fun_sftp 1.1.1 → 1.1.2

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: 4321bd7cdf279cfd2d1362f1831615ba9a64fdf9
4
- data.tar.gz: a525fcdd94e1394a2b151eddd2696a79b70a7021
3
+ metadata.gz: 37f9f1db779bf26f20c1dc1305c4f18271d5ce5d
4
+ data.tar.gz: ad19b1b22a56ea64ea4dd5a4819954041fd5d245
5
5
  SHA512:
6
- metadata.gz: 6236a1788a0a51a95c6640a15742aa810a4d1358d93a08a8a91c7fae0d5f24081d3aaaa59f12108ead5f22b8036a52918978110eff357131084d71a9b99a318a
7
- data.tar.gz: 36716df02183be8c014e59104e3092c2d1b29777fa42fe1f72fe807c7acd589ecb1a2bb7e9bf02635f8c96f456d0bb920836d7970bfa9efcf1510a8f3b116138
6
+ metadata.gz: 80f3b9e8f82b2ac205c5382ea83e30a47bb63cf35424056a7967c01d7ce2f624c64cd0e4a7a81b4034dcc2311c7fe3c6957c67770c58c87d52b2d7681c44f7ea
7
+ data.tar.gz: 83ebbc79d4e2169d73a49584519999d75a1492a5194996ce2a30617c90157495ac98d82bb4ab905a47c4e90cc9c8759483479f8dd0981d05ba8a60be3ffcdd15
data/Dockerfile ADDED
@@ -0,0 +1,11 @@
1
+ FROM ruby:2.3.3
2
+ RUN apt-get update -qq && apt-get install -y build-essential
3
+ RUN mkdir /app
4
+ WORKDIR /app
5
+ ADD Gemfile /app/Gemfile
6
+ ADD Gemfile.lock /app/Gemfile.lock
7
+ ADD fun_sftp.gemspec /app/fun_sftp.gemspec
8
+ ADD lib /app/lib
9
+ RUN bundle install
10
+ ADD . /app
11
+
data/lib/fun_sftp.rb CHANGED
@@ -34,20 +34,20 @@ module FunSftp
34
34
  end
35
35
  end
36
36
 
37
- def upload!(src, target) #send to remote
37
+ def upload!(src, target, opts={}) #send to remote
38
38
  #target example: 'some_directory/some_name.txt'
39
- opts = { progress: UploadCallbacks.new, recursive: true }
39
+ opts = { progress: UploadCallbacks.new, recursive: true }.merge(opts)
40
40
  converted_target = clean_path(target)
41
41
  opts.delete(:progress) unless FunSftp.loggable?
42
- opts.delete(:recursive) unless has_directory?(target)
42
+ opts.delete(:recursive) unless opts[:recursive] && has_directory?(target)
43
43
  client.upload!(src, converted_target, opts)
44
44
  end
45
45
 
46
- def download!(remote, local) #fetch from remote to local
47
- opts = { progress: DownloadCallbacks.new, recursive: true}
46
+ def download!(remote, local, opts={}) #fetch from remote to local
47
+ opts = { progress: DownloadCallbacks.new, recursive: true }.merge(opts)
48
48
  converted_remote_path = clean_path(remote)
49
49
  opts.delete(:progress) unless FunSftp.loggable?
50
- opts.delete(:recursive) unless has_directory?(remote)
50
+ opts.delete(:recursive) unless opts[:recursive] && has_directory?(remote)
51
51
  client.download!(converted_remote_path, local, opts)
52
52
  end
53
53
 
@@ -1,3 +1,3 @@
1
1
  module FunSftp
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -41,6 +41,28 @@ module FunSftp
41
41
  end
42
42
  end
43
43
 
44
+ describe '#download' do
45
+ before do
46
+ allow(sftp_mock).to receive(:download!)
47
+ end
48
+
49
+ it 'respects passed in options' do
50
+ expect(sftp_mock).to receive(:download!).with('remote_file', 'local_file', hash_not_including(:recursive))
51
+ sftp_cli.download!('remote_file', 'local_file', recursive: false)
52
+ end
53
+ end
54
+
55
+ describe '#upload' do
56
+ before do
57
+ allow(sftp_mock).to receive(:upload!)
58
+ end
59
+
60
+ it 'respects passed in options' do
61
+ expect(sftp_mock).to receive(:upload!).with('src', 'target', hash_not_including(:recursive))
62
+ sftp_cli.upload!('src', 'target', recursive: false)
63
+ end
64
+ end
65
+
44
66
  describe '#read' do
45
67
  it 'should read both lines from test file' do
46
68
  expect(sftp_cli).to receive(:puts).twice
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fun_sftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Diaz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-28 00:00:00.000000000 Z
11
+ date: 2017-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-sftp
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
+ - Dockerfile
79
80
  - Gemfile
80
81
  - README.md
81
82
  - Rakefile