Module: Opsk::Thorable
- Included in:
- Bump, Clean, Deploy, Dockerize, GenerateChef, GeneratePuppet, Module, Package
- Defined in:
- lib/opskeleton/thorable.rb
Class Method Summary collapse
Instance Method Summary collapse
- #artifact ⇒ Object
- #artifact_path ⇒ 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
28 29 30 |
# File 'lib/opskeleton/thorable.rb', line 28 def artifact "#{name}-#{.version}" end |
#artifact_path ⇒ Object
32 33 34 |
# File 'lib/opskeleton/thorable.rb', line 32 def artifact_path "pkg/#{name}-#{.version}" end |
#machines ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/opskeleton/thorable.rb', line 36 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
24 25 26 |
# File 'lib/opskeleton/thorable.rb', line 24 def name "#{.name}-sandbox" end |
#type_of ⇒ Object
18 19 20 21 22 |
# File 'lib/opskeleton/thorable.rb', line 18 def type_of return :puppet if .includes.include?('Puppetfile') return :chef if .includes.include?('Cheffile') raise Exception.new('no matching provisoner type found, make sure to include Cheffile or Pupppetfile in opsk.yaml') end |