Skip to content

Instantly share code, notes, and snippets.

@Sharpie
Last active January 2, 2016 10:28
Show Gist options
  • Save Sharpie/8289867 to your computer and use it in GitHub Desktop.
Save Sharpie/8289867 to your computer and use it in GitHub Desktop.
Use fpm-cookery to build packages with UTF-8 descriptions
source 'https://rubygems.org'
gem 'fpm'
gem 'fpm-cookery'
task :default => :build
directory 'bin'
file 'bin/fpm-cook' do
Kernel.system 'bundle', 'install', '--binstubs', '--path=vendor'
end
task :build => 'bin/fpm-cook' do
Kernel.system 'bin/fpm-cook', 'package', '-t', 'deb', 'recipe.rb'
Kernel.system 'bin/fpm-cook', 'package', '-t', 'rpm', 'recipe.rb'
puts 'Packages built. Results are in the pkg directory'
end
# encoding: UTF-8
class MoreCowbell < FPM::Cookery::Recipe
source '', :with => :noop
name 'more-cowbell'
license 'MIT'
version '1.0.0'
revision 0
arch 'noarch'
description 'Apologies to Blue Öyster Cult.'
def build
File.open(workdir('more_cowbell'), 'w') do |f|
f.write <<-EOF
#!/bin/bash
echo "This node NEEDS more cowbell!"
EOF
end
`chmod +x #{workdir('more_cowbell')}`
end
def install
destdir('bin').install workdir('more_cowbell')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment