RubyPackager process flow

From RubyPackager

Jump to: navigation, search

Contents

[edit] Overview

Here is the global process of RubyPackager.

RubyPackager creates a directory structure under the current directory where it will store every file it has to generate. The structure is currently named Releases/<PlatformName>/<Version>/<Flavor>/<Date>.

Here is the subdirectories created in this place:

  • Release/: Contains the released files (binaries, libraries...), ready to be packaged in installers.
  • Installer/: Contains files generated by installers (NSIS installers, Gems...), ready to be uploaded on distributors.
  • Documentation/: Contains files generated for documentation purposes:
    • Documentation/rdoc/: Contains generated RDoc.
    • Documentation/ReleaseNote.txt: Release note in text format.
    • Documentation/ReleaseNote.html: Release note in html format.

[edit] Detailed steps

The complete process in Ruby can be found in the RubyPackager::Releaser#execute method.

[edit] Check installed tools

This step calls every actor (Installer, Distributor...) in the release process and check if it has the tools needed to perform its operation (presence of some binaries, Internet connection...).

Here are the different methods called (if defined):

  • ReleaseInfo.check_ready_for_release: The release file checks.
  • PlatformSpecificInfo.check_exe_tools: The platform specifics way to generate a binary (called only for executable releases).
  • Installer.check_tools: The installer specifics tools. Called for each needed Installer.
  • Distributor.check_tools: The distributor specifics tools. Called for each needed Distributor.

If any of those methods return false, then the process exits before releasing any file.

[edit] Create release

This step copies the Core files and creates a ReleaseInfo file into the Release/ directory, then generates a binary with them (for an executable release only). Then it copies the additional files and test files if needed in the Release/ directory.

The ReleaseInfo file created among the Core files can then be used by the Ruby application itself to get some info about the release it is running on. Here is the information that can be gathered from this file:

  • The version number
  • The tags
  • The development status

Here is an example of such a file:

# This file has been generated by RubyPackager during a delivery.
# More info about RubyPackager: http://rubypackager.sourceforge.net
{
  :version => '0.1.0.20091021',
  :tags => [],
  :dev_status => 'Alpha'
}

This file can be easily parsed in any language, and most easily in Ruby where it defines a complete map. A Ruby application can then read this map using this code:

lReleaseInfo = File.exists?('ReleaseInfo') ? eval(File.read('ReleaseInfo')) : {}
# Here, lReleaseInfo is a map containing information about the release (or an empty map if the file did not exist)
# Print some info for example:
puts "Version: #{lReleaseInfo[:version]}"
puts "Tags: #{lReleaseInfo[:tags].join(', ')}"
puts "Development status: #{lReleaseInfo[:dev_status]}"

[edit] Generate documentation and release notes

Implementation can be found in the following methods:

This step generates RDoc in the Documentation/rdoc directory, and the Documentation/ReleaseNote.txt and Documentation/ReleaseNote.html files.

[edit] Package Release and generate installer

Implementation can be found in each Installer's plugin (list found in RubyPackager::Installers namespace). Here are the current ones:

This step generates deliverables in the Installer/ directory.

[edit] Distribute released files

Implementation can be found in each Distributor's plugin (list found in RubyPackager::Distributors namespace). Here are the current ones:

This steps uploads deliverables, documentation and release notes to the specified Distributor.

Personal tools