six-updater 0.18.2-x86-mingw32 → 0.19.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ require 'rake/testtask'
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.platform = "x86-mingw32"
15
15
  s.name = 'six-updater'
16
- s.version = '0.18.2'
16
+ s.version = '0.19.1'
17
17
  s.has_rdoc = true
18
18
  s.extra_rdoc_files = ['README', 'LICENSE']
19
19
  s.summary = 'Your summary here'
@@ -35,7 +35,7 @@ end
35
35
  spec3 = Gem::Specification.new do |s|
36
36
  s.platform = "x86-mswin32"
37
37
  s.name = 'six-updater'
38
- s.version = '0.18.2'
38
+ s.version = '0.19.1'
39
39
  s.has_rdoc = true
40
40
  s.extra_rdoc_files = ['README', 'LICENSE']
41
41
  s.summary = 'Your summary here'
@@ -56,7 +56,7 @@ end
56
56
 
57
57
  spec2 = Gem::Specification.new do |s|
58
58
  s.name = 'six-updater'
59
- s.version = '0.18.2'
59
+ s.version = '0.19.1'
60
60
  s.has_rdoc = true
61
61
  s.extra_rdoc_files = ['README', 'LICENSE']
62
62
  s.summary = 'Your summary here'
@@ -0,0 +1,112 @@
1
+ # by Sickboy
2
+ # Rename any folder or file in the given path, if it has uppercase characters, to lowercase
3
+ # If the filename is .repository.yml, update the :pack and :remote hashes with lowercase keys
4
+
5
+ require 'fileutils'
6
+ require 'yaml'
7
+
8
+ module Six
9
+ class Cleanup
10
+ def self.check_dir(dir, repack = false)
11
+ if File.directory?(dir)
12
+ entry = File.join(dir, ".repository.yml")
13
+ if File.exists?(entry)
14
+ puts "Processing: #{entry}"
15
+ config = YAML::load_file(entry)
16
+ [:pack, :wd].each do |typ|
17
+ ar = []
18
+ config[typ].each do |e|
19
+ sum = if repack && e[0] =~ /.*[A-Z].*\.gz$/
20
+ Dir.chdir(dir) do
21
+ puts "Repacking #{e[0]} to #{e[0].downcase}"
22
+ system "gunzip \"#{e[0]}\""
23
+ f = e[0].clone
24
+ f.sub!(/\.gz$/, "")
25
+
26
+ target = if f[/(.*)\/(.*)/]
27
+ "#{$1}/#{$2.downcase}"
28
+ else
29
+ f.downcase
30
+ end
31
+ rename(f, target)
32
+ system "gzip --rsyncable --best \"#{target}\""
33
+ r = %x[md5sum "#{target}.gz"]
34
+ r[/\A\w*/]
35
+ end
36
+ else
37
+ e[1]
38
+ end
39
+ ar << [e[0].downcase, sum]
40
+ end
41
+ config[typ] = ar
42
+ end
43
+ File.open(entry, 'w') {|f| f.puts config.to_yaml }#.to_s
44
+ end
45
+
46
+ Dir.glob(File.join(dir, "**", "*")).each do |e|
47
+ cleanup(e, repack)
48
+ #self.repack(e) if repack
49
+ end
50
+ end
51
+ end
52
+
53
+ def self.rename(entry, newentry)
54
+ FileUtils.mv(entry, "#{entry}_tmp")
55
+ FileUtils.mv("#{entry}_tmp", newentry)
56
+ end
57
+
58
+ def self.cleanup(entry, repack = false)
59
+ dirname = File.dirname(entry)
60
+ base = File.basename(entry)
61
+
62
+ if base =~ /[A-Z]/
63
+ newentry = File.join(dirname, base.downcase)
64
+ rename(entry, newentry)
65
+ entry = newentry
66
+ base = File.basename(entry)
67
+ end
68
+
69
+ if File.directory?(entry)
70
+ check_dir(File.join(entry, ".rsync"), repack)
71
+ check_dir(File.join(entry, ".rsync/.pack"), repack)
72
+ check_dir(File.join(entry, ".pack"), repack)
73
+ end
74
+ end
75
+
76
+ def self.repack(entry)
77
+ dirname = File.dirname(entry)
78
+ base = File.basename(entry)
79
+ if base =~ /\.gz$/
80
+ Dir.chdir(dirname) do
81
+ system "gunzip \"#{base}\""
82
+ f = entry.clone
83
+ f.sub!(/\.gz$/, "")
84
+ rename(f, f.downcase)
85
+ dirname = File.dirname(f)
86
+ base = File.basename(f)
87
+ system "gzip --rsyncable --best \"#{base}\""
88
+ end
89
+ end
90
+ end
91
+
92
+ def self.process(dir, repack = false)
93
+ if File.directory?(dir)
94
+ check_dir(File.join(dir, ".rsync"), repack)
95
+ check_dir(File.join(dir, ".rsync/.pack"), repack)
96
+ check_dir(File.join(dir, ".pack"), repack)
97
+
98
+ Dir.glob(File.join(dir, '**', '*')).each do |entry|
99
+ cleanup(entry, repack)
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+
106
+ if $0 == __FILE__
107
+ unless ARGV.empty?
108
+ dir = ARGV[0]
109
+ ARGV.shift
110
+ Six::Cleanup.process(dir, true)
111
+ end
112
+ end
data/lib/six/updater.rb CHANGED
@@ -20,6 +20,7 @@ end
20
20
  gem 'six-rsync'
21
21
  require 'six/rsync'
22
22
 
23
+ require 'six/cleanup'
23
24
  require 'six/updater/mod'
24
25
  #require 'sixupdater/gitrepo'
25
26
  require 'six/updater/rsyncrepo'
@@ -38,7 +39,7 @@ end
38
39
  module Six
39
40
  # TODO: Evaluate if this module should be a class instead?
40
41
  module Updater
41
- VERSION = '0.18.2'
42
+ VERSION = '0.19.1'
42
43
  COMPONENT = 'six-updater'
43
44
  LOG_LIMIT = 9999
44
45
  FOLDER = /(.*)\/(.*)/
@@ -31,6 +31,9 @@ module Six
31
31
  @changed = false
32
32
 
33
33
  @installed = if FileTest.exists?(File.join(@path, '.rsync'))
34
+ # TODO: Temporary, downcase all files and process the configs
35
+ Six::Cleanup.process(@path)
36
+
34
37
  @repository = RsyncRepo.new(@modconfig[:repository], @path, :log => log)
35
38
  true
36
39
  else
@@ -15,7 +15,7 @@ module Six
15
15
  end
16
16
 
17
17
  def version
18
- f = File.join(@path, '.rsync', '.pack', '.repository.yml')
18
+ f = File.join(@path, '.rsync', '.repository.yml')
19
19
  if FileTest.exist?(f)
20
20
  File.open(f) {|file| YAML::load(file)[:version] }
21
21
  else
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 18
8
- - 2
9
- version: 0.18.2
7
+ - 19
8
+ - 1
9
+ version: 0.19.1
10
10
  platform: x86-mingw32
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-26 00:00:00 +02:00
17
+ date: 2010-04-27 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -115,6 +115,7 @@ files:
115
115
  - README
116
116
  - Rakefile
117
117
  - bin/six-updater
118
+ - lib/six/cleanup.rb
118
119
  - lib/six/updater/gitrepo.rb
119
120
  - lib/six/updater/mod.rb
120
121
  - lib/six/updater/options.rb