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



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

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



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

def distcleanfiles
  @distcleanfiles
end

.inventoryInventory

Returns The default inventory to use for tasks.

Returns:

  • (Inventory)

    The default inventory to use for tasks



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

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



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

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)


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

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)


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

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