simple_sync 0.0.2 → 0.1.0

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: 2d33cda9c934b024253b445ade7038c6761e8428
4
- data.tar.gz: c5c4f2432020f4dbd23af2054f78239553e04b83
3
+ metadata.gz: cbff489f48d64f5346c0a5adba82dee17abe7b39
4
+ data.tar.gz: 30677740648886cf8b3781b2405c9c639a86351a
5
5
  SHA512:
6
- metadata.gz: d6b3db16a47cd174c3e346978cb3e3b4f81640a858f06ed26a7e21c9015dc3acf019a706f56cbeb34ca62a87aa67d915e206480ce6d6a6cc66bb915d3f79ac20
7
- data.tar.gz: 26d4e1635d9853450973db7e8d7e3babed4aa3c315e605267487e8bf8316d88a9e2d388a5b46f5aa9fa7b27a4c03abcaf54305351eb33f57586e5aeb7be07611
6
+ metadata.gz: 185116627b854e5311e6b3a4457f661fdb4b96ae67b9f71945b999e152c89253c093fa7abc8b6e029ebe933f11583917bf96ea79d45c8f1007906852f4b33235
7
+ data.tar.gz: 6159b9adbbac2dd07dc84113cf48e19b12faf7ac9445d48eb855eb50bcd593622c347e16697b7f95722d00eefbfa25e1c426bfeabfb99be3858edac506d01d55
data/bin/simple_sync CHANGED
@@ -4,7 +4,8 @@ require 'simple_sync'
4
4
  bs = SimpleSync.new
5
5
  result = bs.load_config
6
6
  if result[:status] == 'success'
7
- bs.copy_to_destination
7
+ STDOUT.sync = true
8
+ puts bs.copy_to_destination[:status]
8
9
  else
9
10
  puts "Error loading cnfiguration #{result[:message]}"
10
11
  end
@@ -26,7 +26,6 @@ class SimpleSync
26
26
 
27
27
  def load_config
28
28
  configuration = read_config_from_file()
29
- #puts configuration
30
29
  return configuration if configuration[:status] == 'error'
31
30
  @config_list = JSON.parse(configuration[:config], symbolize_names: true)
32
31
  return { status: 'success' }
@@ -36,11 +35,14 @@ class SimpleSync
36
35
  output = []
37
36
  @config_list[:configurations].each { |config|
38
37
  config[:config][:sources].each { |source|
39
- #puts "Synching from #{source} to #{@config[:destination]}..."
40
- #puts "rsync #{config[:config][:rsync]} --itemize-changes #{source} #{config[:config][:destination]} #{config[:config][:rsync_suffix]} "
41
- output << IO.popen("rsync #{config[:config][:rsync]} --itemize-changes #{source} #{config[:config][:destination]} #{config[:config][:rsync_suffix]} ").read
38
+ reader,writer = IO.pipe
39
+ IO.popen("rsync #{config[:config][:rsync]} --itemize-changes #{source} #{config[:config][:destination]} #{config[:config][:rsync_suffix]} "){ |output|
40
+ output.each do |line|
41
+ puts line
42
+ end
43
+ }
42
44
  }
43
45
  }
44
- { status: 'success', message: output }.to_json
46
+ { status: 'success'}
45
47
  end
46
48
  end
@@ -1,3 +1,3 @@
1
1
  class SimpleSync
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Claburn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler