six-rsync 0.4.13 → 0.5.1

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.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/six/rsync/lib.rb +51 -6
  3. data/lib/six/rsync.rb +1 -1
  4. metadata +4 -4
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ require 'rake/testtask'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = 'six-rsync'
15
- s.version = '0.4.13'
15
+ s.version = '0.5.1'
16
16
  s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README', 'LICENSE']
18
18
  s.summary = 'Your summary here'
data/lib/six/rsync/lib.rb CHANGED
@@ -255,7 +255,13 @@ module Six
255
255
  end
256
256
  end
257
257
 
258
+ def rename(entry, newentry)
259
+ FileUtils.mv(entry, "#{entry}_tmp")
260
+ FileUtils.mv("#{entry}_tmp", newentry)
261
+ end
262
+
258
263
  def commit
264
+ cfg = CONFIG[:commit] ? CONFIG[:commit] : Hash.new
259
265
  @logger.info "Committing changes on #{@rsync_work_dir}"
260
266
  @config = load_config
261
267
  unless @config
@@ -271,6 +277,26 @@ module Six
271
277
  load_repos(:local)
272
278
  load_repos(:remote)
273
279
 
280
+
281
+ =begin
282
+ # TODO: Rewrite
283
+ if cfg[:force_downcase]
284
+ # Run through all files, only in the working folder!, and downcase those which are not
285
+ Dir.glob(File.join(@rsync_work_dir, '**', '*')).each do |entry|
286
+ dirname, base = File.dirname(entry), File.basename(entry)
287
+ if base[/[A-Z]/]
288
+ part = entry.sub("#{@rsync_work_dir}", '')
289
+ part.sub!(/^\//, "")
290
+ if @repos_local[:wd][part]
291
+ @repos_local[:wd].delete part
292
+ @repos_local[:wd][]
293
+ end
294
+ rename(entry, File.join(dirname, base.downcase))
295
+ end
296
+ end
297
+ end
298
+ =end
299
+
274
300
  @logger.info "Calculating Checksums..."
275
301
  @repos_local[:wd] = calc_sums(:wd)
276
302
  # Added or Changed files
@@ -785,11 +811,30 @@ module Six
785
811
  # Does nicely display error output in logwindow though
786
812
  io = IO.popen(rsync_cmd)
787
813
  io.sync = true
788
- io.each do |buffer|
789
- process_msg buffer
790
- out << buffer
814
+
815
+ #io.each do |buffer|
816
+ # process_msg buffer
817
+ # out << buffer
818
+ #end
819
+
820
+ buff = []
821
+ io.each_byte do |buffer|
822
+ buffer = buffer.chr
823
+ buff << buffer
824
+ if ["\n", "\r"].include?(buffer)
825
+ b = buff.join("")
826
+ process_msg b
827
+ out << b
828
+ buff = []
829
+ end
791
830
  end
792
831
 
832
+ unless buff.empty?
833
+ b = buff.join("")
834
+ process_msg b
835
+ out << b
836
+ end
837
+
793
838
  out[/rsync error: .* \(code ([0-9]*)\)/]
794
839
  status = $1 ? $1.to_i : 0
795
840
 
@@ -806,9 +851,9 @@ module Six
806
851
  end
807
852
 
808
853
  def process_msg(msg)
809
- if msg[/[k|m|g]?B\/s/i]
810
- msg.gsub!("\n", '')
811
- print "#{msg}\r" if @verbose
854
+ if msg[/\r/] #msg[/[k|m|g]?B\/s/i]
855
+ #msg.gsub!("\n", '')
856
+ print msg if @verbose
812
857
  else
813
858
  @logger.debug msg
814
859
  print msg if @verbose
data/lib/six/rsync.rb CHANGED
@@ -31,7 +31,7 @@ module Six
31
31
 
32
32
  module Rsync
33
33
  COMPONENT = 'six-rsync'
34
- VERSION = '0.4.13'
34
+ VERSION = '0.5.1'
35
35
  FOLDER = /(.*)\/(.*)/
36
36
 
37
37
  case RUBY_PLATFORM
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- - 13
9
- version: 0.4.13
7
+ - 5
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sickboy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-27 00:00:00 +02:00
17
+ date: 2010-04-28 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency