datapipe2 0.0.5 → 0.0.8

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
  SHA1:
3
- metadata.gz: 1484071c5a50332e6707526b1a45fe7546716c90
4
- data.tar.gz: ed9430b7e754959abe46454672239440fa955b2e
3
+ metadata.gz: e58251e81793f50d5d677bf7485c1f469dbc222c
4
+ data.tar.gz: d66a83209077537948f0f1cc37278c657a50e333
5
5
  SHA512:
6
- metadata.gz: 23162306076c01311fcc4b743c48a4fd15776fc416d7f744b377897dcedf11192b4d2251fbf53e7ba598c1aac0d2b98db96b64003db4605a091b25841c79c4f4
7
- data.tar.gz: 6cc315349fab6fe9cc4304091e4816498a83892fbedbad8abc01a78a1031d64e563048f5b10f58602f12283dd9dcfd7b07fa85ff7b91531306536e99a1c8a2cd
6
+ metadata.gz: 0e2998ba98a465152dbaa9ed9e18253062e880a97625ff1cb55b085c55ceca0c68e32caaf6f77b20af13cbfacb15f09353be8455ba405ec79a9e2682ee9086ad
7
+ data.tar.gz: 7d8cc4e5d3eb90df850c5f0f2bac941a4166dd5adcf2e0c2f971f962d5ed6fdc18e98b8df1ec2a63f2ef4047907af4a38e097b86f24372e2fb99e4d6c24ae9b3
data/lib/datapipe2.rb CHANGED
@@ -11,6 +11,7 @@ module DataPipe2
11
11
  require 'fns/db_to_json'
12
12
  require 'fns/csv_to_db'
13
13
  require 'fns/mssql_to_pgsql'
14
+ require 'fns/smb_to_local'
14
15
 
15
16
  class DataPipe2lineError < StandardError
16
17
  end
@@ -17,6 +17,7 @@ def mssql_to_pgsql(select_sql, table_name, columns)
17
17
  count = 0
18
18
  results.each(as: array, cache_rows: false) do |r|
19
19
  count += 1
20
+ p '.' if count % 1000 == 0
20
21
  d.connection.put_copy_data "#{r.join('|')}\n"
21
22
  end
22
23
  d.connection.put_copy_end
@@ -0,0 +1,22 @@
1
+ require 'sambal'
2
+ require 'uri'
3
+ require 'cgi'
4
+
5
+ def smb_to_local(smb_uri_string, local_folder)
6
+ # encode the string
7
+ uri = URI.parse(URI.escape(smb_uri_string))
8
+ domain = nil
9
+ unless uri.query.nil?
10
+ params = CGI.parse(uri.query)
11
+ domain = params['domain'][0]
12
+ end
13
+ p "#{domain}, #{uri.host}, #{uri.user}, #{uri.password}"
14
+ client = Sambal::Client.new(domain: domain, host: uri.host,
15
+ share: 'Data', user: uri.user, password: uri.password)
16
+ client.ls(remote_dirpath).each do |remote_filepath|
17
+ local_filepath = local_folder
18
+ client.get(remote_filepath, local_filepath) # downloads file from server
19
+ client.del(remote_filepath) # deletes files from server
20
+ end
21
+ client.close # closes connection
22
+ end
metadata CHANGED
@@ -1,57 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datapipe2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-03 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: fluiddb
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: parse-cron
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description: zero to one for moving data
56
14
  email: guy@guyirvine.com
57
15
  executables:
@@ -64,6 +22,7 @@ files:
64
22
  - lib/fns/db_to_csv.rb
65
23
  - lib/fns/db_to_json.rb
66
24
  - lib/fns/mssql_to_pgsql.rb
25
+ - lib/fns/smb_to_local.rb
67
26
  - lib/helper_functions.rb
68
27
  - lib/host.rb
69
28
  - lib/jobs.rb