Module: RakeCompilerDock
- Defined in:
- lib/rake_compiler_dock.rb,
lib/rake_compiler_dock/colors.rb,
lib/rake_compiler_dock/starter.rb,
lib/rake_compiler_dock/version.rb,
lib/rake_compiler_dock/docker_check.rb
Defined Under Namespace
Modules: Colors Classes: DockerCheck, DockerIsNotAvailable, Starter
Constant Summary collapse
- VERSION =
"0.4.0"
Class Method Summary collapse
-
.exec(*args, &block) ⇒ Object
Run the command cmd within a fresh rake-compiler-dock container.
- .image_name ⇒ Object
-
.sh(cmd, options = {}, &block) ⇒ Object
Run the command cmd within a fresh rake-compiler-dock container and within a shell.
Class Method Details
.exec(*args, &block) ⇒ Object
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
:verbosecan be set to enable printing of the command line. If not set, rake’s verbose flag is used. -
Option
:check_dockercan be set to false to disable the docker check. -
Option
:sigfwcan be set to false to not stop the container on Ctrl-C. -
Option
:runascan be set to false to execute the command as user root. -
Option
:optionscan be an Array of additional options to the ‘docker run’ command.
Examples:
RakeCompilerDock.exec 'bash', '-c', 'echo $RUBY_CC_VERSION'
51 52 53 |
# File 'lib/rake_compiler_dock.rb', line 51 def exec(*args, &block) Starter.exec(*args, &block) end |
.image_name ⇒ Object
31 32 33 |
# File 'lib/rake_compiler_dock.rb', line 31 def image_name Starter.image_name end |
.sh(cmd, options = {}, &block) ⇒ Object
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.
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
27 28 29 |
# File 'lib/rake_compiler_dock.rb', line 27 def sh(cmd, ={}, &block) Starter.sh(cmd, , &block) end |