Class: Halite::RakeHelper

Inherits:
HelperBase show all
Defined in:
lib/halite/rake_helper.rb

Overview

Helper class to install Halite rake tasks.

Examples:

Rakefile

require 'halite/rake_helper'
Halite::RakeHelper.install

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Halite::HelperBase

Instance Method Details

#install

This method returns an undefined value.

Install all Rake tasks.

Since:

  • 1.0.0



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/halite/rake_helper.rb', line 37

def install
  extend Rake::DSL
  # Core Halite tasks
  unless options[:no_gem]
    desc "Convert #{gemspec.name}-#{gemspec.version} to a cookbook in the pkg directory"
    task 'chef:build' do
      build_cookbook
    end

    desc "Push #{gemspec.name}-#{gemspec.version} to Supermarket"
    task 'chef:release' => ['chef:build'] do
      release_cookbook(pkg_path)
    end

    # Patch the core gem tasks to run ours too
    task 'build' => ['chef:build']
    task 'release' => ['chef:release']
  else
    desc "Push #{gem_name} to Supermarket"
    task 'chef:release' do
      release_cookbook(base)
    end
  end

  # Foodcritic doesn't have a config file, so just always try to add it.
  unless options[:no_foodcritic]
    install_foodcritic
  end

  # If a .kitchen.yml exists, install the Test Kitchen tasks.
  unless options[:no_kitchen] || !File.exist?(File.join(@base, '.kitchen.yml'))
    install_kitchen
  end
end