bernd / fpm-cookery

A tool for building software packages with fpm.
Other
460 stars 88 forks source link

Added support for DirRecipe and Directory Handler #147

Closed boc-tothefuture closed 8 years ago

boc-tothefuture commented 8 years ago

This PR provides support for easily taking a directory tree and turning it into a package.

The PR includes a new recipe type called DirRecipe which implements an empty build and an install phase that copies files over from the build dir. It also deletes cookies, otherwise they end up in the FPM artifact.

The PR also includes a new handler of type 'directory' that specifies the part of the directory tree to use as source.

I use this setup often for packaging and versioning things like scripts or other elements that need to be versioned and packaged. Here is an example use.

class Scripts < FPM::Cookery::DirRecipe
  homepage 'https://www.example.com/'
  source File.join('/home/vagrant/build/stage/'), :with => :directory

  name 'scripts'
  version '1:1.0.0'
  revision '0'
  arch 'all'
  vendor 'me'
  maintainer 'Foo Bar <foo@bar.com>'
  description 'Some scripts'

  def build
    FileUtils.chmod("u=rw,go=r", Dir.glob(File.join(builddir,'/path/to/place/scripts/*')))
  end
end

If accepted, I will update the docs/wiki.

bernd commented 8 years ago

Thank you! :smiley:

beddari commented 8 years ago

Nice, thanks!