Sha256: e4d0fc15df5966174787d6f985e15493e54b872275955694156d9b759df1a7fd

Contents?: true

Size: 996 Bytes

Versions: 34

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true

# DeployRubygem - deploy a gem using rake
# Containing a class
module DeployRubygem
  # Using Kitchen to deploy and manage Kitchen
  class Kitchen
    attr_reader :kitchen_name, :cookbook

    def initialize(kitchen_name, cookbook)
      @kitchen_name = kitchen_name
      @cookbook = cookbook
    end

    def check_file
      ::File.join("#{kitchen_name}_check.log")
    end

    def converge
      system("kitchen converge #{kitchen_name}")
    end

    def destroy
      system("kitchen destroy #{kitchen_name}")
    end

    def ip
      switch_to_cookbook
      system("kitchen exec #{kitchen_name} -c 'hostname -I'")
    end

    def verify(showing: true)
      cookbook.switch_to_cookbook
      if showing
        system("kitchen verify #{kitchen_name}")
      else
        system("kitchen verify #{kitchen_name} > #{check_file}")
      end
    end

    def target
      verify(showing: false)
      system("grep -n Target #{check_file}")
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
deploy_rubygem-0.60.21 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.20 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.19 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.18 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.17 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.16 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.15 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.14 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.13 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.12 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.11 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.10 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.5 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.1.0 lib/deploy_rubygem/kitchen.rb