Module: Opsk::Thorable

Included in:
Analyze, Bump, Clean, Commit, DeployBintray, DeployS3, DeployScp, GeneratePuppet, Module, Package, Push, Uncommited, Update
Defined in:
lib/opskeleton/thorable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/opskeleton/thorable.rb', line 3

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

Instance Method Details

#artifactObject



27
28
29
# File 'lib/opskeleton/thorable.rb', line 27

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

#artifact_pathObject



31
32
33
# File 'lib/opskeleton/thorable.rb', line 31

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

#check_rootObject



44
45
46
47
48
49
# File 'lib/opskeleton/thorable.rb', line 44

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

#machinesObject



35
36
37
38
39
40
41
42
# File 'lib/opskeleton/thorable.rb', line 35

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

#metaObject



14
15
16
# File 'lib/opskeleton/thorable.rb', line 14

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

#nameObject



23
24
25
# File 'lib/opskeleton/thorable.rb', line 23

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

#type_ofObject

Raises:

  • (Exception)


18
19
20
21
# File 'lib/opskeleton/thorable.rb', line 18

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