sps_filesync 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 711e11ca97636d5d844135fce4536cd3fc1bfa9eba3e99e19a0fd81a13cf0f36
4
+ data.tar.gz: f9a384de79ee25dad945a87c6204de9a4c1898895e95851a0f408db4e6e98b6e
5
+ SHA512:
6
+ metadata.gz: 784b3e141adfbd001a083074b68ff4a1285f6edcb2008f34213e82864f5e435d9e17440e96e1728b72d24f0c84e20df677534f4aaa3a94bc7586e2914fa14f06
7
+ data.tar.gz: 539bd2abcb92bc9216bf22d42e6f73c5128fa2f191436ff783b3c50f2a2b3438ddd7ed6d6b8c1e881b6416c3f4928b7ce78de2270828ae314938f649839d6880
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ Y��K �py�s�܊eC�긲4%��� �\�#�}K��g�b��؏T'1�T��%�l�P��'���<ۣɚ�Yw�Fn�� @�f���X��z�lK�k���Y�6��<8�e)����u�V�E0 �Yzj��usP���g� }�Ԥ����kx�|�.+E
2
+ [�:`if�6Cao(���Pm��O};<��ۇ�sƻb�/㴧�%��qi��$ଓ���A���Q�uP~{��A����� m�b@f���l�%VO,��b�l[� *F>��6����૪,�O)�4pY`�0.Pί!7,�HsAȒiA�7L�� <��ǭ�7!oD�^�$4
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ -��>��\W������_!�˯�4���V@�j�$�l�ku��E\B�B��L)C;BE�mE�;�Ƨ0��$ �R���=�6lo<Vǧ�b���@,Z�WK �G�p?�"�o���&�y3{s�u�ϑX�����Ź�b%A �0��yʵ[L(GC}��yu4�w��y �ޔ1N���)~�O��ngg�hǵ7��N3ٙ`���[!�����`�[aA� 4��k�6��B�K���/m�|V����`� ]Ė+=h��u~�F=�H�������7�
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: sps_filesync.rb
4
+
5
+ require 'sps-sub'
6
+ require 'drb_fileclient'
7
+
8
+
9
+ class SpsFileSync < SPSSub
10
+
11
+
12
+ def initialize(nodes=[], port: '59000', host: nil, log: nil, debug: false)
13
+
14
+ raise 'SpsFileSync::initialize nodes.empty' if nodes.empty?
15
+
16
+ @nodes, @debug = nodes, debug
17
+ super(port: port, host: host, log: log)
18
+
19
+ end
20
+
21
+ def subscribe(topic: 'file/*')
22
+
23
+ super(topic: topic) do |msg, topic|
24
+
25
+
26
+ if @debug then
27
+ puts 'topic: ' + topic.inspect
28
+ puts 'msg: ' + msg.inspect
29
+ end
30
+
31
+ action = topic.split('/').last.to_sym
32
+
33
+ @master_address , path = msg.match(/^dfs:\/\/([^\/]+)(.*)/).captures
34
+
35
+ case action
36
+ when :cp
37
+
38
+ src, dest = msg.split(/ +/,2)
39
+
40
+ file_op do |f, node|
41
+ src_path = "dfs://%s%s" % [node, src[/^dfs:\/\/[^\/]+(.*)/]]
42
+ target_path = "dfs://%s%s" % [node, dest[/^dfs:\/\/[^\/]+(.*)/]]
43
+ f.cp src_path, target_path
44
+ end
45
+
46
+ when :mkdir
47
+
48
+ file_op {|f, node| f.mkdir "dfs://%s%s" % [node, path] }
49
+
50
+ when :mkdir_p
51
+
52
+ file_op {|f, node| f.mkdir_p "dfs://%s%s" % [node, path] }
53
+
54
+ when :mv
55
+
56
+ src, dest = msg.split(/ +/,2)
57
+
58
+ file_op do |f, node|
59
+ src_path = "dfs://%s/%s" % [node, src[/^dfs:\/\/[^\/]+(.*)/]]
60
+ target_path = "dfs://%s/%s" % [node, dest[/^dfs:\/\/[^\/]+(.*)/]]
61
+ f.mv src_path, target_path
62
+ end
63
+
64
+ when :write
65
+
66
+ master_path = msg
67
+
68
+ file_op do |f, node|
69
+ target_path = "dfs://%s%s" % [node, path]
70
+
71
+ if @debug then
72
+ puts 'master_path: ' + master_path.inspect
73
+ puts 'target_path: ' + target_path.inspect
74
+ end
75
+
76
+ DfsFile.cp master_path, target_path
77
+
78
+ end
79
+
80
+ when :rm
81
+
82
+ file_op {|f, node| f.rm "dfs://%s%s" % [node, path] }
83
+
84
+ when :zip
85
+
86
+ master_path = msg
87
+
88
+ file_op do |f, node|
89
+ target_path = "dfs://%s%s" % [node, path]
90
+ f.cp master_path, target_path
91
+ end
92
+
93
+ end
94
+ end
95
+ end
96
+
97
+ private
98
+
99
+ def file_op()
100
+
101
+ (@nodes - [@master_address]).each do |node|
102
+
103
+ puts 'node: ' + node.inspect if @debug
104
+
105
+ begin
106
+ yield(DfsFile, node)
107
+ rescue
108
+ 'warning: node: ' + node + ' ' + ($!).inspect
109
+ end
110
+
111
+ end
112
+
113
+ end
114
+
115
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sps_filesync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwODIzMjMyOTQwWhcN
15
+ MTkwODIzMjMyOTQwWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCw3mas
17
+ jZEWgj6OFyG9TNSjeF09YCP72pKa9ggsCMoeKc9rbbY7TyINmPLG1s4ev95sqsPS
18
+ 13ANiuzVZn0JfftMpwnFy2o0qgXwIZpovk+Zn6FenG3Fr4tUur9liiv6EL/jyrtp
19
+ O0rwmeO00lXzhJs8B+3ZpYmGAHvkKTpv+oUCNvn6v9Gw22DgD9BWm/CXg5GfBn73
20
+ BO5LToWeJ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QJ2sjZ+1mneJVJOWXuQ
36
+ 0EhbgFKdvj2b8zaB8UqvKK0Q
37
+ -----END CERTIFICATE-----
38
+ date: 2018-08-23 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: sps-sub
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.3'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.3.6
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.3'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.3.6
60
+ - !ruby/object:Gem::Dependency
61
+ name: drb_fileclient
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.4'
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 0.4.2
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.4'
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 0.4.2
80
+ description:
81
+ email: james@jamesrobertson.eu
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - lib/sps_filesync.rb
87
+ homepage: https://github.com/jrobertson/sps_filesync
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.7.6
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Used in conjunction with the drb_fileserver_plus gem to synchronise files
111
+ between 2 or more nodes on the network.
112
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ ro:55�[��V���I�Rx��jB��y��c-|5��`l��}�A�ym�[�:O��п�&� ����=׊�wb�<�3#\m:̄]x2y�Z�gv��Fr�N)
2
+ ��"������On��D8��m~�j��S�p�|�_����pfq��ٮg��m�� �a���NV=q�|7`���vr��,�ң�^�Zd�F�P�tB�=L�&���Hf85'8�#4���o<y&Ϧ-��+�k<��<
3
+ ��Cr�^�
4
+ ��Se.�ýy|x3��܅!ǍR�L�\��R$�;����5� �5H���'f��TE K��T�|]�Yr匷���DzK5l�z�:��K� 7ˆ:�������U�=�oǭ�[�ԧ��j�