rUtilAnts 1.0.0.20120223 → 1.0.1.20130320

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -7,3 +7,4 @@
7
7
  * 0.2.2.20101125
8
8
  * 0.3.0.20110825
9
9
  * 1.0.0.20120223
10
+ * 1.0.1.20130320
data/ChangeLog CHANGED
@@ -1,5 +1,13 @@
1
1
  = rUtilAnts Release History
2
2
 
3
+ == 1.0.1.20130320 (Beta)
4
+
5
+ * [Platform] Added missing platforms, works for JRuby and MacOS
6
+ * [MySQLPool] Bug correction: Could not close connections correctly
7
+ * [Plugins] Removed warning about unused variable
8
+ * Updated Release file to last version of RubyPackager (1.1.0)
9
+ * Use SSH key as authentication method
10
+
3
11
  == 1.0.0.20120223 (Beta)
4
12
 
5
13
  * Renamed public methods to match standard Ruby's conventions
data/ReleaseInfo CHANGED
@@ -2,7 +2,7 @@
2
2
  # This file has been generated by RubyPackager during a delivery.
3
3
  # More info about RubyPackager: http://rubypackager.sourceforge.net
4
4
  {
5
- :Version => '1.0.0.20120223',
6
- :Tags => [ 'Beta' ],
7
- :DevStatus => 'Beta'
5
+ :version => '1.0.1.20130320',
6
+ :tags => [ 'Beta' ],
7
+ :dev_status => 'Beta'
8
8
  }
@@ -165,6 +165,7 @@ module RUtilAnts
165
165
  def close_prepared_statement(iMySQLConnection, iPreparedStatement)
166
166
  lPreparedStatements = $RUtilAnts_MySQLPool_Pool[findMySQLConnectionKey(iMySQLConnection)][2]
167
167
  lFound = false
168
+ lDelete = nil
168
169
  lPreparedStatements.each do |iStrSQL, ioPreparedStatementInfo|
169
170
  if (ioPreparedStatementInfo[0] == iPreparedStatement)
170
171
  # Found it
@@ -172,13 +173,14 @@ module RUtilAnts
172
173
  ioPreparedStatementInfo[1] -= 1
173
174
  if (ioPreparedStatementInfo[1] == 0)
174
175
  # Close it for real
175
- ioPreparedStatementInfo[1].close
176
- lPreparedStatements[iStrSQL] = nil
176
+ ioPreparedStatementInfo[0].close
177
+ lDelete = iStrSQL
177
178
  end
178
179
  end
179
180
  lFound = true
180
181
  end
181
182
  end
183
+ lPreparedStatements.delete(lDelete) if (lDelete != nil)
182
184
  if (!lFound)
183
185
  raise MissingPreparedStatementFromPoolError.new("Prepared statement #{iPreparedStatement.inspect} can't be found among the pool of MySQL connection #{iMySQLConnection.inspect}")
184
186
  end
@@ -11,16 +11,35 @@ module RUtilAnts
11
11
 
12
12
  # Initialize the module
13
13
  def self.includePlatformSpecificModule
14
+ # Get the OS
15
+ require 'rbconfig'
16
+ real_os ||= (
17
+ host_os = RbConfig::CONFIG['host_os']
18
+ case host_os
19
+ when /cygwin/
20
+ 'cygwin'
21
+ when /mswin|msys|mingw|bccwin|wince|emc/
22
+ 'windows'
23
+ when /darwin|mac os/
24
+ 'macosx'
25
+ when /linux/
26
+ 'linux'
27
+ when /solaris|bsd/
28
+ 'unix'
29
+ else
30
+ raise RuntimeError, "Unknown os: #{host_os.inspect}"
31
+ end
32
+ )
14
33
  # Require the platform info
15
34
  begin
16
- require "rUtilAnts/Platforms/#{RUBY_PLATFORM}/PlatformInfo"
35
+ require "rUtilAnts/Platforms/#{real_os}/PlatformInfo"
17
36
  rescue Exception
18
37
  if (!defined?(log_bug))
19
38
  require 'rUtilAnts/Logging'
20
39
  RUtilAnts::Logging::install_logger_on_object
21
40
  end
22
- log_bug "Current platform #{RUBY_PLATFORM} is not supported (#{$!})."
23
- raise RuntimeError, "Current platform #{RUBY_PLATFORM} is not supported (#{$!})."
41
+ log_bug "Current platform #{real_os} is not supported (#{$!})."
42
+ raise RuntimeError, "Current platform #{real_os} is not supported (#{$!})."
24
43
  end
25
44
  # Include the platform specific module
26
45
  PlatformInterface.module_eval('include RUtilAnts::Platform::PlatformInfo')
@@ -40,6 +59,7 @@ module RUtilAnts
40
59
  OS_WINDOWS = 0
41
60
  OS_LINUX = 1
42
61
  OS_CYGWIN = 2
62
+ OS_MACOSX = 3
43
63
 
44
64
  # Initialize the platform info
45
65
  def self.install_platform_on_object
@@ -49,4 +69,4 @@ module RUtilAnts
49
69
 
50
70
  end
51
71
 
52
- end
72
+ end
@@ -15,7 +15,7 @@ module RUtilAnts
15
15
  # Return::
16
16
  # * _Integer_: OS ID
17
17
  def os
18
- return OS_WINDOWS
18
+ return OS_MACOSX
19
19
  end
20
20
 
21
21
  # Return the list of directories where we look for executables
@@ -23,7 +23,7 @@ module RUtilAnts
23
23
  # Return::
24
24
  # * <em>list<String></em>: List of directories
25
25
  def getSystemExePath
26
- return ENV['PATH'].split(';')
26
+ return ENV['PATH'].split(':')
27
27
  end
28
28
 
29
29
  # Set the list of directories where we look for executables
@@ -31,7 +31,7 @@ module RUtilAnts
31
31
  # Parameters::
32
32
  # * *iNewDirsList* (<em>list<String></em>): List of directories
33
33
  def setSystemExePath(iNewDirsList)
34
- ENV['PATH'] = iNewDirsList.join(';')
34
+ ENV['PATH'] = iNewDirsList.join(':')
35
35
  end
36
36
 
37
37
  # Return the list of file extensions that might be discretely happened to executable files.
@@ -40,13 +40,7 @@ module RUtilAnts
40
40
  # Return::
41
41
  # * <em>list<String></em>: List of extensions (including .)
42
42
  def getDiscreteExeExtensions
43
- rExtList = []
44
-
45
- ENV['PATHEXT'].split(';').each do |iExt|
46
- rExtList << iExt.downcase
47
- end
48
-
49
- return rExtList
43
+ return []
50
44
  end
51
45
 
52
46
  # Return the list of directories where we look for libraries
@@ -54,7 +48,13 @@ module RUtilAnts
54
48
  # Return::
55
49
  # * <em>list<String></em>: List of directories
56
50
  def getSystemLibsPath
57
- return ENV['PATH'].split(';')
51
+ rList = ENV['PATH'].split(':')
52
+
53
+ if (ENV['LD_LIBRARY_PATH'] != nil)
54
+ rList += ENV['LD_LIBRARY_PATH'].split(':')
55
+ end
56
+
57
+ return rList
58
58
  end
59
59
 
60
60
  # Set the list of directories where we look for libraries
@@ -62,7 +62,7 @@ module RUtilAnts
62
62
  # Parameters::
63
63
  # * *iNewDirsList* (<em>list<String></em>): List of directories
64
64
  def setSystemLibsPath(iNewDirsList)
65
- ENV['PATH'] = iNewDirsList.join(';')
65
+ ENV['LD_LIBRARY_PATH'] = iNewDirsList.join(':')
66
66
  end
67
67
 
68
68
  # This method sends a message (platform dependent) to the user, without the use of wxruby
@@ -70,13 +70,15 @@ module RUtilAnts
70
70
  # Parameters::
71
71
  # * *iMsg* (_String_): The message to display
72
72
  def sendMsg(iMsg)
73
- # iMsg must not be longer than 255 characters
74
- # \n must be escaped.
75
- if (iMsg.size > 255)
76
- system("msg \"#{ENV['USERNAME']}\" /W \"#{iMsg[0..254]}\"")
77
- else
78
- system("msg \"#{ENV['USERNAME']}\" /W \"#{iMsg}\"")
73
+ # TODO: Handle case of xmessage not installed
74
+ # Create a temporary file with the content to display
75
+ require 'tmpdir'
76
+ lTmpFileName = "#{Dir.tmpdir}/RUA_MSG"
77
+ File.open(lTmpFileName, 'w') do |oFile|
78
+ oFile.write(iMsg)
79
79
  end
80
+ system("xmessage -file #{lTmpFileName}")
81
+ File.unlink(lTmpFileName)
80
82
  end
81
83
 
82
84
  # Execute a Shell command.
@@ -91,7 +93,8 @@ module RUtilAnts
91
93
  rException = nil
92
94
 
93
95
  if (iInTerminal)
94
- if (!system("start cmd /c #{iCmd}"))
96
+ # TODO: Handle case of xterm not installed
97
+ if (!system("xterm -e \"#{iCmd}\""))
95
98
  rException = RuntimeError.new
96
99
  end
97
100
  else
@@ -114,12 +117,10 @@ module RUtilAnts
114
117
  def launchURL(iURL)
115
118
  rError = nil
116
119
 
117
- # We must put " around the URL after the http:// prefix, as otherwise & symbol will not be recognized
118
- lMatch = iURL.match(/^(http|https|ftp|ftps):\/\/(.*)$/)
119
- if (lMatch == nil)
120
- rError = "URL #{iURL} is not one of http://, https://, ftp:// or ftps://. Can't invoke it."
121
- else
122
- IO.popen("start #{lMatch[1]}://\"#{lMatch[2]}\"")
120
+ begin
121
+ IO.popen("xdg-open '#{iURL}'")
122
+ rescue Exception
123
+ rError = $!.to_s
123
124
  end
124
125
 
125
126
  return rError
@@ -130,15 +131,7 @@ module RUtilAnts
130
131
  # Return::
131
132
  # * <em>list<String></em>: List of extensions (including . character). It can be empty.
132
133
  def getExecutableExtensions
133
- rLstExt = [ '.exe', '.com', '.bat' ]
134
-
135
- # Use PATHEXT environment variable if possible
136
- if (ENV['PATHEXT'] != nil)
137
- rLstExt.concat(ENV['PATHEXT'].split(';').map { |iExt| iExt.downcase })
138
- rLstExt.uniq!
139
- end
140
-
141
- return rLstExt
134
+ return []
142
135
  end
143
136
 
144
137
  # Get prohibited characters from file names
@@ -146,7 +139,7 @@ module RUtilAnts
146
139
  # Return::
147
140
  # * _String_: String of prohibited characters in file names
148
141
  def getProhibitedFileNamesCharacters
149
- return '\\/:*?"<>|'
142
+ return '/'
150
143
  end
151
144
 
152
145
  # Create a shortcut (ln -s on Cygwin/Unix systems, a .lnk file on Windows systems)
@@ -155,10 +148,8 @@ module RUtilAnts
155
148
  # * *iSrc* (_String_): The source file
156
149
  # * *iDst* (_String_): The destination file
157
150
  def createShortcut(iSrc, iDst)
158
- require 'win32/shortcut'
159
- Win32::Shortcut.new(getShortcutFileName(iDst)) do |oShortcut|
160
- oShortcut.path = File.expand_path(iSrc)
161
- end
151
+ require 'fileutils'
152
+ FileUtils::ln_s(iSrc, iDst)
162
153
  end
163
154
 
164
155
  # Get the name of a real file name, pointed by a shortcut.
@@ -169,8 +160,7 @@ module RUtilAnts
169
160
  # Return::
170
161
  # * _String_: The real file name pointed by this shortcut
171
162
  def followShortcut(iShortcutName)
172
- require 'win32/shortcut'
173
- return Win32::Shortcut.open(getShortcutFileName(iShortcutName)).path
163
+ return File.readlink(iShortcutName)
174
164
  end
175
165
 
176
166
  # Get the real file name of a shortcut
@@ -180,7 +170,7 @@ module RUtilAnts
180
170
  # Return::
181
171
  # * _String_: The real shortcut file name
182
172
  def getShortcutFileName(iDst)
183
- return "#{iDst}.lnk"
173
+ return iDst
184
174
  end
185
175
 
186
176
  end
@@ -130,7 +130,6 @@ module RUtilAnts
130
130
  # Don't load it now, but store it along with its description if it exists
131
131
  if (@Plugins[iCategory][lPluginName] == nil)
132
132
  # Check if we have a description
133
- lDesc = lDescriptions[lPluginName]
134
133
  register_new_plugin(
135
134
  iCategory,
136
135
  lPluginName,
@@ -223,7 +222,7 @@ module RUtilAnts
223
222
  # Load other plugins
224
223
  lDesc[:PluginsDependencies].each do |iPluginInfo|
225
224
  iPluginCategory, iPluginName = iPluginInfo
226
- lPlugin, lError = get_plugin_instance(iPluginCategory, iPluginName, iParameters)
225
+ _, lError = get_plugin_instance(iPluginCategory, iPluginName, iParameters)
227
226
  lSuccess = (lError == nil)
228
227
  if (!lSuccess)
229
228
  # Don't try further
metadata CHANGED
@@ -1,33 +1,22 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rUtilAnts
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 0
9
- - 20120223
10
- version: 1.0.0.20120223
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1.20130320
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Muriel Salvan
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-23 00:00:00 +01:00
19
- default_executable:
12
+ date: 2013-03-20 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
14
  description: rUtilAnts is used by several projects. It includes common standard code.
23
15
  email: muriel@x-aeon.com
24
16
  executables: []
25
-
26
17
  extensions: []
27
-
28
18
  extra_rdoc_files: []
29
-
30
- files:
19
+ files:
31
20
  - AUTHORS
32
21
  - ChangeLog
33
22
  - Credits
@@ -40,11 +29,11 @@ files:
40
29
  - lib/rUtilAnts/Misc.rb
41
30
  - lib/rUtilAnts/MySQLPool.rb
42
31
  - lib/rUtilAnts/Platform.rb
43
- - lib/rUtilAnts/Platforms/i386-cygwin/PlatformInfo.rb
44
- - lib/rUtilAnts/Platforms/i386-linux/PlatformInfo.rb
45
- - lib/rUtilAnts/Platforms/i386-mingw32/PlatformInfo.rb
46
- - lib/rUtilAnts/Platforms/i386-mswin32/PlatformInfo.rb
47
- - lib/rUtilAnts/Platforms/x86_64-linux/PlatformInfo.rb
32
+ - lib/rUtilAnts/Platforms/cygwin/PlatformInfo.rb
33
+ - lib/rUtilAnts/Platforms/linux/PlatformInfo.rb
34
+ - lib/rUtilAnts/Platforms/macosx/PlatformInfo.rb
35
+ - lib/rUtilAnts/Platforms/unix/PlatformInfo.rb
36
+ - lib/rUtilAnts/Platforms/windows/PlatformInfo.rb
48
37
  - lib/rUtilAnts/Plugins.rb
49
38
  - lib/rUtilAnts/SingletonProxy.rb
50
39
  - lib/rUtilAnts/URLAccess.rb
@@ -56,37 +45,28 @@ files:
56
45
  - LICENSE
57
46
  - README
58
47
  - ReleaseInfo
59
- has_rdoc: true
60
48
  homepage: http://rutilants.sourceforge.net/
61
49
  licenses: []
62
-
63
50
  post_install_message:
64
51
  rdoc_options: []
65
-
66
- require_paths:
52
+ require_paths:
67
53
  - lib
68
- required_ruby_version: !ruby/object:Gem::Requirement
54
+ required_ruby_version: !ruby/object:Gem::Requirement
69
55
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- segments:
74
- - 0
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
61
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- segments:
82
- - 0
83
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
84
66
  requirements: []
85
-
86
67
  rubyforge_project: rutilants
87
- rubygems_version: 1.3.7
68
+ rubygems_version: 1.8.24
88
69
  signing_key:
89
70
  specification_version: 3
90
71
  summary: A collection of various utility libraries.
91
72
  test_files: []
92
-