Class: DeployRubygem::RakeDefaultTask

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/deploy_rubygem/rake/default.rb

Overview

RakeTask to use with DeployRubygem projects

Direct Known Subclasses

RakeCookbookTask, RakeCucumberTask, RakeTask

Instance Method Summary collapse

Constructor Details

#initialize(task_name, desc) {|_self| ... } ⇒ RakeDefaultTask

Define DeployRubygem Rake task

Yields:

  • (_self)

Yield Parameters:



13
14
15
16
17
18
# File 'lib/deploy_rubygem/rake/default.rb', line 13

def initialize(task_name, desc)
  @task_name = task_name
  @desc = desc
  yield self if block_given?
  define_tasks
end

Instance Method Details

#check_localObject

:nodoc:



69
70
71
72
# File 'lib/deploy_rubygem/rake/default.rb', line 69

def check_local # :nodoc:
  desc "@desc with #{__method__}"
  task check_local: %i[rubocop spec]
end

#chef_installObject

:nodoc:



41
42
43
44
45
46
47
# File 'lib/deploy_rubygem/rake/default.rb', line 41

def chef_install # :nodoc:
  desc "@desc with #{__method__}"
  task :install_chef_workstation do
    extend DeployRubygem
    install_chef_workstation
  end
end

#complianceObject

:nodoc:



74
75
76
77
78
79
# File 'lib/deploy_rubygem/rake/default.rb', line 74

def compliance # :nodoc:
  desc "@desc with #{__method__}"
  task compliance: :install_chef_workstation do
    system('inspec exec compliance')
  end
end

#cycleObject

:nodoc:



59
60
61
62
# File 'lib/deploy_rubygem/rake/default.rb', line 59

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

#defaultObject

:nodoc:



54
55
56
57
# File 'lib/deploy_rubygem/rake/default.rb', line 54

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

#define_tasksObject

:nodoc:



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/deploy_rubygem/rake/default.rb', line 28

def define_tasks # :nodoc:
  rspec_and_rubocop
  test_framework
  default
  cycle
  test_version
  check_local
  compliance
  develop
  push
  chef_install
end

#developObject

:nodoc:



81
82
83
84
# File 'lib/deploy_rubygem/rake/default.rb', line 81

def develop # :nodoc:
  desc "@desc with #{__method__}"
  task develop: %i[check_local clean push default]
end

#pushObject

:nodoc:



86
87
88
89
90
91
92
93
# File 'lib/deploy_rubygem/rake/default.rb', line 86

def push # :nodoc:
  desc "@desc with #{__method__}"
  task :push do
    system('git add .')
    system("git commit -m 'Rake pusing version #{VERSION}'")
    system('git push')
  end
end

#rspec_and_rubocopObject



20
21
22
23
24
25
26
# File 'lib/deploy_rubygem/rake/default.rb', line 20

def rspec_and_rubocop
  require 'rspec/core/rake_task'
  require 'rubocop/rake_task'

  RSpec::Core::RakeTask.new(:spec)
  RuboCop::RakeTask.new
end

#test_frameworkObject

:nodoc:



49
50
51
52
# File 'lib/deploy_rubygem/rake/default.rb', line 49

def test_framework # :nodoc:
  desc "@desc with #{__method__}"
  task test_framework: %i[clean check_local]
end

#test_versionObject

:nodoc:



64
65
66
67
# File 'lib/deploy_rubygem/rake/default.rb', line 64

def test_version # :nodoc:
  desc "@desc with #{__method__}"
  task test_version: %i[install compliance]
end