tetra 0.48.0 → 0.49.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/SPECIAL_CASES.md +1 -1
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/INSTALL +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/KEYS +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/LICENSE +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/NOTICE +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/README +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/WHATSNEW +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/ant +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/ant.bat +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/ant.cmd +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antRun +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antRun.bat +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antRun.pl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/antenv.cmd +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/complete-ant-cmd.pl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/envset.cmd +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/lcp.bat +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/runant.pl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/runant.py +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/bin/runrc.cmd +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/ant-bootstrap.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/changelog.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/checkstyle/checkstyle-frames.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/checkstyle/checkstyle-text.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/checkstyle/checkstyle-xdoc.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/coverage-frames.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/jdepend-frames.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/jdepend.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/junit-frames-xalan1.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/junit-frames.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/junit-noframes.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/log.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/maudit-frames.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/mmetrics-frames.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/etc/tagdiff.xsl +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/fetch.xml +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/get-m2.xml +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/README +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-antlr.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-antlr.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bcel.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bcel.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bsf.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-bsf.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-log4j.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-log4j.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-oro.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-oro.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-regexp.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-regexp.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-resolver.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-resolver.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-xalan2.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-apache-xalan2.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-logging.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-logging.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-net.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-commons-net.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jai.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jai.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-javamail.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-javamail.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jdepend.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jdepend.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jmf.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jmf.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jsch.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-jsch.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit4.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-junit4.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-launcher.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-launcher.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-netrexx.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-netrexx.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-parent.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-swing.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-swing.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-testutil.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant-testutil.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant.jar +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/ant.pom +0 -0
- data/lib/template/{kit → bundled}/apache-ant-1.9.4/lib/libraries.properties +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/LICENSE +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/NOTICE +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/README.txt +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/m2.conf +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvn +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvn.bat +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvnDebug +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvnDebug.bat +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/bin/mvnyjp +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/boot/plexus-classworlds-2.5.2.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/conf/logging/simplelogger.properties +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/conf/settings.xml +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-api-1.0.0.v20140518.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-api.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-connector-basic-1.0.0.v20140518.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-connector-basic.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-impl-1.0.0.v20140518.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-impl.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-spi-1.0.0.v20140518.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-spi.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-transport-wagon-1.0.0.v20140518.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-transport-wagon.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-util-1.0.0.v20140518.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aether-util.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/aopalliance-1.0.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/cdi-api-1.0.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/cdi-api.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/commons-cli-1.2.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/commons-io-2.2.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/commons-lang-2.6.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/ext/README.txt +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/guava-18.0.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/javax.inject-1.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsoup-1.7.2.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsoup.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsr250-api-1.0.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/jsr250-api.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-aether-provider-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-aether-provider.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-artifact-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-artifact.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-compat-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-compat.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-core-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-core.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-embedder-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-embedder.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model-builder-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model-builder.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-model.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-plugin-api-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-plugin-api.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-repository-metadata-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-repository-metadata.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings-builder-3.2.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings-builder.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/maven-settings.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.inject-0.3.0.M1.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.inject.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus-0.3.0.M1.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-cipher-1.7.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-cipher.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-component-annotations-1.5.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-interpolation-1.21.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-sec-dispatcher-1.3.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-sec-dispatcher.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/plexus-utils-3.0.20.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/sisu-guice-3.2.3-no_aop.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-api-1.7.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-api.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-simple-1.7.5.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/slf4j-simple.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-file-2.8.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-file.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http-2.8-shaded.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http-shared-2.8.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http-shared.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-http.license +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-provider-api-2.8.jar +0 -0
- data/lib/template/{kit → bundled}/apache-maven-3.2.5/lib/wagon-provider-api.license +0 -0
- data/lib/tetra/facades/git.rb +59 -70
- data/lib/tetra/facades/process_runner.rb +10 -9
- data/lib/tetra/packages/kit_package.rb +1 -2
- data/lib/tetra/packages/package.rb +1 -1
- data/lib/tetra/packages/scriptable.rb +1 -1
- data/lib/tetra/packages/speccable.rb +1 -1
- data/lib/tetra/pom.rb +5 -1
- data/lib/tetra/project.rb +64 -65
- data/lib/tetra/version.rb +1 -1
- data/spec/lib/built_package_spec.rb +1 -1
- data/spec/lib/git_spec.rb +23 -28
- data/spec/lib/project_spec.rb +30 -12
- data/spec/lib/scriptable_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +168 -168
@@ -6,9 +6,9 @@ module Tetra
|
|
6
6
|
include Logging
|
7
7
|
|
8
8
|
# runs an external executable and returns its output as a string
|
9
|
-
# raises ExecutionFailed if the exit status is not 0
|
9
|
+
# raises ExecutionFailed if the exit status is not 0
|
10
10
|
# optionally echoes the executable's output/error to standard output/error
|
11
|
-
def run(commandline, echo = false
|
11
|
+
def run(commandline, echo = false)
|
12
12
|
log.debug "running `#{commandline}`"
|
13
13
|
|
14
14
|
out_recorder = echo ? RecordingIO.new(STDOUT) : RecordingIO.new
|
@@ -19,14 +19,15 @@ module Tetra
|
|
19
19
|
log.debug "`#{commandline}` exited with status #{status}"
|
20
20
|
|
21
21
|
if status != 0
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
log.warn("
|
27
|
-
log.warn(
|
28
|
-
|
22
|
+
log.warn("`#{commandline}` failed with status #{status}")
|
23
|
+
out = out_recorder.record
|
24
|
+
err = err_recorder.record
|
25
|
+
if out != "" || err != ""
|
26
|
+
log.warn("Output follows:")
|
27
|
+
log.warn(out) unless out == ""
|
28
|
+
log.warn(err) unless err == ""
|
29
29
|
end
|
30
|
+
fail ExecutionFailed.new(commandline, status)
|
30
31
|
end
|
31
32
|
|
32
33
|
out_recorder.record
|
@@ -8,14 +8,13 @@ module Tetra
|
|
8
8
|
include Speccable
|
9
9
|
|
10
10
|
attr_reader :name
|
11
|
-
|
11
|
+
def_delegator :@project, :version
|
12
12
|
def_delegator :@project, :name, :project_name
|
13
13
|
|
14
14
|
def initialize(project)
|
15
15
|
@project = project
|
16
16
|
|
17
17
|
@name = "#{project.name}-kit"
|
18
|
-
@version = "#{project.version}"
|
19
18
|
end
|
20
19
|
|
21
20
|
def to_archive
|
@@ -28,7 +28,7 @@ module Tetra
|
|
28
28
|
FileUtils.mkdir_p(result_dir)
|
29
29
|
result_path = File.join(result_dir, "build.sh")
|
30
30
|
conflict_count = project.merge_new_content(new_content, result_path, "Build script generated",
|
31
|
-
"
|
31
|
+
"script")
|
32
32
|
|
33
33
|
[result_path, conflict_count]
|
34
34
|
end
|
@@ -18,7 +18,7 @@ module Tetra
|
|
18
18
|
new_content = generate(template_spec_name, binding)
|
19
19
|
label = "Spec for #{name} generated"
|
20
20
|
conflict_count = project.merge_new_content(new_content, spec_path,
|
21
|
-
label, "
|
21
|
+
label, "#{name}-spec")
|
22
22
|
[spec_path, conflict_count]
|
23
23
|
end
|
24
24
|
end
|
data/lib/tetra/pom.rb
CHANGED
@@ -4,7 +4,11 @@ module Tetra
|
|
4
4
|
# encapsulates a pom.xml file
|
5
5
|
class Pom
|
6
6
|
def initialize(filename)
|
7
|
-
@doc = Nokogiri::XML(
|
7
|
+
@doc = Nokogiri::XML(
|
8
|
+
if filename && File.file?(filename)
|
9
|
+
open(filename).read
|
10
|
+
end
|
11
|
+
)
|
8
12
|
@doc.remove_namespaces!
|
9
13
|
end
|
10
14
|
|
data/lib/tetra/project.rb
CHANGED
@@ -5,6 +5,9 @@ module Tetra
|
|
5
5
|
class Project
|
6
6
|
include Logging
|
7
7
|
|
8
|
+
# path of the project template files
|
9
|
+
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "..", "template")
|
10
|
+
|
8
11
|
attr_reader :full_path
|
9
12
|
|
10
13
|
def initialize(path)
|
@@ -17,7 +20,7 @@ module Tetra
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def version
|
20
|
-
|
23
|
+
@git.latest_id("tetra: dry-run-finished")
|
21
24
|
end
|
22
25
|
|
23
26
|
def packages_dir
|
@@ -44,31 +47,43 @@ module Tetra
|
|
44
47
|
end
|
45
48
|
|
46
49
|
# inits a new project directory structure
|
47
|
-
def self.init(dir)
|
50
|
+
def self.init(dir, include_bundled_software = true)
|
48
51
|
Dir.chdir(dir) do
|
49
52
|
Tetra::Git.new(".").init
|
50
53
|
|
51
54
|
FileUtils.mkdir_p("src")
|
52
55
|
FileUtils.mkdir_p("kit")
|
53
56
|
|
54
|
-
# populate the project with templates and
|
57
|
+
# populate the project with templates and commit it
|
55
58
|
project = Project.new(".")
|
56
59
|
|
57
|
-
|
60
|
+
project.template_files(include_bundled_software).each do |source, destination|
|
61
|
+
FileUtils.cp_r(File.join(TEMPLATE_PATH, source), destination)
|
62
|
+
end
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
"src" => ".",
|
63
|
-
"gitignore" => ".gitignore"
|
64
|
-
}
|
64
|
+
project.commit_whole_project("Template files added")
|
65
|
+
end
|
66
|
+
end
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
+
# returns a hash that maps filenames that should be copied from TEMPLATE_PATH
|
69
|
+
# to the value directory
|
70
|
+
def template_files(include_bundled_software)
|
71
|
+
result = {
|
72
|
+
"kit" => ".",
|
73
|
+
"packages" => ".",
|
74
|
+
"src" => ".",
|
75
|
+
"gitignore" => ".gitignore"
|
76
|
+
}
|
77
|
+
|
78
|
+
if include_bundled_software
|
79
|
+
Dir.chdir(TEMPLATE_PATH) do
|
80
|
+
Dir.glob(File.join("bundled", "*")).each do |file|
|
81
|
+
result[file] = "kit"
|
82
|
+
end
|
68
83
|
end
|
69
|
-
|
70
|
-
project.take_snapshot("Template files added", :init)
|
71
84
|
end
|
85
|
+
|
86
|
+
result
|
72
87
|
end
|
73
88
|
|
74
89
|
# starts a dry running phase: files added to kit/ will be added
|
@@ -79,24 +94,25 @@ module Tetra
|
|
79
94
|
|
80
95
|
current_directory = Pathname.new(Dir.pwd).relative_path_from(Pathname.new(@full_path))
|
81
96
|
|
82
|
-
|
97
|
+
commit_whole_project("Dry-run started", "tetra: dry-run-started: #{current_directory}")
|
83
98
|
true
|
84
99
|
end
|
85
100
|
|
86
101
|
# returns true iff we are currently dry-running
|
87
102
|
def dry_running?
|
88
|
-
|
103
|
+
latest_comment = @git.latest_comment("tetra: dry-run-")
|
104
|
+
!latest_comment.nil? && !(latest_comment =~ /tetra: dry-run-finished/)
|
89
105
|
end
|
90
106
|
|
91
107
|
# ends a dry-run assuming a successful build
|
92
108
|
# reverts sources and updates output file lists
|
93
109
|
def finish
|
94
110
|
if dry_running?
|
95
|
-
|
111
|
+
commit_whole_project("Changes during dry-run", "tetra: dry-run-changed")
|
96
112
|
|
97
|
-
@git.revert_whole_directory("src",
|
113
|
+
@git.revert_whole_directory("src", @git.latest_id("tetra: dry-run-started"))
|
98
114
|
|
99
|
-
|
115
|
+
commit_whole_project("Dry run finished", "tetra: dry-run-finished")
|
100
116
|
return true
|
101
117
|
end
|
102
118
|
false
|
@@ -106,17 +122,16 @@ module Tetra
|
|
106
122
|
# reverts the whole project directory
|
107
123
|
def abort
|
108
124
|
if dry_running?
|
109
|
-
@git.revert_whole_directory(".",
|
110
|
-
@git.
|
125
|
+
@git.revert_whole_directory(".", @git.latest_id("tetra: dry-run-started"))
|
126
|
+
@git.undo_last_commit
|
111
127
|
return true
|
112
128
|
end
|
113
129
|
false
|
114
130
|
end
|
115
131
|
|
116
|
-
#
|
117
|
-
def
|
118
|
-
# rename all .gitignore files
|
119
|
-
# they prevent snapshotting
|
132
|
+
# commits all files in the project
|
133
|
+
def commit_whole_project(*comments)
|
134
|
+
# rename all .gitignore files that might have slipped in
|
120
135
|
from_directory("src") do
|
121
136
|
Find.find(".") do |file|
|
122
137
|
next unless file =~ /\.gitignore$/
|
@@ -125,58 +140,46 @@ module Tetra
|
|
125
140
|
end
|
126
141
|
end
|
127
142
|
|
128
|
-
@git.commit_whole_directory(
|
143
|
+
@git.commit_whole_directory(comments.join("\n\n"))
|
129
144
|
end
|
130
145
|
|
131
|
-
# replaces content in path with new_content,
|
132
|
-
#
|
133
|
-
#
|
146
|
+
# replaces content in path with new_content, commits using
|
147
|
+
# comment and 3-way merges new and old content with the previous
|
148
|
+
# version of file of the same kind, if it exists.
|
134
149
|
# returns the number of conflicts
|
135
|
-
def merge_new_content(new_content, path,
|
150
|
+
def merge_new_content(new_content, path, comment, kind)
|
136
151
|
from_directory do
|
137
|
-
log.debug "merging new content to #{path}
|
152
|
+
log.debug "merging new content to #{path} of kind #{kind}"
|
138
153
|
already_existing = File.exist?(path)
|
139
154
|
|
155
|
+
generated_comment = "tetra: generated-#{kind}"
|
156
|
+
whole_comment = [comment, generated_comment].join("\n\n")
|
157
|
+
|
140
158
|
if already_existing
|
141
|
-
|
142
|
-
log.debug "
|
143
|
-
@git.commit_file(path,
|
159
|
+
unless @git.latest_id(generated_comment)
|
160
|
+
log.debug "committing new file"
|
161
|
+
@git.commit_file(path, whole_comment)
|
144
162
|
end
|
145
163
|
log.debug "moving #{path} to #{path}.tetra_user_edited"
|
146
|
-
File.rename
|
164
|
+
File.rename(path, "#{path}.tetra_user_edited")
|
147
165
|
end
|
148
166
|
|
149
|
-
|
167
|
+
previous_id = @git.latest_id(generated_comment)
|
150
168
|
|
151
169
|
File.open(path, "w") { |io| io.write(new_content) }
|
152
|
-
log.debug "
|
153
|
-
@git.commit_file(path,
|
170
|
+
log.debug "committing new content: #{comment}"
|
171
|
+
@git.commit_file(path, whole_comment)
|
154
172
|
|
155
173
|
if already_existing
|
156
174
|
# 3-way merge
|
157
|
-
conflict_count = @git.
|
158
|
-
File.delete
|
175
|
+
conflict_count = @git.merge_with_id("#{path}", "#{path}.tetra_user_edited", previous_id)
|
176
|
+
File.delete("#{path}.tetra_user_edited")
|
159
177
|
return conflict_count
|
160
178
|
end
|
161
179
|
return 0
|
162
180
|
end
|
163
181
|
end
|
164
182
|
|
165
|
-
# returns the tag with maximum count for a given tag prefix
|
166
|
-
def latest_tag(prefix)
|
167
|
-
"#{prefix}_#{latest_tag_count(prefix)}"
|
168
|
-
end
|
169
|
-
|
170
|
-
# returns the maximum tag count for a given tag prefix
|
171
|
-
def latest_tag_count(prefix)
|
172
|
-
@git.get_tag_maximum_suffix(prefix)
|
173
|
-
end
|
174
|
-
|
175
|
-
# returns the next tag for a given tag prefix
|
176
|
-
def next_tag(prefix)
|
177
|
-
"#{prefix}_#{latest_tag_count(prefix) + 1}"
|
178
|
-
end
|
179
|
-
|
180
183
|
# runs a block from the project directory or a subdirectory
|
181
184
|
def from_directory(subdirectory = "")
|
182
185
|
Dir.chdir(File.join(@full_path, subdirectory)) do
|
@@ -186,19 +189,15 @@ module Tetra
|
|
186
189
|
|
187
190
|
# returns the latest dry run start directory
|
188
191
|
def latest_dry_run_directory
|
189
|
-
@git.
|
192
|
+
@git.latest_comment("tetra: dry-run-started")[/tetra: dry-run-started: (.*)$/, 1]
|
190
193
|
end
|
191
194
|
|
192
|
-
# returns a list of files produced during dry-
|
195
|
+
# returns a list of files produced during the last dry-run
|
193
196
|
def produced_files
|
194
|
-
|
195
|
-
|
196
|
-
if
|
197
|
-
(
|
198
|
-
@git.changed_files_between("dry_run_started_#{i}", "dry_run_changed_#{i}", "src")
|
199
|
-
end
|
200
|
-
.flatten
|
201
|
-
.uniq
|
197
|
+
start_id = @git.latest_id("tetra: dry-run-started")
|
198
|
+
end_id = @git.latest_id("tetra: dry-run-changed")
|
199
|
+
if !start_id.nil? && !end_id.nil?
|
200
|
+
@git.changed_files_between(start_id, end_id, "src")
|
202
201
|
.sort
|
203
202
|
.map { |file| Pathname.new(file).relative_path_from(Pathname.new("src")).to_s }
|
204
203
|
else
|
data/lib/tetra/version.rb
CHANGED
@@ -50,7 +50,7 @@ describe Tetra::Package do
|
|
50
50
|
expect(spec_lines).to include("License: The Apache Software License, Version 2.0\n")
|
51
51
|
expect(spec_lines).to include("Summary: Nailgun is a client, protocol, and server for running Java\n")
|
52
52
|
expect(spec_lines).to include("Url: http://martiansoftware.com/nailgun\n")
|
53
|
-
expect(spec_lines).to include("BuildRequires: test-project-kit ==
|
53
|
+
expect(spec_lines).to include("BuildRequires: test-project-kit == #{@project.version}\n")
|
54
54
|
expect(spec_lines).to include("Provides: mvn(com.martiansoftware:nailgun-all) == 0.9.1\n")
|
55
55
|
expect(spec_lines).to include("cp -a out/test3.jar %{buildroot}%{_javadir}/test3.jar\n")
|
56
56
|
end
|
data/spec/lib/git_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Tetra::Git do
|
|
15
15
|
FileUtils.rm_rf(@git_path)
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "#init"
|
18
|
+
describe "#init" do
|
19
19
|
it "complains if a double initialization is attempted" do
|
20
20
|
expect do
|
21
21
|
@git.init
|
@@ -23,41 +23,33 @@ describe Tetra::Git do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
describe "#
|
27
|
-
it "
|
26
|
+
describe "#latest_id" do
|
27
|
+
it "does not find a commit with a non-existing comment" do
|
28
28
|
Dir.chdir(@git_path) do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
expect(files).to include("file1")
|
29
|
+
@git.commit_file(".", "initial commit")
|
30
|
+
expect(@git.latest_id("tetra: test")).to be_nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
it "finds a commit with a certain comment" do
|
34
|
+
Dir.chdir(@git_path) do
|
35
|
+
@git.commit_file(".", "tetra: test")
|
36
|
+
expect(@git.latest_id("tetra: test")).to eq `git rev-parse HEAD`.strip
|
38
37
|
end
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
describe "#
|
43
|
-
it "
|
41
|
+
describe "#commit_whole_directory" do
|
42
|
+
it "commits all contents of a directory to git for later use" do
|
44
43
|
Dir.chdir(@git_path) do
|
45
44
|
File.open("file1", "w") do |file|
|
46
45
|
file.write "test"
|
47
46
|
end
|
48
47
|
|
49
|
-
@git.commit_whole_directory("test"
|
50
|
-
|
51
|
-
File.open("file2", "w") do |file|
|
52
|
-
file.write "test"
|
53
|
-
end
|
54
|
-
|
55
|
-
@git.commit_whole_directory("test end", :test_end)
|
48
|
+
@git.commit_whole_directory("test")
|
56
49
|
|
57
|
-
files =
|
50
|
+
files = `git ls-tree --name-only -r HEAD`.split("\n")
|
58
51
|
|
59
|
-
expect(files).
|
60
|
-
expect(files).to include("file2")
|
52
|
+
expect(files).to include("file1")
|
61
53
|
end
|
62
54
|
end
|
63
55
|
end
|
@@ -69,7 +61,7 @@ describe Tetra::Git do
|
|
69
61
|
file.write "test"
|
70
62
|
end
|
71
63
|
|
72
|
-
@git.commit_whole_directory("test
|
64
|
+
@git.commit_whole_directory("test\ntetra: test_start")
|
73
65
|
|
74
66
|
File.open("file2", "w") do |file|
|
75
67
|
file.write "test"
|
@@ -79,15 +71,18 @@ describe Tetra::Git do
|
|
79
71
|
file.write "test"
|
80
72
|
end
|
81
73
|
|
82
|
-
@git.commit_whole_directory("test
|
74
|
+
@git.commit_whole_directory("test\ntetra: test_end")
|
83
75
|
|
84
76
|
File.open("file4", "w") do |file|
|
85
77
|
file.write "test"
|
86
78
|
end
|
87
79
|
|
88
|
-
@git.commit_whole_directory("test
|
80
|
+
@git.commit_whole_directory("test\ntetra: test_after")
|
81
|
+
|
82
|
+
start_id = @git.latest_id("tetra: test_start")
|
83
|
+
end_id = @git.latest_id("tetra: test_end")
|
89
84
|
|
90
|
-
files = @git.changed_files_between(
|
85
|
+
files = @git.changed_files_between(start_id, end_id, "subdir")
|
91
86
|
|
92
87
|
expect(files).not_to include("file1")
|
93
88
|
expect(files).not_to include("file2")
|
data/spec/lib/project_spec.rb
CHANGED
@@ -3,16 +3,26 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
5
|
describe Tetra::Project do
|
6
|
-
|
7
|
-
@project_path = File.join("spec", "data", "test-project")
|
8
|
-
Dir.mkdir(@project_path)
|
6
|
+
include Tetra::Mockers
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
before(:each) do
|
9
|
+
create_mock_project
|
12
10
|
end
|
13
11
|
|
14
12
|
after(:each) do
|
15
|
-
|
13
|
+
delete_mock_project
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "version" do
|
17
|
+
it "returns no project version in case no dry-run happened" do
|
18
|
+
expect(@project.version).to be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns a project version after dry-run" do
|
22
|
+
@project.dry_run
|
23
|
+
@project.finish
|
24
|
+
expect(@project.version).to be
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
28
|
describe "#project?" do
|
@@ -41,6 +51,16 @@ describe Tetra::Project do
|
|
41
51
|
end
|
42
52
|
end
|
43
53
|
|
54
|
+
describe "#template_files" do
|
55
|
+
it "returns the list of template files without bundles" do
|
56
|
+
expect(@project.template_files(false)).to include("kit" => ".")
|
57
|
+
end
|
58
|
+
|
59
|
+
it "returns the list of template files with bundles" do
|
60
|
+
expect(@project.template_files(true)).to include("bundled/apache-ant-1.9.4" => "kit")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
44
64
|
describe "#init" do
|
45
65
|
it "inits a new project" do
|
46
66
|
kit_path = File.join(@project_path, "kit")
|
@@ -63,7 +83,7 @@ describe Tetra::Project do
|
|
63
83
|
end
|
64
84
|
end
|
65
85
|
|
66
|
-
describe "#
|
86
|
+
describe "#commit_whole_project" do
|
67
87
|
it "commits the project contents to git for later use" do
|
68
88
|
@project.from_directory do
|
69
89
|
FileUtils.touch(File.join("kit", "test"))
|
@@ -73,13 +93,12 @@ describe Tetra::Project do
|
|
73
93
|
file.write "file"
|
74
94
|
end
|
75
95
|
|
76
|
-
@project.
|
96
|
+
@project.commit_whole_project("test")
|
77
97
|
|
78
98
|
files = `git ls-tree --name-only -r HEAD`.split("\n")
|
79
99
|
expect(files).to include("src/.gitignore_disabled_by_tetra")
|
80
100
|
|
81
101
|
expect(`git rev-list --all`.split("\n").length).to eq 2
|
82
|
-
expect(@project.latest_tag(:revertable)).to eq "revertable_1"
|
83
102
|
end
|
84
103
|
end
|
85
104
|
end
|
@@ -133,7 +152,7 @@ describe Tetra::Project do
|
|
133
152
|
expect(@project.dry_running?).to be_falsey
|
134
153
|
|
135
154
|
@project.from_directory do
|
136
|
-
expect(`git rev-list --all`.split("\n").length).to eq
|
155
|
+
expect(`git rev-list --all`.split("\n").length).to eq 1
|
137
156
|
expect(File.read("src/test")).to eq "A"
|
138
157
|
expect(File.exist?("src/test2")).to be_falsey
|
139
158
|
|
@@ -159,7 +178,6 @@ describe Tetra::Project do
|
|
159
178
|
expect(@project.dry_running?).to be_truthy
|
160
179
|
expect(`git rev-list --all`.split("\n").length).to eq 2
|
161
180
|
expect(`git diff-tree --no-commit-id --name-only -r HEAD`.split("\n")).to include("src/test")
|
162
|
-
expect(`git cat-file tag tetra_dry_run_started_1 | tail -1`).to include("src")
|
163
181
|
end
|
164
182
|
end
|
165
183
|
end
|
@@ -184,9 +202,9 @@ describe Tetra::Project do
|
|
184
202
|
expect(@project.finish).to be_truthy
|
185
203
|
|
186
204
|
list = @project.produced_files
|
187
|
-
expect(list).to include("added_in_first_dry_run")
|
188
205
|
expect(list).to include("added_in_second_dry_run")
|
189
206
|
|
207
|
+
expect(list).not_to include("added_in_first_dry_run")
|
190
208
|
expect(list).not_to include("added_outside_dry_run")
|
191
209
|
expect(list).not_to include("added_outside_directory")
|
192
210
|
end
|