buildrizpack 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +90 -15
- data/Rakefile +1 -1
- data/buildrizpack.gemspec +13 -15
- data/lib/buildrizpack/package.rb +43 -14
- data/lib/buildrizpack/package.rb~ +43 -14
- data/rakelib/checks.rake +1 -1
- data/{spec/spec_helpers.rb~ → rakelib/checks.rake~} +11 -14
- data/rakelib/doc.rake +24 -102
- data/rakelib/doc.rake~ +85 -92
- data/rakelib/package.rake +0 -15
- data/rakelib/package.rake~ +0 -12
- data/rakelib/rspec.rake +1 -1
- data/rakelib/rspec.rake~ +1 -1
- data/spec/buildrizpack/package_spec.rb +30 -2
- data/spec/buildrizpack/package_spec.rb~ +33 -4
- metadata +32 -110
- data.tar.gz.sig +0 -0
- data/spec/buildrizpack/buildfile.example_1~ +0 -7
- data/spec/buildrizpack/buildfile.example_2~ +0 -8
- data/spec/buildrizpack/buildfile.example_3~ +0 -18
- data/spec/buildrizpack/example_1/buildfile +0 -7
- data/spec/buildrizpack/example_2/buildfile +0 -25
- data/spec/buildrizpack/example_3/buildfile +0 -18
- metadata.gz.sig +0 -3
data/README.rdoc
CHANGED
@@ -12,49 +12,121 @@ This plugin provides a one-stop solution for packaging, distributing and deployi
|
|
12
12
|
|
13
13
|
gem install BuildrIzPack
|
14
14
|
|
15
|
-
|
15
|
+
It has been tested using jruby-1.6.5, ruby-1.8.7-p358 and ruby-1.9.3-p125.
|
16
|
+
Running "rake spec" with rubies 1.8.7 and 1.9.2 failed with the message "Failed to download org.jruby:jruby-complete:jar:1.5.4,". This problem should be fixed once buildr 1.4.7 will be out.
|
16
17
|
|
17
|
-
|
18
|
+
== Usage
|
18
19
|
|
19
20
|
1. Include one or more files and let the BuildrIzPack build a simple installer, where you may choose the installation path. Default langues is 'eng'. The locales accepts an array of locale-identifiers (3-letters ISO code)
|
20
|
-
|
21
21
|
2. Specifiy a IzPack installer-XML via the the input methods
|
22
22
|
3. Specify the XML-content of the various elements of the IzPack installation
|
23
23
|
|
24
|
-
=== Example 1
|
24
|
+
=== Example 1: Simple, defaults
|
25
25
|
|
26
26
|
include one or more files and let the BuildrIzPack build a simple installer
|
27
27
|
|
28
28
|
require 'buildrizpack'
|
29
|
-
Buildr::write "
|
30
|
-
define '
|
29
|
+
Buildr::write "example_1/src/main/java/Hello.java", "public class Hello {}"
|
30
|
+
define 'example_1', :version => '0.9.8' do
|
31
31
|
package(:jar)
|
32
32
|
package(:izpack).locales = ['eng', 'fra', 'deu']
|
33
33
|
package(:izpack).include(package(:jar))
|
34
34
|
end
|
35
35
|
|
36
|
-
=== Example 2
|
36
|
+
=== Example 2: Using a IzPack installer-XML
|
37
37
|
|
38
38
|
Specifiy a IzPack installer-XML via the the input methods
|
39
39
|
|
40
40
|
require 'buildrizpack'
|
41
|
-
define '
|
41
|
+
define 'example_2', :version => '0.9.8' do
|
42
|
+
myInstXml = path_to(:target, 'myInstaller.xml')
|
43
|
+
xm = Builder::XmlMarkup.new(:target=>File.open(myInstXml, 'w+'), :indent => 2)
|
44
|
+
xm.instruct!
|
45
|
+
xm.installation('version'=>'1.0') {
|
46
|
+
xm.tag!('info') { xm.appversion(project.version); xm.appname(project.name) }
|
47
|
+
xm.guiprefs('width' => '400', 'height' => '400', 'resizable' => 'no')
|
48
|
+
xm.panels { |x| xm.panel('classname' => 'InstallPanel') }
|
49
|
+
xm.locale { |x| xm.langpack('iso3'=>'eng') }
|
50
|
+
xm.packs {
|
51
|
+
xm.pack('name' => 'main', 'required' => 'yes') {
|
52
|
+
xm.description("my first and only pack for #{project.name}")
|
53
|
+
xm.file('src'=> myInstXml, 'targetdir' =>'$INSTALL_PATH')
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
xm.target!().close
|
42
58
|
package(:jar)
|
43
59
|
# It is you responsability to specify correctly all dependencies!!
|
44
|
-
package(:izpack).input =
|
60
|
+
package(:izpack).input = myInstXml
|
45
61
|
package(:izpack)
|
46
62
|
end
|
47
63
|
|
48
|
-
=== Example 3
|
49
64
|
|
50
|
-
|
65
|
+
=== Example 3: A more realistic example. Specifies installer.xml, dependencies and integration checks
|
66
|
+
|
67
|
+
This example is closer to what you will probably need for a full blown application.
|
51
68
|
|
52
69
|
require 'buildrizpack'
|
53
|
-
|
54
|
-
|
70
|
+
define 'example_3', :version => '0.9.8' do
|
71
|
+
myJavaFile = "example_3/src/main/java/Hello.java"
|
72
|
+
myFirstTextFile = path_to(:target)+"/1_5.txt"
|
73
|
+
mySecondTxtFile = path_to(:target)+"/3_7.txt"
|
74
|
+
myInstXml = path_to(:target, 'myInstaller.xml')
|
75
|
+
myInstaller = _('deploy/myInstaller.jar')
|
76
|
+
Buildr::write myJavaFile, "public class Hello {}" if !File.exists?(myJavaFile)
|
55
77
|
package(:jar)
|
56
|
-
|
57
|
-
package(:izpack)
|
78
|
+
|
79
|
+
# :file attribute must appear on the first call to package(:izpack) or it will have no effet
|
80
|
+
package(:izpack, :file => myInstaller).locales = ['eng', 'fra', 'deu']
|
81
|
+
|
82
|
+
# we create file task for each file to be packed
|
83
|
+
file(myFirstTextFile) do Buildr.write(myFirstTextFile, "This is file 1_5.txt") end
|
84
|
+
file(mySecondTxtFile) do Buildr.write(mySecondTxtFile, "This is file 3_7.txt") end
|
85
|
+
|
86
|
+
# Use the BuildrIzPack::Pack to pack some files
|
87
|
+
pack = BuildrIzPack::Pack.new('myPackName', 'myPack description')
|
88
|
+
pack.addFile(myInstXml)
|
89
|
+
pack.addFile(package(:jar).to_s)
|
90
|
+
pack.addFile(myFirstTextFile)
|
91
|
+
pack.addFile(mySecondTxtFile, "$INSTALL_PATH/another_name")
|
92
|
+
|
93
|
+
# Create a custom installer.xml as there are just too many options to find a simple,
|
94
|
+
# less complex, easy to use abstraction. And XmlMarkup is easy to read & create!
|
95
|
+
file(myInstXml => [package(:jar).to_s, myFirstTextFile, mySecondTxtFile]) do
|
96
|
+
xm = Builder::XmlMarkup.new(:target=>File.open(myInstXml, 'w+'), :indent => 2)
|
97
|
+
xm.instruct!
|
98
|
+
xm.installation('version'=>'1.0') {
|
99
|
+
xm.tag!('info') { xm.appversion(project.version); xm.appname(project.name) }
|
100
|
+
xm.guiprefs('width' => '400', 'height' => '400', 'resizable' => 'no')
|
101
|
+
xm.panels { |x| xm.panel('classname' => 'InstallPanel') }
|
102
|
+
xm.locale { |x| xm.langpack('iso3'=>'eng') }
|
103
|
+
xm.packs {
|
104
|
+
pack.emitIzPackXML(xm)
|
105
|
+
}
|
106
|
+
}
|
107
|
+
xm.target!().close
|
108
|
+
end
|
109
|
+
|
110
|
+
# Specify an explizit dependency to the installer.xml file
|
111
|
+
package(:izpack).input = myInstXml
|
112
|
+
file(package(:izpack).to_s => myInstXml)
|
113
|
+
package(:izpack)
|
114
|
+
|
115
|
+
# It is always a good idea to check whether your buildr project had the desired effect.
|
116
|
+
# Therefore I love to add some integration tests like
|
117
|
+
check package(:izpack), 'checks, whether IzPack installer works correctly' do
|
118
|
+
File.should exist(myJavaFile)
|
119
|
+
File.should exist(myInstXml)
|
120
|
+
File.should exist(myInstaller)
|
121
|
+
content = IO.readlines(myInstXml).join('')
|
122
|
+
content.should match(/installation/)
|
123
|
+
content.should match(/\$INSTALL_PATH\/another_name/)
|
124
|
+
content.should match(/pack name="myPackName"/)
|
125
|
+
content.should match(/<description>myPack description<\/description>/)
|
126
|
+
content.should match(/target="\$INSTALL_PATH\/plugins\/1_5.txt"/)
|
127
|
+
content.should match(/target="\$INSTALL_PATH\/another_name"/)
|
128
|
+
end
|
129
|
+
|
58
130
|
end
|
59
131
|
|
60
132
|
== Living On the Edge
|
@@ -73,8 +145,11 @@ which changes might have broken your build. To run all the test cases:
|
|
73
145
|
|
74
146
|
rake spec
|
75
147
|
|
148
|
+
(Works only with ruby-1.8.7 not with jruby or ruby 1.9)
|
76
149
|
If you have any questions or suggestions for improvements you may reach me via E-Mail to mail:niklaus.giger@member.fsf.org
|
77
150
|
|
151
|
+
A continuos integration setup can be found under http://ngiger.dyndns.org/jenkins/job/buildrizpack/.
|
152
|
+
|
78
153
|
|
79
154
|
== License
|
80
155
|
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# the License.
|
15
15
|
|
16
16
|
# To work-around a bug with gemcutter: http://stackoverflow.com/questions/4932881/gemcutter-rake-build-now-throws-undefined-method-write-for-syckemitter
|
17
|
-
require 'psych' unless RUBY_PLATFORM[/java/]
|
17
|
+
require 'psych' unless RUBY_PLATFORM[/java/] or /1.8.\d/.match(RUBY_VERSION)
|
18
18
|
|
19
19
|
# We need JAVA_HOME for most things (setup, spec, etc).
|
20
20
|
unless ENV['JAVA_HOME']
|
data/buildrizpack.gemspec
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
Gem::Specification.new do |spec|
|
18
18
|
spec.name = 'buildrizpack'
|
19
|
-
spec.version = '0.
|
19
|
+
spec.version = '0.2'
|
20
20
|
spec.author = 'Niklaus Giger'
|
21
21
|
spec.email = "niklaus.giger@member.fsf.org"
|
22
22
|
spec.homepage = "http://buildr.apache.org/"
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.description = <<-TEXT
|
25
25
|
A buildr plugin contributing a new packaging method to package your project as a IzPack installer.
|
26
26
|
TEXT
|
27
|
-
|
27
|
+
spec.rubyforge_project = 'buildrizpack'
|
28
28
|
# Rakefile needs to create spec for both platforms (ruby and java), using the
|
29
29
|
# $platform global variable. In all other cases, we figure it out from RUBY_PLATFORM.
|
30
30
|
spec.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
|
@@ -42,12 +42,13 @@ TEXT
|
|
42
42
|
spec.add_dependency 'net-ssh', '2.0.23'
|
43
43
|
spec.add_dependency 'net-sftp', '2.0.4'
|
44
44
|
spec.add_dependency 'rubyzip', '0.9.4'
|
45
|
-
spec.add_dependency 'highline', '1.
|
45
|
+
spec.add_dependency 'highline', '1.5.1'
|
46
46
|
spec.add_dependency 'json_pure', '1.4.3'
|
47
47
|
spec.add_dependency 'rubyforge', '2.0.3'
|
48
48
|
spec.add_dependency 'hoe', '2.3.3'
|
49
|
-
spec.add_dependency 'rjb', '1.3.
|
50
|
-
spec.add_dependency '
|
49
|
+
spec.add_dependency 'rjb', '1.3.3' if spec.platform.to_s == 'ruby'
|
50
|
+
spec.add_dependency 'rjb', '1.3.2' if spec.platform.to_s == 'x86-mswin32'
|
51
|
+
spec.add_dependency 'atoulme-Antwrap', '0.7.1'
|
51
52
|
spec.add_dependency 'diff-lcs', '1.1.2'
|
52
53
|
spec.add_dependency 'rspec-expectations', '2.1.0'
|
53
54
|
spec.add_dependency 'rspec-mocks', '2.1.0'
|
@@ -57,24 +58,21 @@ TEXT
|
|
57
58
|
spec.add_dependency 'minitar', '0.5.3'
|
58
59
|
spec.add_dependency 'jruby-openssl', '>= 0.7' if spec.platform.to_s == 'java'
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
spec.add_development_dependency 'jekyll', '0.11.0'
|
63
|
-
spec.add_development_dependency 'RedCloth', '4.2.9'
|
64
|
-
spec.add_development_dependency 'jekylltask', '1.1.0'
|
65
|
-
spec.add_development_dependency 'rdoc', '3.8'
|
66
|
-
spec.add_development_dependency 'rcov', '0.9.9'
|
67
|
-
end
|
61
|
+
spec.add_development_dependency 'rdoc', '>=3.8'
|
62
|
+
spec.add_development_dependency 'rcov', '0.9.9'
|
68
63
|
|
69
64
|
spec.add_development_dependency 'ci_reporter', '1.6.3'
|
70
|
-
spec.add_development_dependency '
|
65
|
+
spec.add_development_dependency 'sdoc'
|
66
|
+
# spec.add_development_dependency 'psych', '>=1.3.0' if spec.platform.to_s != 'java' and !/1.8.\d/.match(RUBY_VERSION)
|
67
|
+
# spec.add_development_dependency 'debugger'
|
71
68
|
spec.add_development_dependency 'readline-ffi'
|
69
|
+
spec.add_development_dependency 'pygmentize'
|
72
70
|
|
73
71
|
spec.add_development_dependency 'bundler'
|
74
72
|
spec.add_development_dependency 'win32console' if spec.platform.to_s == 'x86-mswin32'
|
75
73
|
spec.add_development_dependency 'rubyforge'
|
76
74
|
|
77
75
|
# signing key and certificate chain
|
78
|
-
spec.signing_key = '/
|
76
|
+
spec.signing_key = '/mnt/Keys/gem-private_key.pem' if false
|
79
77
|
spec.cert_chain = ['gem-public_cert.pem']
|
80
78
|
end
|
data/lib/buildrizpack/package.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
|
2
|
+
# :include:../../README.rdoc
|
3
3
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
4
4
|
# contributor license agreements. See the NOTICE file distributed with this
|
5
5
|
# work for additional information regarding copyright ownership. The ASF
|
@@ -19,6 +19,45 @@ require "rexml/document"
|
|
19
19
|
include REXML
|
20
20
|
|
21
21
|
module BuildrIzPack
|
22
|
+
|
23
|
+
# A simple helper class to create a single pack
|
24
|
+
#
|
25
|
+
class Pack
|
26
|
+
# The path to be used by the IzPack-installer for this pack. Defaults to
|
27
|
+
attr_reader :defaultPath
|
28
|
+
# A hast of the files to be packed (src => installpath)
|
29
|
+
attr_reader :files
|
30
|
+
# A more elaborate description of the pack
|
31
|
+
attr_reader :description
|
32
|
+
# Attributes of the pack. a hash of name => value, eg. 'require' => 'yes'
|
33
|
+
attr_reader :attributes
|
34
|
+
# Initialize an IzPack-Pack by name, description.
|
35
|
+
# :attributes: Attributes of the pack, a Hash, eg. { 'required' => 'yes' }
|
36
|
+
def initialize(name, description, attributes = {}, defaultPath = '$INSTALL_PATH/plugins')
|
37
|
+
@description = description
|
38
|
+
@attributes = attributes
|
39
|
+
@attributes['name'] = name
|
40
|
+
@files = Hash.new
|
41
|
+
@defaultPath = defaultPath
|
42
|
+
@attributes['required'] = 'no' if !@attributes['required']
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add a single file to the pack
|
46
|
+
def addFile(src, dest=nil)
|
47
|
+
orig = dest
|
48
|
+
dest = File.join(@defaultPath, File.basename(src)) if !dest
|
49
|
+
@files[src] = dest
|
50
|
+
end
|
51
|
+
|
52
|
+
# collect the XML representation for the pack using an XMLMarkup object
|
53
|
+
def emitIzPackXML(xm)
|
54
|
+
# raise "xm must be an Builder::XmlMarkup object, but is #{xm.class}" if xm.class != Builder::XmlMarkup
|
55
|
+
xm.pack(@attributes) {
|
56
|
+
xm.description(@description)
|
57
|
+
@files.each{ |src, dest| xm.singlefile('src'=> src, 'target' =>dest) }
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
22
61
|
|
23
62
|
class IzPackTask < Buildr::ArchiveTask
|
24
63
|
|
@@ -60,17 +99,7 @@ module BuildrIzPack
|
|
60
99
|
|
61
100
|
attr_accessor :packaging, :properties, :variables, :dynamicvariables, :conditions, :installerrequirements,:resources,
|
62
101
|
:listeners, :jar, :native
|
63
|
-
|
64
|
-
#
|
65
|
-
# * May be called several times for the same package
|
66
|
-
#
|
67
|
-
# * +packName+ - the name of the destination pack, if it is a Hash, then it must point to a hash of attributes for the pack
|
68
|
-
# * +filePaths+ - May be a single filename or an array of filenames
|
69
|
-
# * +description+ - Description of the pack
|
70
|
-
# * +destination+ - IzPack will copy the files at installation time to this directory/file.
|
71
|
-
#
|
72
|
-
def addToPack(packName, filePaths, description=packName, destination='')
|
73
|
-
end
|
102
|
+
|
74
103
|
# The ArchiveTask class delegates this method
|
75
104
|
# so we can create the archive.
|
76
105
|
# the file_map is the result of the computations of the include and exclude filters.
|
@@ -86,7 +115,7 @@ module BuildrIzPack
|
|
86
115
|
@locales ||= ['eng']
|
87
116
|
@panels ||= ['TargetPanel', 'InstallPanel']
|
88
117
|
@packs ||=
|
89
|
-
raise "You must include at least one file to create an izPack installer" if file_map.size == 0 and !File.exists?(@input)
|
118
|
+
raise "You must include at least one file to create an izPack installer" if file_map.size == 0 and !File.exists?(@input)
|
90
119
|
izPackArtifact = Buildr.artifact( "org.codehaus.izpack:izpack-standalone-compiler:jar:#{@izpackVersion}")
|
91
120
|
doc = nil
|
92
121
|
if !File.exists?(@input)
|
@@ -96,7 +125,7 @@ module BuildrIzPack
|
|
96
125
|
end
|
97
126
|
Buildr.ant('izpack-ant') do |x|
|
98
127
|
izPackArtifact.invoke
|
99
|
-
msg = "Generating izpack aus #{File.expand_path(@input)}
|
128
|
+
msg = "Generating izpack aus #{File.expand_path(@input)}"
|
100
129
|
trace msg
|
101
130
|
if properties
|
102
131
|
properties.each{ |name, value|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
|
2
|
+
# :include:../../README.rdoc
|
3
3
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
4
4
|
# contributor license agreements. See the NOTICE file distributed with this
|
5
5
|
# work for additional information regarding copyright ownership. The ASF
|
@@ -19,6 +19,45 @@ require "rexml/document"
|
|
19
19
|
include REXML
|
20
20
|
|
21
21
|
module BuildrIzPack
|
22
|
+
|
23
|
+
# A simple helper class to create a single pack
|
24
|
+
#
|
25
|
+
class Pack
|
26
|
+
# The path to be used by the IzPack-installer for this pack. Defaults to
|
27
|
+
attr_reader :defaultPath
|
28
|
+
# A hast of the files to be packed (src => installpath)
|
29
|
+
attr_reader :files
|
30
|
+
# A more elaborate description of the pack
|
31
|
+
attr_reader :description
|
32
|
+
# Attributes of the pack. a hash of name => value, eg. 'require' => 'yes'
|
33
|
+
attr_reader :attributes
|
34
|
+
# Initialize an IzPack-Pack by name, description.
|
35
|
+
# :attributes: Attributes of the pack, a Hash, eg. { 'required' => 'yes' }
|
36
|
+
def initialize(name, description, attributes = {}, defaultPath = '$INSTALL_PATH/plugins')
|
37
|
+
@description = description
|
38
|
+
@attributes = attributes
|
39
|
+
@attributes['name'] = name
|
40
|
+
@files = Hash.new
|
41
|
+
@defaultPath = defaultPath
|
42
|
+
@attributes['required'] = 'no' if !@attributes['required']
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add a single file to the pack
|
46
|
+
def addFile(src, dest=nil)
|
47
|
+
orig = dest
|
48
|
+
dest = File.join(@defaultPath, File.basename(src)) if !dest
|
49
|
+
@files[src] = dest
|
50
|
+
end
|
51
|
+
|
52
|
+
# collect the XML representation for the pack using an XMLMarkup object
|
53
|
+
def emitIzPackXML(xm)
|
54
|
+
# raise "xm must be an Builder::XmlMarkup object, but is #{xm.class}" if xm.class != Builder::XmlMarkup
|
55
|
+
xm.pack(@attributes) {
|
56
|
+
xm.description(@description)
|
57
|
+
@files.each{ |src, dest| xm.singlefile('src'=> src, 'target' =>dest) }
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
22
61
|
|
23
62
|
class IzPackTask < Buildr::ArchiveTask
|
24
63
|
|
@@ -60,17 +99,7 @@ module BuildrIzPack
|
|
60
99
|
|
61
100
|
attr_accessor :packaging, :properties, :variables, :dynamicvariables, :conditions, :installerrequirements,:resources,
|
62
101
|
:listeners, :jar, :native
|
63
|
-
|
64
|
-
#
|
65
|
-
# * May be called several times for the same package
|
66
|
-
#
|
67
|
-
# * +packName+ - the name of the destination pack, if it is a Hash, then it must point to a hash of attributes for the pack
|
68
|
-
# * +filePaths+ - May be a single filename or an array of filenames
|
69
|
-
# * +description+ - Description of the pack
|
70
|
-
# * +destination+ - IzPack will copy the files at installation time to this directory/file.
|
71
|
-
#
|
72
|
-
def addToPack(packName, filePaths, description=packName, destination='')
|
73
|
-
end
|
102
|
+
|
74
103
|
# The ArchiveTask class delegates this method
|
75
104
|
# so we can create the archive.
|
76
105
|
# the file_map is the result of the computations of the include and exclude filters.
|
@@ -86,12 +115,12 @@ module BuildrIzPack
|
|
86
115
|
@locales ||= ['eng']
|
87
116
|
@panels ||= ['TargetPanel', 'InstallPanel']
|
88
117
|
@packs ||=
|
89
|
-
raise "You must include at least one file to create an izPack installer" if file_map.size == 0 and !File.exists?(@input)
|
118
|
+
raise "You must include at least one file to create an izPack installer" if file_map.size == 0 and !File.exists?(@input)
|
90
119
|
izPackArtifact = Buildr.artifact( "org.codehaus.izpack:izpack-standalone-compiler:jar:#{@izpackVersion}")
|
91
120
|
doc = nil
|
92
121
|
if !File.exists?(@input)
|
93
|
-
# genInstaller(Builder::XmlMarkup.new(:target=>$stdout, :indent => 2), file_map)
|
94
122
|
genInstaller(Builder::XmlMarkup.new(:target=>File.open(@input, 'w+'), :indent => 2), file_map)
|
123
|
+
# genInstaller(Builder::XmlMarkup.new(:target=>$stdout, :indent => 2), file_map)
|
95
124
|
# genInstaller(Builder::XmlMarkup.new(:target=>File.open('/home/niklaus/tmp2.xml', 'w+'), :indent => 2), file_map)
|
96
125
|
end
|
97
126
|
Buildr.ant('izpack-ant') do |x|
|
data/rakelib/checks.rake
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
desc "Check that source files contain the Apache license"
|
18
|
-
task :license=>FileList["**/*.{rb,rake,
|
18
|
+
task :license=>FileList["**/*.{rb,rake,gemspec,buildfile}", 'Rakefile'] do |task|
|
19
19
|
puts "Checking that files contain the Apache license ... "
|
20
20
|
required = task.prerequisites.select { |fn| File.file?(fn) }
|
21
21
|
missing = required.reject { |fn|
|
@@ -13,19 +13,16 @@
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
14
14
|
# the License.
|
15
15
|
|
16
|
-
unless defined?(SpecHelpers)
|
17
|
-
module SandboxHook
|
18
|
-
|
19
|
-
def SandboxHook.included(spec_helpers)
|
20
|
-
# For testing we use the gem requirements specified on the buildr4osgi.gemspec
|
21
|
-
spec = Gem::Specification.load(File.expand_path('../buildrizpack.gemspec', File.dirname(__FILE__)))
|
22
|
-
spec.dependencies.each { |dep| gem dep.name, dep.version_requirements.to_s }
|
23
|
-
# Make sure to load from these paths first, we don't want to load any
|
24
|
-
# code from Gem library.
|
25
|
-
$LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
|
26
|
-
require 'buildrizpack'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
require File.join(File.dirname(__FILE__), "/../buildr/spec/spec_helpers.rb")
|
30
16
|
|
17
|
+
desc "Check that source files contain the Apache license"
|
18
|
+
task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
|
19
|
+
puts "Checking that files contain the Apache license ... "
|
20
|
+
required = task.prerequisites.select { |fn| File.file?(fn) }
|
21
|
+
missing = required.reject { |fn|
|
22
|
+
comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
|
23
|
+
map { |match| match.compact }.flatten.join("\n")
|
24
|
+
comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
|
25
|
+
}
|
26
|
+
fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
|
27
|
+
puts "[x] Source files contain the Apache license"
|
31
28
|
end
|
data/rakelib/doc.rake
CHANGED
@@ -13,111 +13,33 @@
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
14
14
|
# the License.
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "Generate RDoc documentation in rdoc/"
|
27
|
-
RDoc::Task.new :rdoc do |rdoc|
|
28
|
-
rdoc.rdoc_dir = 'rdoc'
|
29
|
-
rdoc.title = spec.name
|
30
|
-
rdoc.options = spec.rdoc_options.clone
|
31
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
32
|
-
rdoc.rdoc_files.include spec.extra_rdoc_files
|
33
|
-
|
34
|
-
# include rake source for better inheritance rdoc
|
35
|
-
rdoc.rdoc_files.include('rake/lib/**.rb')
|
36
|
-
end
|
37
|
-
task :rdoc => ["rake/lib"]
|
38
|
-
|
39
|
-
begin
|
40
|
-
require 'jekylltask'
|
41
|
-
module TocFilter
|
42
|
-
def toc(input)
|
43
|
-
output = "<ol class=\"toc\">"
|
44
|
-
input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
|
45
|
-
id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
|
46
|
-
title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
|
47
|
-
if id
|
48
|
-
output << %{<li><a href="##{id}">#{title}</a></li>}
|
49
|
-
else
|
50
|
-
output << %{<li>#{title}</li>}
|
51
|
-
end
|
52
|
-
end
|
53
|
-
output << "</ol>"
|
54
|
-
output
|
55
|
-
end
|
56
|
-
end
|
57
|
-
Liquid::Template.register_filter(TocFilter)
|
58
|
-
|
59
|
-
desc "Generate Buildr documentation in _site/"
|
60
|
-
JekyllTask.new :jekyll do |task|
|
61
|
-
task.source = 'doc'
|
62
|
-
task.target = '_site'
|
63
|
-
end
|
64
|
-
|
65
|
-
rescue LoadError
|
66
|
-
puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running bundler"
|
67
|
-
end
|
68
|
-
|
69
|
-
if `pygmentize -V`.empty?
|
70
|
-
puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments'"
|
71
|
-
end
|
16
|
+
gem 'rdoc'
|
17
|
+
require 'rdoc/task'
|
18
|
+
desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
|
19
|
+
file "rake/lib" do
|
20
|
+
rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
|
21
|
+
mkdir_p "rake"
|
22
|
+
File.symlink(rake_path, "rake/lib")
|
23
|
+
end
|
72
24
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
25
|
+
desc "Generate RDoc documentation in rdoc/"
|
26
|
+
RDoc::Task.new :rdoc do |rdoc|
|
27
|
+
rdoc.rdoc_dir = 'rdoc'
|
28
|
+
rdoc.title = spec.name
|
29
|
+
rdoc.options = spec.rdoc_options.clone
|
30
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
31
|
+
rdoc.rdoc_files.include spec.extra_rdoc_files
|
78
32
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
cp '_reports/specs.html', '_site'
|
84
|
-
cp_r '_reports/coverage', '_site'
|
85
|
-
fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
|
86
|
-
cp 'CHANGELOG', '_site'
|
87
|
-
open("_site/.htaccess", "w") do |htaccess|
|
88
|
-
htaccess << %Q{
|
89
|
-
<FilesMatch "CHANGELOG">
|
90
|
-
ForceType 'text/plain; charset=UTF-8'
|
91
|
-
</FilesMatch>
|
92
|
-
}
|
93
|
-
end
|
94
|
-
cp 'buildr.pdf', '_site'
|
95
|
-
fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
|
96
|
-
puts 'OK'
|
97
|
-
end
|
33
|
+
# include rake source for better inheritance rdoc
|
34
|
+
rdoc.rdoc_files.include('rake/lib/**.rb')
|
35
|
+
end
|
36
|
+
task :rdoc => ["rake/lib"]
|
98
37
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
puts "Uploading new site to #{target} ..."
|
103
|
-
sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
|
104
|
-
sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
|
105
|
-
puts "Done"
|
106
|
-
end
|
38
|
+
if `pygmentize -V`.empty?
|
39
|
+
puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments'"
|
40
|
+
end
|
107
41
|
|
108
|
-
# Update HTML + PDF documentation (but not entire site; no specs, coverage, etc.)
|
109
|
-
task 'publish-doc' => ['buildr.pdf', '_site'] do
|
110
|
-
cp 'buildr.pdf', '_site'
|
111
|
-
target = "people.apache.org:/www/#{spec.name}.apache.org/"
|
112
|
-
puts "Uploading new site to #{target} ..."
|
113
|
-
sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
|
114
|
-
sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
|
115
|
-
puts "Done"
|
116
|
-
end
|
117
42
|
|
118
|
-
|
119
|
-
|
120
|
-
rm_f 'buildr.pdf'
|
121
|
-
rm_f 'prince_errors.log'
|
122
|
-
end
|
43
|
+
task :clobber do
|
44
|
+
rm_rf 'rdoc'
|
123
45
|
end
|