Class: Revamp::Persister::Rpm

Inherits:
Object
  • Object
show all
Defined in:
lib/revamp/persister/rpm.rb

Overview

A main RPM persister

Defined Under Namespace

Modules: BuilderInternals Classes: Builder, CommandLine

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRpm

Returns a new instance of Rpm.



10
11
12
# File 'lib/revamp/persister/rpm.rb', line 10

def initialize
  @options = nil
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



14
15
16
# File 'lib/revamp/persister/rpm.rb', line 14

def options
  @options
end

Instance Method Details

#persist(model) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/revamp/persister/rpm.rb', line 16

def persist(model)
  dir = File.expand_path('~')
  workdir = Pathname.new(dir).join('rpmbuild')
  @builder = Builder.new(model, workdir, options)
  @builder.make_structure
  @builder.write_spec
  @builder.write_sources
  target = @builder.produce
  @builder.cleanup if options[:cleanup]
  target
end

#persisted?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/revamp/persister/rpm.rb', line 28

def persisted?
  @builder.nil? ? false : @builder.produced?
end