module RakeCompilerDock

Constants

IMAGE_VERSION
PredefinedGroups
PredefinedUsers
VERSION

Public Class Methods

exec(*args, &block) click to toggle source

Run the command cmd within a fresh rake-compiler-dock container. The command is run directly, without the shell.

If a block is given, upon command completion the block is called with an OK flag (true on a zero exit status) and a Process::Status object. Without a block a RuntimeError is raised when the command exits non-zero.

  • Option :verbose can be set to enable printing of the command line. If not set, rake's verbose flag is used.

  • Option :check_docker can be set to false to disable the docker check.

  • Option :sigfw can be set to false to not stop the container on Ctrl-C.

  • Option :runas can be set to false to execute the command as user root.

  • Option :options can be an Array of additional options to the 'docker run' command.

  • Option :username can be used to overwrite the user name in the container

  • Option :groupname can be used to overwrite the group name in the container

Examples:

RakeCompilerDock.exec 'bash', '-c', 'echo $RUBY_CC_VERSION'
# File lib/rake_compiler_dock.rb, line 71
def exec(*args, &block)
  Starter.exec(*args, &block)
end
image_name() click to toggle source
# File lib/rake_compiler_dock.rb, line 49
def image_name
  Starter.image_name
end
sh(cmd, options={}, &block) click to toggle source

Run the command cmd within a fresh rake-compiler-dock container and within a shell.

If a block is given, upon command completion the block is called with an OK flag (true on a zero exit status) and a Process::Status object. Without a block a RuntimeError is raised when the command exits non-zero.

Option :verbose can be set to enable printing of the command line. If not set, rake's verbose flag is used.

Option :rubyvm can be set to :mri or :jruby . It selects the docker image with an appropriate toolchain.

Option :platform can be set to a list of space separated values. It selects the docker image(s) with an appropriate toolchain. Allowed values are :x86-mingw32, x64-mingw32, x86-linux or x86_64-linux. If the list contains multiple values, cmd is consecutively executed in each of the docker images, Option :platform is ignored when :rubyvm is set to :jruby. Default is “x86-mingw32 x64-mingw32” .

Examples:

RakeCompilerDock.sh 'bundle && rake cross native gem'

Check exit status after command runs:

sh %{bundle && rake cross native gem}, verbose: false do |ok, res|
  if ! ok
    puts "windows cross build failed (status = #{res.exitstatus})"
  end
end
# File lib/rake_compiler_dock.rb, line 45
def sh(cmd, options={}, &block)
  Starter.sh(cmd, options, &block)
end

Private Instance Methods

exec(*args, &block) click to toggle source

Run the command cmd within a fresh rake-compiler-dock container. The command is run directly, without the shell.

If a block is given, upon command completion the block is called with an OK flag (true on a zero exit status) and a Process::Status object. Without a block a RuntimeError is raised when the command exits non-zero.

  • Option :verbose can be set to enable printing of the command line. If not set, rake's verbose flag is used.

  • Option :check_docker can be set to false to disable the docker check.

  • Option :sigfw can be set to false to not stop the container on Ctrl-C.

  • Option :runas can be set to false to execute the command as user root.

  • Option :options can be an Array of additional options to the 'docker run' command.

  • Option :username can be used to overwrite the user name in the container

  • Option :groupname can be used to overwrite the group name in the container

Examples:

RakeCompilerDock.exec 'bash', '-c', 'echo $RUBY_CC_VERSION'
# File lib/rake_compiler_dock.rb, line 71
def exec(*args, &block)
  Starter.exec(*args, &block)
end
image_name() click to toggle source
# File lib/rake_compiler_dock.rb, line 49
def image_name
  Starter.image_name
end
sh(cmd, options={}, &block) click to toggle source

Run the command cmd within a fresh rake-compiler-dock container and within a shell.

If a block is given, upon command completion the block is called with an OK flag (true on a zero exit status) and a Process::Status object. Without a block a RuntimeError is raised when the command exits non-zero.

Option :verbose can be set to enable printing of the command line. If not set, rake's verbose flag is used.

Option :rubyvm can be set to :mri or :jruby . It selects the docker image with an appropriate toolchain.

Option :platform can be set to a list of space separated values. It selects the docker image(s) with an appropriate toolchain. Allowed values are :x86-mingw32, x64-mingw32, x86-linux or x86_64-linux. If the list contains multiple values, cmd is consecutively executed in each of the docker images, Option :platform is ignored when :rubyvm is set to :jruby. Default is “x86-mingw32 x64-mingw32” .

Examples:

RakeCompilerDock.sh 'bundle && rake cross native gem'

Check exit status after command runs:

sh %{bundle && rake cross native gem}, verbose: false do |ok, res|
  if ! ok
    puts "windows cross build failed (status = #{res.exitstatus})"
  end
end
# File lib/rake_compiler_dock.rb, line 45
def sh(cmd, options={}, &block)
  Starter.sh(cmd, options, &block)
end