Class: Jenkins::Plugin::Tools::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/jenkins/plugin/tools/manifest.rb

Defined Under Namespace

Classes: Writer

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Manifest

Returns a new instance of Manifest.



11
12
13
# File 'lib/jenkins/plugin/tools/manifest.rb', line 11

def initialize(spec)
  @spec = spec
end

Instance Method Details

#write_hpi(io) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/jenkins/plugin/tools/manifest.rb', line 15

def write_hpi(io)
  w = Writer.new(io)
  w.put "Manifest-Version", "1.0"
  w.put "Created-By", Jenkins::Plugin::VERSION
  w.put "Build-Ruby-Platform", RUBY_PLATFORM
  w.put "Build-Ruby-Version", RUBY_VERSION

  w.put "Group-Id", "org.jenkins-ci.plugins"
  w.put "Short-Name", @spec.name
  w.put "Long-Name", @spec.name # TODO: better name
  w.put "Url", "http://jenkins-ci.org/" # TODO: better value

  w.put "Plugin-Class", "ruby.RubyPlugin"
  w.put "Plugin-Version", @spec.version
  w.put "Jenkins-Version", "1.426"

  w.put "Plugin-Dependencies", @spec.dependencies.map{|k,v| "#{k}:#{v}"}.join(",")
end

#write_hpl(io, loadpath) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/jenkins/plugin/tools/manifest.rb', line 34

def write_hpl(io, loadpath)
  write_hpi(io)

  w = Writer.new(io)
  w.put "Load-Path", loadpath.to_a.join(':')
  w.put "Lib-Path", "#{Dir.pwd}/lib/"
  w.put "Models-Path", "#{Dir.pwd}/models"
  # Stapler expects view erb/haml scripts to be in the JVM ClassPath
  w.put "Class-Path", "#{Dir.pwd}/views" if File.exists?("#{Dir.pwd}/views")
  # Directory for static images, javascript, css, etc. of this plugin.
  # The static resources are mapped under #CONTEXTPATH/plugin/SHORTNAME/
  w.put "Resource-Path", "#{Dir.pwd}/static"
end