Class: FPM::Fry::Plugin::EditStaging::DSL

Inherits:
Struct
  • Object
show all
Defined in:
lib/fpm/fry/plugin/edit_staging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#builderObject

Returns the value of attribute builder

Returns:

  • (Object)

    the current value of builder



37
38
39
# File 'lib/fpm/fry/plugin/edit_staging.rb', line 37

def builder
  @builder
end

Instance Method Details

#add_file(path, content, options = {}) ⇒ Object

Parameters:

  • path (String)
  • content (IO, String)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fpm/fry/plugin/edit_staging.rb', line 41

def add_file(path, content, options = {})
  if content.kind_of?(IO) || content.kind_of?(StringIO)
    io = content
  elsif content.kind_of? String
    io = StringIO.new(content)
  else
    raise ArgumentError.new("File content must be a String or IO, got #{content.inspect}")
  end
  options = options.dup
  options[:chmod] = convert_chmod(options[:chmod]) if options[:chmod]
  options.freeze
  io.rewind if io.respond_to? :rewind
  builder.output_hooks << AddFile.new(path, io, options)
end

#ln_s(src, dest) ⇒ Object



56
57
58
# File 'lib/fpm/fry/plugin/edit_staging.rb', line 56

def ln_s(src, dest)
  builder.output_hooks << LnS.new(src,dest)
end