Sha256: cc7826c3318c70fad44d01150c3d4c7b03acdec2d5fa87f099566a2763299d98

Contents?: true

Size: 1.12 KB

Versions: 18

Compression:

Stored size: 1.12 KB

Contents

module Opsk 
  module Thorable
    def self.included klass
	def klass.source_root
	  # during dev time
	  if(File.dirname(__FILE__) == './bin')
	    File.dirname('.')
	  else 
	    "#{File.dirname(__FILE__)}/../../"
	  end
	end
    end

    def meta 
	OpenStruct.new(YAML.load_file('opsk.yaml'))
    end

    def type_of
	return :puppet if meta.includes.include?('Puppetfile')
	return :chef if meta.includes.include?('Cheffile')
	raise Exception.new('no matching provisoner type found, make sure to include Cheffile or Pupppetfile in opsk.yaml')
    end

    def name 
	"#{meta.name}-sandbox"
    end

    def artifact
	"#{name}-#{meta.version}"
    end

    def artifact_path
	"pkg/#{name}-#{meta.version}"
    end

    def machines
	machines = %x{vagrant status --machine-readable 2>&1}	
	unless $? == 0
        $stderr.puts "failed to parse vagrant machines #{machines}"
	  exit 1 
	end
	machines.split('\n').collect {|line| line.split(',')[1]}.find_all{|v| v}
    end

    def check_root
	unless File.exist?("#{Dir.pwd}/opsk.yaml")
	  say('Please run from the root folder of an opskeleton project',:red) 
	  exit(1)
	end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
opskeleton-0.9.8 lib/opskeleton/thorable.rb
opskeleton-0.9.7 lib/opskeleton/thorable.rb
opskeleton-0.9.6 lib/opskeleton/thorable.rb
opskeleton-0.9.5 lib/opskeleton/thorable.rb
opskeleton-0.9.4 lib/opskeleton/thorable.rb
opskeleton-0.9.3 lib/opskeleton/thorable.rb
opskeleton-0.9.2 lib/opskeleton/thorable.rb
opskeleton-0.9.1 lib/opskeleton/thorable.rb
opskeleton-0.9.0 lib/opskeleton/thorable.rb
opskeleton-0.8.12 lib/opskeleton/thorable.rb
opskeleton-0.8.11 lib/opskeleton/thorable.rb
opskeleton-0.8.10 lib/opskeleton/thorable.rb
opskeleton-0.8.9 lib/opskeleton/thorable.rb
opskeleton-0.8.8 lib/opskeleton/thorable.rb
opskeleton-0.8.7 lib/opskeleton/thorable.rb
opskeleton-0.8.6 lib/opskeleton/thorable.rb
opskeleton-0.8.5 lib/opskeleton/thorable.rb
opskeleton-0.8.4 lib/opskeleton/thorable.rb