tetra 0.46.0 → 0.48.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rubocop.yml +6 -0
- data/README.md +5 -12
- data/SPECIAL_CASES.md +3 -74
- data/integration-tests/build-commons.sh +5 -8
- data/lib/template/kit/CONTENTS +4 -3
- data/lib/template/kit/apache-ant-1.9.4/INSTALL +2 -0
- data/lib/template/kit/apache-ant-1.9.4/KEYS +1497 -0
- data/lib/template/kit/apache-ant-1.9.4/LICENSE +272 -0
- data/lib/template/kit/apache-ant-1.9.4/NOTICE +9 -0
- data/lib/template/kit/apache-ant-1.9.4/README +97 -0
- data/lib/template/kit/apache-ant-1.9.4/WHATSNEW +6108 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/ant +336 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/ant.bat +218 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/ant.cmd +93 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/antRun +24 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/antRun.bat +50 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/antRun.pl +66 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/antenv.cmd +98 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/complete-ant-cmd.pl +114 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/envset.cmd +131 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/lcp.bat +31 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/runant.pl +153 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/runant.py +102 -0
- data/lib/template/kit/apache-ant-1.9.4/bin/runrc.cmd +60 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/ant-bootstrap.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/changelog.xsl +148 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/checkstyle/checkstyle-frames.xsl +299 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/checkstyle/checkstyle-text.xsl +34 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/checkstyle/checkstyle-xdoc.xsl +130 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/coverage-frames.xsl +489 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/jdepend-frames.xsl +487 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/jdepend.xsl +276 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/junit-frames-xalan1.xsl +745 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/junit-frames.xsl +955 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/junit-noframes.xsl +496 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/log.xsl +203 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/maudit-frames.xsl +503 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/mmetrics-frames.xsl +1026 -0
- data/lib/template/kit/apache-ant-1.9.4/etc/tagdiff.xsl +179 -0
- data/lib/template/kit/apache-ant-1.9.4/fetch.xml +335 -0
- data/lib/template/kit/apache-ant-1.9.4/get-m2.xml +121 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/README +3 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-antlr.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-antlr.pom +75 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bcel.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bcel.pom +71 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bsf.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bsf.pom +74 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-log4j.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-log4j.pom +69 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-oro.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-oro.pom +74 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-regexp.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-regexp.pom +70 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-resolver.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-resolver.pom +69 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-xalan2.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-xalan2.pom +94 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-logging.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-logging.pom +70 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-net.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-net.pom +75 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jai.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jai.pom +85 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-javamail.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-javamail.pom +78 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jdepend.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jdepend.pom +72 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jmf.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jmf.pom +65 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jsch.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-jsch.pom +74 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit.pom +101 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit4.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit4.pom +71 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-launcher.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-launcher.pom +57 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-netrexx.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-netrexx.pom +98 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-parent.pom +151 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-swing.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-swing.pom +66 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-testutil.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant-testutil.pom +74 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant.jar +0 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/ant.pom +225 -0
- data/lib/template/kit/apache-ant-1.9.4/lib/libraries.properties +65 -0
- data/lib/template/kit/apache-maven-3.2.5/LICENSE +302 -0
- data/lib/template/kit/apache-maven-3.2.5/NOTICE +8 -0
- data/lib/template/kit/apache-maven-3.2.5/README.txt +77 -0
- data/lib/template/kit/apache-maven-3.2.5/bin/m2.conf +8 -0
- data/lib/template/kit/apache-maven-3.2.5/bin/mvn +202 -0
- data/lib/template/kit/apache-maven-3.2.5/bin/mvn.bat +197 -0
- data/lib/template/kit/apache-maven-3.2.5/bin/mvnDebug +200 -0
- data/lib/template/kit/apache-maven-3.2.5/bin/mvnDebug.bat +200 -0
- data/lib/template/kit/apache-maven-3.2.5/bin/mvnyjp +207 -0
- data/lib/template/kit/apache-maven-3.2.5/boot/plexus-classworlds-2.5.2.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/conf/logging/simplelogger.properties +25 -0
- data/lib/template/kit/apache-maven-3.2.5/conf/settings.xml +257 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-api-1.0.0.v20140518.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-api.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-connector-basic-1.0.0.v20140518.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-connector-basic.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-impl-1.0.0.v20140518.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-impl.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-spi-1.0.0.v20140518.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-spi.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-transport-wagon-1.0.0.v20140518.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-transport-wagon.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-util-1.0.0.v20140518.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aether-util.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/aopalliance-1.0.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/cdi-api-1.0.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/cdi-api.license +445 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/commons-cli-1.2.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/commons-io-2.2.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/commons-lang-2.6.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/ext/README.txt +2 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/guava-18.0.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/javax.inject-1.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/jsoup-1.7.2.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/jsoup.license +66 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/jsr250-api-1.0.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/jsr250-api.license +406 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-aether-provider-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-aether-provider.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-artifact-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-artifact.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-compat-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-compat.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-core-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-core.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-embedder-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-embedder.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-model-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-model-builder-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-model-builder.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-model.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-plugin-api-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-plugin-api.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-repository-metadata-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-repository-metadata.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings-builder-3.2.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings-builder.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.inject-0.3.0.M1.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.inject.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus-0.3.0.M1.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus.license +261 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-cipher-1.7.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-cipher.license +445 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-component-annotations-1.5.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-interpolation-1.21.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-sec-dispatcher-1.3.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-sec-dispatcher.license +445 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/plexus-utils-3.0.20.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/sisu-guice-3.2.3-no_aop.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-api-1.7.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-api.license +190 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-simple-1.7.5.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-simple.license +190 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-file-2.8.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-file.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http-2.8-shaded.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http-shared-2.8.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http-shared.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http.license +202 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-provider-api-2.8.jar +0 -0
- data/lib/template/kit/apache-maven-3.2.5/lib/wagon-provider-api.license +202 -0
- data/lib/tetra.rb +30 -29
- data/lib/tetra/facades/ant.rb +27 -0
- data/lib/tetra/{git.rb → facades/git.rb} +29 -24
- data/lib/tetra/facades/mvn.rb +44 -0
- data/lib/tetra/facades/process_runner.rb +65 -0
- data/lib/tetra/facades/tar.rb +20 -0
- data/lib/tetra/{kit_runner.rb → kit.rb} +3 -10
- data/lib/tetra/main.rb +12 -36
- data/lib/tetra/maven_website.rb +1 -1
- data/lib/tetra/packages/archivable.rb +3 -11
- data/lib/tetra/packages/{kit.rb → kit_package.rb} +1 -1
- data/lib/tetra/packages/{built_package.rb → package.rb} +2 -2
- data/lib/tetra/packages/scriptable.rb +27 -15
- data/lib/tetra/project.rb +18 -14
- data/lib/tetra/{commands/ant.rb → ui/ant_subcommand.rb} +5 -5
- data/lib/tetra/ui/dry_run_subcommand.rb +44 -0
- data/lib/tetra/{commands/generate_all.rb → ui/generate_all_subcommand.rb} +5 -5
- data/lib/tetra/{commands/generate_archive.rb → ui/generate_archive_subcommand.rb} +2 -2
- data/lib/tetra/{commands/generate_kit.rb → ui/generate_kit_subcommand.rb} +2 -2
- data/lib/tetra/{commands/generate_script.rb → ui/generate_script_subcommand.rb} +2 -2
- data/lib/tetra/{commands/generate_spec.rb → ui/generate_spec_subcommand.rb} +2 -2
- data/lib/tetra/{commands/get_pom.rb → ui/get_pom_subcommand.rb} +1 -1
- data/lib/tetra/{commands/init.rb → ui/init_subcommand.rb} +1 -1
- data/lib/tetra/{commands/move_jars_to_kit.rb → ui/move_jars_to_kit_subcommand.rb} +1 -1
- data/lib/tetra/{commands/mvn.rb → ui/mvn_subcommand.rb} +5 -5
- data/lib/tetra/{commands/base.rb → ui/subcommand.rb} +19 -6
- data/lib/tetra/version.rb +1 -1
- data/spec/lib/ant_spec.rb +36 -0
- data/spec/lib/archivable_spec.rb +1 -1
- data/spec/lib/built_package_spec.rb +6 -6
- data/spec/lib/kit_package_spec.rb +47 -0
- data/spec/lib/kit_spec.rb +8 -28
- data/spec/lib/mvn_spec.rb +47 -0
- data/spec/lib/project_spec.rb +11 -11
- data/spec/lib/scriptable_spec.rb +8 -16
- data/spec/spec_helper.rb +13 -4
- data/tetra.gemspec +1 -0
- metadata +207 -31
- data/lib/tetra/ant_runner.rb +0 -27
- data/lib/tetra/commands/download_maven_source_jars.rb +0 -29
- data/lib/tetra/commands/dry_run.rb +0 -17
- data/lib/tetra/commands/finish.rb +0 -22
- data/lib/tetra/commands/get_source.rb +0 -30
- data/lib/tetra/commands/list_kit_missing_sources.rb +0 -21
- data/lib/tetra/kit_checker.rb +0 -104
- data/lib/tetra/maven_runner.rb +0 -43
- data/lib/tetra/source_getter.rb +0 -41
- data/spec/lib/ant_runner_spec.rb +0 -45
- data/spec/lib/kit_checker_spec.rb +0 -119
- data/spec/lib/maven_runner_spec.rb +0 -68
- data/spec/lib/source_getter_spec.rb +0 -36
- data/spec/support/kit_runner_examples.rb +0 -15
data/lib/tetra/maven_website.rb
CHANGED
@@ -53,7 +53,7 @@ module Tetra
|
|
53
53
|
def download_pom(group_id, artifact_id, version)
|
54
54
|
path = "#{group_id.gsub('.', '/')}/#{artifact_id}/#{version}/#{artifact_id}-#{version}.pom"
|
55
55
|
log.debug("downloading #{path}...")
|
56
|
-
(RestClient.get
|
56
|
+
(RestClient.get("http://search.maven.org/remotecontent", params: { filepath: path })).to_s
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -9,17 +9,9 @@ module Tetra
|
|
9
9
|
# this will archive files in source_dir in
|
10
10
|
# destination_dir/name/name.tar.xz
|
11
11
|
def _to_archive(project, name, source_dir, destination_dir)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
project.from_directory(source_dir) do
|
17
|
-
destination_path = File.join(full_destination_dir, "#{name}.tar.xz")
|
18
|
-
log.debug "tarring to #{destination_path}"
|
19
|
-
|
20
|
-
`tar -cJf #{destination_path} *`
|
21
|
-
|
22
|
-
destination_path
|
12
|
+
project.from_directory do
|
13
|
+
full_destination_dir = File.join(destination_dir, name)
|
14
|
+
Tetra::Tar.new.archive(name, source_dir, full_destination_dir)
|
23
15
|
end
|
24
16
|
end
|
25
17
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# represents a Java project packaged in tetra
|
5
|
-
class
|
5
|
+
class Package
|
6
6
|
extend Forwardable
|
7
7
|
include Archivable
|
8
8
|
include Speccable
|
@@ -20,7 +20,7 @@ module Tetra
|
|
20
20
|
|
21
21
|
def initialize(project, pom_path = nil, filter = nil)
|
22
22
|
@project = project
|
23
|
-
@kit = Tetra::
|
23
|
+
@kit = Tetra::KitPackage.new(project)
|
24
24
|
@pom = pom_path.nil? ? nil : Tetra::Pom.new(pom_path)
|
25
25
|
@filter = filter
|
26
26
|
end
|
@@ -3,18 +3,16 @@
|
|
3
3
|
module Tetra
|
4
4
|
# generates a package build script from bash_history
|
5
5
|
module Scriptable
|
6
|
+
# returns a build script for this package
|
6
7
|
def _to_script(project, history_path)
|
7
|
-
ant_runner = Tetra::AntRunner.new(project)
|
8
|
-
maven_runner = Tetra::MavenRunner.new(project)
|
9
|
-
|
10
8
|
project.from_directory do
|
11
9
|
history_lines = File.readlines(history_path).map(&:strip)
|
12
10
|
relevant_lines =
|
13
11
|
history_lines
|
14
12
|
.reverse
|
15
|
-
.take_while { |e| e.match(/tetra +dry-run/).nil? }
|
13
|
+
.take_while { |e| e.match(/tetra +dry-run +start/).nil? }
|
16
14
|
.reverse
|
17
|
-
.take_while { |e| e.match(/tetra +finish/).nil? }
|
15
|
+
.take_while { |e| e.match(/tetra +dry-run +finish/).nil? }
|
18
16
|
.select { |e| e.match(/^#/).nil? }
|
19
17
|
|
20
18
|
script_lines = [
|
@@ -22,16 +20,7 @@ module Tetra
|
|
22
20
|
"set -xe",
|
23
21
|
"PROJECT_PREFIX=`readlink -e .`",
|
24
22
|
"cd #{project.latest_dry_run_directory}"
|
25
|
-
] +
|
26
|
-
relevant_lines.map do |line|
|
27
|
-
if line =~ /tetra +mvn/
|
28
|
-
line.gsub(/tetra +mvn/, "#{maven_runner.get_maven_commandline('$PROJECT_PREFIX', ['-o'])}")
|
29
|
-
elsif line =~ /tetra +ant/
|
30
|
-
line.gsub(/tetra +ant/, "#{ant_runner.get_ant_commandline('$PROJECT_PREFIX')}")
|
31
|
-
else
|
32
|
-
line
|
33
|
-
end
|
34
|
-
end
|
23
|
+
] + script_body(project, relevant_lines)
|
35
24
|
|
36
25
|
new_content = script_lines.join("\n") + "\n"
|
37
26
|
|
@@ -44,5 +33,28 @@ module Tetra
|
|
44
33
|
[result_path, conflict_count]
|
45
34
|
end
|
46
35
|
end
|
36
|
+
|
37
|
+
# returns the script body
|
38
|
+
def script_body(project, relevant_lines)
|
39
|
+
ant = if relevant_lines.any? { |e| e.match(/tetra +ant/) }
|
40
|
+
path = Tetra::Kit.new(project).find_executable("ant")
|
41
|
+
Tetra::Ant.new(project.full_path, path).ant(@options)
|
42
|
+
end
|
43
|
+
|
44
|
+
mvn = if relevant_lines.any? { |e| e.match(/tetra +mvn/) }
|
45
|
+
mvn_path = Tetra::Kit.new(project).find_executable("mvn")
|
46
|
+
mvn = Tetra::Mvn.new("$PROJECT_PREFIX", mvn_path)
|
47
|
+
end
|
48
|
+
|
49
|
+
relevant_lines.map do |line|
|
50
|
+
if line =~ /tetra +mvn/
|
51
|
+
line.gsub(/tetra +mvn/, "#{mvn.get_mvn_commandline(['-o'])}")
|
52
|
+
elsif line =~ /tetra +ant/
|
53
|
+
line.gsub(/tetra +ant/, "#{ant.get_ant_commandline([])}")
|
54
|
+
else
|
55
|
+
line
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
47
59
|
end
|
48
60
|
end
|
data/lib/tetra/project.rb
CHANGED
@@ -5,8 +5,7 @@ module Tetra
|
|
5
5
|
class Project
|
6
6
|
include Logging
|
7
7
|
|
8
|
-
|
9
|
-
attr_accessor :git
|
8
|
+
attr_reader :full_path
|
10
9
|
|
11
10
|
def initialize(path)
|
12
11
|
@full_path = Tetra::Project.find_project_dir(File.expand_path(path))
|
@@ -89,21 +88,26 @@ module Tetra
|
|
89
88
|
latest_tag_count(:dry_run_started) > latest_tag_count(:dry_run_finished)
|
90
89
|
end
|
91
90
|
|
92
|
-
# ends a dry-run
|
93
|
-
#
|
94
|
-
|
95
|
-
def finish(abort)
|
91
|
+
# ends a dry-run assuming a successful build
|
92
|
+
# reverts sources and updates output file lists
|
93
|
+
def finish
|
96
94
|
if dry_running?
|
97
|
-
|
98
|
-
@git.revert_whole_directory(".", latest_tag(:dry_run_started))
|
99
|
-
@git.delete_tag(latest_tag(:dry_run_started))
|
100
|
-
else
|
101
|
-
take_snapshot("Changes during dry-run", :dry_run_changed)
|
95
|
+
take_snapshot("Changes during dry-run", :dry_run_changed)
|
102
96
|
|
103
|
-
|
97
|
+
@git.revert_whole_directory("src", latest_tag(:dry_run_started))
|
104
98
|
|
105
|
-
|
106
|
-
|
99
|
+
take_snapshot("Dry run finished", :dry_run_finished)
|
100
|
+
return true
|
101
|
+
end
|
102
|
+
false
|
103
|
+
end
|
104
|
+
|
105
|
+
# ends a dry-run assuming the built went wrong
|
106
|
+
# reverts the whole project directory
|
107
|
+
def abort
|
108
|
+
if dry_running?
|
109
|
+
@git.revert_whole_directory(".", latest_tag(:dry_run_started))
|
110
|
+
@git.delete_tag(latest_tag(:dry_run_started))
|
107
111
|
return true
|
108
112
|
end
|
109
113
|
false
|
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra ant
|
5
|
-
class
|
5
|
+
class AntSubcommand < Tetra::Subcommand
|
6
6
|
parameter "[ANT OPTIONS] ...", "ant options", attribute_name: "dummy"
|
7
7
|
|
8
|
-
#
|
9
|
-
# rubocop:disable TrivialAccessors
|
8
|
+
# options will be parsed by ant
|
10
9
|
def parse(args)
|
11
|
-
|
10
|
+
bypass_parsing(args)
|
12
11
|
end
|
13
12
|
|
14
13
|
def execute
|
15
14
|
checking_exceptions do
|
16
15
|
project = Tetra::Project.new(".")
|
17
16
|
ensure_dry_running(true, project) do
|
18
|
-
Tetra::
|
17
|
+
path = Tetra::Kit.new(project).find_executable("ant")
|
18
|
+
Tetra::Ant.new(project.full_path, path).ant(@options)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module Tetra
|
4
|
+
# tetra dry-run
|
5
|
+
class DryRunSubcommand < Tetra::Subcommand
|
6
|
+
parameter "COMMAND", "\"start\" to begin, \"finish\" to end or \"abort\" to undo changes" do |command|
|
7
|
+
if %w(start finish abort).include?(command)
|
8
|
+
command
|
9
|
+
else
|
10
|
+
fail ArgumentError, "\"#{command}\" is not valid, must be one of \"start\", \"finish\" or \"abort\""
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute
|
15
|
+
checking_exceptions do
|
16
|
+
project = Tetra::Project.new(".")
|
17
|
+
|
18
|
+
if command == "start"
|
19
|
+
if project.dry_run
|
20
|
+
puts "Now dry-running, please start your build."
|
21
|
+
puts "To run a Maven installation from the kit, use \"tetra mvn\"."
|
22
|
+
puts "If the build succeedes end this dry run with \"tetra dry-run finish\"."
|
23
|
+
puts "If the build does not succeed use \"tetra dry-run abort\" to undo any change."
|
24
|
+
else
|
25
|
+
puts "Dry-run already in progress."
|
26
|
+
puts "Use \"tetra dry-run finish\" to end it or \"tetra dry-run abort\" to undo changes."
|
27
|
+
end
|
28
|
+
elsif command == "finish"
|
29
|
+
if project.finish
|
30
|
+
puts "Dry-run finished."
|
31
|
+
else
|
32
|
+
puts "No dry-run is in progress."
|
33
|
+
end
|
34
|
+
elsif command == "abort"
|
35
|
+
if project.abort
|
36
|
+
puts "Project reverted as before dry-run."
|
37
|
+
else
|
38
|
+
puts "No dry-run is in progress."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra generate-all
|
5
|
-
class
|
5
|
+
class GenerateAllSubcommand < Tetra::Subcommand
|
6
6
|
option %w(-f --filter), "FILTER", "filter files to be installed by this package spec", default: "*.jar"
|
7
7
|
parameter "[POM]", "a package pom file path", default: "pom.xml"
|
8
8
|
|
@@ -10,13 +10,13 @@ module Tetra
|
|
10
10
|
checking_exceptions do
|
11
11
|
project = Tetra::Project.new(".")
|
12
12
|
ensure_dry_running(false, project) do
|
13
|
-
|
13
|
+
GenerateKitSubcommand.new(@invocation_path).execute
|
14
14
|
|
15
|
-
|
15
|
+
GenerateScriptSubcommand.new(@invocation_path).execute
|
16
16
|
|
17
|
-
|
17
|
+
GenerateArchiveSubcommand.new(@invocation_path).execute
|
18
18
|
|
19
|
-
command =
|
19
|
+
command = GenerateSpecSubcommand.new(@invocation_path)
|
20
20
|
command.filter = filter
|
21
21
|
command.pom = pom
|
22
22
|
command.execute
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra generate-archive
|
5
|
-
class
|
5
|
+
class GenerateArchiveSubcommand < Tetra::Subcommand
|
6
6
|
def execute
|
7
7
|
checking_exceptions do
|
8
8
|
project = Tetra::Project.new(".")
|
9
9
|
ensure_dry_running(false, project) do
|
10
|
-
result_path = Tetra::
|
10
|
+
result_path = Tetra::Package.new(project).to_archive
|
11
11
|
print_generation_result(project, result_path)
|
12
12
|
end
|
13
13
|
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra generate-kit
|
5
|
-
class
|
5
|
+
class GenerateKitSubcommand < Tetra::Subcommand
|
6
6
|
def execute
|
7
7
|
checking_exceptions do
|
8
8
|
project = Tetra::Project.new(".")
|
9
9
|
ensure_dry_running(false, project) do
|
10
|
-
kit = Tetra::
|
10
|
+
kit = Tetra::KitPackage.new(project)
|
11
11
|
result_path, conflict_count = kit.to_spec
|
12
12
|
print_generation_result(project, result_path, conflict_count)
|
13
13
|
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra generate-script
|
5
|
-
class
|
5
|
+
class GenerateScriptSubcommand < Tetra::Subcommand
|
6
6
|
def execute
|
7
7
|
checking_exceptions do
|
8
8
|
project = Tetra::Project.new(".")
|
9
9
|
ensure_dry_running(false, project) do
|
10
10
|
history = File.join(Dir.home, ".bash_history")
|
11
11
|
result_path, conflict_count =
|
12
|
-
Tetra::
|
12
|
+
Tetra::Package.new(project).to_script(history)
|
13
13
|
print_generation_result(project, result_path, conflict_count)
|
14
14
|
end
|
15
15
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra generate-spec
|
5
|
-
class
|
5
|
+
class GenerateSpecSubcommand < Tetra::Subcommand
|
6
6
|
option %w(-f --filter), "FILTER", "filter files to be installed by this spec", default: "*.jar"
|
7
7
|
parameter "[POM]", "a pom file path", default: "pom.xml"
|
8
8
|
|
@@ -11,7 +11,7 @@ module Tetra
|
|
11
11
|
project = Tetra::Project.new(".")
|
12
12
|
ensure_dry_running(false, project) do
|
13
13
|
result_path, conflict_count =
|
14
|
-
Tetra::
|
14
|
+
Tetra::Package.new(project, pom, filter).to_spec
|
15
15
|
print_generation_result(project, result_path, conflict_count)
|
16
16
|
end
|
17
17
|
end
|
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# tetra mvn
|
5
|
-
class
|
5
|
+
class MvnSubcommand < Tetra::Subcommand
|
6
6
|
parameter "[MAVEN OPTIONS] ...", "mvn options", attribute_name: "dummy"
|
7
7
|
|
8
|
-
#
|
9
|
-
# rubocop:disable TrivialAccessors
|
8
|
+
# options will be parsed by mvn
|
10
9
|
def parse(args)
|
11
|
-
|
10
|
+
bypass_parsing(args)
|
12
11
|
end
|
13
12
|
|
14
13
|
def execute
|
15
14
|
checking_exceptions do
|
16
15
|
project = Tetra::Project.new(".")
|
17
16
|
ensure_dry_running(true, project) do
|
18
|
-
Tetra::
|
17
|
+
path = Tetra::Kit.new(project).find_executable("mvn")
|
18
|
+
Tetra::Mvn.new(project.full_path, path).mvn(@options)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
module Tetra
|
4
4
|
# implements common options and utility methods
|
5
|
-
class
|
5
|
+
class Subcommand < Clamp::Command
|
6
6
|
include Logging
|
7
7
|
|
8
8
|
# Options available to all tetra commands
|
9
|
-
option
|
10
|
-
option
|
11
|
-
option
|
9
|
+
option "--verbose", :flag, "verbose output"
|
10
|
+
option "--very-verbose", :flag, "very verbose output"
|
11
|
+
option "--very-very-verbose", :flag, "very very verbose output"
|
12
12
|
|
13
13
|
# verbosity handlers
|
14
14
|
def very_very_verbose=(flag)
|
@@ -36,15 +36,24 @@ module Tetra
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
# override default option parsing to pass options to other commands
|
40
|
+
def bypass_parsing(args)
|
41
|
+
log.level = ::Logger::WARN if args.delete "--verbose"
|
42
|
+
log.level = ::Logger::INFO if args.delete "--very-verbose"
|
43
|
+
log.level = ::Logger::DEBUG if args.delete "--very-very-verbose"
|
44
|
+
|
45
|
+
@options = args
|
46
|
+
end
|
47
|
+
|
39
48
|
# prints an error message and exits unless there is a dry-run in progress
|
40
49
|
def ensure_dry_running(state, project)
|
41
50
|
if project.dry_running? == state
|
42
51
|
yield
|
43
52
|
else
|
44
53
|
if state == true
|
45
|
-
puts "Please start a dry-run first, use \"tetra dry-run\""
|
54
|
+
puts "Please start a dry-run first, use \"tetra dry-run start\""
|
46
55
|
else
|
47
|
-
puts "Please finish or abort this dry-run first, use \"tetra finish\" or \"tetra
|
56
|
+
puts "Please finish or abort this dry-run first, use \"tetra dry-run finish\" or \"tetra dry-run abort\""
|
48
57
|
end
|
49
58
|
end
|
50
59
|
end
|
@@ -82,6 +91,10 @@ module Tetra
|
|
82
91
|
$stderr.puts "This directory is already a tetra project"
|
83
92
|
rescue ExecutableNotFoundError => e
|
84
93
|
$stderr.puts "Executable #{e.executable} not found in kit/ or any of its subdirectories"
|
94
|
+
rescue ExecutionFailed => e
|
95
|
+
$stderr.puts "Failed to run `#{e.commandline}` (exit status #{e.status})"
|
96
|
+
rescue Interrupt
|
97
|
+
$stderr.puts "Execution interrupted by the user"
|
85
98
|
end
|
86
99
|
end
|
87
100
|
end
|