tetra 0.52.0 → 0.53.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/SPECIAL_CASES.md +9 -3
- data/bin/tetra +2 -11
- data/lib/template/bashrc +21 -0
- data/lib/tetra.rb +2 -4
- data/lib/tetra/facades/ant.rb +7 -19
- data/lib/tetra/facades/bash.rb +39 -14
- data/lib/tetra/facades/mvn.rb +12 -31
- data/lib/tetra/facades/process_runner.rb +2 -3
- data/lib/tetra/generatable.rb +17 -0
- data/lib/tetra/kit.rb +6 -14
- data/lib/tetra/packages/scriptable.rb +10 -12
- data/lib/tetra/packages/speccable.rb +2 -21
- data/lib/tetra/ui/dry_run_subcommand.rb +1 -1
- data/lib/tetra/{main.rb → ui/main.rb} +0 -12
- data/lib/tetra/ui/subcommand.rb +0 -2
- data/lib/tetra/version.rb +1 -1
- data/spec/lib/ant_spec.rb +2 -13
- data/spec/lib/kit_spec.rb +3 -3
- data/spec/lib/mvn_spec.rb +3 -23
- data/spec/lib/scriptable_spec.rb +1 -1
- metadata +5 -5
- data/lib/tetra/ui/ant_subcommand.rb +0 -23
- data/lib/tetra/ui/mvn_subcommand.rb +0 -23
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Install `tetra` via RubyGems:
|
|
24
24
|
Building a package with `tetra` is quite unusual — this is a deliberate choice, so don't worry. Basic steps are:
|
25
25
|
|
26
26
|
* `tetra init` a new project;
|
27
|
-
* add sources to `src/<package name>` and anything else needed for the build in `kit/` in binary form (Ant and Maven are already
|
27
|
+
* add sources to `src/<package name>` and anything else needed for the build in `kit/` in binary form (Ant and Maven are already pre-bundled);
|
28
28
|
* execute `tetra dry-run`, which will open a bash subshell. In there, build your project, and when you are done conclude quitting it with `Ctrl+D`;
|
29
29
|
* execute `tetra generate-all`: tetra will scaffold spec files and tarballs.
|
30
30
|
|
@@ -60,11 +60,11 @@ Third, you need to show `tetra` how to build your package. Run `tetra dry-run` a
|
|
60
60
|
tetra dry-run
|
61
61
|
|
62
62
|
cd commons-collections-3.2.1-src/
|
63
|
-
|
63
|
+
mvn package
|
64
64
|
|
65
65
|
^D
|
66
66
|
|
67
|
-
Note that
|
67
|
+
Note that you don't even need to install Maven - `tetra` bundles a copy in `kit/` and uses it by default!
|
68
68
|
Also note that this being a dry-run build, sources will be brought back to their original state after it finishes to ensure repeatability.
|
69
69
|
|
70
70
|
Finally, generate build scripts, spec files and tarballs in the `packages/` directory:
|
data/SPECIAL_CASES.md
CHANGED
@@ -27,7 +27,7 @@ In case you want to swap sources completely and throw away all previous patches
|
|
27
27
|
|
28
28
|
## Ant builds
|
29
29
|
|
30
|
-
|
30
|
+
Ant is supported as well as Maven. You have a prebundled copy in `kit`, and using `ant` from a dry-run will use that by default.
|
31
31
|
|
32
32
|
Sometimes you will have jar files distributed along with the source archive that will end up in `src/`: you don't want that! Run:
|
33
33
|
|
@@ -39,6 +39,12 @@ When generating spec files, it helps to have a `pom.xml` in your package directo
|
|
39
39
|
|
40
40
|
You can also ask `tetra` to find one via `tetra get-pom <filename>.jar`.
|
41
41
|
|
42
|
+
## Use different Ant or Maven versions
|
43
|
+
|
44
|
+
In case the bundled Ant or Maven versions are not usable in your project for whatever reason and you want to bundle a different one, just remove their directories from `kit` and replace them with your own. `tetra` will look for binaries named `ant` or `mvn` in kit and use them wherever they are found.
|
45
|
+
|
46
|
+
You can also use system-provided Ant and Maven by simply deleting their directories from `kit/`. Note that this is not recommended because a different version might be used at build time (for example in OBS), potentially resulting in non-reproducible builds.
|
47
|
+
|
42
48
|
## Other build tools
|
43
49
|
|
44
50
|
Other build tools are currently unsupported but will be added in the future. You can nevertheless use them just make sure all of their files, included automatically downloaded ones, are stored in `kit`.
|
@@ -54,7 +60,7 @@ Note that the kit packages is only needed at build time by OBS, no end user shou
|
|
54
60
|
## Gotchas
|
55
61
|
|
56
62
|
* `tetra` internally uses `git` to keep track of files, any tetra project is actually also a `git` repo. Feel free to use it as any ordinary git repo, including pushing to a remote repo, rebasing, merging or using GitHub's pull requests. Just make sure any `tetra: ` comments are preserved;
|
57
|
-
* some Maven plugins like the Eclipse Project ones ([Tycho](https://www.eclipse.org/tycho/)) will save data in `/tmp` downloaded from the Internet and will produce errors if this data is not there during offline builds. One way to work around that is to force Java to use a kit subdirectory as `/tmp`. Add the following option to `
|
63
|
+
* some Maven plugins like the Eclipse Project ones ([Tycho](https://www.eclipse.org/tycho/)) will save data in `/tmp` downloaded from the Internet and will produce errors if this data is not there during offline builds. One way to work around that is to force Java to use a kit subdirectory as `/tmp`. Add the following option to `mvn` during your build:
|
58
64
|
|
59
65
|
-Djava.io.tmpdir=<full path to project>/kit/tmp
|
60
66
|
|
@@ -63,7 +69,7 @@ Use the following option in `mvn` in your build.sh file to make it reproducible:
|
|
63
69
|
-Djava.io.tmpdir=$PROJECT_PREFIX/kit/tmp
|
64
70
|
|
65
71
|
* Tycho builds may also require NSS, so if you get NSS errors be sure to add `mozilla-nss` or an equivalent package in a BuildRequires: line;
|
66
|
-
* some badly designed testsuites might not work in OBS. If you are using `
|
72
|
+
* some badly designed testsuites might not work in OBS. If you are using `mvn` you can add the following option to disable them:
|
67
73
|
|
68
74
|
-DskipTests=true
|
69
75
|
|
data/bin/tetra
CHANGED
@@ -1,18 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
#
|
4
|
-
#
|
5
|
-
# packager Swiss Army Knife.
|
4
|
+
# tetra is a tool to help you build RPM packages for Java projects.
|
6
5
|
#
|
7
|
-
# Copyright
|
8
|
-
#
|
9
|
-
# Inspired mainly by pom2spec by:
|
10
|
-
# Pascal Bleser <pascal.bleser@opensuse.org>
|
11
|
-
# Duncan Mac-Vicar Prett <dmacvicar@suse.de>
|
12
|
-
#
|
13
|
-
# This file is licensed under the
|
14
|
-
# GNU Lesser General Public License version 2.1 or later:
|
15
|
-
# http://www.gnu.org/licenses/lgpl-2.1.html
|
6
|
+
# Copyright 2015 Silvio Moioli <moio@suse.de>
|
16
7
|
#
|
17
8
|
|
18
9
|
if File.exist?(File.join(File.dirname(__FILE__), "..", ".git"))
|
data/lib/template/bashrc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# use a temporary file for history
|
2
|
+
HISTFILE=<%= history_file %>
|
3
|
+
|
4
|
+
# don't limit file size
|
5
|
+
HISTFILESIZE=-1
|
6
|
+
|
7
|
+
# don't limit history length
|
8
|
+
HISTSIZE=-1
|
9
|
+
|
10
|
+
# don't keep timestamps in history
|
11
|
+
unset HISTTIMEFORMAT
|
12
|
+
|
13
|
+
# don't skip any command
|
14
|
+
HISTCONTROL=""
|
15
|
+
|
16
|
+
# change prompt
|
17
|
+
PS1="\e[1;33mdry-running\e[m:\w\$ "
|
18
|
+
|
19
|
+
# add default commandline switches
|
20
|
+
alias ant='<%= ant_commandline %>'
|
21
|
+
alias mvn='<%= mvn_commandline %>'
|
data/lib/tetra.rb
CHANGED
@@ -22,6 +22,7 @@ require "open4"
|
|
22
22
|
|
23
23
|
# base components
|
24
24
|
require "tetra/logger"
|
25
|
+
require "tetra/generatable"
|
25
26
|
|
26
27
|
# facades to other programs
|
27
28
|
require "tetra/facades/process_runner"
|
@@ -47,7 +48,6 @@ require "tetra/packages/package"
|
|
47
48
|
|
48
49
|
# UI
|
49
50
|
require "tetra/ui/subcommand"
|
50
|
-
require "tetra/ui/ant_subcommand"
|
51
51
|
require "tetra/ui/dry_run_subcommand"
|
52
52
|
require "tetra/ui/generate_all_subcommand"
|
53
53
|
require "tetra/ui/generate_kit_subcommand"
|
@@ -57,7 +57,5 @@ require "tetra/ui/generate_spec_subcommand"
|
|
57
57
|
require "tetra/ui/get_pom_subcommand"
|
58
58
|
require "tetra/ui/init_subcommand"
|
59
59
|
require "tetra/ui/move_jars_to_kit_subcommand"
|
60
|
-
require "tetra/ui/mvn_subcommand"
|
61
60
|
require "tetra/ui/patch_subcommand"
|
62
|
-
|
63
|
-
require "tetra/main"
|
61
|
+
require "tetra/ui/main"
|
data/lib/tetra/facades/ant.rb
CHANGED
@@ -1,27 +1,15 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Tetra
|
4
|
-
#
|
4
|
+
# encapsulates tetra-specific Ant commandline options
|
5
5
|
class Ant
|
6
|
-
include Logging
|
7
|
-
include ProcessRunner
|
8
|
-
|
9
|
-
# project_path is relative to the current dir
|
10
|
-
# ant_path is relative to project_path
|
11
|
-
def initialize(project_path, ant_path)
|
12
|
-
@project_path = project_path
|
13
|
-
@ant_path = ant_path
|
14
|
-
end
|
15
|
-
|
16
|
-
# runs ant in a subprocess
|
17
|
-
def ant(options)
|
18
|
-
run(get_ant_commandline(options), true)
|
19
|
-
end
|
20
|
-
|
21
6
|
# returns a command line for running Ant
|
22
|
-
def
|
23
|
-
|
24
|
-
|
7
|
+
def self.commandline(project_path, ant_path)
|
8
|
+
if ant_path
|
9
|
+
File.join(project_path, ant_path, "ant")
|
10
|
+
else
|
11
|
+
"ant" # use system-provided executable
|
12
|
+
end
|
25
13
|
end
|
26
14
|
end
|
27
15
|
end
|
data/lib/tetra/facades/bash.rb
CHANGED
@@ -5,24 +5,49 @@ module Tetra
|
|
5
5
|
class Bash
|
6
6
|
include ProcessRunner
|
7
7
|
|
8
|
+
def initialize(project)
|
9
|
+
@project = project
|
10
|
+
end
|
11
|
+
|
8
12
|
# runs bash in a subshell, returns list of
|
9
13
|
# commands that were run in the session
|
10
14
|
def bash
|
11
|
-
Tempfile.open("tetra-history") do |
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
Tempfile.open("tetra-history") do |history_file|
|
16
|
+
Tempfile.open("tetra-bashrc") do |bashrc_file|
|
17
|
+
kit = Tetra::Kit.new(@project)
|
18
|
+
ant_path = kit.find_executable("ant")
|
19
|
+
ant_commandline = Tetra::Ant.commandline(@project.full_path, ant_path)
|
20
|
+
|
21
|
+
mvn_path = kit.find_executable("mvn")
|
22
|
+
mvn_commandline = Tetra::Mvn.commandline(@project.full_path, mvn_path)
|
23
|
+
|
24
|
+
bashrc = Bashrc.new(history_file.path, ant_commandline, mvn_commandline)
|
25
|
+
bashrc_file.write(bashrc.to_s)
|
26
|
+
bashrc_file.flush
|
27
|
+
|
28
|
+
run_interactive("bash --rcfile #{bashrc_file.path}")
|
29
|
+
File.read(history_file).split("\n").map(&:strip)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
34
|
+
|
35
|
+
# encapsulates variables in bashrc template
|
36
|
+
class Bashrc
|
37
|
+
include Tetra::Generatable
|
38
|
+
|
39
|
+
attr_reader :history_file
|
40
|
+
attr_reader :ant_commandline
|
41
|
+
attr_reader :mvn_commandline
|
42
|
+
|
43
|
+
def initialize(history_file, ant_commandline, mvn_commandline)
|
44
|
+
@history_file = history_file
|
45
|
+
@ant_commandline = ant_commandline
|
46
|
+
@mvn_commandline = mvn_commandline
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_s
|
50
|
+
generate("bashrc", binding)
|
51
|
+
end
|
52
|
+
end
|
28
53
|
end
|
data/lib/tetra/facades/mvn.rb
CHANGED
@@ -1,44 +1,25 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
module Tetra
|
4
|
-
#
|
4
|
+
# encapsulates tetra-specific Maven commandline options
|
5
5
|
class Mvn
|
6
|
-
include Logging
|
7
|
-
include ProcessRunner
|
8
|
-
|
9
|
-
# project_path is relative to the current dir
|
10
|
-
# mvn_path is relative to project_path
|
11
|
-
def initialize(project_path, mvn_path)
|
12
|
-
@project_path = project_path
|
13
|
-
@mvn_path = mvn_path
|
14
|
-
end
|
15
|
-
|
16
|
-
# runs Maven in a subprocess
|
17
|
-
def mvn(options)
|
18
|
-
run(get_mvn_commandline(options), true)
|
19
|
-
end
|
20
|
-
|
21
|
-
# runs Maven to get the effective POM from an existing POM
|
22
|
-
# returns effective pom path or nil if not found
|
23
|
-
def get_effective_pom(pom_path)
|
24
|
-
effective_pom_path = "#{pom_path}.effective"
|
25
|
-
success = mvn(["help:effective-pom", "-f#{pom_path}", "-Doutput=#{File.split(effective_pom_path)[1]}"])
|
26
|
-
effective_pom_path if success
|
27
|
-
end
|
28
|
-
|
29
6
|
# returns a command line for running Maven
|
30
|
-
def
|
31
|
-
full_path =
|
32
|
-
|
33
|
-
|
7
|
+
def self.commandline(project_path, mvn_path)
|
8
|
+
full_path = if mvn_path
|
9
|
+
File.join(project_path, mvn_path, "mvn")
|
10
|
+
else
|
11
|
+
"mvn" # use system-provided executable
|
12
|
+
end
|
13
|
+
repo_path = File.join(project_path, "kit", "m2")
|
14
|
+
config_path = File.join(project_path, "kit", "m2", "settings.xml")
|
34
15
|
|
35
|
-
|
16
|
+
options = [
|
36
17
|
"-Dmaven.repo.local=#{repo_path}",
|
37
18
|
"--settings #{config_path}",
|
38
19
|
"--strict-checksums"
|
39
|
-
]
|
20
|
+
]
|
40
21
|
|
41
|
-
"#{full_path} #{
|
22
|
+
"#{full_path} #{options.join(' ')}"
|
42
23
|
end
|
43
24
|
end
|
44
25
|
end
|
@@ -35,9 +35,8 @@ module Tetra
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# runs an interactive executable in a subshell
|
38
|
-
|
39
|
-
|
40
|
-
success = system(env, command)
|
38
|
+
def run_interactive(command)
|
39
|
+
success = system({}, command)
|
41
40
|
fail ExecutionFailed.new(command, $CHILD_STATUS, nil, nil) unless success
|
42
41
|
end
|
43
42
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module Tetra
|
4
|
+
# adds methods to generate text files from an ERB template
|
5
|
+
module Generatable
|
6
|
+
# returns the template path
|
7
|
+
def template_path
|
8
|
+
File.join(File.dirname(__FILE__), "..", "template")
|
9
|
+
end
|
10
|
+
|
11
|
+
# generates content from an ERB template and an object binding
|
12
|
+
def generate(template_name, object_binding)
|
13
|
+
erb = ERB.new(File.read(File.join(template_path, template_name)), nil, "<>")
|
14
|
+
erb.result(object_binding)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/tetra/kit.rb
CHANGED
@@ -10,27 +10,19 @@ module Tetra
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# finds an executable in a bin/ subdirectory of kit
|
13
|
+
# returns nil if executable cannot be found
|
13
14
|
def find_executable(name)
|
14
15
|
@project.from_directory do
|
15
16
|
Find.find("kit") do |path|
|
16
|
-
next unless path =~ /bin\/#{name}$/
|
17
|
+
next unless path =~ /(.*bin)\/#{name}$/
|
18
|
+
result = Regexp.last_match[1]
|
17
19
|
|
18
|
-
log.debug("found #{name} executable
|
19
|
-
return
|
20
|
+
log.debug("found #{name} executable in #{result}")
|
21
|
+
return result
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
|
24
|
-
fail ExecutableNotFoundError, name
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# an executable from the kit was not found
|
29
|
-
class ExecutableNotFoundError < Exception
|
30
|
-
attr_reader :executable
|
31
|
-
|
32
|
-
def initialize(executable)
|
33
|
-
@executable = executable
|
25
|
+
nil
|
34
26
|
end
|
35
27
|
end
|
36
28
|
end
|
@@ -29,21 +29,19 @@ module Tetra
|
|
29
29
|
# build script lines and adjusting mvn and ant's paths
|
30
30
|
def script_body(project)
|
31
31
|
lines = project.build_script_lines
|
32
|
-
ant = if lines.any? { |e| e.match(/tetra +ant/) }
|
33
|
-
path = Tetra::Kit.new(project).find_executable("ant")
|
34
|
-
Tetra::Ant.new(project.full_path, path).ant(@options)
|
35
|
-
end
|
36
32
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
kit = Tetra::Kit.new(project)
|
34
|
+
ant_path = kit.find_executable("ant")
|
35
|
+
ant_commandline = Tetra::Ant.commandline("$PROJECT_PREFIX", ant_path)
|
36
|
+
|
37
|
+
mvn_path = kit.find_executable("mvn")
|
38
|
+
mvn_commandline = Tetra::Mvn.commandline("$PROJECT_PREFIX", mvn_path)
|
41
39
|
|
42
40
|
lines.map do |line|
|
43
|
-
if line =~
|
44
|
-
line.gsub(
|
45
|
-
elsif line =~
|
46
|
-
line.gsub(
|
41
|
+
if line =~ /^ant( .*)?$/
|
42
|
+
line.gsub(/^ant/, ant_commandline)
|
43
|
+
elsif line =~ /^mvn( .*)?$/
|
44
|
+
line.gsub(/^mvn/, "#{mvn_commandline} -o")
|
47
45
|
else
|
48
46
|
line
|
49
47
|
end
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Tetra
|
4
4
|
# adds methods to generate a spec file from a package object
|
5
5
|
module Speccable
|
6
|
+
include Tetra::Generatable
|
7
|
+
|
6
8
|
# saves a specfile for this object in correct directories
|
7
9
|
# returns the spec path and the conflict count with the previously generated
|
8
10
|
# version, if any
|
@@ -22,26 +24,5 @@ module Tetra
|
|
22
24
|
[spec_path, conflict_count]
|
23
25
|
end
|
24
26
|
end
|
25
|
-
|
26
|
-
# returns the spec template path, exposed for testing
|
27
|
-
def template_path
|
28
|
-
File.join(File.dirname(__FILE__), "..", "..", "template")
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
# generates content from an ERB template and an object binding
|
34
|
-
# if destination_path is given, write it to that file, otherwise just
|
35
|
-
# return it
|
36
|
-
def generate(template_name, object_binding, destination_path = nil)
|
37
|
-
erb = ERB.new File.read(File.join(template_path, template_name)), nil, "<>"
|
38
|
-
new_content = erb.result(object_binding)
|
39
|
-
|
40
|
-
unless destination_path.nil?
|
41
|
-
File.open(destination_path, "w") { |io| io.write new_content }
|
42
|
-
end
|
43
|
-
|
44
|
-
new_content
|
45
|
-
end
|
46
27
|
end
|
47
28
|
end
|
@@ -15,18 +15,6 @@ module Tetra
|
|
15
15
|
Tetra::DryRunSubcommand
|
16
16
|
)
|
17
17
|
|
18
|
-
subcommand(
|
19
|
-
"mvn",
|
20
|
-
"Locates and runs Maven from any directory in kit/",
|
21
|
-
Tetra::MvnSubcommand
|
22
|
-
)
|
23
|
-
|
24
|
-
subcommand(
|
25
|
-
"ant",
|
26
|
-
"Locates and runs Ant from any directory in kit/",
|
27
|
-
Tetra::AntSubcommand
|
28
|
-
)
|
29
|
-
|
30
18
|
subcommand(
|
31
19
|
"generate-kit",
|
32
20
|
"Create or refresh the kit spec and archive files",
|
data/lib/tetra/ui/subcommand.rb
CHANGED
@@ -98,8 +98,6 @@ module Tetra
|
|
98
98
|
$stderr.puts "#{e.directory} is not a tetra project directory, see tetra init"
|
99
99
|
rescue GitAlreadyInitedError
|
100
100
|
$stderr.puts "This directory is already a tetra project"
|
101
|
-
rescue ExecutableNotFoundError => e
|
102
|
-
$stderr.puts "Executable #{e.executable} not found in kit/ or any of its subdirectories"
|
103
101
|
rescue ExecutionFailed => e
|
104
102
|
$stderr.puts "Failed to run `#{e.commandline}` (exit status #{e.status})"
|
105
103
|
rescue Interrupt
|
data/lib/tetra/version.rb
CHANGED
data/spec/lib/ant_spec.rb
CHANGED
@@ -10,8 +10,6 @@ describe Tetra::Ant do
|
|
10
10
|
@path = create_mock_executable("ant")
|
11
11
|
end
|
12
12
|
|
13
|
-
let(:instance) { Tetra::Ant.new(".", mock_executable_path("ant")) }
|
14
|
-
|
15
13
|
after(:each) do
|
16
14
|
delete_mock_project
|
17
15
|
end
|
@@ -19,17 +17,8 @@ describe Tetra::Ant do
|
|
19
17
|
describe "#get_ant_commandline" do
|
20
18
|
it "returns commandline options for running Ant" do
|
21
19
|
@project.from_directory do
|
22
|
-
commandline =
|
23
|
-
expect(commandline).to eq "./#{@path}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#ant" do
|
29
|
-
it "runs Ant" do
|
30
|
-
@project.from_directory do
|
31
|
-
instance.ant(["extra-option"])
|
32
|
-
expect(File.read("test_out").strip).to match(/extra-option$/)
|
20
|
+
commandline = Tetra::Ant.commandline(".", mock_executable_dir("ant"))
|
21
|
+
expect(commandline).to eq "./#{@path}"
|
33
22
|
end
|
34
23
|
end
|
35
24
|
end
|
data/spec/lib/kit_spec.rb
CHANGED
@@ -17,11 +17,11 @@ describe Tetra::Kit do
|
|
17
17
|
|
18
18
|
describe "#find_executable" do
|
19
19
|
it "finds an executable in kit" do
|
20
|
-
|
21
|
-
expect(instance.find_executable("any")).to eq
|
20
|
+
create_mock_executable("any")
|
21
|
+
expect(instance.find_executable("any")).to eq mock_executable_dir("any")
|
22
22
|
end
|
23
23
|
it "doesn't find an executable in kit" do
|
24
|
-
expect
|
24
|
+
expect(instance.find_executable("any")).to be_nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/spec/lib/mvn_spec.rb
CHANGED
@@ -10,8 +10,6 @@ describe Tetra::Mvn do
|
|
10
10
|
@path = create_mock_executable("mvn")
|
11
11
|
end
|
12
12
|
|
13
|
-
let(:instance) { Tetra::Mvn.new(".", mock_executable_path("mvn")) }
|
14
|
-
|
15
13
|
after(:each) do
|
16
14
|
delete_mock_project
|
17
15
|
end
|
@@ -19,29 +17,11 @@ describe Tetra::Mvn do
|
|
19
17
|
describe "#get_mvn_commandline" do
|
20
18
|
it "returns commandline options for running maven" do
|
21
19
|
@project.from_directory do
|
22
|
-
commandline =
|
23
|
-
expected_commandline = "./#{@path} -Dmaven.repo.local=./kit/m2
|
24
|
-
./kit/m2/settings.xml --strict-checksums
|
20
|
+
commandline = Tetra::Mvn.commandline(".", mock_executable_dir("mvn"))
|
21
|
+
expected_commandline = "./#{@path} -Dmaven.repo.local=./kit/m2 \
|
22
|
+
--settings ./kit/m2/settings.xml --strict-checksums"
|
25
23
|
expect(commandline).to eq expected_commandline
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
29
|
-
|
30
|
-
describe "#mvn" do
|
31
|
-
it "runs maven" do
|
32
|
-
@project.from_directory do
|
33
|
-
instance.mvn(["extra-option"])
|
34
|
-
expect(File.read("test_out").strip).to match(/extra-option$/)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe "#get_effective_pom" do
|
40
|
-
it "runs maven to get an effective pom" do
|
41
|
-
@project.from_directory do
|
42
|
-
expect(instance.get_effective_pom("test.pom")).to eq "test.pom.effective"
|
43
|
-
expect(File.read("test_out").strip).to match(/help:effective-pom -ftest.pom -Doutput=test.pom.effective$/)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
27
|
end
|
data/spec/lib/scriptable_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tetra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.53.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- bin/tetra
|
177
177
|
- integration-tests/build-commons.sh
|
178
178
|
- integration-tests/commons-collections-3.2.1-src.zip
|
179
|
+
- lib/template/bashrc
|
179
180
|
- lib/template/bundled/apache-ant-1.9.4/INSTALL
|
180
181
|
- lib/template/bundled/apache-ant-1.9.4/KEYS
|
181
182
|
- lib/template/bundled/apache-ant-1.9.4/LICENSE
|
@@ -356,9 +357,9 @@ files:
|
|
356
357
|
- lib/tetra/facades/git.rb
|
357
358
|
- lib/tetra/facades/mvn.rb
|
358
359
|
- lib/tetra/facades/process_runner.rb
|
360
|
+
- lib/tetra/generatable.rb
|
359
361
|
- lib/tetra/kit.rb
|
360
362
|
- lib/tetra/logger.rb
|
361
|
-
- lib/tetra/main.rb
|
362
363
|
- lib/tetra/maven_website.rb
|
363
364
|
- lib/tetra/packages/kit_package.rb
|
364
365
|
- lib/tetra/packages/package.rb
|
@@ -367,7 +368,6 @@ files:
|
|
367
368
|
- lib/tetra/pom.rb
|
368
369
|
- lib/tetra/pom_getter.rb
|
369
370
|
- lib/tetra/project.rb
|
370
|
-
- lib/tetra/ui/ant_subcommand.rb
|
371
371
|
- lib/tetra/ui/dry_run_subcommand.rb
|
372
372
|
- lib/tetra/ui/generate_all_subcommand.rb
|
373
373
|
- lib/tetra/ui/generate_archive_subcommand.rb
|
@@ -376,8 +376,8 @@ files:
|
|
376
376
|
- lib/tetra/ui/generate_spec_subcommand.rb
|
377
377
|
- lib/tetra/ui/get_pom_subcommand.rb
|
378
378
|
- lib/tetra/ui/init_subcommand.rb
|
379
|
+
- lib/tetra/ui/main.rb
|
379
380
|
- lib/tetra/ui/move_jars_to_kit_subcommand.rb
|
380
|
-
- lib/tetra/ui/mvn_subcommand.rb
|
381
381
|
- lib/tetra/ui/patch_subcommand.rb
|
382
382
|
- lib/tetra/ui/subcommand.rb
|
383
383
|
- lib/tetra/version.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Tetra
|
4
|
-
# tetra ant
|
5
|
-
class AntSubcommand < Tetra::Subcommand
|
6
|
-
parameter "[ANT OPTIONS] ...", "ant options", attribute_name: "dummy"
|
7
|
-
|
8
|
-
# options will be parsed by ant
|
9
|
-
def parse(args)
|
10
|
-
bypass_parsing(args)
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute
|
14
|
-
checking_exceptions do
|
15
|
-
project = Tetra::Project.new(".")
|
16
|
-
ensure_dry_running(:is_in_progress, project) do
|
17
|
-
path = Tetra::Kit.new(project).find_executable("ant")
|
18
|
-
Tetra::Ant.new(project.full_path, path).ant(@options)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Tetra
|
4
|
-
# tetra mvn
|
5
|
-
class MvnSubcommand < Tetra::Subcommand
|
6
|
-
parameter "[MAVEN OPTIONS] ...", "mvn options", attribute_name: "dummy"
|
7
|
-
|
8
|
-
# options will be parsed by mvn
|
9
|
-
def parse(args)
|
10
|
-
bypass_parsing(args)
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute
|
14
|
-
checking_exceptions do
|
15
|
-
project = Tetra::Project.new(".")
|
16
|
-
ensure_dry_running(:is_in_progress, project) do
|
17
|
-
path = Tetra::Kit.new(project).find_executable("mvn")
|
18
|
-
Tetra::Mvn.new(project.full_path, path).mvn(@options)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|