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.47 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.46 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.45 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.44 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.43 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.41 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.40 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.39 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.38 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.37 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.36 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.35 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.34 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.29 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.28 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.26 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.25 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.24 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.23 lib/deploy_rubygem/kitchen.rb
deploy_rubygem-0.60.22 lib/deploy_rubygem/kitchen.rb