Class: DeployRubygem::RakeCookbookTask

Inherits:
RakeDefaultTask show all
Includes:
ChefCookbookTask, InspecCookbookTask, KnifeCookbookTask
Defined in:
lib/deploy_rubygem/rake/cookbook.rb

Overview

RakeTask to use with DeployRubygem projects

Instance Method Summary collapse

Methods included from KnifeCookbookTask

#build_cookbook, #cookstyle

Methods included from InspecCookbookTask

#compliance

Methods included from ChefCookbookTask

#chef_client, #install_cookbook, #install_policy, #release_policy, #report

Methods inherited from RakeDefaultTask

#check_local, #chef_install, #compliance, #push, #rspec_and_rubocop, #test_version

Constructor Details

#initialize(task_name = 'cookbook', desc = 'Run DeployRubygem task') ⇒ RakeCookbookTask

Returns a new instance of RakeCookbookTask.



18
19
20
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 18

def initialize(task_name = 'cookbook', desc = 'Run DeployRubygem task')
  super
end

Instance Method Details

#clean_cookbookObject

:nodoc:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 66

def clean_cookbook # :nodoc:
  desc "@desc with #{__method__}"
  task clean_cookbook: %i[clean] do
    system('kitchen destroy base')
    FileUtils.rm_f('Policyfile.lock.json')
    FileUtils.rm_f('Gemfile.lock')
    FileUtils.rm_f('.rspec_status')
    profiles_folder = File.join(%w[compliance profiles])
    Dir.children(profiles_folder).each do |sub_folder|
      vendor_folder = File.join(profiles_folder, sub_folder, 'vendor')
      inspec_file = File.join(profiles_folder, sub_folder, 'inspec.lock')
      FileUtils.rm_rf(vendor_folder)
      FileUtils.rm_f(inspec_file)
    end
  end
end

#cycleObject

:nodoc:



46
47
48
49
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 46

def cycle # :nodoc:
  desc "@desc with #{__method__}"
  task cycle: %i[test_framework release_policy test_version]
end

#defaultObject

:nodoc:



41
42
43
44
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 41

def default # :nodoc:
  desc "@desc with #{__method__}"
  task default: %i[test_framework build install:local]
end

#define_tasksObject

:nodoc:



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 22

def define_tasks # :nodoc:
  super
  test_cookbook
  release_cookbook
  cookstyle
  build_cookbook
  install_policy
  release_policy
  install_cookbook
  report
  clean_cookbook
  chef_client
end

#developObject

:nodoc:



51
52
53
54
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 51

def develop # :nodoc:
  desc "@desc with #{__method__}"
  task develop: %i[build_cookbook spec push install release_policy report]
end

#release_cookbookObject

:nodoc:



61
62
63
64
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 61

def release_cookbook # :nodoc:
  desc "@desc with #{__method__}"
  task release_cookbook: %i[clean_cookbook release_policy release]
end

#test_cookbookObject

:nodoc:



56
57
58
59
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 56

def test_cookbook # :nodoc:
  desc "@desc with #{__method__}"
  task test_cookbook: %i[build_cookbook spec push install release_policy report]
end

#test_frameworkObject

:nodoc:



36
37
38
39
# File 'lib/deploy_rubygem/rake/cookbook.rb', line 36

def test_framework # :nodoc:
  desc "@desc with #{__method__}"
  task test_framework: %i[build_cookbook spec clean_cookbook]
end