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
- #artifact ⇒ Object
- #artifact_path ⇒ Object
- #check_root ⇒ Object
- #machines ⇒ Object
- #meta ⇒ Object
- #name ⇒ Object
- #type_of ⇒ Object
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
#artifact ⇒ Object
27 28 29 |
# File 'lib/opskeleton/thorable.rb', line 27 def artifact "#{name}-#{.version}" end |
#artifact_path ⇒ Object
31 32 33 |
# File 'lib/opskeleton/thorable.rb', line 31 def artifact_path "pkg/#{name}-#{.version}" end |
#check_root ⇒ Object
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 |
#machines ⇒ Object
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 |
#meta ⇒ Object
14 15 16 |
# File 'lib/opskeleton/thorable.rb', line 14 def OpenStruct.new(YAML.load_file('opsk.yaml')) end |
#name ⇒ Object
23 24 25 |
# File 'lib/opskeleton/thorable.rb', line 23 def name "#{.name}-sandbox" end |
#type_of ⇒ Object
18 19 20 21 |
# File 'lib/opskeleton/thorable.rb', line 18 def type_of return :puppet if .includes.include?('Puppetfile') raise Exception.new('no matching provisoner type found, make sure to include Pupppetfile in opsk.yaml') end |