module Buildr::Shell

Public Class Methods

define_task(project, name, provider = nil) click to toggle source
# File lib/buildr/shell.rb, line 37
def define_task(project, name, provider = nil)
  ShellTask.define_task(name).tap do |t|
    t.send(:associate_with, project)
    t.enhance([project.compile]) do |t|
      # double-enhance to execute the provider last
      t.enhance { |t| t.run }
    end
    t.using provider.to_sym if provider
  end
end
providers() click to toggle source
# File lib/buildr/shell.rb, line 21
def providers
  @providers ||= []
end
select(lang)
Alias for: select_by_lang
select_by_lang(lang) click to toggle source
# File lib/buildr/shell.rb, line 25
def select_by_lang(lang)
  fail 'Unable to define shell task for nil language' if lang.nil?
  providers.detect { |e| e.languages.nil? ? false : e.languages.include?(lang.to_sym) }
end
Also aliased as: select
select_by_name(name) click to toggle source
# File lib/buildr/shell.rb, line 32
def select_by_name(name)
  fail 'Unable to define run task for nil' if name.nil?
  providers.detect { |e| e.to_sym == name.to_sym }
end

Public Instance Methods

shell(&block) → ShellTask click to toggle source

This method returns the project’s shell task. It also accepts a block to be executed when the shell task is invoked.

# File lib/buildr/shell.rb, line 174
def shell(&block)
  task('shell').tap do |t|
    t.enhance &block if block
  end
end