Class: VersionCookbook::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
DaptivChefCI::RakeTaskHelpers, Rake::DSL
Defined in:
lib/daptiv-chef-ci/version_cookbook_task.rb

Overview

Example usage, versions a cookbook to 1.0.x for usage in CI

VersionCookbook::RakeTask.new ‘version_cookbook’ do |t|

t.bump = false
t.version = "1.0.#{ENV['BUILD_NUMBER']}"
t.version_file = 'version.txt'

end

This class lets you define Rake tasks to manage a cookbook version.txt file

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DaptivChefCI::RakeTaskHelpers

#execute, #exit_on_failure, #exit_on_failure=

Constructor Details

#initialize(name = 'version_cookbook', desc = 'Version cookbook task') {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Parameters:

  • name (String) (defaults to: 'version_cookbook')

    The task name.

  • desc (String) (defaults to: 'Version cookbook task')

    Description of the task.

Yields:

  • (_self)

Yield Parameters:



28
29
30
31
32
33
34
35
# File 'lib/daptiv-chef-ci/version_cookbook_task.rb', line 28

def initialize(name = 'version_cookbook', desc = 'Version cookbook task')
  @logger = Log4r::Logger.new('daptiv_chef_ci::version_cookbook_task')
  @name, @desc = name, desc
  @version_file = File.join(Dir.pwd, 'version.txt')
  @bump = true
  yield self if block_given?
  define_task
end

Instance Attribute Details

#bumpObject

Returns the value of attribute bump.



22
23
24
# File 'lib/daptiv-chef-ci/version_cookbook_task.rb', line 22

def bump
  @bump
end

#versionObject

Returns the value of attribute version.



23
24
25
# File 'lib/daptiv-chef-ci/version_cookbook_task.rb', line 23

def version
  @version
end

#version_fileObject

Returns the value of attribute version_file.



24
25
26
# File 'lib/daptiv-chef-ci/version_cookbook_task.rb', line 24

def version_file
  @version_file
end