Class: Opsk::Package
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Opsk::Package
- Includes:
- Thorable, Thor::Actions
- Defined in:
- lib/opskeleton/package.rb
Instance Method Summary collapse
- #artifact ⇒ Object
- #artifact_path ⇒ Object
- #create_build ⇒ Object
- #create_pkg ⇒ Object
- #meta ⇒ Object
- #name ⇒ Object
- #package ⇒ Object
Methods included from Thorable
Instance Method Details
#artifact ⇒ Object
13 14 15 |
# File 'lib/opskeleton/package.rb', line 13 def artifact "#{name}-#{meta.version}" end |
#artifact_path ⇒ Object
17 18 19 |
# File 'lib/opskeleton/package.rb', line 17 def artifact_path "pkg/#{name}-#{meta.version}" end |
#create_build ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/opskeleton/package.rb', line 21 def create_build empty_directory(artifact_path) path = Dir.getwd directory path, artifact_path, :verbose => false empty_directory("#{artifact_path}/scripts") %w(lookup.rb run.sh).each do |s| template("templates/scripts/#{s}", "#{artifact_path}/scripts/#{s}") chmod("#{artifact_path}/scripts/#{s}", 0755) end unless(File.exists?("#{artifact_path}/manifests/site.pp")) template('templates/puppet/site.erb', "#{artifact_path}/manifests/site.pp") end end |
#create_pkg ⇒ Object
35 36 37 |
# File 'lib/opskeleton/package.rb', line 35 def create_pkg empty_directory('pkg') end |
#meta ⇒ Object
5 6 7 |
# File 'lib/opskeleton/package.rb', line 5 def OpenStruct.new(YAML.load_file('opsk.yml')) end |
#name ⇒ Object
9 10 11 |
# File 'lib/opskeleton/package.rb', line 9 def name File.basename(Dir.getwd) end |
#package ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/opskeleton/package.rb', line 39 def package ignored = IO.readlines('.gitignore').map(&:chomp) ignored.delete('modules') excludes = ignored.map{|f| "'#{f}'"}.join(" --exclude=") << ' --exclude-backups --exclude-vcs --exclude=pkg' tar = "#{artifact}.tar.gz" input = artifact inside('pkg') do run("tar --exclude=#{excludes} -czf #{tar} #{input} >> /dev/null" , :verbose => false) end end |