Class: RubyPackager::PlatformReleaser
- Inherits:
-
Object
- Object
- RubyPackager::PlatformReleaser
- Defined in:
- lib/RubyPackager/linux/PlatformReleaser.rb,
lib/RubyPackager/cygwin/PlatformReleaser.rb,
lib/RubyPackager/windows/PlatformReleaser.rb
Constant Summary collapse
- PLATFORM_DIR =
File.dirname(__FILE__)
Instance Method Summary collapse
-
#check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation) ⇒ Object
Check if the tools we will use to generate an executable are present.
-
#create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo) ⇒ Object
Create the binary.
Instance Method Details
#check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation) ⇒ Object
Check if the tools we will use to generate an executable are present
- Parameters
-
iRootDir (String): Root directory
-
iIncludeRuby (Boolean): Do we include Ruby in the release ?
-
iNeedBinaryCompilation (Boolean): Do we need to compile RB files into a binary executable ?
- Return
-
Boolean: Are tools correctly useable ?
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/RubyPackager/linux/PlatformReleaser.rb', line 20 def check_exe_tools(iRootDir, iIncludeRuby, iNeedBinaryCompilation) rSuccess = true if (iIncludeRuby) # We need allinoneruby if (Gem.find_files('allinoneruby').empty?) log_err "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)." rSuccess = false end end return rSuccess end |
#create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo) ⇒ Object
Create the binary. This is called when the core library has been copied in the release directory.
- Parameters
-
iRootDir (String): Root directory
-
iReleaseDir (String): Release directory
-
iIncludeRuby (Boolean): Do we include Ruby in the release ?
-
iExecutableInfo (map<Symbol,Object>): The executable information
- Return
-
Boolean: Success ?
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/RubyPackager/linux/PlatformReleaser.rb', line 44 def create_binary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo) rSuccess = true lBinSubDir = "Launch/#{PLATFORM_ID}/bin" lRubyBaseBinName = 'ruby' lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin" if (iIncludeRuby) # First create the binary containing all ruby lBinDir = "#{iReleaseDir}/#{lBinSubDir}" FileUtils::mkdir_p(lBinDir) change_dir(lBinDir) do lCmd = "allinoneruby #{lBinName}" rSuccess = system(lCmd) if (!rSuccess) log_err "Error while executing \"#{lCmd}\"" end end end if (rSuccess) # Then create the real executable # Generate the Shell file that launches everything for Linux lShellFileName = "#{iReleaseDir}/#{iExecutableInfo[:exe_name]}" File.open(lShellFileName, 'w') do |oFile| oFile << "\#!/bin/sh \#-- \# Copyright (c) 2009 - 2012 Muriel Salvan ([email protected]) \# Licensed under the terms specified in LICENSE file. No warranty is provided. \#++ \# This file is generated by RubyPackager for Linux. \# This file has to launch the correct binary. There can be several binaries dependending on the configuration. \# This is the file that will be created as the executable to launch. \# Test Ruby's existence which ruby >/dev/null 2>/dev/null OUT=$? if [ $OUT -eq 1 ] then echo 'Ruby not found on current platform. Use embedded one.' if [ ! -d tempruby ] then echo 'Extracting Ruby distribution...' mkdir tempruby cd tempruby ../#{lBinSubDir}/#{lBinName} --eee-justextract cd .. fi \# Set the environment correctly to execute Ruby from the extracted dir 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} export RUBYOPT= ./tempruby/bin/ruby -w #{iExecutableInfo[:startup_rb_file]} else echo 'Ruby found on current platform. Use it directly.' ruby -w #{iExecutableInfo[:startup_rb_file]} fi " end File.chmod(0755, lShellFileName) end return rSuccess end |