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
@@ -1,27 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # runs Ant with tetra-specific options
5
- class AntRunner < KitRunner
6
- include Logging
7
-
8
- # runs ant in a subprocess
9
- def ant(options)
10
- run_executable("#{get_ant_commandline(@project.full_path)} #{options.join(' ')}")
11
- end
12
-
13
- # returns a command line for running Ant from the specified
14
- # prefix
15
- def get_ant_commandline(prefix)
16
- executable = find_executable("ant")
17
-
18
- if !executable.nil?
19
- ant_path = File.join(prefix, executable)
20
-
21
- "#{ant_path}"
22
- else
23
- fail ExecutableNotFoundError, "ant"
24
- end
25
- end
26
- end
27
- end
@@ -1,29 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # tetra download-maven-source-jars
5
- class DownloadMavenSourceJarsCommand < Tetra::BaseCommand
6
- def execute
7
- checking_exceptions do
8
- project = Tetra::Project.new(".")
9
- source_getter = Tetra::SourceGetter.new
10
-
11
- ensure_dry_running(false, project) do
12
- puts "Getting sources from Maven..."
13
- succeeded, failed = source_getter.get_maven_source_jars(project)
14
-
15
- puts "\n**SUMMARY**\n"
16
- puts "Sources found for:"
17
- succeeded.each do |path|
18
- puts " #{format_path(path, project)}"
19
- end
20
-
21
- puts "\nSources not found for:"
22
- failed.each do |path|
23
- puts " #{format_path(path, project)}"
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,17 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # tetra dry-run
5
- class DryRunCommand < Tetra::BaseCommand
6
- def execute
7
- checking_exceptions do
8
- if Tetra::Project.new(".").dry_run
9
- puts "Now dry-running, please start your build."
10
- puts "To run a Maven installation from the kit, use \"tetra mvn\"."
11
- puts "If the build succeedes end this dry run with \"tetra finish\"."
12
- puts "If the build does not succeed use \"tetra finish --abort\" to restore files."
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,22 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # tetra finish
5
- class FinishCommand < Tetra::BaseCommand
6
- option %w(-a --abort), :flag, "abort build, restore files as before dry-run"
7
-
8
- def execute
9
- checking_exceptions do
10
- if Tetra::Project.new(".").finish(abort?)
11
- if abort?
12
- puts "Project reverted as before dry-run."
13
- else
14
- puts "Dry-run finished."
15
- end
16
- else
17
- puts "No dry-run is in progress."
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,30 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # tetra get-source
5
- class GetSourceCommand < Tetra::BaseCommand
6
- parameter "POM", "a pom file path or URI"
7
-
8
- def execute
9
- checking_exceptions do
10
- project = Tetra::Project.new(".")
11
- source_getter = Tetra::SourceGetter.new
12
-
13
- puts "Attempting to find source through Maven..."
14
- if source_getter.get_maven_source_jar(project, pom)
15
- puts "Source jar found and added to Maven repository."
16
- else
17
- effective_pom_path = Tetra::MavenRunner.new(project).get_effective_pom(pom)
18
- puts "Source jar not found in Maven. Try looking here:"
19
- pom = Tetra::Pom.new(effective_pom_path)
20
- puts "Website: #{pom.url}" unless pom.url.empty?
21
- puts "SCM connection: #{pom.scm_connection}" unless pom.scm_connection.empty?
22
- puts "SCM connection: #{pom.scm_url}" unless pom.scm_url.empty?
23
- puts "The effective POM: #{effective_pom_path}"
24
- name = !pom.name.empty? ? pom.name : pom.artifact_id
25
- puts "Google: http://google.com/#q=#{URI.encode("#{name} sources")}"
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,21 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # tetra list-kit-missing-sources
5
- class ListKitMissingSourcesCommand < Tetra::BaseCommand
6
- def execute
7
- checking_exceptions do
8
- project = Tetra::Project.new(".")
9
- kit_checker = Tetra::KitChecker.new(project)
10
-
11
- ensure_dry_running(false, project) do
12
- puts "Some source files were not found in these archives:"
13
- kit_checker.unsourced_archives.each do |archive|
14
- percentage = 100.0 * archive[:unsourced_class_names].length / archive[:class_names].length
15
- puts "#{format_path(archive[:archive], project)} (~#{format('%.2f', percentage)}% missing)"
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,104 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # checks kits for errors
5
- class KitChecker
6
- include Logging
7
-
8
- def initialize(project)
9
- @project = project
10
- end
11
-
12
- # returns an array of [path, archive] couples found in kit/
13
- # archive is not nil if path is inside a zip file
14
- def kit_file_paths
15
- @project.from_directory("kit") do
16
- plain_file_paths = Dir[File.join("**", "*")].select do |path|
17
- File.file?(path)
18
- end.map do |path|
19
- [path, nil]
20
- end
21
-
22
- archived_file_paths = plain_file_paths.select do |path, _archive|
23
- path. =~ (/\.(zip)|([jwe]ar)$/)
24
- end.map do |path, _archive|
25
- result = []
26
- Zip::File.foreach(path) do |entry|
27
- result << [entry.to_s, path] if entry.file?
28
- end
29
- result
30
- end.flatten(1)
31
-
32
- plain_file_paths + archived_file_paths
33
- end
34
- end
35
-
36
- # returns a list of class names for which
37
- # we have source files in kit/
38
- def source_class_names(paths)
39
- source_paths = paths.select do |path, _archive|
40
- path =~ /\.java$/
41
- end
42
-
43
- # heuristically add all possible package names, walking
44
- # back the directory tree all the way back to root.
45
- # This could add non-existent names, but allows not looking
46
- # in the file at all
47
- class_names = source_paths.map do |path, _archive|
48
- class_name = path_to_class(path)
49
- parts = class_name.split(".")
50
- last_index = parts.length - 1
51
- (0..last_index).map do |i|
52
- parts[i..last_index].join(".")
53
- end
54
- end.flatten
55
-
56
- Set.new(class_names)
57
- end
58
-
59
- # returns a list of class names for which
60
- # we have binary files in kit/
61
- def compiled_classes(paths)
62
- result = {}
63
- paths.select do |path, _archive|
64
- path =~ /\.class$/
65
- end.each do |path, archive|
66
- class_name = path_to_class(path)
67
- if result[archive].nil?
68
- result[archive] = [class_name]
69
- else
70
- result[archive] << class_name
71
- end
72
- end
73
-
74
- result
75
- end
76
-
77
- # returns a hash that associates archive names and
78
- # the unsourced classes within them
79
- def unsourced_archives
80
- paths = kit_file_paths
81
- source_class_names = source_class_names(paths)
82
- archive_paths_to_class_names = compiled_classes(paths)
83
-
84
- archive_paths_to_class_names.map do |archive, class_names|
85
- unsourced_class_names = class_names.select do |class_name|
86
- source_class_names.include?(class_name) == false
87
- end
88
- { archive: archive, class_names: class_names, unsourced_class_names: unsourced_class_names }
89
- end.select do |archive|
90
- archive[:unsourced_class_names].any?
91
- end
92
- end
93
-
94
- private
95
-
96
- # attempts to turn a .java/.class file name into a class name
97
- def path_to_class(path)
98
- path
99
- .gsub(/\$.+?\./, ".") # remove $InnerClasses
100
- .gsub(/\..+?$/, "") # remove .extension
101
- .gsub("/", ".") # convert paths in package names
102
- end
103
- end
104
- end
@@ -1,43 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # runs Maven with tetra-specific options
5
- class MavenRunner < KitRunner
6
- include Logging
7
-
8
- # runs Maven in a subprocess
9
- def mvn(options)
10
- run_executable(get_maven_commandline(@project.full_path, options))
11
- end
12
-
13
- # runs Maven to attempt getting a source jar
14
- # returns true if successful
15
- def get_source_jar(group_id, artifact_id, version)
16
- mvn(["dependency:get", "-Dartifact=#{group_id}:#{artifact_id}:#{version}:jar:sources", "-Dtransitive=false"])
17
- end
18
-
19
- # runs Maven to get the effective POM from an existing POM
20
- # returns effective pom path or nil if not found
21
- def get_effective_pom(pom_path)
22
- effective_pom_path = "#{pom_path}.effective"
23
- success = mvn(["help:effective-pom", "-f#{pom_path}", "-Doutput=#{File.split(effective_pom_path)[1]}"])
24
- effective_pom_path if success
25
- end
26
-
27
- # returns a command line for running Maven from the specified
28
- # prefix
29
- def get_maven_commandline(prefix, options)
30
- executable = find_executable("mvn")
31
-
32
- if !executable.nil?
33
- mvn_path = File.join(prefix, executable)
34
- repo_path = File.join(prefix, "kit", "m2")
35
- config_path = File.join(prefix, "kit", "m2", "settings.xml")
36
-
37
- "#{mvn_path} -Dmaven.repo.local=#{repo_path} -s#{config_path} #{options.join(' ')}"
38
- else
39
- fail ExecutableNotFoundError, "mvn"
40
- end
41
- end
42
- end
43
- end
@@ -1,41 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Tetra
4
- # attempts to get java projects' sources
5
- class SourceGetter
6
- include Logging
7
-
8
- # attempts to download a project's sources
9
- def get_maven_source_jar(project, pom_path)
10
- maven_runner = Tetra::MavenRunner.new(project)
11
- pom = Pom.new(pom_path)
12
- maven_runner.get_source_jar(pom.group_id, pom.artifact_id, pom.version)
13
- end
14
-
15
- # looks for jars in maven's local repo and downloads corresponding
16
- # source jars
17
- def get_maven_source_jars(project)
18
- maven_runner = Tetra::MavenRunner.new(project)
19
-
20
- project.from_directory do
21
- paths = Find.find(".").reject { |path| artifact_from_path(path).nil? }.sort
22
-
23
- succeded_paths = paths.each do |path|
24
- group_id, artifact_id, version = artifact_from_path(path)
25
- log.info("attempting source download for #{path} (#{group_id}:#{artifact_id}:#{version})")
26
- maven_runner.get_source_jar(group_id, artifact_id, version)
27
- end
28
-
29
- [succeded_paths, (paths - succeded_paths)]
30
- end
31
- end
32
-
33
- private
34
-
35
- # if possible, turn path into a Maven artifact name, otherwise return nil
36
- def artifact_from_path(path)
37
- match = path.match(%r{\./kit/m2/(.+)/(.+)/(.+)/\2-\3.*\.jar$})
38
- [match[1].gsub("/", "."), match[2], match[3]] unless match.nil?
39
- end
40
- end
41
- end
@@ -1,45 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require "spec_helper"
4
-
5
- describe Tetra::AntRunner do
6
- it_behaves_like Tetra::KitRunner
7
- include Tetra::Mockers
8
-
9
- before(:each) do
10
- create_mock_project
11
- @kit_runner = Tetra::AntRunner.new(@project)
12
- end
13
-
14
- after(:each) do
15
- delete_mock_project
16
- end
17
-
18
- describe "#get_ant_commandline" do
19
- it "returns commandline options for running Ant" do
20
- executable_path = create_mock_executable("ant")
21
- @project.from_directory do
22
- commandline = @kit_runner.get_ant_commandline(".")
23
- expect(commandline).to eq "./#{executable_path}"
24
- end
25
- end
26
- it "doesn't return commandline options if Ant is not available" do
27
- expect { @kit_runner.get_ant_commandline(".") }.to raise_error(Tetra::ExecutableNotFoundError)
28
- end
29
- end
30
-
31
- describe "#ant" do
32
- it "runs Ant" do
33
- create_mock_executable("ant")
34
- @project.from_directory do
35
- @kit_runner.ant(["extra-option"])
36
- expect(File.read("test_out").strip).to match(/extra-option$/)
37
- end
38
- end
39
- it "doesn't run Ant if it is not available" do
40
- @project.from_directory do
41
- expect { @kit_runner.ant([]) }.to raise_error(Tetra::ExecutableNotFoundError)
42
- end
43
- end
44
- end
45
- end
@@ -1,119 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require "spec_helper"
4
- require "rubygems"
5
- require "zip"
6
-
7
- describe Tetra::KitChecker do
8
- include Tetra::Mockers
9
-
10
- before(:each) do
11
- create_mock_project
12
- @kit_checker = Tetra::KitChecker.new(@project)
13
- end
14
-
15
- after(:each) do
16
- delete_mock_project
17
- end
18
-
19
- describe "#kit_file_paths" do
20
- it "returns an array of paths found in kit" do
21
- @project.from_directory("kit") do
22
- FileUtils.touch("top_level")
23
- FileUtils.mkdir_p("directory")
24
- FileUtils.touch(File.join("directory", "in_directory"))
25
- Zip::File.open("zipped.zip", Zip::File::CREATE) do |zipfile|
26
- Dir[File.join("directory", "**", "**")].each do |file|
27
- zipfile.add(file.sub("/directory", ""), file)
28
- end
29
- end
30
- end
31
-
32
- all_files = @kit_checker.kit_file_paths
33
-
34
- expect(all_files).to include ["top_level", nil]
35
- expect(all_files).not_to include ["directory", nil]
36
- expect(all_files).to include ["directory/in_directory", nil]
37
- expect(all_files).to include ["zipped.zip", nil]
38
- expect(all_files).to include ["directory/in_directory", "zipped.zip"]
39
- end
40
- end
41
-
42
- describe "#source_class_names" do
43
- it "distills source class names in kit" do
44
- all_files = [
45
- ["path/to/ClassOne.java", nil],
46
- ["path/to/ClassTwo.java", "path/to/archive.jar"],
47
- ["ClassThree.java", "another_archive.jar"],
48
- ["path/to/CompiledClass.class", "yet_another.jar"]
49
- ]
50
-
51
- class_names = @kit_checker.source_class_names(all_files)
52
-
53
- expect(class_names).to include "path.to.ClassOne"
54
- expect(class_names).to include "path.to.ClassTwo"
55
- expect(class_names).to include "ClassThree"
56
- expect(class_names).not_to include "path.to.CompiledClass"
57
- end
58
- end
59
-
60
- describe "#compiled_classes" do
61
- it "distills source class names in kit" do
62
- all_files = [
63
- ["path/to/ClassOne.class", nil],
64
- ["path/to/ClassTwo.class", "path/to/archive.jar"],
65
- ["ClassThree.class", "another_archive.jar"],
66
- ["path/to/SourceClass.java", "yet_another.jar"]
67
- ]
68
-
69
- classes = @kit_checker.compiled_classes(all_files)
70
-
71
- expect(classes[nil]).to include "path.to.ClassOne"
72
- expect(classes["path/to/archive.jar"]).to include "path.to.ClassTwo"
73
- expect(classes["another_archive.jar"]).to include "ClassThree"
74
- expect(classes["yet_another.jar"]).to be_nil
75
- end
76
- end
77
-
78
- describe "#unsourced_archives" do
79
- it "returns a list of jars wich source files are missing" do
80
- @project.from_directory("kit") do
81
- FileUtils.mkdir_p("package1")
82
- FileUtils.touch(File.join("package1", "UnsourcedClass.class"))
83
-
84
- FileUtils.mkdir_p("package2")
85
- FileUtils.touch(File.join("package2", "SourcedClass.java"))
86
- Zip::File.open("zipped-source-2.jar", Zip::File::CREATE) do |zipfile|
87
- Dir[File.join("package2", "**", "**")].each do |file|
88
- zipfile.add(file.sub("/package2", ""), file)
89
- end
90
- end
91
- FileUtils.rm(File.join("package2", "SourcedClass.java"))
92
- FileUtils.touch(File.join("package2", "SourcedClass.class"))
93
- Zip::File.open("zipped-2.jar", Zip::File::CREATE) do |zipfile|
94
- Dir[File.join("package2", "**", "**")].each do |file|
95
- zipfile.add(file.sub("/package2", ""), file)
96
- end
97
- end
98
-
99
- FileUtils.mkdir_p("package3")
100
- FileUtils.touch(File.join("package3", "SourcedSameArchive.java"))
101
- FileUtils.touch(File.join("package3", "SourcedSameArchive.class"))
102
- Zip::File.open("zipped-3.zip", Zip::File::CREATE) do |zipfile|
103
- Dir[File.join("package3", "**", "**")].each do |file|
104
- zipfile.add(file.sub("/package3", ""), file)
105
- end
106
- end
107
- end
108
-
109
- unsourced = @kit_checker.unsourced_archives
110
- expect(unsourced.length).to eq 1
111
-
112
- expect(unsourced.first[:archive]).to be_nil
113
- expect(unsourced.first[:class_names]).to include "package1.UnsourcedClass"
114
- expect(unsourced.first[:class_names]).to include "package2.SourcedClass"
115
- expect(unsourced.first[:class_names]).to include "package3.SourcedSameArchive"
116
- expect(unsourced.first[:unsourced_class_names]).to include "package1.UnsourcedClass"
117
- end
118
- end
119
- end