rUtilAnts 0.3.0.20110825 → 1.0.0.20120223
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.
- data/AUTHORS +7 -1
- data/ChangeLog +16 -0
- data/LICENSE +1 -1
- data/README +2 -5
- data/ReleaseInfo +8 -8
- data/lib/rUtilAnts/Archive.rb +26 -26
- data/lib/rUtilAnts/ForeignProcess.rb +20 -21
- data/lib/rUtilAnts/GUI.rb +38 -38
- data/lib/rUtilAnts/GUI/BugReportDialog.rb +5 -5
- data/lib/rUtilAnts/Logging.rb +124 -254
- data/lib/rUtilAnts/Misc.rb +70 -37
- data/lib/rUtilAnts/MySQLPool.rb +31 -31
- data/lib/rUtilAnts/Platform.rb +33 -16
- data/lib/rUtilAnts/Platforms/i386-cygwin/PlatformInfo.rb +46 -15
- data/lib/rUtilAnts/Platforms/i386-linux/PlatformInfo.rb +46 -15
- data/lib/rUtilAnts/Platforms/i386-mingw32/PlatformInfo.rb +58 -17
- data/lib/rUtilAnts/Platforms/i386-mswin32/PlatformInfo.rb +58 -17
- data/lib/rUtilAnts/Platforms/x86_64-linux/PlatformInfo.rb +46 -15
- data/lib/rUtilAnts/Plugins.rb +54 -139
- data/lib/rUtilAnts/SingletonProxy.rb +33 -0
- data/lib/rUtilAnts/URLAccess.rb +44 -66
- data/lib/rUtilAnts/URLCache.rb +39 -56
- data/lib/rUtilAnts/URLHandlers/DataImage.rb +20 -20
- data/lib/rUtilAnts/URLHandlers/FTP.rb +24 -24
- data/lib/rUtilAnts/URLHandlers/HTTP.rb +21 -21
- data/lib/rUtilAnts/URLHandlers/LocalFile.rb +19 -19
- metadata +10 -10
@@ -1,11 +1,11 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 -
|
2
|
+
# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
6
6
|
module RUtilAnts
|
7
7
|
|
8
|
-
module
|
8
|
+
module URLAccess
|
9
9
|
|
10
10
|
module URLHandlers
|
11
11
|
|
@@ -14,9 +14,9 @@ module RUtilAnts
|
|
14
14
|
|
15
15
|
# Get a list of regexps matching the URL to get to this handler
|
16
16
|
#
|
17
|
-
# Return
|
17
|
+
# Return::
|
18
18
|
# * <em>list<Regexp></em>: The list of regexps matching URLs from this handler
|
19
|
-
def self.
|
19
|
+
def self.get_matching_regexps
|
20
20
|
return [
|
21
21
|
/^(ftp|ftps):\/\/.*$/
|
22
22
|
]
|
@@ -24,7 +24,7 @@ module RUtilAnts
|
|
24
24
|
|
25
25
|
# Constructor
|
26
26
|
#
|
27
|
-
# Parameters
|
27
|
+
# Parameters::
|
28
28
|
# * *iURL* (_String_): The URL that this handler will manage
|
29
29
|
def initialize(iURL)
|
30
30
|
@URL = iURL
|
@@ -33,7 +33,7 @@ module RUtilAnts
|
|
33
33
|
lURLMatch = iURL.match(/^(ftp|ftps):\/\/(.*)$/)
|
34
34
|
end
|
35
35
|
if (lURLMatch == nil)
|
36
|
-
|
36
|
+
log_bug "URL #{iURL} was identified as an ftp like, but it appears to be false."
|
37
37
|
else
|
38
38
|
@URLProtocol, @URLServer, @URLPath = lURLMatch[1..3]
|
39
39
|
end
|
@@ -41,17 +41,17 @@ module RUtilAnts
|
|
41
41
|
|
42
42
|
# Get the server ID
|
43
43
|
#
|
44
|
-
# Return
|
44
|
+
# Return::
|
45
45
|
# * _String_: The server ID
|
46
|
-
def
|
46
|
+
def get_server_id
|
47
47
|
return "#{@URLProtocol}://#{@URLServer}"
|
48
48
|
end
|
49
49
|
|
50
50
|
# Get the current CRC of the URL
|
51
51
|
#
|
52
|
-
# Return
|
52
|
+
# Return::
|
53
53
|
# * _Integer_: The CRC
|
54
|
-
def
|
54
|
+
def get_crc
|
55
55
|
# We consider FTP URLs to be definitive: CRCs will never change.
|
56
56
|
return 0
|
57
57
|
end
|
@@ -59,9 +59,9 @@ module RUtilAnts
|
|
59
59
|
# Get a corresponding file base name.
|
60
60
|
# This method has to make sure file extensions are respected, as it can be used for further processing.
|
61
61
|
#
|
62
|
-
# Return
|
62
|
+
# Return::
|
63
63
|
# * _String_: The file name
|
64
|
-
def
|
64
|
+
def get_corresponding_file_base_name
|
65
65
|
lBase = File.basename(@URLPath)
|
66
66
|
lExt = File.extname(@URLPath)
|
67
67
|
lFileName = nil
|
@@ -73,22 +73,22 @@ module RUtilAnts
|
|
73
73
|
lFileName = "#{lBase}#{lExt.gsub(/^([^#\?;]*).*$/,'\1')}"
|
74
74
|
end
|
75
75
|
|
76
|
-
return
|
76
|
+
return get_valid_file_name(lFileName)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Get the content of the URL
|
80
80
|
#
|
81
|
-
# Parameters
|
81
|
+
# Parameters::
|
82
82
|
# * *iFollowRedirections* (_Boolean_): Do we follow redirections while accessing the content ?
|
83
|
-
# Return
|
83
|
+
# Return::
|
84
84
|
# * _Integer_: Type of content returned
|
85
85
|
# * _Object_: The content, depending on the type previously returned:
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
def
|
86
|
+
# * _Exception_ if CONTENT_ERROR: The corresponding error
|
87
|
+
# * _String_ if CONTENT_REDIRECT: The new URL
|
88
|
+
# * _String_ if CONTENT_STRING: The real content
|
89
|
+
# * _String_ if CONTENT_LOCALFILENAME: The name of the local file name storing the content
|
90
|
+
# * _String_ if CONTENT_LOCALFILENAME_TEMPORARY: The name of the temporary local file name storing the content
|
91
|
+
def get_content(iFollowRedirections)
|
92
92
|
rContentFormat = nil
|
93
93
|
rContent = nil
|
94
94
|
|
@@ -97,15 +97,15 @@ module RUtilAnts
|
|
97
97
|
lFTPConnection = Net::FTP.new(@URLServer)
|
98
98
|
lFTPConnection.login
|
99
99
|
lFTPConnection.chdir(File.dirname(@URLPath))
|
100
|
-
rContent =
|
100
|
+
rContent = get_corresponding_file_base_name
|
101
101
|
rContentFormat = CONTENT_LOCALFILENAME_TEMPORARY
|
102
|
-
|
102
|
+
log_debug "URL #{@URL} => Temporary file #{rContent}"
|
103
103
|
lFTPConnection.getbinaryfile(File.basename(@URLPath), rContent)
|
104
104
|
lFTPConnection.close
|
105
105
|
rescue Exception
|
106
106
|
rContent = $!
|
107
107
|
rContentFormat = CONTENT_ERROR
|
108
|
-
|
108
|
+
log_debug "Error accessing #{@URL}: #{rContent}"
|
109
109
|
end
|
110
110
|
|
111
111
|
return rContentFormat, rContent
|
@@ -1,11 +1,11 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 -
|
2
|
+
# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
6
6
|
module RUtilAnts
|
7
7
|
|
8
|
-
module
|
8
|
+
module URLAccess
|
9
9
|
|
10
10
|
module URLHandlers
|
11
11
|
|
@@ -14,9 +14,9 @@ module RUtilAnts
|
|
14
14
|
|
15
15
|
# Get a list of regexps matching the URL to get to this handler
|
16
16
|
#
|
17
|
-
# Return
|
17
|
+
# Return::
|
18
18
|
# * <em>list<Regexp></em>: The list of regexps matching URLs from this handler
|
19
|
-
def self.
|
19
|
+
def self.get_matching_regexps
|
20
20
|
return [
|
21
21
|
/^(http|https):\/\/.*$/
|
22
22
|
]
|
@@ -24,7 +24,7 @@ module RUtilAnts
|
|
24
24
|
|
25
25
|
# Constructor
|
26
26
|
#
|
27
|
-
# Parameters
|
27
|
+
# Parameters::
|
28
28
|
# * *iURL* (_String_): The URL that this handler will manage
|
29
29
|
def initialize(iURL)
|
30
30
|
@URL = iURL
|
@@ -33,7 +33,7 @@ module RUtilAnts
|
|
33
33
|
lURLMatch = iURL.match(/^(http|https):\/\/(.*)$/)
|
34
34
|
end
|
35
35
|
if (lURLMatch == nil)
|
36
|
-
|
36
|
+
log_bug "URL #{iURL} was identified as an http like, but it appears to be false."
|
37
37
|
else
|
38
38
|
@URLProtocol, @URLServer, @URLPath = lURLMatch[1..3]
|
39
39
|
end
|
@@ -41,17 +41,17 @@ module RUtilAnts
|
|
41
41
|
|
42
42
|
# Get the server ID
|
43
43
|
#
|
44
|
-
# Return
|
44
|
+
# Return::
|
45
45
|
# * _String_: The server ID
|
46
|
-
def
|
46
|
+
def get_server_id
|
47
47
|
return "#{@URLProtocol}://#{@URLServer}"
|
48
48
|
end
|
49
49
|
|
50
50
|
# Get the current CRC of the URL
|
51
51
|
#
|
52
|
-
# Return
|
52
|
+
# Return::
|
53
53
|
# * _Integer_: The CRC
|
54
|
-
def
|
54
|
+
def get_crc
|
55
55
|
# We consider HTTP URLs to be definitive: CRCs will never change.
|
56
56
|
return 0
|
57
57
|
end
|
@@ -59,27 +59,27 @@ module RUtilAnts
|
|
59
59
|
# Get a corresponding file base name.
|
60
60
|
# This method has to make sure file extensions are respected, as it can be used for further processing.
|
61
61
|
#
|
62
|
-
# Return
|
62
|
+
# Return::
|
63
63
|
# * _String_: The file name
|
64
|
-
def
|
64
|
+
def get_corresponding_file_base_name
|
65
65
|
# TODO: Handle the case where there is no base name (ie. www.google.com instead of www.google.com/index.html)
|
66
66
|
# Check that extension has no characters following the URL (#, ? and ;)
|
67
|
-
return
|
67
|
+
return get_valid_file_name(File.basename(@URLPath.gsub(/^([^#\?;]*).*$/,'\1')))
|
68
68
|
end
|
69
69
|
|
70
70
|
# Get the content of the URL
|
71
71
|
#
|
72
|
-
# Parameters
|
72
|
+
# Parameters::
|
73
73
|
# * *iFollowRedirections* (_Boolean_): Do we follow redirections while accessing the content ?
|
74
|
-
# Return
|
74
|
+
# Return::
|
75
75
|
# * _Integer_: Type of content returned
|
76
76
|
# * _Object_: The content, depending on the type previously returned:
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
def
|
77
|
+
# * _Exception_ if CONTENT_ERROR: The corresponding error
|
78
|
+
# * _String_ if CONTENT_REDIRECT: The new URL
|
79
|
+
# * _String_ if CONTENT_STRING: The real content
|
80
|
+
# * _String_ if CONTENT_LOCALFILENAME: The name of the local file name storing the content
|
81
|
+
# * _String_ if CONTENT_LOCALFILENAME_TEMPORARY: The name of the temporary local file name storing the content
|
82
|
+
def get_content(iFollowRedirections)
|
83
83
|
rContentFormat = nil
|
84
84
|
rContent = nil
|
85
85
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 -
|
2
|
+
# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
6
6
|
module RUtilAnts
|
7
7
|
|
8
|
-
module
|
8
|
+
module URLAccess
|
9
9
|
|
10
10
|
module URLHandlers
|
11
11
|
|
@@ -14,9 +14,9 @@ module RUtilAnts
|
|
14
14
|
|
15
15
|
# Get a list of regexps matching the URL to get to this handler
|
16
16
|
#
|
17
|
-
# Return
|
17
|
+
# Return::
|
18
18
|
# * <em>list<Regexp></em>: The list of regexps matching URLs from this handler
|
19
|
-
def self.
|
19
|
+
def self.get_matching_regexps
|
20
20
|
return [
|
21
21
|
/^file:\/\/\/(.*)$/
|
22
22
|
]
|
@@ -24,7 +24,7 @@ module RUtilAnts
|
|
24
24
|
|
25
25
|
# Constructor
|
26
26
|
#
|
27
|
-
# Parameters
|
27
|
+
# Parameters::
|
28
28
|
# * *iURL* (_String_): The URL that this handler will manage
|
29
29
|
def initialize(iURL)
|
30
30
|
@URL = iURL
|
@@ -36,17 +36,17 @@ module RUtilAnts
|
|
36
36
|
|
37
37
|
# Get the server ID
|
38
38
|
#
|
39
|
-
# Return
|
39
|
+
# Return::
|
40
40
|
# * _String_: The server ID
|
41
|
-
def
|
41
|
+
def get_server_id
|
42
42
|
return nil
|
43
43
|
end
|
44
44
|
|
45
45
|
# Get the current CRC of the URL
|
46
46
|
#
|
47
|
-
# Return
|
47
|
+
# Return::
|
48
48
|
# * _Integer_: The CRC
|
49
|
-
def
|
49
|
+
def get_crc
|
50
50
|
# We consider the file's modification time
|
51
51
|
if (File.exists?(@URL))
|
52
52
|
return File.mtime(@URL)
|
@@ -58,25 +58,25 @@ module RUtilAnts
|
|
58
58
|
# Get a corresponding file base name.
|
59
59
|
# This method has to make sure file extensions are respected, as it can be used for further processing.
|
60
60
|
#
|
61
|
-
# Return
|
61
|
+
# Return::
|
62
62
|
# * _String_: The file name
|
63
|
-
def
|
63
|
+
def get_corresponding_file_base_name
|
64
64
|
return File.basename(@URL)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Get the content of the URL
|
68
68
|
#
|
69
|
-
# Parameters
|
69
|
+
# Parameters::
|
70
70
|
# * *iFollowRedirections* (_Boolean_): Do we follow redirections while accessing the content ?
|
71
|
-
# Return
|
71
|
+
# Return::
|
72
72
|
# * _Integer_: Type of content returned
|
73
73
|
# * _Object_: The content, depending on the type previously returned:
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
def
|
74
|
+
# * _Exception_ if CONTENT_ERROR: The corresponding error
|
75
|
+
# * _String_ if CONTENT_REDIRECT: The new URL
|
76
|
+
# * _String_ if CONTENT_STRING: The real content
|
77
|
+
# * _String_ if CONTENT_LOCALFILENAME: The name of the local file name storing the content
|
78
|
+
# * _String_ if CONTENT_LOCALFILENAME_TEMPORARY: The name of the temporary local file name storing the content
|
79
|
+
def get_content(iFollowRedirections)
|
80
80
|
rContentFormat = nil
|
81
81
|
rContent = nil
|
82
82
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rUtilAnts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
6
|
+
- 1
|
7
7
|
- 0
|
8
|
-
- 3
|
9
8
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.
|
9
|
+
- 20120223
|
10
|
+
version: 1.0.0.20120223
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Muriel Salvan
|
@@ -16,11 +15,12 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date:
|
18
|
+
date: 2012-02-23 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
22
|
description: rUtilAnts is used by several projects. It includes common standard code.
|
23
|
-
email:
|
23
|
+
email: muriel@x-aeon.com
|
24
24
|
executables: []
|
25
25
|
|
26
26
|
extensions: []
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- lib/rUtilAnts/Platforms/i386-mswin32/PlatformInfo.rb
|
47
47
|
- lib/rUtilAnts/Platforms/x86_64-linux/PlatformInfo.rb
|
48
48
|
- lib/rUtilAnts/Plugins.rb
|
49
|
+
- lib/rUtilAnts/SingletonProxy.rb
|
49
50
|
- lib/rUtilAnts/URLAccess.rb
|
50
51
|
- lib/rUtilAnts/URLCache.rb
|
51
52
|
- lib/rUtilAnts/URLHandlers/DataImage.rb
|
@@ -55,6 +56,7 @@ files:
|
|
55
56
|
- LICENSE
|
56
57
|
- README
|
57
58
|
- ReleaseInfo
|
59
|
+
has_rdoc: true
|
58
60
|
homepage: http://rutilants.sourceforge.net/
|
59
61
|
licenses: []
|
60
62
|
|
@@ -68,7 +70,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
70
|
requirements:
|
69
71
|
- - ">="
|
70
72
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
73
|
segments:
|
73
74
|
- 0
|
74
75
|
version: "0"
|
@@ -77,14 +78,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
requirements:
|
78
79
|
- - ">="
|
79
80
|
- !ruby/object:Gem::Version
|
80
|
-
hash: 3
|
81
81
|
segments:
|
82
82
|
- 0
|
83
83
|
version: "0"
|
84
84
|
requirements: []
|
85
85
|
|
86
86
|
rubyforge_project: rutilants
|
87
|
-
rubygems_version: 1.
|
87
|
+
rubygems_version: 1.3.7
|
88
88
|
signing_key:
|
89
89
|
specification_version: 3
|
90
90
|
summary: A collection of various utility libraries.
|