Module: Inventory::Rake::Tasks

Defined in:
lib/inventory-rake-1.0/tasks.rb

Overview

Namespace for Rake tasks using an Inventory.

Defined Under Namespace

Classes: Clean, Compile, Gem, Inventory

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cleanfilesArray<String> (readonly)

Returns The files to clean when running the “clean” task.

Returns:

  • (Array<String>)

    The files to clean when running the “clean” task



17
18
19
# File 'lib/inventory-rake-1.0/tasks.rb', line 17

def cleanfiles
  @cleanfiles
end

.distcleanfilesArray<String> (readonly)

Returns The files to clean when running the “distclean”task.

Returns:

  • (Array<String>)

    The files to clean when running the “distclean”task



21
22
23
# File 'lib/inventory-rake-1.0/tasks.rb', line 21

def distcleanfiles
  @distcleanfiles
end

.inventoryInventory

Returns The default inventory to use for tasks.

Parameters:

Returns:

  • (Inventory)

    The default inventory to use for tasks



10
11
12
# File 'lib/inventory-rake-1.0/tasks.rb', line 10

def inventory
  @inventory
end

.mostlycleanfilesArray<String> (readonly)

Returns The files to clean when running the “mostlyclean”task.

Returns:

  • (Array<String>)

    The files to clean when running the “mostlyclean”task



14
15
16
# File 'lib/inventory-rake-1.0/tasks.rb', line 14

def mostlycleanfiles
  @mostlycleanfiles
end

Class Method Details

.define(inventory, options = {}) ⇒ self

Sets the default inventory to INVENTORY, then defines Clean, Compile, Inventory, and Gem tasks.

A task named “check” will already have been created. This task is meant to depend on tasks that check the package before distribution.

Parameters:

  • inventory (Inventory)
  • options (Hash) (defaults to: {})

Options Hash (options):

Returns:

  • (self)


34
35
36
37
38
39
40
41
# File 'lib/inventory-rake-1.0/tasks.rb', line 34

def define(inventory, options = {})
  self.inventory = inventory
  Clean.define
  Compile.new :inventory => inventory
  Inventory.new :inventory => inventory
  Gem.new(:inventory => inventory, &options.fetch(:gem, proc{}))
  self
end

.unless_installing_dependencies {|?| ... } ⇒ self

Yields if the top-level tasks that Rake’s running don’t include any of

  • deps:install

  • deps:install:user

  • gem:deps:install

  • gem:deps:install:user

that is, Rake’s not being run to install the inventory’s dependencies.

Yields:

  • (?)

Returns:

  • (self)


54
55
56
57
58
59
60
61
# File 'lib/inventory-rake-1.0/tasks.rb', line 54

def unless_installing_dependencies
  yield if (%w'deps:install
               deps:install:user
               gem:deps:install
               gem:deps:install:user' &
            Rake.application.top_level_tasks).empty?
  self
end