Module: Buildr::Shell

Includes:
Extension
Included in:
Project
Defined in:
lib/buildr/clojure/shell.rb,
lib/buildr/shell.rb,
lib/buildr/core/shell.rb

Overview

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Classes: Base, BeanShell, Clojure, JIRB, ShellTask

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Extension

included

Class Method Details

.define_task(project, name, provider = nil) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/buildr/shell.rb', line 38

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

.providersObject



22
23
24
# File 'lib/buildr/shell.rb', line 22

def providers
  @providers ||= []
end

.select_by_lang(lang) ⇒ Object Also known as: select



26
27
28
29
# File 'lib/buildr/shell.rb', line 26

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

.select_by_name(name) ⇒ Object



33
34
35
36
# File 'lib/buildr/shell.rb', line 33

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

Instance Method Details

#shell(&block) ⇒ Object

:call-seq:

shell(&block) => ShellTask

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



175
176
177
178
179
# File 'lib/buildr/shell.rb', line 175

def shell(&block)
  task('shell').tap do |t|
    t.enhance &block if block
  end
end