class Albacore::FpmAppSpec::Task
task implementation that can be execute
'd
Public Class Methods
new(opts)
click to toggle source
create a new task instance with the given opts
# File lib/albacore/fpm_app_spec.rb, line 101 def initialize opts raise ArgumentError, 'opts is nil' if opts.nil? @opts = opts end
Public Instance Methods
execute()
click to toggle source
this runs fpm and does some file copying
# File lib/albacore/fpm_app_spec.rb, line 107 def execute warn 'executing fpm app spec task, but there are no input files [fpm_app_spec::task#execute]' if @opts.get(:files).empty? fpm_package @opts.get(:out), @opts.get(:files) end
Private Instance Methods
fpm_package(out, appspecs)
click to toggle source
# File lib/albacore/fpm_app_spec.rb, line 115 def fpm_package out, appspecs pkg = File.join out, 'pkg' appspecs. map { |path| Albacore::AppSpec.load path }. map { |spec| [spec, Albacore::FpmAppSpec.new(spec, pkg)] }. each do |spec, fpm| targ = "#{out}/#{spec.title}/tmp-dest/" FileUtils.mkdir_p targ bin = File.join targ, "opt/#{spec.title}/bin" FileUtils.mkdir_p bin FileUtils.cp_r Dir.glob(File.join(fpm_rel(spec, spec.bin_folder), '*')), bin, verbose: true etc = File.join targ, "etc/#{spec.title}" FileUtils.mkdir_p etc, verbose: true # FileUtils.cp_r Dir.glob(File.join(fpm_rel(spec, spec.conf_folder), '*')), # etc, verbose: true spec.contents.each do |con| FileUtils.cp_r fpm_rel(spec, con), File.join(targ, con), verbose: true end run fpm.generate_flags_flat({ '-C' => targ }) end end
fpm_rel(spec, path)
click to toggle source
# File lib/albacore/fpm_app_spec.rb, line 144 def fpm_rel spec, path File.join spec.dir_path, path end
run(pars)
click to toggle source
# File lib/albacore/fpm_app_spec.rb, line 148 def run pars if @opts.get :bundle system 'bundle', %w|exec fpm|.concat(pars) else system 'fpm', pars end Albacore.publish :artifact, OpenStruct.new({ :location => "#{pkg}/#{fpm.filename}" }) end