tetra 0.46.0 → 0.48.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/.rubocop.yml +6 -0
  2. data/README.md +5 -12
  3. data/SPECIAL_CASES.md +3 -74
  4. data/integration-tests/build-commons.sh +5 -8
  5. data/lib/template/kit/CONTENTS +4 -3
  6. data/lib/template/kit/apache-ant-1.9.4/INSTALL +2 -0
  7. data/lib/template/kit/apache-ant-1.9.4/KEYS +1497 -0
  8. data/lib/template/kit/apache-ant-1.9.4/LICENSE +272 -0
  9. data/lib/template/kit/apache-ant-1.9.4/NOTICE +9 -0
  10. data/lib/template/kit/apache-ant-1.9.4/README +97 -0
  11. data/lib/template/kit/apache-ant-1.9.4/WHATSNEW +6108 -0
  12. data/lib/template/kit/apache-ant-1.9.4/bin/ant +336 -0
  13. data/lib/template/kit/apache-ant-1.9.4/bin/ant.bat +218 -0
  14. data/lib/template/kit/apache-ant-1.9.4/bin/ant.cmd +93 -0
  15. data/lib/template/kit/apache-ant-1.9.4/bin/antRun +24 -0
  16. data/lib/template/kit/apache-ant-1.9.4/bin/antRun.bat +50 -0
  17. data/lib/template/kit/apache-ant-1.9.4/bin/antRun.pl +66 -0
  18. data/lib/template/kit/apache-ant-1.9.4/bin/antenv.cmd +98 -0
  19. data/lib/template/kit/apache-ant-1.9.4/bin/complete-ant-cmd.pl +114 -0
  20. data/lib/template/kit/apache-ant-1.9.4/bin/envset.cmd +131 -0
  21. data/lib/template/kit/apache-ant-1.9.4/bin/lcp.bat +31 -0
  22. data/lib/template/kit/apache-ant-1.9.4/bin/runant.pl +153 -0
  23. data/lib/template/kit/apache-ant-1.9.4/bin/runant.py +102 -0
  24. data/lib/template/kit/apache-ant-1.9.4/bin/runrc.cmd +60 -0
  25. data/lib/template/kit/apache-ant-1.9.4/etc/ant-bootstrap.jar +0 -0
  26. data/lib/template/kit/apache-ant-1.9.4/etc/changelog.xsl +148 -0
  27. data/lib/template/kit/apache-ant-1.9.4/etc/checkstyle/checkstyle-frames.xsl +299 -0
  28. data/lib/template/kit/apache-ant-1.9.4/etc/checkstyle/checkstyle-text.xsl +34 -0
  29. data/lib/template/kit/apache-ant-1.9.4/etc/checkstyle/checkstyle-xdoc.xsl +130 -0
  30. data/lib/template/kit/apache-ant-1.9.4/etc/coverage-frames.xsl +489 -0
  31. data/lib/template/kit/apache-ant-1.9.4/etc/jdepend-frames.xsl +487 -0
  32. data/lib/template/kit/apache-ant-1.9.4/etc/jdepend.xsl +276 -0
  33. data/lib/template/kit/apache-ant-1.9.4/etc/junit-frames-xalan1.xsl +745 -0
  34. data/lib/template/kit/apache-ant-1.9.4/etc/junit-frames.xsl +955 -0
  35. data/lib/template/kit/apache-ant-1.9.4/etc/junit-noframes.xsl +496 -0
  36. data/lib/template/kit/apache-ant-1.9.4/etc/log.xsl +203 -0
  37. data/lib/template/kit/apache-ant-1.9.4/etc/maudit-frames.xsl +503 -0
  38. data/lib/template/kit/apache-ant-1.9.4/etc/mmetrics-frames.xsl +1026 -0
  39. data/lib/template/kit/apache-ant-1.9.4/etc/tagdiff.xsl +179 -0
  40. data/lib/template/kit/apache-ant-1.9.4/fetch.xml +335 -0
  41. data/lib/template/kit/apache-ant-1.9.4/get-m2.xml +121 -0
  42. data/lib/template/kit/apache-ant-1.9.4/lib/README +3 -0
  43. data/lib/template/kit/apache-ant-1.9.4/lib/ant-antlr.jar +0 -0
  44. data/lib/template/kit/apache-ant-1.9.4/lib/ant-antlr.pom +75 -0
  45. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bcel.jar +0 -0
  46. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bcel.pom +71 -0
  47. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bsf.jar +0 -0
  48. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-bsf.pom +74 -0
  49. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-log4j.jar +0 -0
  50. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-log4j.pom +69 -0
  51. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-oro.jar +0 -0
  52. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-oro.pom +74 -0
  53. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-regexp.jar +0 -0
  54. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-regexp.pom +70 -0
  55. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-resolver.jar +0 -0
  56. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-resolver.pom +69 -0
  57. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-xalan2.jar +0 -0
  58. data/lib/template/kit/apache-ant-1.9.4/lib/ant-apache-xalan2.pom +94 -0
  59. data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-logging.jar +0 -0
  60. data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-logging.pom +70 -0
  61. data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-net.jar +0 -0
  62. data/lib/template/kit/apache-ant-1.9.4/lib/ant-commons-net.pom +75 -0
  63. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jai.jar +0 -0
  64. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jai.pom +85 -0
  65. data/lib/template/kit/apache-ant-1.9.4/lib/ant-javamail.jar +0 -0
  66. data/lib/template/kit/apache-ant-1.9.4/lib/ant-javamail.pom +78 -0
  67. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jdepend.jar +0 -0
  68. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jdepend.pom +72 -0
  69. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jmf.jar +0 -0
  70. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jmf.pom +65 -0
  71. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jsch.jar +0 -0
  72. data/lib/template/kit/apache-ant-1.9.4/lib/ant-jsch.pom +74 -0
  73. data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit.jar +0 -0
  74. data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit.pom +101 -0
  75. data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit4.jar +0 -0
  76. data/lib/template/kit/apache-ant-1.9.4/lib/ant-junit4.pom +71 -0
  77. data/lib/template/kit/apache-ant-1.9.4/lib/ant-launcher.jar +0 -0
  78. data/lib/template/kit/apache-ant-1.9.4/lib/ant-launcher.pom +57 -0
  79. data/lib/template/kit/apache-ant-1.9.4/lib/ant-netrexx.jar +0 -0
  80. data/lib/template/kit/apache-ant-1.9.4/lib/ant-netrexx.pom +98 -0
  81. data/lib/template/kit/apache-ant-1.9.4/lib/ant-parent.pom +151 -0
  82. data/lib/template/kit/apache-ant-1.9.4/lib/ant-swing.jar +0 -0
  83. data/lib/template/kit/apache-ant-1.9.4/lib/ant-swing.pom +66 -0
  84. data/lib/template/kit/apache-ant-1.9.4/lib/ant-testutil.jar +0 -0
  85. data/lib/template/kit/apache-ant-1.9.4/lib/ant-testutil.pom +74 -0
  86. data/lib/template/kit/apache-ant-1.9.4/lib/ant.jar +0 -0
  87. data/lib/template/kit/apache-ant-1.9.4/lib/ant.pom +225 -0
  88. data/lib/template/kit/apache-ant-1.9.4/lib/libraries.properties +65 -0
  89. data/lib/template/kit/apache-maven-3.2.5/LICENSE +302 -0
  90. data/lib/template/kit/apache-maven-3.2.5/NOTICE +8 -0
  91. data/lib/template/kit/apache-maven-3.2.5/README.txt +77 -0
  92. data/lib/template/kit/apache-maven-3.2.5/bin/m2.conf +8 -0
  93. data/lib/template/kit/apache-maven-3.2.5/bin/mvn +202 -0
  94. data/lib/template/kit/apache-maven-3.2.5/bin/mvn.bat +197 -0
  95. data/lib/template/kit/apache-maven-3.2.5/bin/mvnDebug +200 -0
  96. data/lib/template/kit/apache-maven-3.2.5/bin/mvnDebug.bat +200 -0
  97. data/lib/template/kit/apache-maven-3.2.5/bin/mvnyjp +207 -0
  98. data/lib/template/kit/apache-maven-3.2.5/boot/plexus-classworlds-2.5.2.jar +0 -0
  99. data/lib/template/kit/apache-maven-3.2.5/conf/logging/simplelogger.properties +25 -0
  100. data/lib/template/kit/apache-maven-3.2.5/conf/settings.xml +257 -0
  101. data/lib/template/kit/apache-maven-3.2.5/lib/aether-api-1.0.0.v20140518.jar +0 -0
  102. data/lib/template/kit/apache-maven-3.2.5/lib/aether-api.license +261 -0
  103. data/lib/template/kit/apache-maven-3.2.5/lib/aether-connector-basic-1.0.0.v20140518.jar +0 -0
  104. data/lib/template/kit/apache-maven-3.2.5/lib/aether-connector-basic.license +261 -0
  105. data/lib/template/kit/apache-maven-3.2.5/lib/aether-impl-1.0.0.v20140518.jar +0 -0
  106. data/lib/template/kit/apache-maven-3.2.5/lib/aether-impl.license +261 -0
  107. data/lib/template/kit/apache-maven-3.2.5/lib/aether-spi-1.0.0.v20140518.jar +0 -0
  108. data/lib/template/kit/apache-maven-3.2.5/lib/aether-spi.license +261 -0
  109. data/lib/template/kit/apache-maven-3.2.5/lib/aether-transport-wagon-1.0.0.v20140518.jar +0 -0
  110. data/lib/template/kit/apache-maven-3.2.5/lib/aether-transport-wagon.license +261 -0
  111. data/lib/template/kit/apache-maven-3.2.5/lib/aether-util-1.0.0.v20140518.jar +0 -0
  112. data/lib/template/kit/apache-maven-3.2.5/lib/aether-util.license +261 -0
  113. data/lib/template/kit/apache-maven-3.2.5/lib/aopalliance-1.0.jar +0 -0
  114. data/lib/template/kit/apache-maven-3.2.5/lib/cdi-api-1.0.jar +0 -0
  115. data/lib/template/kit/apache-maven-3.2.5/lib/cdi-api.license +445 -0
  116. data/lib/template/kit/apache-maven-3.2.5/lib/commons-cli-1.2.jar +0 -0
  117. data/lib/template/kit/apache-maven-3.2.5/lib/commons-io-2.2.jar +0 -0
  118. data/lib/template/kit/apache-maven-3.2.5/lib/commons-lang-2.6.jar +0 -0
  119. data/lib/template/kit/apache-maven-3.2.5/lib/ext/README.txt +2 -0
  120. data/lib/template/kit/apache-maven-3.2.5/lib/guava-18.0.jar +0 -0
  121. data/lib/template/kit/apache-maven-3.2.5/lib/javax.inject-1.jar +0 -0
  122. data/lib/template/kit/apache-maven-3.2.5/lib/jsoup-1.7.2.jar +0 -0
  123. data/lib/template/kit/apache-maven-3.2.5/lib/jsoup.license +66 -0
  124. data/lib/template/kit/apache-maven-3.2.5/lib/jsr250-api-1.0.jar +0 -0
  125. data/lib/template/kit/apache-maven-3.2.5/lib/jsr250-api.license +406 -0
  126. data/lib/template/kit/apache-maven-3.2.5/lib/maven-aether-provider-3.2.5.jar +0 -0
  127. data/lib/template/kit/apache-maven-3.2.5/lib/maven-aether-provider.license +202 -0
  128. data/lib/template/kit/apache-maven-3.2.5/lib/maven-artifact-3.2.5.jar +0 -0
  129. data/lib/template/kit/apache-maven-3.2.5/lib/maven-artifact.license +202 -0
  130. data/lib/template/kit/apache-maven-3.2.5/lib/maven-compat-3.2.5.jar +0 -0
  131. data/lib/template/kit/apache-maven-3.2.5/lib/maven-compat.license +202 -0
  132. data/lib/template/kit/apache-maven-3.2.5/lib/maven-core-3.2.5.jar +0 -0
  133. data/lib/template/kit/apache-maven-3.2.5/lib/maven-core.license +202 -0
  134. data/lib/template/kit/apache-maven-3.2.5/lib/maven-embedder-3.2.5.jar +0 -0
  135. data/lib/template/kit/apache-maven-3.2.5/lib/maven-embedder.license +202 -0
  136. data/lib/template/kit/apache-maven-3.2.5/lib/maven-model-3.2.5.jar +0 -0
  137. data/lib/template/kit/apache-maven-3.2.5/lib/maven-model-builder-3.2.5.jar +0 -0
  138. data/lib/template/kit/apache-maven-3.2.5/lib/maven-model-builder.license +202 -0
  139. data/lib/template/kit/apache-maven-3.2.5/lib/maven-model.license +202 -0
  140. data/lib/template/kit/apache-maven-3.2.5/lib/maven-plugin-api-3.2.5.jar +0 -0
  141. data/lib/template/kit/apache-maven-3.2.5/lib/maven-plugin-api.license +202 -0
  142. data/lib/template/kit/apache-maven-3.2.5/lib/maven-repository-metadata-3.2.5.jar +0 -0
  143. data/lib/template/kit/apache-maven-3.2.5/lib/maven-repository-metadata.license +202 -0
  144. data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings-3.2.5.jar +0 -0
  145. data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings-builder-3.2.5.jar +0 -0
  146. data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings-builder.license +202 -0
  147. data/lib/template/kit/apache-maven-3.2.5/lib/maven-settings.license +202 -0
  148. data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.inject-0.3.0.M1.jar +0 -0
  149. data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.inject.license +261 -0
  150. data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus-0.3.0.M1.jar +0 -0
  151. data/lib/template/kit/apache-maven-3.2.5/lib/org.eclipse.sisu.plexus.license +261 -0
  152. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-cipher-1.7.jar +0 -0
  153. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-cipher.license +445 -0
  154. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-component-annotations-1.5.5.jar +0 -0
  155. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-interpolation-1.21.jar +0 -0
  156. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-sec-dispatcher-1.3.jar +0 -0
  157. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-sec-dispatcher.license +445 -0
  158. data/lib/template/kit/apache-maven-3.2.5/lib/plexus-utils-3.0.20.jar +0 -0
  159. data/lib/template/kit/apache-maven-3.2.5/lib/sisu-guice-3.2.3-no_aop.jar +0 -0
  160. data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-api-1.7.5.jar +0 -0
  161. data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-api.license +190 -0
  162. data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-simple-1.7.5.jar +0 -0
  163. data/lib/template/kit/apache-maven-3.2.5/lib/slf4j-simple.license +190 -0
  164. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-file-2.8.jar +0 -0
  165. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-file.license +202 -0
  166. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http-2.8-shaded.jar +0 -0
  167. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http-shared-2.8.jar +0 -0
  168. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http-shared.license +202 -0
  169. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-http.license +202 -0
  170. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-provider-api-2.8.jar +0 -0
  171. data/lib/template/kit/apache-maven-3.2.5/lib/wagon-provider-api.license +202 -0
  172. data/lib/tetra.rb +30 -29
  173. data/lib/tetra/facades/ant.rb +27 -0
  174. data/lib/tetra/{git.rb → facades/git.rb} +29 -24
  175. data/lib/tetra/facades/mvn.rb +44 -0
  176. data/lib/tetra/facades/process_runner.rb +65 -0
  177. data/lib/tetra/facades/tar.rb +20 -0
  178. data/lib/tetra/{kit_runner.rb → kit.rb} +3 -10
  179. data/lib/tetra/main.rb +12 -36
  180. data/lib/tetra/maven_website.rb +1 -1
  181. data/lib/tetra/packages/archivable.rb +3 -11
  182. data/lib/tetra/packages/{kit.rb → kit_package.rb} +1 -1
  183. data/lib/tetra/packages/{built_package.rb → package.rb} +2 -2
  184. data/lib/tetra/packages/scriptable.rb +27 -15
  185. data/lib/tetra/project.rb +18 -14
  186. data/lib/tetra/{commands/ant.rb → ui/ant_subcommand.rb} +5 -5
  187. data/lib/tetra/ui/dry_run_subcommand.rb +44 -0
  188. data/lib/tetra/{commands/generate_all.rb → ui/generate_all_subcommand.rb} +5 -5
  189. data/lib/tetra/{commands/generate_archive.rb → ui/generate_archive_subcommand.rb} +2 -2
  190. data/lib/tetra/{commands/generate_kit.rb → ui/generate_kit_subcommand.rb} +2 -2
  191. data/lib/tetra/{commands/generate_script.rb → ui/generate_script_subcommand.rb} +2 -2
  192. data/lib/tetra/{commands/generate_spec.rb → ui/generate_spec_subcommand.rb} +2 -2
  193. data/lib/tetra/{commands/get_pom.rb → ui/get_pom_subcommand.rb} +1 -1
  194. data/lib/tetra/{commands/init.rb → ui/init_subcommand.rb} +1 -1
  195. data/lib/tetra/{commands/move_jars_to_kit.rb → ui/move_jars_to_kit_subcommand.rb} +1 -1
  196. data/lib/tetra/{commands/mvn.rb → ui/mvn_subcommand.rb} +5 -5
  197. data/lib/tetra/{commands/base.rb → ui/subcommand.rb} +19 -6
  198. data/lib/tetra/version.rb +1 -1
  199. data/spec/lib/ant_spec.rb +36 -0
  200. data/spec/lib/archivable_spec.rb +1 -1
  201. data/spec/lib/built_package_spec.rb +6 -6
  202. data/spec/lib/kit_package_spec.rb +47 -0
  203. data/spec/lib/kit_spec.rb +8 -28
  204. data/spec/lib/mvn_spec.rb +47 -0
  205. data/spec/lib/project_spec.rb +11 -11
  206. data/spec/lib/scriptable_spec.rb +8 -16
  207. data/spec/spec_helper.rb +13 -4
  208. data/tetra.gemspec +1 -0
  209. metadata +207 -31
  210. data/lib/tetra/ant_runner.rb +0 -27
  211. data/lib/tetra/commands/download_maven_source_jars.rb +0 -29
  212. data/lib/tetra/commands/dry_run.rb +0 -17
  213. data/lib/tetra/commands/finish.rb +0 -22
  214. data/lib/tetra/commands/get_source.rb +0 -30
  215. data/lib/tetra/commands/list_kit_missing_sources.rb +0 -21
  216. data/lib/tetra/kit_checker.rb +0 -104
  217. data/lib/tetra/maven_runner.rb +0 -43
  218. data/lib/tetra/source_getter.rb +0 -41
  219. data/spec/lib/ant_runner_spec.rb +0 -45
  220. data/spec/lib/kit_checker_spec.rb +0 -119
  221. data/spec/lib/maven_runner_spec.rb +0 -68
  222. data/spec/lib/source_getter_spec.rb +0 -36
  223. data/spec/support/kit_runner_examples.rb +0 -15
data/lib/tetra.rb CHANGED
@@ -18,45 +18,46 @@ require "json"
18
18
  require "nokogiri"
19
19
  require "rest_client"
20
20
  require "zip"
21
+ require "open4"
21
22
 
22
- # internal, backend
23
- require "tetra/version"
23
+ # base components
24
24
  require "tetra/logger"
25
- require "tetra/git"
25
+
26
+ # facades to other programs
27
+ require "tetra/facades/process_runner"
28
+ require "tetra/facades/git"
29
+ require "tetra/facades/tar"
30
+ require "tetra/facades/ant"
31
+ require "tetra/facades/mvn"
32
+
33
+ # main internal classes
34
+ require "tetra/version"
26
35
  require "tetra/project"
27
36
  require "tetra/pom"
37
+ require "tetra/kit"
28
38
  require "tetra/version_matcher"
29
39
  require "tetra/maven_website"
30
40
  require "tetra/pom_getter"
31
- require "tetra/source_getter"
32
- require "tetra/kit_runner"
33
- require "tetra/ant_runner"
34
- require "tetra/maven_runner"
35
- require "tetra/kit_checker"
36
41
 
37
- # internal, package related
42
+ # package building
38
43
  require "tetra/packages/archivable"
39
44
  require "tetra/packages/speccable"
40
45
  require "tetra/packages/scriptable"
41
- require "tetra/packages/kit"
42
- require "tetra/packages/built_package"
43
-
44
- # internal, UI
45
- require "tetra/commands/base"
46
- require "tetra/commands/ant"
47
- require "tetra/commands/download_maven_source_jars"
48
- require "tetra/commands/dry_run"
49
- require "tetra/commands/finish"
50
- require "tetra/commands/generate_all"
51
- require "tetra/commands/generate_kit"
52
- require "tetra/commands/generate_archive"
53
- require "tetra/commands/generate_script"
54
- require "tetra/commands/generate_spec"
55
- require "tetra/commands/get_pom"
56
- require "tetra/commands/get_source"
57
- require "tetra/commands/init"
58
- require "tetra/commands/list_kit_missing_sources"
59
- require "tetra/commands/move_jars_to_kit"
60
- require "tetra/commands/mvn"
46
+ require "tetra/packages/kit_package"
47
+ require "tetra/packages/package"
48
+
49
+ # UI
50
+ require "tetra/ui/subcommand"
51
+ require "tetra/ui/ant_subcommand"
52
+ require "tetra/ui/dry_run_subcommand"
53
+ require "tetra/ui/generate_all_subcommand"
54
+ require "tetra/ui/generate_kit_subcommand"
55
+ require "tetra/ui/generate_archive_subcommand"
56
+ require "tetra/ui/generate_script_subcommand"
57
+ require "tetra/ui/generate_spec_subcommand"
58
+ require "tetra/ui/get_pom_subcommand"
59
+ require "tetra/ui/init_subcommand"
60
+ require "tetra/ui/move_jars_to_kit_subcommand"
61
+ require "tetra/ui/mvn_subcommand"
61
62
 
62
63
  require "tetra/main"
@@ -0,0 +1,27 @@
1
+ # encoding: UTF-8
2
+
3
+ module Tetra
4
+ # runs Ant with tetra-specific options
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
+ # returns a command line for running Ant
22
+ def get_ant_commandline(options)
23
+ full_path = File.join(@project_path, @ant_path)
24
+ "#{full_path} #{options.join(' ')}"
25
+ end
26
+ end
27
+ end
@@ -5,6 +5,7 @@ module Tetra
5
5
  # prefixes all tags with "tetra_"
6
6
  class Git
7
7
  include Logging
8
+ include ProcessRunner
8
9
 
9
10
  # inits a new git manager object pointing to the specified
10
11
  # directory
@@ -16,7 +17,7 @@ module Tetra
16
17
  def init
17
18
  Dir.chdir(@directory) do
18
19
  if Dir.exist?(".git") == false
19
- `git init`
20
+ run("git init")
20
21
  else
21
22
  fail GitAlreadyInitedError
22
23
  end
@@ -41,8 +42,12 @@ module Tetra
41
42
  "HEAD"
42
43
  end
43
44
  )
44
- `git diff-tree --no-commit-id --name-only -r #{prefixed_start_tag} #{prefixed_end_tag} -- #{directory}`
45
- .split("\n")
45
+ run("git diff-tree \
46
+ --no-commit-id \
47
+ --name-only \
48
+ -r #{prefixed_start_tag} #{prefixed_end_tag}\
49
+ -- #{directory}"
50
+ ).split("\n")
46
51
  end
47
52
  end
48
53
 
@@ -53,14 +58,14 @@ module Tetra
53
58
  Dir.chdir(@directory) do
54
59
  log.debug "committing with message: #{message}"
55
60
 
56
- `git rm -r --cached --ignore-unmatch .`
57
- `git add .`
58
- `git commit -m "#{message}"`
61
+ run("git rm -r --cached --ignore-unmatch .")
62
+ run("git add .")
63
+ run("git commit -m \"#{message}\"", false, false)
59
64
 
60
65
  if !tag_message.nil?
61
- `git tag tetra_#{tag} -m "#{tag_message}"`
66
+ run("git tag tetra_#{tag} -m \"#{tag_message}\"")
62
67
  else
63
- `git tag tetra_#{tag}`
68
+ run("git tag tetra_#{tag}")
64
69
  end
65
70
  end
66
71
  end
@@ -70,16 +75,16 @@ module Tetra
70
75
  def commit_file(path, message, tag)
71
76
  Dir.chdir(@directory) do
72
77
  log.debug "committing path #{path} with message: #{message}"
73
- `git add #{path}`
74
- `git commit -m "#{message}"`
75
- `git tag tetra_#{tag}`
78
+ run("git add #{path}")
79
+ run("git commit -m \"#{message}\"", false, false)
80
+ run("git tag tetra_#{tag}")
76
81
  end
77
82
  end
78
83
 
79
84
  # returns the highest suffix found in tags with the given prefix
80
85
  def get_tag_maximum_suffix(prefix)
81
86
  Dir.chdir(@directory) do
82
- `git tag`.split.map do |tag|
87
+ run("git tag").split.map do |tag|
83
88
  if tag =~ /^tetra_#{prefix}_([0-9]+)$/
84
89
  Regexp.last_match[1].to_i
85
90
  else
@@ -93,12 +98,12 @@ module Tetra
93
98
  def revert_whole_directory(path, tag)
94
99
  Dir.chdir(@directory) do
95
100
  # reverts added and modified files, both in index and working tree
96
- `git checkout -f tetra_#{tag} -- #{path}`
101
+ run("git checkout -f tetra_#{tag} -- #{path}")
97
102
 
98
103
  # compute the list of deleted files
99
- files_in_tag = `git ls-tree --name-only -r tetra_#{tag} -- #{path}`.split("\n")
100
- files_in_head = `git ls-tree --name-only -r HEAD -- #{path}`.split("\n")
101
- files_added_after_head = `git ls-files -o -- #{path}`.split("\n")
104
+ files_in_tag = run("git ls-tree --name-only -r tetra_#{tag} -- #{path}").split("\n")
105
+ files_in_head = run("git ls-tree --name-only -r HEAD -- #{path}").split("\n")
106
+ files_added_after_head = run("git ls-files -o -- #{path}").split("\n")
102
107
  files_to_delete = files_in_head - files_in_tag + files_added_after_head
103
108
 
104
109
  files_to_delete.each do |file|
@@ -112,13 +117,13 @@ module Tetra
112
117
  # returns the conflict count
113
118
  def merge_with_tag(path, new_path, tag)
114
119
  Dir.chdir(@directory) do
115
- log.debug "calling git show tetra_#{tag}:#{path} > #{path}.old_version, output follows"
116
- `git show tetra_#{tag}:#{path} > #{path}.old_version`
117
- log.debug "calling git merge-file #{path} #{path}.old_version #{new_path}, output follows"
118
- `git merge-file #{path} #{path}.old_version #{new_path} \
119
- -L "newly generated" -L "previously generated" -L "user edited"`
120
+ run("git show tetra_#{tag}:#{path} > #{path}.old_version")
121
+ run("git merge-file #{path} #{path}.old_version #{new_path} \
122
+ -L \"newly generated\" \
123
+ -L \"previously generated\" \
124
+ -L \"user edited\"")
120
125
  conflict_count = $CHILD_STATUS.exitstatus
121
- File.delete "#{path}.old_version"
126
+ File.delete("#{path}.old_version")
122
127
  return conflict_count
123
128
  end
124
129
  end
@@ -126,13 +131,13 @@ module Tetra
126
131
  # deletes a tag
127
132
  def delete_tag(tag)
128
133
  Dir.chdir(@directory) do
129
- `git tag -d tetra_#{tag}`
134
+ run("git tag -d tetra_#{tag}")
130
135
  end
131
136
  end
132
137
 
133
138
  # returns the tag message
134
139
  def get_message(tag)
135
- `git cat-file tag tetra_#{tag}`.split.last
140
+ run("git cat-file tag tetra_#{tag}").split.last
136
141
  end
137
142
  end
138
143
 
@@ -0,0 +1,44 @@
1
+ # encoding: UTF-8
2
+
3
+ module Tetra
4
+ # runs Maven with tetra-specific options
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
+ # returns a command line for running Maven
30
+ def get_mvn_commandline(options)
31
+ full_path = File.join(@project_path, @mvn_path)
32
+ repo_path = File.join(@project_path, "kit", "m2")
33
+ config_path = File.join(@project_path, "kit", "m2", "settings.xml")
34
+
35
+ full_options = [
36
+ "-Dmaven.repo.local=#{repo_path}",
37
+ "--settings #{config_path}",
38
+ "--strict-checksums"
39
+ ] + options
40
+
41
+ "#{full_path} #{full_options.join(' ')}"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,65 @@
1
+ # encoding: UTF-8
2
+
3
+ module Tetra
4
+ # runs programs in subprocesses
5
+ module ProcessRunner
6
+ include Logging
7
+
8
+ # runs an external executable and returns its output as a string
9
+ # raises ExecutionFailed if the exit status is not 0 (override with fail_on_error)
10
+ # optionally echoes the executable's output/error to standard output/error
11
+ def run(commandline, echo = false, fail_on_error = true)
12
+ log.debug "running `#{commandline}`"
13
+
14
+ out_recorder = echo ? RecordingIO.new(STDOUT) : RecordingIO.new
15
+ err_recorder = echo ? RecordingIO.new(STDERR) : RecordingIO.new
16
+
17
+ status = Open4.spawn(commandline, stdout: out_recorder, stderr: err_recorder, quiet: true).exitstatus
18
+
19
+ log.debug "`#{commandline}` exited with status #{status}"
20
+
21
+ if status != 0
22
+ if fail_on_error
23
+ log.warn("`#{commandline}` failed, status #{status}")
24
+ log.warn("standard output follows")
25
+ log.warn(out_recorder.record)
26
+ log.warn("standard error follows")
27
+ log.warn(err_recorder.record)
28
+ fail ExecutionFailed.new(commandline, status)
29
+ end
30
+ end
31
+
32
+ out_recorder.record
33
+ end
34
+
35
+ # records bytes sent via "<<" for later use
36
+ # optionally echoes to another IO object
37
+ class RecordingIO
38
+ attr_reader :record
39
+
40
+ def initialize(io = nil)
41
+ @io = io
42
+ @record = ""
43
+ end
44
+
45
+ def <<(*args)
46
+ if @io
47
+ @io.<<(*args)
48
+ @io.flush
49
+ end
50
+ @record.<<(*args)
51
+ end
52
+ end
53
+ end
54
+
55
+ # raised when a command returns a non-zero status
56
+ class ExecutionFailed < Exception
57
+ attr_reader :commandline
58
+ attr_reader :status
59
+
60
+ def initialize(commandline, status)
61
+ @commandline = commandline
62
+ @status = status
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: UTF-8
2
+
3
+ module Tetra
4
+ # facade to tar
5
+ class Tar
6
+ include Logging
7
+ include ProcessRunner
8
+
9
+ def archive(name, source_dir, destination_dir)
10
+ log.debug("creating #{destination_dir}")
11
+ FileUtils.mkdir_p(destination_dir)
12
+
13
+ destination_path = File.join(destination_dir, "#{name}.tar.xz")
14
+
15
+ run("tar -cJf #{destination_path} -C #{source_dir} .")
16
+
17
+ destination_path
18
+ end
19
+ end
20
+ end
@@ -1,8 +1,8 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Tetra
4
- # runs programs from a tetra kit with tetra-specific options
5
- class KitRunner
4
+ # encapsulates a Tetra kit directory
5
+ class Kit
6
6
  include Logging
7
7
 
8
8
  def initialize(project)
@@ -21,14 +21,7 @@ module Tetra
21
21
  end
22
22
 
23
23
  log.debug("#{name} executable not found")
24
- nil
25
- end
26
-
27
- # runs an external executable, returns true on success
28
- def run_executable(full_commandline)
29
- log.debug "running #{full_commandline}"
30
- Process.wait(Process.spawn(full_commandline))
31
- $CHILD_STATUS.exitstatus == 0
24
+ fail ExecutableNotFoundError, name
32
25
  end
33
26
  end
34
27
 
data/lib/tetra/main.rb CHANGED
@@ -6,91 +6,67 @@ module Tetra
6
6
  subcommand(
7
7
  "init",
8
8
  "Inits a tetra project in the current directory",
9
- Tetra::InitCommand
9
+ Tetra::InitSubcommand
10
10
  )
11
11
 
12
12
  subcommand(
13
13
  "dry-run",
14
- "Starts a dry-run build",
15
- Tetra::DryRunCommand
14
+ "Starts or ends a dry-run build",
15
+ Tetra::DryRunSubcommand
16
16
  )
17
17
 
18
18
  subcommand(
19
19
  "mvn",
20
20
  "Locates and runs Maven from any directory in kit/",
21
- Tetra::MavenCommand
21
+ Tetra::MvnSubcommand
22
22
  )
23
23
 
24
24
  subcommand(
25
25
  "ant",
26
26
  "Locates and runs Ant from any directory in kit/",
27
- Tetra::AntCommand
28
- )
29
-
30
- subcommand(
31
- "finish",
32
- "Ends the current dry-run",
33
- Tetra::FinishCommand
27
+ Tetra::AntSubcommand
34
28
  )
35
29
 
36
30
  subcommand(
37
31
  "generate-kit",
38
32
  "Create or refresh the kit spec and archive files",
39
- Tetra::GenerateKitCommand
33
+ Tetra::GenerateKitSubcommand
40
34
  )
41
35
 
42
36
  subcommand(
43
37
  "generate-script",
44
38
  "Create or refresh the package build.sh file",
45
- Tetra::GenerateScriptCommand
39
+ Tetra::GenerateScriptSubcommand
46
40
  )
47
41
 
48
42
  subcommand(
49
43
  "generate-archive",
50
44
  "Create or refresh the package tarball",
51
- Tetra::GenerateArchiveCommand
45
+ Tetra::GenerateArchiveSubcommand
52
46
  )
53
47
 
54
48
  subcommand(
55
49
  "generate-spec",
56
50
  "Create or refresh the package spec file",
57
- Tetra::GenerateSpecCommand
51
+ Tetra::GenerateSpecSubcommand
58
52
  )
59
53
 
60
54
  subcommand(
61
55
  "generate-all",
62
56
  "Create or refresh all specs, archives, scripts",
63
- Tetra::GenerateAllCommand
57
+ Tetra::GenerateAllSubcommand
64
58
  )
65
59
 
66
60
  subcommand(
67
61
  "move-jars-to-kit",
68
62
  "Locates jars in src/ and moves them to kit/",
69
- Tetra::MoveJarsToKitCommand
70
- )
71
-
72
- subcommand(
73
- "download-maven-source-jars",
74
- "Attempts to download Maven kit/ sources",
75
- Tetra::DownloadMavenSourceJarsCommand
63
+ Tetra::MoveJarsToKitSubcommand
76
64
  )
77
65
 
78
66
  subcommand(
79
67
  "get-pom",
80
68
  "Retrieves a pom file",
81
- Tetra::GetPomCommand
82
- )
83
-
84
- subcommand(
85
- "get-source",
86
- "Attempts to retrieve a project's sources",
87
- Tetra::GetSourceCommand
88
- )
89
-
90
- subcommand(
91
- "list-kit-missing-sources",
92
- "Locates jars in kit/ that have no source files",
93
- Tetra::ListKitMissingSourcesCommand
69
+ Tetra::GetPomSubcommand
94
70
  )
95
71
  end
96
72
  end