class Autobuild::Ruby

Handling of “standard” Ruby packages

The package is expected to follow the general standards laid down by the bundler guys (i.e. look like a package generated by ‘bundler gem`)

Attributes

rake_clean_task[RW]

The Rake task that is used to run cleanup. Defaults to “clean”. Set to nil to disable tests for this package

rake_doc_task[RW]

The Rake task that is used to generate documentation. Defaults to “doc”. Set to nil to disable documentation generation

rake_setup_task[RW]

The Rake task that is used to set up the package. Defaults to “default”. Set to nil to disable setup altogether

rake_test_options[RW]

Options that should be passed to the rake task

rake_test_task[RW]

The Rake task that is used to run tests. Defaults to “test”. Set to nil to disable tests for this package

Public Class Methods

new(*args) click to toggle source
Calls superclass method Autobuild::ImporterPackage::new
# File lib/autobuild/packages/ruby.rb, line 22
def initialize(*args)
    self.rake_setup_task = "default"
    self.rake_doc_task   = "redocs"
    self.rake_clean_task = "clean"
    self.rake_test_task  = "test"
    self.rake_test_options = []

    super
    exclude << /\.so$/
    exclude << /Makefile$/
    exclude << /mkmf.log$/
    exclude << /\.o$/
    exclude << /doc$/
end

Public Instance Methods

install() click to toggle source
Calls superclass method Autobuild::Package#install
# File lib/autobuild/packages/ruby.rb, line 70
def install
    progress_start "setting up Ruby package %s",
                   done_message: 'set up Ruby package %s' do
        invoke_rake
    end
    super
end
invoke_rake(setup_task = rake_setup_task) click to toggle source
# File lib/autobuild/packages/ruby.rb, line 61
def invoke_rake(setup_task = rake_setup_task)
    if setup_task && File.file?(File.join(srcdir, 'Rakefile'))
        run 'post-install',
            Autobuild.tool_in_path('ruby'), '-S',
            Autobuild.tool('rake'), setup_task,
            working_directory: srcdir
    end
end
update_environment() click to toggle source
# File lib/autobuild/packages/ruby.rb, line 107
def update_environment
    env_add_prefix srcdir
    libdir = File.join(srcdir, 'lib')
    env_add_path 'RUBYLIB', libdir if File.directory?(libdir)
end
with_doc() click to toggle source
# File lib/autobuild/packages/ruby.rb, line 37
def with_doc
    doc_task do
        progress_start "generating documentation for %s",
                       done_message: 'generated documentation for %s' do
            run 'doc',
                Autobuild.tool_in_path('ruby'), '-S',
                Autobuild.tool('rake'), rake_doc_task,
                working_directory: srcdir
        end
    end
end
with_tests() click to toggle source
# File lib/autobuild/packages/ruby.rb, line 49
def with_tests
    test_utility.task do
        progress_start "running tests for %s",
                       done_message: 'tests passed for %s' do
            run 'test',
                Autobuild.tool_in_path('ruby'), '-S',
                Autobuild.tool('rake'), rake_test_task, *rake_test_options,
                working_directory: srcdir
        end
    end
end