Sha256: c2548dea179b1d9f160bb421fd15d6a72bc2fcc4c67efefe38e1b04f9ebf04f9

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 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
    end

    def create_pkg
	empty_directory('pkg')
    end

    def create_scripts
	empty_directory('scripts')
	%w(lookup.sh run.sh).each  do |s|
	  template("templates/scripts/#{s}", "scripts/#{s}")
	  chmod("scripts/#{s}", 0755)
	end

    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

1 entries across 1 versions & 1 rubygems

Version Path
opskeleton-0.1.1 lib/opskeleton/package.rb