Sha256: 58e53e9e7bf1f888915966121c3710fe95e787dba24381f1f61f76c9b8542f58

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

module  Opsk
  class Package < Thor::Group
    include Thorable, Thor::Actions

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

    def name 
     	File.basename(Dir.getwd)
    end

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

    def create_build
	empty_directory(artifact)
	path = Dir.getwd
	directory path , artifact
	empty_directory("#{artifact}/scripts")
	%w(lookup.sh run.sh).each  do |s|
	  template("templates/scripts/#{s}", "#{artifact}/scripts/#{s}")
	  chmod("#{artifact}/scripts/#{s}", 0755)
	end
	template('templates/puppet/site.erb', "#{artifact}/manifests/site.pp")
    end

    def create_pkg
	empty_directory('pkg')
    end

    def package
	ignored = IO.readlines('.gitignore').map(&:chomp)
	ignored.delete('modules')
	excludes = ignored.map{|f| "'#{f}'"}.join(" --exclude=") << ' --exclude-backups --exclude-vcs --exclude=pkg'
	run("tar --exclude=#{excludes} -czf pkg/#{artifact}.tar.gz #{artifact} > /dev/null", :verbose => false)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opskeleton-0.1.4 lib/opskeleton/package.rb
opskeleton-0.1.3 lib/opskeleton/package.rb