Class: Doubleshot::CLI::Commands::Jar
Constant Summary
USAGE
Class Method Summary
collapse
commands, detect, inherited, task_name, usage
Class Method Details
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/doubleshot/commands/jar.rb', line 9
def self.options
Options.new do |options|
options.banner = "Usage: doubleshot jar"
options.separator ""
options.separator "Options"
options.test = true
options.on "--no-test", "Disable testing as a packaging prerequisite." do
options.test = false
end
options.sparse = false
options.on "--sparse", "Don't include JAR dependencies in your JAR. (For example, if you want to use Maven.)" do
options.sparse = true
end
options.separator ""
options.separator "Summary: #{summary}"
end
end
|
.start(args) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/doubleshot/commands/jar.rb', line 30
def self.start(args)
options = self.options.parse!(args)
doubleshot = Doubleshot::current
if options.test
puts "Executing tests..."
if Doubleshot::CLI::Commands::Test.start([ "--ci" ]) != 0
STDERR.puts "Test failed, aborting JAR creation."
return 1
end
else
doubleshot.setup!
doubleshot.build!
end
unless Pathname::glob(doubleshot.config.source.java + "**/*.java").empty?
target = doubleshot.config.target
jarfile = (target + "#{doubleshot.config.project}.jar")
jarfile.delete if jarfile.exist?
ant.jar jarfile: jarfile, basedir: target do
manifest{
attribute(:name => "Main-Class", :value => doubleshot.config.java_main)
}
fileset dir: doubleshot.config.source.ruby.parent, includes: doubleshot.config.source.ruby.to_s + "/**/*"
unless options.sparse
doubleshot.lockfile.jars.each do |jar|
zipfileset src: jar.path.expand_path, excludes: "META-INF/*.SF"
end
end
end
end
return 0
end
|
3
4
5
6
7
|
# File 'lib/doubleshot/commands/jar.rb', line 3
def self.summary
<<-EOS.margin
Package your project as a JAR.
EOS
end
|