RubyPackager 1.2.0.20120302 → 1.2.1.20131211

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -6,3 +6,4 @@
6
6
  * 1.0.0.20120301
7
7
  * 1.1.0.20120301
8
8
  * 1.2.0.20120302
9
+ * 1.2.1.20131211
data/ChangeLog CHANGED
@@ -1,5 +1,17 @@
1
1
  = RubyPackager Release History
2
2
 
3
+ == 1.2.1.20131211 (Beta)
4
+
5
+ * Changed the way to test for exerb.
6
+ * Removed useless copyrights
7
+ * Sorted file names in test stubs for determinism
8
+ * Sort installers to avoid problems with testing
9
+ * Setup unique repository names for parallel execution on Travis
10
+ * Made tests pass on Windows, Cygwin and Linux
11
+ * Adapted code and tests for all platforms
12
+ * Added support for Travis
13
+ * Added missing comment
14
+
3
15
  == 1.2.0.20120302 (Beta)
4
16
 
5
17
  * Adapted release information to last version of RubyPackager
@@ -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.2.0.20120302',
5
+ :version => '1.2.1.20131211',
6
6
  :tags => [ 'Beta' ],
7
7
  :dev_status => 'Beta'
8
8
  }
@@ -1,8 +1,4 @@
1
1
  #!env ruby
2
- #--
3
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
4
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
5
- #++
6
2
 
7
3
  # Release a distribution of a Ruby program or library.
8
4
  # Here is the behaviour:
@@ -15,9 +11,24 @@ require 'rUtilAnts/Logging'
15
11
  RUtilAnts::Logging::install_logger_on_object(:lib_root_dir => "#{File.dirname(__FILE__)}/..", :bug_tracker_url => 'http://sourceforge.net/tracker/?group_id=274236&atid=1165400')
16
12
  require 'rUtilAnts/Misc'
17
13
  RUtilAnts::Misc.install_misc_on_object
14
+ require 'rUtilAnts/Platform'
15
+ RUtilAnts::Platform.install_platform_on_object
18
16
 
19
17
  module RubyPackager
20
18
 
19
+ PLATFORM_ID = (
20
+ case os
21
+ when RUtilAnts::Platform::OS_WINDOWS
22
+ 'windows'
23
+ when RUtilAnts::Platform::OS_LINUX, RUtilAnts::Platform::OS_MACOSX
24
+ 'linux'
25
+ when RUtilAnts::Platform::OS_CYGWIN
26
+ 'cygwin'
27
+ else
28
+ raise RuntimeError, "Non supported OS code: #{os}"
29
+ end
30
+ )
31
+
21
32
  # Class giving command line options for the releaser
22
33
  class Launcher
23
34
 
@@ -49,9 +60,9 @@ module RubyPackager
49
60
  require 'rUtilAnts/Plugins'
50
61
  lPluginsManager = RUtilAnts::Plugins::PluginsManager.new
51
62
  lPluginsManager.parse_plugins_from_dir('Installers', "#{File.dirname(FILE_PATH)}/../lib/RubyPackager/Installers", 'RubyPackager::Installers')
52
- lPluginsManager.parse_plugins_from_dir('Installers', "#{File.dirname(FILE_PATH)}/../lib/RubyPackager/#{RUBY_PLATFORM}/Installers", 'RubyPackager::Installers')
63
+ lPluginsManager.parse_plugins_from_dir('Installers', "#{File.dirname(FILE_PATH)}/../lib/RubyPackager/#{PLATFORM_ID}/Installers", 'RubyPackager::Installers')
53
64
  lPluginsManager.parse_plugins_from_dir('Distributors', "#{File.dirname(FILE_PATH)}/../lib/RubyPackager/Distributors", 'RubyPackager::Distributors')
54
- lPluginsManager.parse_plugins_from_dir('Distributors', "#{File.dirname(FILE_PATH)}/../lib/RubyPackager/#{RUBY_PLATFORM}/Distributors", 'RubyPackager::Distributors')
65
+ lPluginsManager.parse_plugins_from_dir('Distributors', "#{File.dirname(FILE_PATH)}/../lib/RubyPackager/#{PLATFORM_ID}/Distributors", 'RubyPackager::Distributors')
55
66
 
56
67
  # Parse command line arguments
57
68
  # Variables set by the parser
@@ -166,7 +177,7 @@ module RubyPackager
166
177
  # All is ok, call the library with parameters
167
178
  require 'RubyPackager/Releaser'
168
179
  # Require the platform specific distribution file
169
- require "RubyPackager/#{RUBY_PLATFORM}/PlatformReleaser"
180
+ require "RubyPackager/#{PLATFORM_ID}/PlatformReleaser"
170
181
  rSuccess = Releaser.new(
171
182
  lPluginsManager,
172
183
  lReleaseInfo,
@@ -179,7 +190,7 @@ module RubyPackager
179
190
  lIncludeRuby,
180
191
  lIncludeTest,
181
192
  lIncludeRDoc,
182
- lInstallers,
193
+ lInstallers.sort,
183
194
  lDistributors
184
195
  ).execute
185
196
  if (rSuccess)
@@ -1,8 +1,3 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
1
  require 'RubyPackager/Tools'
7
2
 
8
3
  module RubyPackager
@@ -10,7 +5,7 @@ module RubyPackager
10
5
  module Distributors
11
6
 
12
7
  class RubyGems
13
-
8
+
14
9
  include RubyPackager::Tools
15
10
 
16
11
  # Check that we can use this distributor
@@ -64,4 +59,4 @@ module RubyPackager
64
59
 
65
60
  end
66
61
 
67
- end
62
+ end
@@ -1,8 +1,3 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
1
  require 'RubyPackager/Tools'
7
2
 
8
3
  module RubyPackager
@@ -10,7 +5,7 @@ module RubyPackager
10
5
  module Distributors
11
6
 
12
7
  class SourceForge
13
-
8
+
14
9
  include RubyPackager::Tools
15
10
 
16
11
  # Check that we can use this distributor
@@ -105,4 +100,4 @@ module RubyPackager
105
100
 
106
101
  end
107
102
 
108
- end
103
+ end
@@ -1,8 +1,3 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
1
  module RubyPackager
7
2
 
8
3
  module Installers
@@ -95,7 +90,7 @@ module RubyPackager
95
90
  lRequirePaths.concat(iReleaseInfo.gem_info[:require_paths])
96
91
  end
97
92
  lStrRequirePaths = (lRequirePaths.empty?) ? 'iSpec.require_path = \'\'' : "iSpec.require_paths = #{lRequirePaths.inspect}"
98
-
93
+
99
94
  # extensions
100
95
  lStrExtensions = ''
101
96
  if ((iReleaseInfo.gem_info[:extensions] != nil) and
@@ -167,4 +162,4 @@ end
167
162
 
168
163
  end
169
164
 
170
- end
165
+ end
@@ -1,8 +1,3 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
1
  module RubyPackager
7
2
 
8
3
  # This class is the base class of all releases info to be provided by packages.
@@ -172,6 +167,7 @@ module RubyPackager
172
167
  # * *:extra_rdoc_files* (<em>list<String></em>): List of file patterns to be included in the RDoc but not in the Gem
173
168
  # * *:test_file* (_String_): Name of the test file to execute
174
169
  # * *:gem_dependencies* (<em>list< [String,String] ></em>): List of [ Gem, Version criteria ] this Gem depends on
170
+ # * *:extensions* (<em>list<String></em>): List of paths to extconf.rb files to include as native C extensions
175
171
  # Return::
176
172
  # * _ReleaseInfo_: self
177
173
  def gem(iParams)
@@ -1,8 +1,4 @@
1
1
  # coding: utf-8
2
- #--
3
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
4
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
5
- #++
6
2
 
7
3
  # Release a distribution of a Ruby program.
8
4
  # This produces an installable executable that will install a set of files and directories:
@@ -1,8 +1,3 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
1
  module RubyPackager
7
2
 
8
3
  module Tools
@@ -98,4 +93,4 @@ module RubyPackager
98
93
 
99
94
  end
100
95
 
101
- end
96
+ end
@@ -1,113 +1,109 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
- # This file prepares a cygwin distribution
7
-
8
- # Require needed to generate the temporary ruby file that produces the executable
9
- require 'tmpdir'
10
-
11
- module RubyPackager
12
-
13
- class PlatformReleaser
14
-
15
- PLATFORM_DIR = File.dirname(__FILE__)
16
-
17
- # Check if the tools we will use to generate an executable are present
18
- #
19
- # Parameters::
20
- # * *iRootDir* (_String_): Root directory
21
- # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
22
- # * *iNeedBinaryCompilation* (_Boolean_): Do we need to compile RB files into a binary executable ?
23
- # Return::
24
- # * _Boolean_: Are tools correctly useable ?
25
- def check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation)
26
- rSuccess = true
27
-
28
- if (iIncludeRuby)
29
- # We need allinoneruby
30
- if (Gem.find_files('allinoneruby').empty?)
31
- log_err "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)."
32
- rSuccess = false
33
- end
34
- end
35
-
36
- return rSuccess
37
- end
38
-
39
- # Create the binary.
40
- # This is called when the core library has been copied in the release directory.
41
- #
42
- # Parameters::
43
- # * *iRootDir* (_String_): Root directory
44
- # * *iReleaseDir* (_String_): Release directory
45
- # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
46
- # * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
47
- # Return::
48
- # * _Boolean_: Success ?
49
- def create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
50
- rSuccess = true
51
-
52
- lBinSubDir = "Launch/#{RUBY_PLATFORM}/bin"
53
- lRubyBaseBinName = 'ruby'
54
- lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
55
- if (iIncludeRuby)
56
- # First create the binary containing all ruby
57
- lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
58
- FileUtils::mkdir_p(lBinDir)
59
- change_dir(lBinDir) do
60
- lCmd = "allinoneruby #{lBinName}"
61
- rSuccess = system(lCmd)
62
- if (!rSuccess)
63
- log_err "Error while executing \"#{lCmd}\""
64
- end
65
- end
66
- end
67
- if (rSuccess)
68
- # Then create the real executable
69
- # Generate the Shell file that launches everything for Linux
70
- File.open("#{iReleaseDir}/#{iExecutableInfo[:exe_name]}", 'w') do |oFile|
71
- oFile << "\#!/bin/sh
72
- \#--
73
- \# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
74
- \# Licensed under the terms specified in LICENSE file. No warranty is provided.
75
- \#++
76
-
77
- \# This file is generated by RubyPackager for Cygwin.
78
-
79
- \# This file has to launch the correct binary. There can be several binaries dependending on the configuration.
80
- \# This is the file that will be created as the executable to launch.
81
-
82
- \# Test Ruby's existence
83
- which ruby >/dev/null 2>/dev/null
84
- if [ $? == 1 ]
85
- then
86
- echo 'Ruby not found on current platform. Use embedded one.'
87
- if [ ! -d tempruby ]
88
- then
89
- echo 'Extracting Ruby distribution...'
90
- mkdir tempruby
91
- cd tempruby
92
- ../#{lBinSubDir}/#{lBinName} --eee-justextract
93
- cd ..
94
- fi
95
- \# Set the environment correctly to execute Ruby from the extracted dir
96
- export LD_LIBRARY_PATH=`pwd`/tempruby/bin:`pwd`/tempruby/lib:`pwd`/tempruby/lib/lib1:`pwd`/tempruby/lib/lib2:`pwd`/tempruby/lib/lib3:`pwd`/tempruby/lib/lib4:${LD_LIRARY_PATH}
97
- export RUBYOPT=
98
- ./tempruby/bin/ruby -w #{iExecutableInfo[:startup_rb_file]}
99
- else
100
- echo 'Ruby found on current platform. Use it directly.'
101
- ruby -w #{iExecutableInfo[:startup_rb_file]}
102
- fi
103
- "
104
- end
105
- File.chmod(0755, "#{iReleaseDir}/#{iExecutableInfo[:exe_name]}")
106
- end
107
-
108
- return rSuccess
109
- end
110
-
111
- end
112
-
113
- end
1
+ # This file prepares a cygwin distribution
2
+
3
+ # Require needed to generate the temporary ruby file that produces the executable
4
+ require 'tmpdir'
5
+
6
+ module RubyPackager
7
+
8
+ class PlatformReleaser
9
+
10
+ PLATFORM_DIR = File.dirname(__FILE__)
11
+
12
+ # Check if the tools we will use to generate an executable are present
13
+ #
14
+ # Parameters::
15
+ # * *iRootDir* (_String_): Root directory
16
+ # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
17
+ # * *iNeedBinaryCompilation* (_Boolean_): Do we need to compile RB files into a binary executable ?
18
+ # Return::
19
+ # * _Boolean_: Are tools correctly useable ?
20
+ def check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation)
21
+ rSuccess = true
22
+
23
+ if (iIncludeRuby)
24
+ # We need allinoneruby
25
+ if (Gem.find_files('allinoneruby').empty?)
26
+ log_err "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)."
27
+ rSuccess = false
28
+ end
29
+ end
30
+
31
+ return rSuccess
32
+ end
33
+
34
+ # Create the binary.
35
+ # This is called when the core library has been copied in the release directory.
36
+ #
37
+ # Parameters::
38
+ # * *iRootDir* (_String_): Root directory
39
+ # * *iReleaseDir* (_String_): Release directory
40
+ # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
41
+ # * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
42
+ # Return::
43
+ # * _Boolean_: Success ?
44
+ def create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
45
+ rSuccess = true
46
+
47
+ lBinSubDir = "Launch/#{PLATFORM_ID}/bin"
48
+ lRubyBaseBinName = 'ruby'
49
+ lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
50
+ if (iIncludeRuby)
51
+ # First create the binary containing all ruby
52
+ lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
53
+ FileUtils::mkdir_p(lBinDir)
54
+ change_dir(lBinDir) do
55
+ lCmd = "allinoneruby #{lBinName}"
56
+ rSuccess = system(lCmd)
57
+ if (!rSuccess)
58
+ log_err "Error while executing \"#{lCmd}\""
59
+ end
60
+ end
61
+ end
62
+ if (rSuccess)
63
+ # Then create the real executable
64
+ # Generate the Shell file that launches everything for Linux
65
+ File.open("#{iReleaseDir}/#{iExecutableInfo[:exe_name]}", 'w') do |oFile|
66
+ oFile << "\#!/bin/sh
67
+ \#--
68
+ \# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
69
+ \# Licensed under the terms specified in LICENSE file. No warranty is provided.
70
+ \#++
71
+
72
+ \# This file is generated by RubyPackager for Cygwin.
73
+
74
+ \# This file has to launch the correct binary. There can be several binaries dependending on the configuration.
75
+ \# This is the file that will be created as the executable to launch.
76
+
77
+ \# Test Ruby's existence
78
+ which ruby >/dev/null 2>/dev/null
79
+ OUT=$?
80
+ if [ $OUT -eq 1 ]
81
+ then
82
+ echo 'Ruby not found on current platform. Use embedded one.'
83
+ if [ ! -d tempruby ]
84
+ then
85
+ echo 'Extracting Ruby distribution...'
86
+ mkdir tempruby
87
+ cd tempruby
88
+ ../#{lBinSubDir}/#{lBinName} --eee-justextract
89
+ cd ..
90
+ fi
91
+ \# Set the environment correctly to execute Ruby from the extracted dir
92
+ export LD_LIBRARY_PATH=`pwd`/tempruby/bin:`pwd`/tempruby/lib:`pwd`/tempruby/lib/lib1:`pwd`/tempruby/lib/lib2:`pwd`/tempruby/lib/lib3:`pwd`/tempruby/lib/lib4:${LD_LIRARY_PATH}
93
+ export RUBYOPT=
94
+ ./tempruby/bin/ruby -w #{iExecutableInfo[:startup_rb_file]}
95
+ else
96
+ echo 'Ruby found on current platform. Use it directly.'
97
+ ruby -w #{iExecutableInfo[:startup_rb_file]}
98
+ fi
99
+ "
100
+ end
101
+ File.chmod(0755, "#{iReleaseDir}/#{iExecutableInfo[:exe_name]}")
102
+ end
103
+
104
+ return rSuccess
105
+ end
106
+
107
+ end
108
+
109
+ end
@@ -1,113 +1,110 @@
1
- #--
2
- # Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
3
- # Licensed under the terms specified in LICENSE file. No warranty is provided.
4
- #++
5
-
6
- # This file prepares a win32 distribution
7
-
8
- # Require needed to generate the temporary ruby file that produces the executable
9
- require 'tmpdir'
10
-
11
- module RubyPackager
12
-
13
- class PlatformReleaser
14
-
15
- PLATFORM_DIR = File.dirname(__FILE__)
16
-
17
- # Check if the tools we will use to generate an executable are present
18
- #
19
- # Parameters::
20
- # * *iRootDir* (_String_): Root directory
21
- # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
22
- # * *iNeedBinaryCompilation* (_Boolean_): Do we need to compile RB files into a binary executable ?
23
- # Return::
24
- # * _Boolean_: Are tools correctly useable ?
25
- def check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation)
26
- rSuccess = true
27
-
28
- if (iIncludeRuby)
29
- # We need allinoneruby
30
- if (Gem.find_files('allinoneruby').empty?)
31
- log_err "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)."
32
- rSuccess = false
33
- end
34
- end
35
-
36
- return rSuccess
37
- end
38
-
39
- # Create the binary.
40
- # This is called when the core library has been copied in the release directory.
41
- #
42
- # Parameters::
43
- # * *iRootDir* (_String_): Root directory
44
- # * *iReleaseDir* (_String_): Release directory
45
- # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
46
- # * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
47
- # Return::
48
- # * _Boolean_: Success ?
49
- def create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
50
- rSuccess = true
51
-
52
- lBinSubDir = "Launch/#{RUBY_PLATFORM}/bin"
53
- lRubyBaseBinName = 'ruby'
54
- lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
55
- if (iIncludeRuby)
56
- # First create the binary containing all ruby
57
- lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
58
- FileUtils::mkdir_p(lBinDir)
59
- change_dir(lBinDir) do
60
- lCmd = "allinoneruby #{lBinName}"
61
- rSuccess = system(lCmd)
62
- if (!rSuccess)
63
- log_err "Error while executing \"#{lCmd}\""
64
- end
65
- end
66
- end
67
- if (rSuccess)
68
- # Then create the real executable
69
- # Generate the Shell file that launches everything for Linux
70
- File.open("#{iReleaseDir}/#{iExecutableInfo[:exe_name]}", 'w') do |oFile|
71
- oFile << "\#!/bin/sh
72
- \#--
73
- \# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
74
- \# Licensed under the terms specified in LICENSE file. No warranty is provided.
75
- \#++
76
-
77
- \# This file is generated by RubyPackager for Linux.
78
-
79
- \# This file has to launch the correct binary. There can be several binaries dependending on the configuration.
80
- \# This is the file that will be created as the executable to launch.
81
-
82
- \# Test Ruby's existence
83
- which ruby >/dev/null 2>/dev/null
84
- if [ $? == 1 ]
85
- then
86
- echo 'Ruby not found on current platform. Use embedded one.'
87
- if [ ! -d tempruby ]
88
- then
89
- echo 'Extracting Ruby distribution...'
90
- mkdir tempruby
91
- cd tempruby
92
- ../#{lBinSubDir}/#{lBinName} --eee-justextract
93
- cd ..
94
- fi
95
- \# Set the environment correctly to execute Ruby from the extracted dir
96
- export LD_LIBRARY_PATH=`pwd`/tempruby/bin:`pwd`/tempruby/lib:`pwd`/tempruby/lib/lib1:`pwd`/tempruby/lib/lib2:`pwd`/tempruby/lib/lib3:`pwd`/tempruby/lib/lib4:${LD_LIRARY_PATH}
97
- export RUBYOPT=
98
- ./tempruby/bin/ruby -w #{iExecutableInfo[:startup_rb_file]}
99
- else
100
- echo 'Ruby found on current platform. Use it directly.'
101
- ruby -w #{iExecutableInfo[:startup_rb_file]}
102
- fi
103
- "
104
- end
105
- File.chmod(0755, "#{iReleaseDir}/#{iExecutableInfo[:exe_name]}")
106
- end
107
-
108
- return rSuccess
109
- end
110
-
111
- end
112
-
113
- end
1
+ # This file prepares a win32 distribution
2
+
3
+ # Require needed to generate the temporary ruby file that produces the executable
4
+ require 'tmpdir'
5
+
6
+ module RubyPackager
7
+
8
+ class PlatformReleaser
9
+
10
+ PLATFORM_DIR = File.dirname(__FILE__)
11
+
12
+ # Check if the tools we will use to generate an executable are present
13
+ #
14
+ # Parameters::
15
+ # * *iRootDir* (_String_): Root directory
16
+ # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
17
+ # * *iNeedBinaryCompilation* (_Boolean_): Do we need to compile RB files into a binary executable ?
18
+ # Return::
19
+ # * _Boolean_: Are tools correctly useable ?
20
+ def check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation)
21
+ rSuccess = true
22
+
23
+ if (iIncludeRuby)
24
+ # We need allinoneruby
25
+ if (Gem.find_files('allinoneruby').empty?)
26
+ log_err "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)."
27
+ rSuccess = false
28
+ end
29
+ end
30
+
31
+ return rSuccess
32
+ end
33
+
34
+ # Create the binary.
35
+ # This is called when the core library has been copied in the release directory.
36
+ #
37
+ # Parameters::
38
+ # * *iRootDir* (_String_): Root directory
39
+ # * *iReleaseDir* (_String_): Release directory
40
+ # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
41
+ # * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
42
+ # Return::
43
+ # * _Boolean_: Success ?
44
+ def create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
45
+ rSuccess = true
46
+
47
+ lBinSubDir = "Launch/#{PLATFORM_ID}/bin"
48
+ lRubyBaseBinName = 'ruby'
49
+ lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
50
+ if (iIncludeRuby)
51
+ # First create the binary containing all ruby
52
+ lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
53
+ FileUtils::mkdir_p(lBinDir)
54
+ change_dir(lBinDir) do
55
+ lCmd = "allinoneruby #{lBinName}"
56
+ rSuccess = system(lCmd)
57
+ if (!rSuccess)
58
+ log_err "Error while executing \"#{lCmd}\""
59
+ end
60
+ end
61
+ end
62
+ if (rSuccess)
63
+ # Then create the real executable
64
+ # Generate the Shell file that launches everything for Linux
65
+ lShellFileName = "#{iReleaseDir}/#{iExecutableInfo[:exe_name]}"
66
+ File.open(lShellFileName, 'w') do |oFile|
67
+ oFile << "\#!/bin/sh
68
+ \#--
69
+ \# Copyright (c) 2009 - 2012 Muriel Salvan (muriel@x-aeon.com)
70
+ \# Licensed under the terms specified in LICENSE file. No warranty is provided.
71
+ \#++
72
+
73
+ \# This file is generated by RubyPackager for Linux.
74
+
75
+ \# This file has to launch the correct binary. There can be several binaries dependending on the configuration.
76
+ \# This is the file that will be created as the executable to launch.
77
+
78
+ \# Test Ruby's existence
79
+ which ruby >/dev/null 2>/dev/null
80
+ OUT=$?
81
+ if [ $OUT -eq 1 ]
82
+ then
83
+ echo 'Ruby not found on current platform. Use embedded one.'
84
+ if [ ! -d tempruby ]
85
+ then
86
+ echo 'Extracting Ruby distribution...'
87
+ mkdir tempruby
88
+ cd tempruby
89
+ ../#{lBinSubDir}/#{lBinName} --eee-justextract
90
+ cd ..
91
+ fi
92
+ \# Set the environment correctly to execute Ruby from the extracted dir
93
+ export LD_LIBRARY_PATH=`pwd`/tempruby/bin:`pwd`/tempruby/lib:`pwd`/tempruby/lib/lib1:`pwd`/tempruby/lib/lib2:`pwd`/tempruby/lib/lib3:`pwd`/tempruby/lib/lib4:${LD_LIRARY_PATH}
94
+ export RUBYOPT=
95
+ ./tempruby/bin/ruby -w #{iExecutableInfo[:startup_rb_file]}
96
+ else
97
+ echo 'Ruby found on current platform. Use it directly.'
98
+ ruby -w #{iExecutableInfo[:startup_rb_file]}
99
+ fi
100
+ "
101
+ end
102
+ File.chmod(0755, lShellFileName)
103
+ end
104
+
105
+ return rSuccess
106
+ end
107
+
108
+ end
109
+
110
+ end