embulk 0.8.39-java → 0.10.24-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (597) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +1 -1
  3. data/LICENSE +202 -0
  4. data/embulk.gemspec +34 -33
  5. data/lib/embulk.rb +5 -61
  6. data/lib/embulk/buffer.rb +1 -2
  7. data/lib/embulk/guess/charset.rb +2 -11
  8. data/lib/embulk/java/bootstrap.rb +0 -1
  9. data/lib/embulk/java_plugin.rb +9 -1
  10. data/lib/embulk/page_builder.rb +2 -2
  11. data/lib/embulk/plugin.rb +2 -2
  12. data/lib/embulk/schema.rb +3 -4
  13. data/lib/embulk/version.rb +3 -22
  14. metadata +22 -757
  15. data/.gitignore +0 -15
  16. data/.ruby-version +0 -1
  17. data/.travis.yml +0 -28
  18. data/COPYING +0 -14
  19. data/Gemfile.lock +0 -30
  20. data/README.md +0 -229
  21. data/Rakefile +0 -26
  22. data/appveyor.yml +0 -28
  23. data/bin/embulk +0 -139
  24. data/build.gradle +0 -419
  25. data/embulk-cli/build.gradle +0 -9
  26. data/embulk-cli/src/main/bat/selfrun.bat +0 -107
  27. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkArguments.java +0 -54
  28. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkCommandLine.java +0 -227
  29. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkCommandLineException.java +0 -25
  30. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkExample.java +0 -86
  31. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkMigrate.java +0 -480
  32. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkNew.java +0 -419
  33. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkRun.java +0 -786
  34. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkSelfUpdate.java +0 -235
  35. data/embulk-cli/src/main/java/org/embulk/cli/EmbulkSubcommand.java +0 -47
  36. data/embulk-cli/src/main/java/org/embulk/cli/Main.java +0 -31
  37. data/embulk-cli/src/main/java/org/embulk/cli/parse/AbstractHelpLineDefinition.java +0 -15
  38. data/embulk-cli/src/main/java/org/embulk/cli/parse/CliHelpFormatterWithHelpMessages.java +0 -141
  39. data/embulk-cli/src/main/java/org/embulk/cli/parse/CliOptionsWithHelpMessages.java +0 -45
  40. data/embulk-cli/src/main/java/org/embulk/cli/parse/EmbulkCommandLineHelpRequired.java +0 -10
  41. data/embulk-cli/src/main/java/org/embulk/cli/parse/EmbulkCommandLineParseException.java +0 -25
  42. data/embulk-cli/src/main/java/org/embulk/cli/parse/EmbulkCommandLineParser.java +0 -187
  43. data/embulk-cli/src/main/java/org/embulk/cli/parse/HelpMessageAsCliOption.java +0 -36
  44. data/embulk-cli/src/main/java/org/embulk/cli/parse/HelpMessageLineDefinition.java +0 -20
  45. data/embulk-cli/src/main/java/org/embulk/cli/parse/OptionBehavior.java +0 -39
  46. data/embulk-cli/src/main/java/org/embulk/cli/parse/OptionDefinition.java +0 -120
  47. data/embulk-cli/src/main/sh/selfrun.sh +0 -60
  48. data/embulk-cli/src/test/java/org/embulk/cli/DummyMain.java +0 -23
  49. data/embulk-cli/src/test/java/org/embulk/cli/SelfrunTest.java +0 -296
  50. data/embulk-core/build.gradle +0 -83
  51. data/embulk-core/src/main/java/org/embulk/EmbulkEmbed.java +0 -321
  52. data/embulk-core/src/main/java/org/embulk/EmbulkRunner.java +0 -531
  53. data/embulk-core/src/main/java/org/embulk/EmbulkService.java +0 -78
  54. data/embulk-core/src/main/java/org/embulk/EmbulkSetup.java +0 -49
  55. data/embulk-core/src/main/java/org/embulk/EmbulkVersion.java +0 -109
  56. data/embulk-core/src/main/java/org/embulk/command/PreviewPrinter.java +0 -87
  57. data/embulk-core/src/main/java/org/embulk/command/TablePreviewPrinter.java +0 -107
  58. data/embulk-core/src/main/java/org/embulk/command/VerticalPreviewPrinter.java +0 -47
  59. data/embulk-core/src/main/java/org/embulk/config/CommitReport.java +0 -36
  60. data/embulk-core/src/main/java/org/embulk/config/Config.java +0 -15
  61. data/embulk-core/src/main/java/org/embulk/config/ConfigDefault.java +0 -15
  62. data/embulk-core/src/main/java/org/embulk/config/ConfigDiff.java +0 -32
  63. data/embulk-core/src/main/java/org/embulk/config/ConfigException.java +0 -26
  64. data/embulk-core/src/main/java/org/embulk/config/ConfigInject.java +0 -14
  65. data/embulk-core/src/main/java/org/embulk/config/ConfigLoader.java +0 -149
  66. data/embulk-core/src/main/java/org/embulk/config/ConfigSource.java +0 -34
  67. data/embulk-core/src/main/java/org/embulk/config/DataSource.java +0 -41
  68. data/embulk-core/src/main/java/org/embulk/config/DataSourceImpl.java +0 -243
  69. data/embulk-core/src/main/java/org/embulk/config/DataSourceSerDe.java +0 -84
  70. data/embulk-core/src/main/java/org/embulk/config/GenericTypeReference.java +0 -20
  71. data/embulk-core/src/main/java/org/embulk/config/ModelManager.java +0 -123
  72. data/embulk-core/src/main/java/org/embulk/config/Task.java +0 -10
  73. data/embulk-core/src/main/java/org/embulk/config/TaskInvocationHandler.java +0 -180
  74. data/embulk-core/src/main/java/org/embulk/config/TaskReport.java +0 -32
  75. data/embulk-core/src/main/java/org/embulk/config/TaskSerDe.java +0 -349
  76. data/embulk-core/src/main/java/org/embulk/config/TaskSource.java +0 -34
  77. data/embulk-core/src/main/java/org/embulk/config/TaskValidationException.java +0 -38
  78. data/embulk-core/src/main/java/org/embulk/config/TaskValidator.java +0 -24
  79. data/embulk-core/src/main/java/org/embulk/config/UserDataException.java +0 -4
  80. data/embulk-core/src/main/java/org/embulk/config/UserDataExceptions.java +0 -17
  81. data/embulk-core/src/main/java/org/embulk/config/YamlTagResolver.java +0 -53
  82. data/embulk-core/src/main/java/org/embulk/exec/BufferFileInputPlugin.java +0 -88
  83. data/embulk-core/src/main/java/org/embulk/exec/BulkLoader.java +0 -754
  84. data/embulk-core/src/main/java/org/embulk/exec/ConfigurableGuessInputPlugin.java +0 -9
  85. data/embulk-core/src/main/java/org/embulk/exec/ExecModule.java +0 -53
  86. data/embulk-core/src/main/java/org/embulk/exec/ExecutionInterruptedException.java +0 -10
  87. data/embulk-core/src/main/java/org/embulk/exec/ExecutionResult.java +0 -33
  88. data/embulk-core/src/main/java/org/embulk/exec/ExtensionServiceLoaderModule.java +0 -43
  89. data/embulk-core/src/main/java/org/embulk/exec/ForGuess.java +0 -16
  90. data/embulk-core/src/main/java/org/embulk/exec/ForSystemConfig.java +0 -16
  91. data/embulk-core/src/main/java/org/embulk/exec/GuessExecutor.java +0 -309
  92. data/embulk-core/src/main/java/org/embulk/exec/LocalExecutorPlugin.java +0 -563
  93. data/embulk-core/src/main/java/org/embulk/exec/LoggerProvider.java +0 -68
  94. data/embulk-core/src/main/java/org/embulk/exec/NoSampleException.java +0 -10
  95. data/embulk-core/src/main/java/org/embulk/exec/PartialExecutionException.java +0 -26
  96. data/embulk-core/src/main/java/org/embulk/exec/PooledBufferAllocator.java +0 -77
  97. data/embulk-core/src/main/java/org/embulk/exec/PreviewExecutor.java +0 -222
  98. data/embulk-core/src/main/java/org/embulk/exec/PreviewResult.java +0 -27
  99. data/embulk-core/src/main/java/org/embulk/exec/PreviewedNoticeError.java +0 -17
  100. data/embulk-core/src/main/java/org/embulk/exec/ResumeState.java +0 -100
  101. data/embulk-core/src/main/java/org/embulk/exec/SamplingParserPlugin.java +0 -215
  102. data/embulk-core/src/main/java/org/embulk/exec/SetCurrentThreadName.java +0 -22
  103. data/embulk-core/src/main/java/org/embulk/exec/SkipTransactionException.java +0 -23
  104. data/embulk-core/src/main/java/org/embulk/exec/SystemConfigModule.java +0 -24
  105. data/embulk-core/src/main/java/org/embulk/exec/TempFileAllocator.java +0 -35
  106. data/embulk-core/src/main/java/org/embulk/exec/TransactionStage.java +0 -27
  107. data/embulk-core/src/main/java/org/embulk/jruby/JRubyPluginSource.java +0 -76
  108. data/embulk-core/src/main/java/org/embulk/jruby/JRubyScriptingModule.java +0 -395
  109. data/embulk-core/src/main/java/org/embulk/plugin/BuiltinPluginSourceModule.java +0 -17
  110. data/embulk-core/src/main/java/org/embulk/plugin/DefaultPluginType.java +0 -50
  111. data/embulk-core/src/main/java/org/embulk/plugin/InjectedPluginSource.java +0 -100
  112. data/embulk-core/src/main/java/org/embulk/plugin/MavenPluginType.java +0 -112
  113. data/embulk-core/src/main/java/org/embulk/plugin/PluginClassLoader.java +0 -993
  114. data/embulk-core/src/main/java/org/embulk/plugin/PluginClassLoaderFactory.java +0 -16
  115. data/embulk-core/src/main/java/org/embulk/plugin/PluginClassLoaderModule.java +0 -102
  116. data/embulk-core/src/main/java/org/embulk/plugin/PluginManager.java +0 -78
  117. data/embulk-core/src/main/java/org/embulk/plugin/PluginSource.java +0 -49
  118. data/embulk-core/src/main/java/org/embulk/plugin/PluginSourceNotMatchException.java +0 -25
  119. data/embulk-core/src/main/java/org/embulk/plugin/PluginType.java +0 -122
  120. data/embulk-core/src/main/java/org/embulk/plugin/compat/InputPluginWrapper.java +0 -102
  121. data/embulk-core/src/main/java/org/embulk/plugin/compat/PluginWrappers.java +0 -30
  122. data/embulk-core/src/main/java/org/embulk/plugin/compat/TransactionalFileInputWrapper.java +0 -96
  123. data/embulk-core/src/main/java/org/embulk/plugin/compat/TransactionalFileOutputWrapper.java +0 -102
  124. data/embulk-core/src/main/java/org/embulk/plugin/compat/TransactionalPageOutputWrapper.java +0 -95
  125. data/embulk-core/src/main/java/org/embulk/plugin/jar/InvalidJarPluginException.java +0 -14
  126. data/embulk-core/src/main/java/org/embulk/plugin/jar/JarPluginLoader.java +0 -232
  127. data/embulk-core/src/main/java/org/embulk/plugin/maven/MavenArtifactFinder.java +0 -134
  128. data/embulk-core/src/main/java/org/embulk/plugin/maven/MavenArtifactNotFoundException.java +0 -20
  129. data/embulk-core/src/main/java/org/embulk/plugin/maven/MavenPluginSource.java +0 -187
  130. data/embulk-core/src/main/java/org/embulk/plugin/maven/MavenPluginSourceModule.java +0 -22
  131. data/embulk-core/src/main/java/org/embulk/plugin/maven/MavenRepositoryNotFoundException.java +0 -31
  132. data/embulk-core/src/main/java/org/embulk/spi/AbortTransactionResource.java +0 -36
  133. data/embulk-core/src/main/java/org/embulk/spi/Buffer.java +0 -148
  134. data/embulk-core/src/main/java/org/embulk/spi/BufferAllocator.java +0 -8
  135. data/embulk-core/src/main/java/org/embulk/spi/CloseResource.java +0 -42
  136. data/embulk-core/src/main/java/org/embulk/spi/Column.java +0 -95
  137. data/embulk-core/src/main/java/org/embulk/spi/ColumnConfig.java +0 -112
  138. data/embulk-core/src/main/java/org/embulk/spi/ColumnVisitor.java +0 -16
  139. data/embulk-core/src/main/java/org/embulk/spi/DataException.java +0 -23
  140. data/embulk-core/src/main/java/org/embulk/spi/DecoderPlugin.java +0 -16
  141. data/embulk-core/src/main/java/org/embulk/spi/EncoderPlugin.java +0 -16
  142. data/embulk-core/src/main/java/org/embulk/spi/Exec.java +0 -113
  143. data/embulk-core/src/main/java/org/embulk/spi/ExecAction.java +0 -6
  144. data/embulk-core/src/main/java/org/embulk/spi/ExecSession.java +0 -220
  145. data/embulk-core/src/main/java/org/embulk/spi/ExecutorPlugin.java +0 -19
  146. data/embulk-core/src/main/java/org/embulk/spi/Extension.java +0 -44
  147. data/embulk-core/src/main/java/org/embulk/spi/FileInput.java +0 -11
  148. data/embulk-core/src/main/java/org/embulk/spi/FileInputPlugin.java +0 -30
  149. data/embulk-core/src/main/java/org/embulk/spi/FileInputRunner.java +0 -169
  150. data/embulk-core/src/main/java/org/embulk/spi/FileOutput.java +0 -13
  151. data/embulk-core/src/main/java/org/embulk/spi/FileOutputPlugin.java +0 -28
  152. data/embulk-core/src/main/java/org/embulk/spi/FileOutputRunner.java +0 -199
  153. data/embulk-core/src/main/java/org/embulk/spi/FilterPlugin.java +0 -18
  154. data/embulk-core/src/main/java/org/embulk/spi/FormatterPlugin.java +0 -18
  155. data/embulk-core/src/main/java/org/embulk/spi/GuessPlugin.java +0 -9
  156. data/embulk-core/src/main/java/org/embulk/spi/InputPlugin.java +0 -33
  157. data/embulk-core/src/main/java/org/embulk/spi/OutputPlugin.java +0 -29
  158. data/embulk-core/src/main/java/org/embulk/spi/Page.java +0 -86
  159. data/embulk-core/src/main/java/org/embulk/spi/PageBuilder.java +0 -696
  160. data/embulk-core/src/main/java/org/embulk/spi/PageFormat.java +0 -47
  161. data/embulk-core/src/main/java/org/embulk/spi/PageOutput.java +0 -11
  162. data/embulk-core/src/main/java/org/embulk/spi/PageReader.java +0 -248
  163. data/embulk-core/src/main/java/org/embulk/spi/ParserPlugin.java +0 -17
  164. data/embulk-core/src/main/java/org/embulk/spi/ProcessState.java +0 -10
  165. data/embulk-core/src/main/java/org/embulk/spi/ProcessTask.java +0 -117
  166. data/embulk-core/src/main/java/org/embulk/spi/Schema.java +0 -139
  167. data/embulk-core/src/main/java/org/embulk/spi/SchemaConfig.java +0 -93
  168. data/embulk-core/src/main/java/org/embulk/spi/SchemaConfigException.java +0 -22
  169. data/embulk-core/src/main/java/org/embulk/spi/TaskState.java +0 -81
  170. data/embulk-core/src/main/java/org/embulk/spi/TempFileException.java +0 -19
  171. data/embulk-core/src/main/java/org/embulk/spi/TempFileSpace.java +0 -88
  172. data/embulk-core/src/main/java/org/embulk/spi/Transactional.java +0 -10
  173. data/embulk-core/src/main/java/org/embulk/spi/TransactionalFileInput.java +0 -17
  174. data/embulk-core/src/main/java/org/embulk/spi/TransactionalFileOutput.java +0 -19
  175. data/embulk-core/src/main/java/org/embulk/spi/TransactionalPageOutput.java +0 -17
  176. data/embulk-core/src/main/java/org/embulk/spi/json/JsonParseException.java +0 -17
  177. data/embulk-core/src/main/java/org/embulk/spi/json/JsonParser.java +0 -233
  178. data/embulk-core/src/main/java/org/embulk/spi/json/RubyValueApi.java +0 -100
  179. data/embulk-core/src/main/java/org/embulk/spi/time/DateTimeZoneSerDe.java +0 -55
  180. data/embulk-core/src/main/java/org/embulk/spi/time/Timestamp.java +0 -180
  181. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormat.java +0 -158
  182. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormatter.java +0 -125
  183. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParseException.java +0 -12
  184. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParser.java +0 -310
  185. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampSerDe.java +0 -49
  186. data/embulk-core/src/main/java/org/embulk/spi/type/AbstractType.java +0 -58
  187. data/embulk-core/src/main/java/org/embulk/spi/type/BooleanType.java +0 -12
  188. data/embulk-core/src/main/java/org/embulk/spi/type/DoubleType.java +0 -12
  189. data/embulk-core/src/main/java/org/embulk/spi/type/JsonType.java +0 -14
  190. data/embulk-core/src/main/java/org/embulk/spi/type/LongType.java +0 -12
  191. data/embulk-core/src/main/java/org/embulk/spi/type/StringType.java +0 -12
  192. data/embulk-core/src/main/java/org/embulk/spi/type/TimestampType.java +0 -41
  193. data/embulk-core/src/main/java/org/embulk/spi/type/Type.java +0 -15
  194. data/embulk-core/src/main/java/org/embulk/spi/type/TypeDeserializer.java +0 -45
  195. data/embulk-core/src/main/java/org/embulk/spi/type/Types.java +0 -16
  196. data/embulk-core/src/main/java/org/embulk/spi/unit/ByteSize.java +0 -156
  197. data/embulk-core/src/main/java/org/embulk/spi/unit/LocalFile.java +0 -106
  198. data/embulk-core/src/main/java/org/embulk/spi/unit/LocalFileSerDe.java +0 -113
  199. data/embulk-core/src/main/java/org/embulk/spi/unit/ToString.java +0 -54
  200. data/embulk-core/src/main/java/org/embulk/spi/unit/ToStringMap.java +0 -34
  201. data/embulk-core/src/main/java/org/embulk/spi/util/CharsetSerDe.java +0 -55
  202. data/embulk-core/src/main/java/org/embulk/spi/util/Decoders.java +0 -81
  203. data/embulk-core/src/main/java/org/embulk/spi/util/DynamicColumnNotFoundException.java +0 -10
  204. data/embulk-core/src/main/java/org/embulk/spi/util/DynamicColumnSetter.java +0 -21
  205. data/embulk-core/src/main/java/org/embulk/spi/util/DynamicColumnSetterFactory.java +0 -134
  206. data/embulk-core/src/main/java/org/embulk/spi/util/DynamicPageBuilder.java +0 -200
  207. data/embulk-core/src/main/java/org/embulk/spi/util/Encoders.java +0 -81
  208. data/embulk-core/src/main/java/org/embulk/spi/util/Executors.java +0 -93
  209. data/embulk-core/src/main/java/org/embulk/spi/util/FileInputInputStream.java +0 -111
  210. data/embulk-core/src/main/java/org/embulk/spi/util/FileOutputOutputStream.java +0 -119
  211. data/embulk-core/src/main/java/org/embulk/spi/util/Filters.java +0 -100
  212. data/embulk-core/src/main/java/org/embulk/spi/util/InputStreamFileInput.java +0 -189
  213. data/embulk-core/src/main/java/org/embulk/spi/util/InputStreamTransactionalFileInput.java +0 -25
  214. data/embulk-core/src/main/java/org/embulk/spi/util/Inputs.java +0 -65
  215. data/embulk-core/src/main/java/org/embulk/spi/util/LineDecoder.java +0 -157
  216. data/embulk-core/src/main/java/org/embulk/spi/util/LineEncoder.java +0 -123
  217. data/embulk-core/src/main/java/org/embulk/spi/util/ListFileInput.java +0 -52
  218. data/embulk-core/src/main/java/org/embulk/spi/util/Newline.java +0 -38
  219. data/embulk-core/src/main/java/org/embulk/spi/util/OutputStreamFileOutput.java +0 -88
  220. data/embulk-core/src/main/java/org/embulk/spi/util/PagePrinter.java +0 -126
  221. data/embulk-core/src/main/java/org/embulk/spi/util/Pages.java +0 -149
  222. data/embulk-core/src/main/java/org/embulk/spi/util/ResumableInputStream.java +0 -168
  223. data/embulk-core/src/main/java/org/embulk/spi/util/RetryExecutor.java +0 -130
  224. data/embulk-core/src/main/java/org/embulk/spi/util/Timestamps.java +0 -53
  225. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/AbstractDynamicColumnSetter.java +0 -94
  226. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/BooleanColumnSetter.java +0 -71
  227. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/DefaultValueSetter.java +0 -20
  228. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/DoubleColumnSetter.java +0 -68
  229. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/JsonColumnSetter.java +0 -64
  230. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/LongColumnSetter.java +0 -78
  231. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/NullDefaultValueSetter.java +0 -39
  232. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/SkipColumnSetter.java +0 -68
  233. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/StringColumnSetter.java +0 -63
  234. data/embulk-core/src/main/java/org/embulk/spi/util/dynamic/TimestampColumnSetter.java +0 -72
  235. data/embulk-core/src/main/resources/embulk/logback-color.xml +0 -72
  236. data/embulk-core/src/main/resources/embulk/logback-console.xml +0 -14
  237. data/embulk-core/src/main/resources/embulk/logback-file.xml +0 -23
  238. data/embulk-core/src/main/resources/embulk/parent_first_packages.properties +0 -73
  239. data/embulk-core/src/main/resources/embulk/parent_first_resources.properties +0 -29
  240. data/embulk-core/src/test/java/org/embulk/EmbulkTestRuntime.java +0 -122
  241. data/embulk-core/src/test/java/org/embulk/GuiceBinder.java +0 -72
  242. data/embulk-core/src/test/java/org/embulk/RandomManager.java +0 -53
  243. data/embulk-core/src/test/java/org/embulk/TestPluginSourceModule.java +0 -23
  244. data/embulk-core/src/test/java/org/embulk/TestUtilityModule.java +0 -17
  245. data/embulk-core/src/test/java/org/embulk/config/TestConfigLoader.java +0 -66
  246. data/embulk-core/src/test/java/org/embulk/config/TestConfigSource.java +0 -114
  247. data/embulk-core/src/test/java/org/embulk/config/TestTaskSource.java +0 -70
  248. data/embulk-core/src/test/java/org/embulk/plugin/MockPluginSource.java +0 -58
  249. data/embulk-core/src/test/java/org/embulk/plugin/TestPluginType.java +0 -83
  250. data/embulk-core/src/test/java/org/embulk/plugin/TestPluginTypeSerDe.java +0 -67
  251. data/embulk-core/src/test/java/org/embulk/plugin/jar/ExampleJarSpiV0.java +0 -9
  252. data/embulk-core/src/test/java/org/embulk/plugin/jar/JarBuilder.java +0 -101
  253. data/embulk-core/src/test/java/org/embulk/plugin/jar/TestJarPluginLoader.java +0 -60
  254. data/embulk-core/src/test/java/org/embulk/plugin/maven/TestMavenArtifactFinder.java +0 -41
  255. data/embulk-core/src/test/java/org/embulk/spi/MockFileOutput.java +0 -63
  256. data/embulk-core/src/test/java/org/embulk/spi/MockFormatterPlugin.java +0 -108
  257. data/embulk-core/src/test/java/org/embulk/spi/MockParserPlugin.java +0 -80
  258. data/embulk-core/src/test/java/org/embulk/spi/PageTestUtils.java +0 -59
  259. data/embulk-core/src/test/java/org/embulk/spi/TestBuffer.java +0 -24
  260. data/embulk-core/src/test/java/org/embulk/spi/TestFileInputInputStream.java +0 -89
  261. data/embulk-core/src/test/java/org/embulk/spi/TestFileInputRunner.java +0 -199
  262. data/embulk-core/src/test/java/org/embulk/spi/TestFileOutputRunner.java +0 -221
  263. data/embulk-core/src/test/java/org/embulk/spi/TestInputStreamFileInput.java +0 -188
  264. data/embulk-core/src/test/java/org/embulk/spi/TestPageBuilderReader.java +0 -411
  265. data/embulk-core/src/test/java/org/embulk/spi/json/TestJsonParser.java +0 -102
  266. data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestamp.java +0 -116
  267. data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParser.java +0 -75
  268. data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParserDeprecated.java +0 -67
  269. data/embulk-core/src/test/java/org/embulk/spi/time/TestTimestampParser.java +0 -247
  270. data/embulk-core/src/test/java/org/embulk/spi/type/TestTypeSerDe.java +0 -45
  271. data/embulk-core/src/test/java/org/embulk/spi/unit/TestByteSize.java +0 -79
  272. data/embulk-core/src/test/java/org/embulk/spi/util/TestLineDecoder.java +0 -237
  273. data/embulk-core/src/test/java/org/embulk/spi/util/TestLineEncoder.java +0 -123
  274. data/embulk-core/src/test/resources/m2.test/.gitignore +0 -1
  275. data/embulk-core/src/test/resources/m2.test/org/embulk/example/embulk-example-maven-artifact/0.1.2/embulk-example-maven-artifact-0.1.2.jar +0 -0
  276. data/embulk-core/src/test/resources/m2.test/org/embulk/example/embulk-example-maven-artifact/0.1.2/embulk-example-maven-artifact-0.1.2.jar.sha1 +0 -1
  277. data/embulk-core/src/test/resources/m2.test/org/embulk/example/embulk-example-maven-artifact/0.1.2/embulk-example-maven-artifact-0.1.2.pom +0 -9
  278. data/embulk-core/src/test/resources/m2.test/org/embulk/example/embulk-example-maven-artifact/0.1.2/embulk-example-maven-artifact-0.1.2.pom.sha1 +0 -1
  279. data/embulk-docs/Makefile +0 -178
  280. data/embulk-docs/build.gradle +0 -41
  281. data/embulk-docs/make.bat +0 -243
  282. data/embulk-docs/push-gh-pages.sh +0 -49
  283. data/embulk-docs/src/_static/embulk-architecture.png +0 -0
  284. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-oneline-tr.png +0 -0
  285. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-oneline-wt.png +0 -0
  286. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-oneline.ai +0 -396
  287. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-sq-tr-small.png +0 -0
  288. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-sq-tr.png +0 -0
  289. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-sq-wt.png +0 -0
  290. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-sq.ai +0 -417
  291. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-sq.svg +0 -1
  292. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-symbol-tr.png +0 -0
  293. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-symbol-wt.png +0 -0
  294. data/embulk-docs/src/_static/embulk-logo-v2/embulk-logo-v2-symbol.ai +1 -394
  295. data/embulk-docs/src/_static/embulk-logo.svg +0 -133
  296. data/embulk-docs/src/built-in.rst +0 -1017
  297. data/embulk-docs/src/conf.py +0 -260
  298. data/embulk-docs/src/customization.rst +0 -184
  299. data/embulk-docs/src/developers/index.rst +0 -45
  300. data/embulk-docs/src/index.rst +0 -102
  301. data/embulk-docs/src/logo.rst +0 -27
  302. data/embulk-docs/src/recipe.rst +0 -8
  303. data/embulk-docs/src/recipe/scheduled-csv-load-to-elasticsearch-kibana5.rst +0 -163
  304. data/embulk-docs/src/release.rst +0 -109
  305. data/embulk-docs/src/release/release-0.1.0.rst +0 -8
  306. data/embulk-docs/src/release/release-0.2.0.rst +0 -16
  307. data/embulk-docs/src/release/release-0.2.1.rst +0 -19
  308. data/embulk-docs/src/release/release-0.3.0.rst +0 -34
  309. data/embulk-docs/src/release/release-0.3.1.rst +0 -11
  310. data/embulk-docs/src/release/release-0.3.2.rst +0 -15
  311. data/embulk-docs/src/release/release-0.4.0.rst +0 -74
  312. data/embulk-docs/src/release/release-0.4.1.rst +0 -18
  313. data/embulk-docs/src/release/release-0.4.10.rst +0 -17
  314. data/embulk-docs/src/release/release-0.4.2.rst +0 -18
  315. data/embulk-docs/src/release/release-0.4.3.rst +0 -34
  316. data/embulk-docs/src/release/release-0.4.4.rst +0 -39
  317. data/embulk-docs/src/release/release-0.4.5.rst +0 -24
  318. data/embulk-docs/src/release/release-0.4.6.rst +0 -30
  319. data/embulk-docs/src/release/release-0.4.7.rst +0 -16
  320. data/embulk-docs/src/release/release-0.4.8.rst +0 -15
  321. data/embulk-docs/src/release/release-0.4.9.rst +0 -23
  322. data/embulk-docs/src/release/release-0.5.0.rst +0 -89
  323. data/embulk-docs/src/release/release-0.5.1.rst +0 -13
  324. data/embulk-docs/src/release/release-0.5.2.rst +0 -30
  325. data/embulk-docs/src/release/release-0.5.3.rst +0 -22
  326. data/embulk-docs/src/release/release-0.5.4.rst +0 -24
  327. data/embulk-docs/src/release/release-0.5.5.rst +0 -18
  328. data/embulk-docs/src/release/release-0.6.0.rst +0 -34
  329. data/embulk-docs/src/release/release-0.6.1.rst +0 -11
  330. data/embulk-docs/src/release/release-0.6.10.rst +0 -15
  331. data/embulk-docs/src/release/release-0.6.11.rst +0 -19
  332. data/embulk-docs/src/release/release-0.6.12.rst +0 -31
  333. data/embulk-docs/src/release/release-0.6.13.rst +0 -23
  334. data/embulk-docs/src/release/release-0.6.14.rst +0 -47
  335. data/embulk-docs/src/release/release-0.6.15.rst +0 -26
  336. data/embulk-docs/src/release/release-0.6.16.rst +0 -26
  337. data/embulk-docs/src/release/release-0.6.17.rst +0 -39
  338. data/embulk-docs/src/release/release-0.6.18.rst +0 -14
  339. data/embulk-docs/src/release/release-0.6.19.rst +0 -18
  340. data/embulk-docs/src/release/release-0.6.2.rst +0 -17
  341. data/embulk-docs/src/release/release-0.6.20.rst +0 -19
  342. data/embulk-docs/src/release/release-0.6.21.rst +0 -20
  343. data/embulk-docs/src/release/release-0.6.22.rst +0 -26
  344. data/embulk-docs/src/release/release-0.6.23.rst +0 -17
  345. data/embulk-docs/src/release/release-0.6.24.rst +0 -13
  346. data/embulk-docs/src/release/release-0.6.25.rst +0 -12
  347. data/embulk-docs/src/release/release-0.6.26.rst +0 -17
  348. data/embulk-docs/src/release/release-0.6.27.rst +0 -11
  349. data/embulk-docs/src/release/release-0.6.3.rst +0 -23
  350. data/embulk-docs/src/release/release-0.6.4.rst +0 -13
  351. data/embulk-docs/src/release/release-0.6.5.rst +0 -17
  352. data/embulk-docs/src/release/release-0.6.6.rst +0 -17
  353. data/embulk-docs/src/release/release-0.6.7.rst +0 -17
  354. data/embulk-docs/src/release/release-0.6.8.rst +0 -24
  355. data/embulk-docs/src/release/release-0.6.9.rst +0 -24
  356. data/embulk-docs/src/release/release-0.7.0.rst +0 -96
  357. data/embulk-docs/src/release/release-0.7.1.rst +0 -22
  358. data/embulk-docs/src/release/release-0.7.10.rst +0 -13
  359. data/embulk-docs/src/release/release-0.7.11.rst +0 -12
  360. data/embulk-docs/src/release/release-0.7.2.rst +0 -25
  361. data/embulk-docs/src/release/release-0.7.3.rst +0 -21
  362. data/embulk-docs/src/release/release-0.7.4.rst +0 -14
  363. data/embulk-docs/src/release/release-0.7.5.rst +0 -22
  364. data/embulk-docs/src/release/release-0.7.6.rst +0 -18
  365. data/embulk-docs/src/release/release-0.7.7.rst +0 -13
  366. data/embulk-docs/src/release/release-0.7.8.rst +0 -14
  367. data/embulk-docs/src/release/release-0.7.9.rst +0 -14
  368. data/embulk-docs/src/release/release-0.8.0.rst +0 -74
  369. data/embulk-docs/src/release/release-0.8.1.rst +0 -18
  370. data/embulk-docs/src/release/release-0.8.10.rst +0 -35
  371. data/embulk-docs/src/release/release-0.8.11.rst +0 -12
  372. data/embulk-docs/src/release/release-0.8.12.rst +0 -12
  373. data/embulk-docs/src/release/release-0.8.13.rst +0 -12
  374. data/embulk-docs/src/release/release-0.8.14.rst +0 -31
  375. data/embulk-docs/src/release/release-0.8.15.rst +0 -17
  376. data/embulk-docs/src/release/release-0.8.16.rst +0 -43
  377. data/embulk-docs/src/release/release-0.8.17.rst +0 -11
  378. data/embulk-docs/src/release/release-0.8.18.rst +0 -27
  379. data/embulk-docs/src/release/release-0.8.19.rst +0 -43
  380. data/embulk-docs/src/release/release-0.8.2.rst +0 -19
  381. data/embulk-docs/src/release/release-0.8.20.rst +0 -11
  382. data/embulk-docs/src/release/release-0.8.21.rst +0 -17
  383. data/embulk-docs/src/release/release-0.8.22.rst +0 -15
  384. data/embulk-docs/src/release/release-0.8.23.rst +0 -14
  385. data/embulk-docs/src/release/release-0.8.24.rst +0 -15
  386. data/embulk-docs/src/release/release-0.8.25.rst +0 -14
  387. data/embulk-docs/src/release/release-0.8.26.rst +0 -16
  388. data/embulk-docs/src/release/release-0.8.27.rst +0 -15
  389. data/embulk-docs/src/release/release-0.8.28.rst +0 -14
  390. data/embulk-docs/src/release/release-0.8.29.rst +0 -14
  391. data/embulk-docs/src/release/release-0.8.3.rst +0 -15
  392. data/embulk-docs/src/release/release-0.8.30.rst +0 -14
  393. data/embulk-docs/src/release/release-0.8.31.rst +0 -12
  394. data/embulk-docs/src/release/release-0.8.32.rst +0 -14
  395. data/embulk-docs/src/release/release-0.8.33.rst +0 -13
  396. data/embulk-docs/src/release/release-0.8.34.rst +0 -12
  397. data/embulk-docs/src/release/release-0.8.35.rst +0 -12
  398. data/embulk-docs/src/release/release-0.8.36.rst +0 -32
  399. data/embulk-docs/src/release/release-0.8.37.rst +0 -20
  400. data/embulk-docs/src/release/release-0.8.38.rst +0 -12
  401. data/embulk-docs/src/release/release-0.8.39.rst +0 -12
  402. data/embulk-docs/src/release/release-0.8.4.rst +0 -18
  403. data/embulk-docs/src/release/release-0.8.5.rst +0 -11
  404. data/embulk-docs/src/release/release-0.8.6.rst +0 -14
  405. data/embulk-docs/src/release/release-0.8.7.rst +0 -18
  406. data/embulk-docs/src/release/release-0.8.8.rst +0 -18
  407. data/embulk-docs/src/release/release-0.8.9.rst +0 -14
  408. data/embulk-jruby-strptime/build.gradle +0 -3
  409. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/RubyDateParser.java +0 -121
  410. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/StrptimeFormat.java +0 -53
  411. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/StrptimeParser.java +0 -884
  412. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/StrptimeToken.java +0 -111
  413. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/TimeZoneConverter.java +0 -466
  414. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/lexer/StrptimeLexer.flex +0 -62
  415. data/embulk-jruby-strptime/src/main/java/org/embulk/spi/time/lexer/StrptimeLexer.java +0 -577
  416. data/embulk-standards/build.gradle +0 -7
  417. data/embulk-standards/src/main/java/org/embulk/standards/Bzip2FileDecoderPlugin.java +0 -55
  418. data/embulk-standards/src/main/java/org/embulk/standards/Bzip2FileEncoderPlugin.java +0 -67
  419. data/embulk-standards/src/main/java/org/embulk/standards/ConfigInputPlugin.java +0 -170
  420. data/embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java +0 -295
  421. data/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java +0 -416
  422. data/embulk-standards/src/main/java/org/embulk/standards/CsvTokenizer.java +0 -545
  423. data/embulk-standards/src/main/java/org/embulk/standards/GzipFileDecoderPlugin.java +0 -55
  424. data/embulk-standards/src/main/java/org/embulk/standards/GzipFileEncoderPlugin.java +0 -71
  425. data/embulk-standards/src/main/java/org/embulk/standards/JsonParserPlugin.java +0 -235
  426. data/embulk-standards/src/main/java/org/embulk/standards/LocalFileInputPlugin.java +0 -232
  427. data/embulk-standards/src/main/java/org/embulk/standards/LocalFileOutputPlugin.java +0 -148
  428. data/embulk-standards/src/main/java/org/embulk/standards/NullOutputPlugin.java +0 -59
  429. data/embulk-standards/src/main/java/org/embulk/standards/RemoveColumnsFilterPlugin.java +0 -268
  430. data/embulk-standards/src/main/java/org/embulk/standards/RenameFilterPlugin.java +0 -479
  431. data/embulk-standards/src/main/java/org/embulk/standards/StandardPluginExtension.java +0 -16
  432. data/embulk-standards/src/main/java/org/embulk/standards/StandardPluginModule.java +0 -60
  433. data/embulk-standards/src/main/java/org/embulk/standards/StdoutOutputPlugin.java +0 -91
  434. data/embulk-standards/src/main/resources/META-INF/services/org.embulk.spi.Extension +0 -1
  435. data/embulk-standards/src/test/java/org/embulk/standards/TestCsvFormatterPlugin.java +0 -312
  436. data/embulk-standards/src/test/java/org/embulk/standards/TestCsvParserPlugin.java +0 -75
  437. data/embulk-standards/src/test/java/org/embulk/standards/TestCsvTokenizer.java +0 -457
  438. data/embulk-standards/src/test/java/org/embulk/standards/TestJsonParserPlugin.java +0 -351
  439. data/embulk-standards/src/test/java/org/embulk/standards/TestRemoveColumnsFilterPlugin.java +0 -121
  440. data/embulk-standards/src/test/java/org/embulk/standards/TestRenameFilterPlugin.java +0 -1020
  441. data/embulk-standards/src/test/java/org/embulk/standards/guess/TestCsvAllStringsGuessPlugin.java +0 -38
  442. data/embulk-standards/src/test/java/org/embulk/standards/guess/TestCsvGuessPlugin.java +0 -248
  443. data/embulk-standards/src/test/java/org/embulk/standards/preview/TestFilePreview.java +0 -73
  444. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_int_single_column_row.csv +0 -1
  445. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_int_single_column_row_and_header.csv +0 -2
  446. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_int_single_column_row_and_header_guessed.yml +0 -12
  447. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_int_single_column_row_and_header_seed.yml +0 -1
  448. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_int_single_column_row_guessed.yml +0 -12
  449. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_int_single_column_row_seed.yml +0 -1
  450. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows.csv +0 -1
  451. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_and_header.csv +0 -2
  452. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_and_header_guessed.yml +0 -16
  453. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_and_header_seed.yml +0 -1
  454. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_and_header_with_trim_needed.csv +0 -2
  455. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_and_header_with_trim_needed_guessed.yml +0 -16
  456. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_and_header_with_trim_needed_seed.yml +0 -1
  457. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_guessed.yml +0 -16
  458. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_seed.yml +0 -1
  459. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_with_trim_needed.csv +0 -1
  460. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_with_trim_needed_guessed.yml +0 -16
  461. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_rows_with_trim_needed_seed.yml +0 -1
  462. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_string_single_column_row.csv +0 -1
  463. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_string_single_column_row_and_header.csv +0 -2
  464. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_string_single_column_row_and_header_guessed.yml +0 -12
  465. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_string_single_column_row_and_header_seed.yml +0 -1
  466. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_string_single_column_row_guessed.yml +0 -12
  467. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_1_string_single_column_row_seed.yml +0 -1
  468. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_int_single_column_rows.csv +0 -2
  469. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_int_single_column_rows_guessed.yml +0 -12
  470. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_int_single_column_rows_seed.yml +0 -1
  471. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_rows.csv +0 -2
  472. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_rows_and_header.csv +0 -3
  473. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_rows_and_header_guessed.yml +0 -16
  474. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_rows_and_header_seed.yml +0 -1
  475. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_rows_guessed.yml +0 -16
  476. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_rows_seed.yml +0 -1
  477. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_string_single_column_rows.csv +0 -2
  478. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_string_single_column_rows_guessed.yml +0 -12
  479. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_2_string_single_column_rows_seed.yml +0 -1
  480. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_backslash_escape.csv +0 -5
  481. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_backslash_escape_guessed.yml +0 -17
  482. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_backslash_escape_seed.yml +0 -1
  483. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_double_single_column.csv +0 -12
  484. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_double_single_column_guessed.yml +0 -12
  485. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_double_single_column_seed.yml +0 -1
  486. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_int_single_column.csv +0 -4
  487. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_int_single_column_guessed.yml +0 -12
  488. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_int_single_column_seed.yml +0 -1
  489. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_int_single_column_with_header.csv +0 -5
  490. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_int_single_column_with_header_guessed.yml +0 -12
  491. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_int_single_column_with_header_seed.yml +0 -1
  492. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_semicolon_delimiter.csv +0 -5
  493. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_semicolon_delimiter_guessed.yml +0 -17
  494. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_semicolon_delimiter_seed.yml +0 -1
  495. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_simple.csv +0 -5
  496. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_simple_guessed.yml +0 -17
  497. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_simple_seed.yml +0 -1
  498. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_single_quote.csv +0 -5
  499. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_single_quote_guessed.yml +0 -17
  500. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_single_quote_seed.yml +0 -1
  501. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_skip_suggest_if_empty_sample_records.csv +0 -5
  502. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_skip_suggest_if_empty_sample_records_guessed.yml +0 -2
  503. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_skip_suggest_if_empty_sample_records_seed.yml +0 -1
  504. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_string_single_column.csv +0 -4
  505. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_string_single_column_guessed.yml +0 -12
  506. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_string_single_column_seed.yml +0 -1
  507. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_string_single_column_with_header.csv +0 -5
  508. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_string_single_column_with_header_guessed.yml +0 -12
  509. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_string_single_column_with_header_seed.yml +0 -1
  510. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_tab_delimiter.csv +0 -4
  511. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_tab_delimiter_guessed.yml +0 -16
  512. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv/test/test_tab_delimiter_seed.yml +0 -1
  513. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv_all_strings/test/test_simple.csv +0 -5
  514. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv_all_strings/test/test_simple_guessed.yml +0 -17
  515. data/embulk-standards/src/test/resources/org/embulk/standards/guess/csv_all_strings/test/test_simple_seed.yml +0 -1
  516. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_sample_buffer_bytes.csv +0 -5
  517. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_sample_buffer_bytes_exec.yml +0 -1
  518. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_sample_buffer_bytes_load.yml +0 -19
  519. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_sample_buffer_bytes_previewed.csv +0 -1
  520. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_simple.csv +0 -5
  521. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_simple_load.yml +0 -19
  522. data/embulk-standards/src/test/resources/org/embulk/standards/preview/file/test/test_simple_previewed.csv +0 -4
  523. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep.csv +0 -5
  524. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_expected.csv +0 -4
  525. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_filter.yml +0 -2
  526. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_in.yml +0 -18
  527. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_with_duplicated_column_names.csv +0 -5
  528. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_with_duplicated_column_names.yml +0 -2
  529. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_with_duplicated_column_names_expected.csv +0 -4
  530. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_with_duplicated_column_names_in.yml +0 -17
  531. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_with_unmatched_filter.yml +0 -3
  532. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_keep_without_unmatched_filter.yml +0 -2
  533. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_remove.csv +0 -5
  534. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_remove_expected.csv +0 -4
  535. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_remove_filter.yml +0 -2
  536. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_remove_in.yml +0 -18
  537. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_remove_with_unmatched_filter.yml +0 -3
  538. data/embulk-standards/src/test/resources/org/embulk/standards/remove_columns/test/test_remove_without_unmatched_filter.yml +0 -2
  539. data/embulk-test/build.gradle +0 -6
  540. data/embulk-test/src/main/java/org/embulk/test/EmbulkTests.java +0 -75
  541. data/embulk-test/src/main/java/org/embulk/test/PreviewResultInputPlugin.java +0 -65
  542. data/embulk-test/src/main/java/org/embulk/test/TestingBulkLoader.java +0 -129
  543. data/embulk-test/src/main/java/org/embulk/test/TestingEmbulk.java +0 -710
  544. data/gradle/wrapper/gradle-wrapper.jar +0 -0
  545. data/gradle/wrapper/gradle-wrapper.properties +0 -5
  546. data/gradlew +0 -172
  547. data/gradlew.bat +0 -84
  548. data/lib/embulk/data/bundle/.bundle/config +0 -3
  549. data/lib/embulk/data/bundle/.ruby-version +0 -1
  550. data/lib/embulk/data/bundle/Gemfile +0 -31
  551. data/lib/embulk/data/bundle/embulk/filter/example.rb +0 -42
  552. data/lib/embulk/data/bundle/embulk/input/example.rb +0 -54
  553. data/lib/embulk/data/bundle/embulk/output/example.rb +0 -58
  554. data/lib/embulk/data/new/LICENSE.txt +0 -21
  555. data/lib/embulk/data/new/README.md.vm +0 -106
  556. data/lib/embulk/data/new/gitignore.vm +0 -17
  557. data/lib/embulk/data/new/java/build.gradle.vm +0 -96
  558. data/lib/embulk/data/new/java/config/checkstyle/checkstyle.xml +0 -128
  559. data/lib/embulk/data/new/java/config/checkstyle/default.xml +0 -108
  560. data/lib/embulk/data/new/java/decoder.java.vm +0 -86
  561. data/lib/embulk/data/new/java/encoder.java.vm +0 -88
  562. data/lib/embulk/data/new/java/file_input.java.vm +0 -145
  563. data/lib/embulk/data/new/java/file_output.java.vm +0 -95
  564. data/lib/embulk/data/new/java/filter.java.vm +0 -57
  565. data/lib/embulk/data/new/java/formatter.java.vm +0 -55
  566. data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  567. data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.properties +0 -5
  568. data/lib/embulk/data/new/java/gradlew +0 -172
  569. data/lib/embulk/data/new/java/gradlew.bat +0 -84
  570. data/lib/embulk/data/new/java/input.java.vm +0 -89
  571. data/lib/embulk/data/new/java/output.java.vm +0 -79
  572. data/lib/embulk/data/new/java/parser.java.vm +0 -61
  573. data/lib/embulk/data/new/java/plugin_loader.rb.vm +0 -3
  574. data/lib/embulk/data/new/java/test.java.vm +0 -5
  575. data/lib/embulk/data/new/ruby/.ruby-version +0 -1
  576. data/lib/embulk/data/new/ruby/Gemfile +0 -2
  577. data/lib/embulk/data/new/ruby/Rakefile +0 -3
  578. data/lib/embulk/data/new/ruby/decoder_guess.rb.vm +0 -25
  579. data/lib/embulk/data/new/ruby/filter.rb.vm +0 -50
  580. data/lib/embulk/data/new/ruby/formatter.rb.vm +0 -49
  581. data/lib/embulk/data/new/ruby/gemspec.vm +0 -20
  582. data/lib/embulk/data/new/ruby/input.rb.vm +0 -59
  583. data/lib/embulk/data/new/ruby/output.rb.vm +0 -61
  584. data/lib/embulk/data/new/ruby/parser.rb.vm +0 -44
  585. data/lib/embulk/data/new/ruby/parser_guess.rb.vm +0 -65
  586. data/lib/embulk/data/package_data.rb +0 -59
  587. data/lib/embulk/runner.rb +0 -53
  588. data/settings.gradle +0 -8
  589. data/test/helper.rb +0 -23
  590. data/test/monkey_strptime/mri/date/test_date_strptime.rb +0 -515
  591. data/test/monkey_strptime/run-test.rb +0 -29
  592. data/test/vanilla/guess/test_csv_all_strings.rb +0 -43
  593. data/test/vanilla/guess/test_csv_guess.rb +0 -170
  594. data/test/vanilla/guess/test_schema_guess.rb +0 -47
  595. data/test/vanilla/guess/test_time_format_guess.rb +0 -135
  596. data/test/vanilla/run-test.rb +0 -14
  597. data/test/vanilla/time/test_timestamp_parser.rb +0 -117
@@ -1,419 +0,0 @@
1
- package org.embulk.cli;
2
-
3
- import java.io.BufferedWriter;
4
- import java.io.IOException;
5
- import java.io.InputStreamReader;
6
- import java.nio.charset.StandardCharsets;
7
- import java.nio.file.Files;
8
- import java.nio.file.FileVisitResult;
9
- import java.nio.file.Path;
10
- import java.nio.file.Paths;
11
- import java.nio.file.SimpleFileVisitor;
12
- import java.nio.file.attribute.BasicFileAttributes;
13
- import java.nio.file.attribute.PosixFilePermission;
14
- import java.util.ArrayList;
15
- import java.util.HashMap;
16
- import java.util.HashSet;
17
- import java.util.Map;
18
- import java.util.Set;
19
-
20
- import com.google.common.base.CaseFormat;
21
- import com.google.common.base.Joiner;
22
- import com.google.common.io.CharStreams;
23
-
24
- import org.apache.velocity.VelocityContext;
25
- import org.apache.velocity.app.VelocityEngine;
26
-
27
- public class EmbulkNew
28
- {
29
- public EmbulkNew(final String categoryWithLanguage, final String nameGiven, final String embulkVersion)
30
- throws IOException
31
- {
32
- this.basePath = Paths.get(".").toAbsolutePath();
33
-
34
- final LanguageAndCategory languageAndCategory = LanguageAndCategory.of(categoryWithLanguage);
35
- this.language = languageAndCategory.getLanguage();
36
- this.category = languageAndCategory.getCategory();
37
- this.nameGiven = nameGiven;
38
- this.embulkVersion = embulkVersion;
39
-
40
- if (category.equals("file_input")) {
41
- this.embulkCategory = "input";
42
- }
43
- else if (category.equals("file_output")) {
44
- this.embulkCategory = "output";
45
- }
46
- else {
47
- this.embulkCategory = category;
48
- }
49
-
50
- this.name = nameGiven.replaceAll("[^a-zA-Z0-9_]+", "_");
51
-
52
- this.fullProjectName = "embulk-" + embulkCategory + "-" + name;
53
- this.pluginDirectory = "lib/embulk";
54
- this.pluginPath = pluginDirectory + "/" + embulkCategory + "/" + name + ".rb";
55
-
56
- this.pluginBasePath = this.basePath.resolve(fullProjectName);
57
-
58
- this.velocityEngine = new VelocityEngine();
59
- this.velocityEngine.init();
60
- this.velocityEngine.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS,
61
- "org.apache.velocity.runtime.log.NullLogSystem");
62
- }
63
-
64
- public boolean newPlugin()
65
- throws IOException
66
- {
67
- if (Files.exists(this.pluginBasePath)) {
68
- throw new IOException("./" + this.fullProjectName + " already exists. Please delete it first.");
69
- }
70
-
71
- Files.createDirectories(this.pluginBasePath);
72
-
73
- System.out.println("Creating " + this.fullProjectName + "/");
74
-
75
- boolean success = false;
76
- try {
77
- //
78
- // Generate gemspec
79
- //
80
- final String author = getGitConfig("user.name", "YOUR_NAME");
81
- final String email = getGitConfig("user.email", "YOUR_NAME");
82
- final String expectedGitHubAccount = email.split("@")[0];
83
-
84
- // variables used in Velocity templates
85
- final String rubyClassName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name);
86
- final String javaClassName =
87
- CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name) +
88
- CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, category) +
89
- "Plugin";
90
- final String javaPackageName = "org.embulk." + embulkCategory + "." + name;
91
- final String displayName = getDisplayName(name);
92
- final String displayCategory = category.replace("_", " ");
93
-
94
- final HashMap<String, String> extraGuesses = new HashMap<String, String>();
95
-
96
- final String description;
97
- switch (category) {
98
- case "input":
99
- description = String.format("Loads records from %s.", displayName);
100
- break;
101
- case "file_input":
102
- description = String.format("Reads files stored on %s.", displayName);
103
- break;
104
- case "parser":
105
- description = String.format("Parses %s files read by other file input plugins.", displayName);
106
- extraGuesses.put("embulk/data/new/ruby/parser_guess.rb.vm",
107
- String.format("%s/guess/%s.rb", pluginDirectory, name));
108
- break;
109
- case "decoder":
110
- description = String.format("Decodes %s-encoded files read by other file input plugins.", displayName);
111
- extraGuesses.put("embulk/data/new/ruby/decoder_guess.rb.vm",
112
- String.format("%s/guess/%s.rb", pluginDirectory, name));
113
- break;
114
- case "output":
115
- description = String.format("Dumps records to %s.", displayName);
116
- break;
117
- case "file_output":
118
- description = String.format("Stores files on %s.", displayName);
119
- break;
120
- case "formatter":
121
- description = String.format("Formats %s files for other file output plugins.", displayName);
122
- break;
123
- case "encoder":
124
- description = String.format("Encodes files using %s for other file output plugins.", displayName);
125
- break;
126
- case "filter":
127
- description = String.format("%s", displayName);
128
- break;
129
- default:
130
- throw new RuntimeException("FATAL: Invalid plugin category.");
131
- }
132
-
133
- //
134
- // Generate project repository
135
- //
136
- final VelocityContext velocityContext = createVelocityContext(
137
- author,
138
- category,
139
- description,
140
- displayName,
141
- displayCategory,
142
- email,
143
- embulkCategory,
144
- this.embulkVersion,
145
- expectedGitHubAccount,
146
- fullProjectName,
147
- javaClassName,
148
- javaPackageName,
149
- language,
150
- name,
151
- rubyClassName);
152
- copyTemplated("embulk/data/new/README.md.vm", "README.md", velocityContext);
153
- copy("embulk/data/new/LICENSE.txt", "LICENSE.txt");
154
- copyTemplated("embulk/data/new/gitignore.vm", ".gitignore", velocityContext);
155
-
156
- switch (language) {
157
- case "ruby":
158
- copy("embulk/data/new/ruby/Rakefile", "Rakefile");
159
- copy("embulk/data/new/ruby/Gemfile", "Gemfile");
160
- copy("embulk/data/new/ruby/.ruby-version", ".ruby-version");
161
- copyTemplated("embulk/data/new/ruby/gemspec.vm",
162
- fullProjectName + ".gemspec",
163
- velocityContext);
164
- copyTemplated(String.format("embulk/data/new/ruby/%s.rb.vm", category),
165
- this.pluginPath,
166
- velocityContext);
167
- break;
168
- case "java":
169
- copy("embulk/data/new/java/gradle/wrapper/gradle-wrapper.jar",
170
- "gradle/wrapper/gradle-wrapper.jar");
171
- copy("embulk/data/new/java/gradle/wrapper/gradle-wrapper.properties",
172
- "gradle/wrapper/gradle-wrapper.properties");
173
- copy("embulk/data/new/java/gradlew.bat", "gradlew.bat");
174
- copy("embulk/data/new/java/gradlew", "gradlew");
175
- setExecutable("gradlew");
176
- copy("embulk/data/new/java/config/checkstyle/checkstyle.xml", "config/checkstyle/checkstyle.xml");
177
- copy("embulk/data/new/java/config/checkstyle/default.xml", "config/checkstyle/default.xml");
178
- copyTemplated("embulk/data/new/java/build.gradle.vm", "build.gradle", velocityContext);
179
- copyTemplated("embulk/data/new/java/plugin_loader.rb.vm", this.pluginPath, velocityContext);
180
- copyTemplated(String.format("embulk/data/new/java/%s.java.vm", category),
181
- String.format("src/main/java/%s/%s.java",
182
- javaPackageName.replaceAll("\\.", "/"),
183
- javaClassName),
184
- velocityContext);
185
- copyTemplated("embulk/data/new/java/test.java.vm",
186
- String.format("src/test/java/%s/Test%s.java",
187
- javaPackageName.replaceAll("\\.", "/"),
188
- javaClassName),
189
- velocityContext);
190
- break;
191
- }
192
-
193
- for (Map.Entry<String, String> entry : extraGuesses.entrySet()) {
194
- copyTemplated(entry.getKey(), entry.getValue(), velocityContext);
195
- }
196
-
197
- System.out.println("");
198
- System.out.println("Plugin template is successfully generated.");
199
-
200
- switch (language) {
201
- case "ruby":
202
- System.out.println("Next steps:");
203
- System.out.println("");
204
- System.out.printf(" $ cd %s\n", fullProjectName);
205
- System.out.println(" $ bundle install # install one using rbenv & rbenv-build");
206
- System.out.println(" $ bundle exec rake # build gem to be released");
207
- System.out.println(" $ bundle exec embulk run config.yml # you can run plugin using this command");
208
- break;
209
- case "java":
210
- System.out.println("Next steps:");
211
- System.out.println("");
212
- System.out.printf(" $ cd %s\n", fullProjectName);
213
- System.out.println(" $ ./gradlew package");
214
- }
215
-
216
- success = true;
217
- System.out.println("");
218
- }
219
- catch (Exception ex) {
220
- ex.printStackTrace();
221
- }
222
- finally {
223
- if (!success) {
224
- System.out.println("Failed. Removing the directory created.");
225
- deleteDirectoryTree(Paths.get(fullProjectName));
226
- }
227
- }
228
- return success;
229
- }
230
-
231
- private static class LanguageAndCategory
232
- {
233
- private LanguageAndCategory(final String language, final String category)
234
- {
235
- this.language = language;
236
- this.category = category;
237
- }
238
-
239
- public static LanguageAndCategory of(final String categoryWithLanguage)
240
- {
241
- switch (categoryWithLanguage) {
242
- case "java-input": return new LanguageAndCategory("java", "input");
243
- case "java-output": return new LanguageAndCategory("java", "output");
244
- case "java-filter": return new LanguageAndCategory("java", "filter");
245
- case "java-file-input": return new LanguageAndCategory("java", "file_input");
246
- case "java-file-output": return new LanguageAndCategory("java", "file_output");
247
- case "java-parser": return new LanguageAndCategory("java", "parser");
248
- case "java-formatter": return new LanguageAndCategory("java", "formatter");
249
- case "java-decoder": return new LanguageAndCategory("java", "decoder");
250
- case "java-encoder": return new LanguageAndCategory("java", "encoder");
251
- case "ruby-input": return new LanguageAndCategory("ruby", "input");
252
- case "ruby-output": return new LanguageAndCategory("ruby", "output");
253
- case "ruby-filter": return new LanguageAndCategory("ruby", "filter");
254
- case "ruby-file-input":
255
- throw new RuntimeException("ruby-file-input is not implemented yet. See #21 on github.");
256
- case "ruby-file-output":
257
- throw new RuntimeException("ruby-file-output is not implemented yet. See #22 on github.");
258
- case "ruby-parser": return new LanguageAndCategory("ruby", "parser");
259
- case "ruby-formatter": return new LanguageAndCategory("ruby", "formatter");
260
- case "ruby-decoder":
261
- throw new RuntimeException("ruby-decoder is not implemented yet. See #31 on github.");
262
- case "ruby-encoder":
263
- throw new RuntimeException("ruby-decoder is not implemented yet. See #32 on github.");
264
- default:
265
- throw new RuntimeException(String.format("Unknown category '%s'", categoryWithLanguage));
266
- }
267
- }
268
-
269
- public String getLanguage()
270
- {
271
- return this.language;
272
- }
273
-
274
- public String getCategory()
275
- {
276
- return this.category;
277
- }
278
-
279
- private final String language;
280
- private final String category;
281
- }
282
-
283
- private String getGitConfig(final String configName, final String defaultValue)
284
- {
285
- try {
286
- final Process process = new ProcessBuilder("git", "config", configName).redirectErrorStream(true).start();
287
- return CharStreams.toString(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8)).trim();
288
- }
289
- catch (Throwable ex) {
290
- return "YOUR_NAME";
291
- }
292
- }
293
-
294
- private Path deleteDirectoryTree(final Path path)
295
- throws IOException
296
- {
297
- return Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
298
- @Override
299
- public FileVisitResult visitFile(Path file, BasicFileAttributes attributes)
300
- throws IOException
301
- {
302
- Files.delete(file);
303
- return FileVisitResult.CONTINUE;
304
- }
305
-
306
- @Override
307
- public FileVisitResult postVisitDirectory(Path directory, IOException exception)
308
- throws IOException
309
- {
310
- Files.delete(directory);
311
- return FileVisitResult.CONTINUE;
312
- }
313
- });
314
- }
315
-
316
- private String getDisplayName(final String name)
317
- {
318
- final String[] nameSplit = name.split("_");
319
- final ArrayList<String> nameComposition = new ArrayList<String>();
320
- for (String namePart : nameSplit) {
321
- nameComposition.add(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, namePart));
322
- }
323
- return Joiner.on(" ").join(nameComposition);
324
- }
325
-
326
- private VelocityContext createVelocityContext(final String author,
327
- final String category,
328
- final String description,
329
- final String displayName,
330
- final String displayCategory,
331
- final String email,
332
- final String embulkCategory,
333
- final String embulkVersion,
334
- final String expectedGitHubAccount,
335
- final String fullProjectName,
336
- final String javaClassName,
337
- final String javaPackageName,
338
- final String language,
339
- final String name,
340
- final String rubyClassName)
341
- {
342
- final VelocityContext velocityContext = new VelocityContext();
343
- // TODO(dmikurube): Revisit this |argumentToRunEmbulkJava|.
344
- // This is in the Velocity context because the value could not be in Velocity templates.
345
- velocityContext.put("argumentToRunEmbulkJava", "\'-L ${file(\".\").absolutePath}\'");
346
- velocityContext.put("author", author);
347
- velocityContext.put("category", category);
348
- velocityContext.put("description", description);
349
- velocityContext.put("displayName", displayName);
350
- velocityContext.put("displayCategory", displayCategory);
351
- velocityContext.put("email", email);
352
- velocityContext.put("embulkCategory", embulkCategory);
353
- velocityContext.put("embulkVersion", embulkVersion);
354
- velocityContext.put("expectedGitHubAccount", expectedGitHubAccount);
355
- velocityContext.put("fullProjectName", fullProjectName);
356
- velocityContext.put("javaClassName", javaClassName);
357
- velocityContext.put("javaGuessClassName", javaClassName.replace("Plugin", "GuessPlugin"));
358
- velocityContext.put("javaPackageName", javaPackageName);
359
- velocityContext.put("language", language);
360
- velocityContext.put("name", name);
361
- velocityContext.put("rubyClassName", rubyClassName);
362
- velocityContext.put("rubyGuessClassName", rubyClassName.replace("Plugin", "GuessPlugin"));
363
- return velocityContext;
364
- }
365
-
366
- private void copy(String sourceResourcePath, String destinationFileName)
367
- throws IOException
368
- {
369
- final Path destinationPath = this.pluginBasePath.resolve(destinationFileName);
370
- Files.createDirectories(destinationPath.getParent());
371
- Files.copy(EmbulkNew.class.getClassLoader().getResourceAsStream(sourceResourcePath), destinationPath);
372
- }
373
-
374
- private void copyTemplated(String sourceResourcePath, String destinationFileName, VelocityContext velocityContext)
375
- throws IOException
376
- {
377
- try (InputStreamReader reader = new InputStreamReader(
378
- EmbulkNew.class.getClassLoader().getResourceAsStream(sourceResourcePath))) {
379
- final Path destinationPath = this.pluginBasePath.resolve(destinationFileName);
380
- Files.createDirectories(destinationPath.getParent());
381
- try (BufferedWriter writer = Files.newBufferedWriter(destinationPath, StandardCharsets.UTF_8)) {
382
- this.velocityEngine.evaluate(velocityContext,
383
- writer,
384
- "embulk-new",
385
- reader);
386
- }
387
- }
388
- }
389
-
390
- private void setExecutable(String targetFileName)
391
- throws IOException
392
- {
393
- final Path targetPath = this.pluginBasePath.resolve(targetFileName);
394
- final Set<PosixFilePermission> permissions =
395
- new HashSet<PosixFilePermission>(Files.getPosixFilePermissions(targetPath));
396
- permissions.add(PosixFilePermission.OWNER_EXECUTE);
397
- permissions.add(PosixFilePermission.GROUP_EXECUTE);
398
- permissions.add(PosixFilePermission.OTHERS_EXECUTE);
399
- Files.setPosixFilePermissions(targetPath, permissions);
400
- }
401
-
402
- private final Path basePath;
403
-
404
- private final String nameGiven;
405
- private final String language;
406
- private final String category;
407
- private final String embulkVersion;
408
-
409
- private final String embulkCategory;
410
- private final String name;
411
-
412
- private final String fullProjectName;
413
- private final String pluginDirectory;
414
- private final String pluginPath;
415
-
416
- private final Path pluginBasePath;
417
-
418
- private final VelocityEngine velocityEngine;
419
- }
@@ -1,786 +0,0 @@
1
- package org.embulk.cli;
2
-
3
- import java.io.IOException;
4
- import java.io.PrintStream;
5
- import java.io.PrintWriter;
6
- import java.net.URISyntaxException;
7
- import java.nio.file.Files;
8
- import java.nio.file.FileVisitResult;
9
- import java.nio.file.Path;
10
- import java.nio.file.Paths;
11
- import java.nio.file.SimpleFileVisitor;
12
- import java.nio.file.attribute.BasicFileAttributes;
13
- import java.util.ArrayList;
14
- import java.util.Arrays;
15
- import java.util.List;
16
- import org.embulk.EmbulkRunner;
17
- import org.embulk.EmbulkSetup;
18
- import org.embulk.cli.parse.EmbulkCommandLineHelpRequired;
19
- import org.embulk.cli.parse.EmbulkCommandLineParseException;
20
- import org.embulk.cli.parse.EmbulkCommandLineParser;
21
- import org.embulk.cli.parse.OptionBehavior;
22
- import org.embulk.cli.parse.OptionDefinition;
23
- // TODO: Replace org.joda.time with java.time when Embulk goes to Java 8.
24
- import org.joda.time.DateTime;
25
- import org.joda.time.format.DateTimeFormat;
26
- import org.joda.time.format.DateTimeFormatter;
27
- import org.jruby.embed.LocalContextScope;
28
- import org.jruby.embed.LocalVariableBehavior;
29
- import org.jruby.embed.ScriptingContainer;
30
-
31
- public class EmbulkRun
32
- {
33
- public EmbulkRun(final String embulkVersion)
34
- {
35
- this.embulkVersion = embulkVersion;
36
- }
37
-
38
- public int run(final List<String> argsEmbulk, final List<String> jrubyOptions)
39
- {
40
- final EmbulkArguments arguments;
41
- try {
42
- arguments = EmbulkArguments.extract(argsEmbulk);
43
- }
44
- catch (EmbulkCommandLineException ex) {
45
- printGeneralUsage(System.err);
46
- System.err.println("");
47
- System.err.println("error: " + ex.getMessage());
48
- return 1;
49
- }
50
-
51
- final EmbulkSubcommand subcommand = arguments.getSubcommand();
52
- if (subcommand == null) {
53
- printGeneralUsage(System.err);
54
- System.err.println("");
55
- System.err.println("Use `<command> --help` to see description of the commands.");
56
- return 1;
57
- }
58
-
59
- final List<String> subcommandArguments = arguments.getSubcommandArguments();
60
-
61
- switch (subcommand) {
62
- case VERSION_OUT:
63
- // TODO(v2)[#723]: Consider capitalizing this "embulk".
64
- // https://github.com/embulk/embulk/issues/723
65
- System.out.println("embulk " + this.embulkVersion);
66
- return 0;
67
- case VERSION_ERR:
68
- // TODO(v2)[#723]: Consider capitalizing this "embulk".
69
- // https://github.com/embulk/embulk/issues/723
70
- System.err.println("embulk " + this.embulkVersion);
71
- return 0;
72
- }
73
-
74
- printEmbulkVersionHeader(System.out);
75
- printEmbulkGeneralNotifications(System.out);
76
-
77
- switch (subcommand) {
78
- case BUNDLE:
79
- case EXEC:
80
- case GEM:
81
- case IRB:
82
- return runSubcommand(subcommand, subcommandArguments, null, jrubyOptions);
83
- default:
84
- final EmbulkCommandLineParser parser = buildCommandLineParser(subcommand);
85
- final EmbulkCommandLine commandLine;
86
- try {
87
- commandLine = parser.parse(
88
- subcommandArguments, jrubyOptions, new PrintWriter(System.out), new PrintWriter(System.err));
89
- }
90
- catch (EmbulkCommandLineParseException ex) {
91
- parser.printHelp(System.err);
92
- System.err.println("");
93
- System.err.println(ex.getMessage());
94
- return 1;
95
- }
96
- catch (EmbulkCommandLineHelpRequired ex) {
97
- parser.printHelp(System.err);
98
- return 1;
99
- }
100
- return runSubcommand(subcommand, subcommandArguments, commandLine, jrubyOptions);
101
- }
102
- }
103
-
104
- private EmbulkCommandLineParser buildCommandLineParser(final EmbulkSubcommand subcommand)
105
- {
106
- final EmbulkCommandLineParser.Builder parserBuilder = EmbulkCommandLineParser.builder();
107
-
108
- // TODO: Revisit the width. JLine may help. https://github.com/jline
109
- parserBuilder
110
- .setWidth(160)
111
- .addHelpMessageLine(" Help:")
112
- .addOptionDefinition(OptionDefinition.defineHelpOption("h", "help", "Print help."))
113
- .addHelpMessageLine("");
114
-
115
- switch (subcommand) {
116
- case RUN:
117
- parserBuilder
118
- .setMainUsage("embulk run <config.yml>")
119
- .addHelpMessageLine(" Options:")
120
- // op.on('-r', '--resume-state PATH', 'Path to a file to write or read resume state') do |path|
121
- // options[:resume_state_path] = path
122
- // end
123
- .addOptionDefinition(OptionDefinition.defineOptionWithArgument(
124
- "r", "resume-state", "PATH", "Path to a file to write or read resume state",
125
- new OptionBehavior()
126
- {
127
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder,
128
- final String argument)
129
- {
130
- commandLineBuilder.setResumeState(argument);
131
- }
132
- }))
133
- // op.on('-o', '--output PATH', '(deprecated)') do |path|
134
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: Run with -o option is deprecated. Please use -c option instead. For example,"
135
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: "
136
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: $ embulk run config.yml -c diff.yml"
137
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: "
138
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: This -c option stores only diff of the next configuration."
139
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: The diff will be merged to the original config.yml file."
140
- // STDERR.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: "
141
- // options[:next_config_output_path] = path
142
- // end
143
- .addOptionDefinition(OptionDefinition.defineOptionWithArgument(
144
- "o", "output", "PATH", "(deprecated)",
145
- new OptionBehavior()
146
- {
147
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
148
- {
149
- final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS Z");
150
- final String now = DateTime.now().toString(formatter);
151
- errorWriter().println(now + ": Run with -o option is deprecated. Please use -c option instead. For example,");
152
- errorWriter().println(now + ": ");
153
- errorWriter().println(now + ": $ embulk run config.yml -c diff.yml");
154
- errorWriter().println(now + ": ");
155
- errorWriter().println(now + ": This -c option stores only diff of the next configuration.");
156
- errorWriter().println(now + ": The diff will be merged to the original config.yml file.");
157
- errorWriter().println(now + ": ");
158
- commandLineBuilder.setOutput(argument);
159
- }
160
- }))
161
- // op.on('-c', '--config-diff PATH', 'Path to a file to read & write the next configuration diff') do |path|
162
- // options[:next_config_diff_path] = path
163
- // end
164
- .addOptionDefinition(OptionDefinition.defineOptionWithArgument(
165
- "c", "config-diff", "PATH", "Path to a file to read & write the next configuration diff",
166
- new OptionBehavior()
167
- {
168
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
169
- {
170
- commandLineBuilder.setConfigDiff(argument);
171
- }
172
- }))
173
- .setArgumentsRange(1, 1);
174
- addPluginLoadOptionDefinitions(parserBuilder);
175
- addOtherOptionDefinitions(parserBuilder);
176
- break;
177
- case CLEANUP:
178
- parserBuilder
179
- .setMainUsage("embulk cleanup <config.yml>")
180
- .addHelpMessageLine(" Options:")
181
- // op.on('-r', '--resume-state PATH', 'Path to a file to cleanup resume state') do |path|
182
- // options[:resume_state_path] = path
183
- // end
184
- .addOptionDefinition(OptionDefinition.defineOptionWithArgument(
185
- "r", "resume-state", "PATH", "Path to a file to cleanup resume state",
186
- new OptionBehavior()
187
- {
188
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
189
- {
190
- commandLineBuilder.setResumeState(argument);
191
- }
192
- }))
193
- .setArgumentsRange(1, 1);
194
- addPluginLoadOptionDefinitions(parserBuilder);
195
- addOtherOptionDefinitions(parserBuilder);
196
- break;
197
- case PREVIEW:
198
- parserBuilder
199
- .setMainUsage("embulk preview <config.yml>")
200
- .addHelpMessageLine(" Options:")
201
- // op.on('-G', '--vertical', "Use vertical output format", TrueClass) do |b|
202
- // options[:format] = "vertical"
203
- // end
204
- .addOptionDefinition(OptionDefinition.defineOptionWithoutArgument(
205
- "G", "vertical", "Use vertical output format",
206
- new OptionBehavior()
207
- {
208
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
209
- {
210
- commandLineBuilder.setFormat("vertical");
211
- }
212
- }))
213
- .setArgumentsRange(1, 1);
214
- addPluginLoadOptionDefinitions(parserBuilder);
215
- addOtherOptionDefinitions(parserBuilder);
216
- break;
217
- case GUESS:
218
- parserBuilder
219
- .setMainUsage("embulk guess <partial-config.yml>")
220
- .addHelpMessageLine(" Options:")
221
- // op.on('-o', '--output PATH', 'Path to a file to write the guessed configuration') do |path|
222
- // options[:next_config_output_path] = path
223
- // end
224
- .addOptionDefinition(OptionDefinition.defineOptionWithArgument(
225
- "o", "output", "PATH", "Path to a file to write the guessed configuration",
226
- new OptionBehavior()
227
- {
228
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
229
- {
230
- commandLineBuilder.setOutput(argument);
231
- }
232
- }))
233
- // op.on('-g', '--guess NAMES', "Comma-separated list of guess plugin names") do |names|
234
- // (options[:system_config][:guess_plugins] ||= []).concat names.split(",") # TODO
235
- // end
236
- .addOptionDefinition(OptionDefinition.defineOptionWithArgument(
237
- "g", "guess", "NAMES", "Comma-separated list of guess plugin names",
238
- new OptionBehavior()
239
- {
240
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
241
- {
242
- for (final String guess : argument.split(",")) {
243
- commandLineBuilder.addSystemConfig("guess_plugins", guess);
244
- }
245
- }
246
- }))
247
- .setArgumentsRange(1, 1);
248
- addPluginLoadOptionDefinitions(parserBuilder);
249
- addOtherOptionDefinitions(parserBuilder);
250
- break;
251
- case MKBUNDLE:
252
- parserBuilder
253
- .setMainUsage("embulk mkbundle <directory> [--path PATH]")
254
- .addHelpMessageLine(" Options:")
255
- // op.on('--path PATH', 'Relative path from <directory> for the location to install gems to (e.g. --path shared/bundle).') do |path|
256
- // options[:bundle_path] = path
257
- // end
258
- .addOptionDefinition(OptionDefinition.defineOnlyLongOptionWithArgument(
259
- "path", "PATH",
260
- "Relative path from <directory> for the location to install gems to (e.g. --path shared/bundle).",
261
- new OptionBehavior()
262
- {
263
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
264
- {
265
- commandLineBuilder.setBundlePath(argument);
266
- }
267
- }))
268
- .addHelpMessageLine("")
269
- .addHelpMessageLine(" \"mkbundle\" creates a new a plugin bundle directory. You can install")
270
- .addHelpMessageLine(" plugins (gems) to the directory instead of ~/.embulk.")
271
- .addHelpMessageLine("")
272
- .addHelpMessageLine(" See generated <directory>/Gemfile to install plugins to the directory.")
273
- .addHelpMessageLine(" Use -b, --bundle BUNDLE_DIR option to use it:")
274
- .addHelpMessageLine("")
275
- .addHelpMessageLine(" $ embulk mkbundle ./dir # create bundle directory")
276
- .addHelpMessageLine(" $ (cd dir && vi Gemfile && embulk bundle) # update plugin list")
277
- .addHelpMessageLine(" $ embulk guess -b ./dir ... # guess using bundled plugins")
278
- .addHelpMessageLine(" $ embulk run -b ./dir ... # run using bundled plugins")
279
- .setArgumentsRange(1, 1);
280
- break;
281
- case NEW:
282
- parserBuilder
283
- .setMainUsage("embulk new <category> <name>")
284
- .addUsage("")
285
- .addUsage("categories:")
286
- .addUsage("")
287
- .addUsage(" ruby-input Ruby record input plugin (like \"mysql\")")
288
- .addUsage(" ruby-output Ruby record output plugin (like \"mysql\")")
289
- .addUsage(" ruby-filter Ruby record filter plugin (like \"add-hostname\")")
290
- .addUsage(" #ruby-file-input Ruby file input plugin (like \"ftp\") # not implemented yet [#21]")
291
- .addUsage(" #ruby-file-output Ruby file output plugin (like \"ftp\") # not implemented yet [#22]")
292
- .addUsage(" ruby-parser Ruby file parser plugin (like \"csv\")")
293
- .addUsage(" ruby-formatter Ruby file formatter plugin (like \"csv\")")
294
- .addUsage(" #ruby-decoder Ruby file decoder plugin (like \"gzip\") # not implemented yet [#31]")
295
- .addUsage(" #ruby-encoder Ruby file encoder plugin (like \"gzip\") # not implemented yet [#32]")
296
- .addUsage(" java-input Java record input plugin (like \"mysql\")")
297
- .addUsage(" java-output Java record output plugin (like \"mysql\")")
298
- .addUsage(" java-filter Java record filter plugin (like \"add-hostname\")")
299
- .addUsage(" java-file-input Java file input plugin (like \"ftp\")")
300
- .addUsage(" java-file-output Java file output plugin (like \"ftp\")")
301
- .addUsage(" java-parser Java file parser plugin (like \"csv\")")
302
- .addUsage(" java-formatter Java file formatter plugin (like \"csv\")")
303
- .addUsage(" java-decoder Java file decoder plugin (like \"gzip\")")
304
- .addUsage(" java-encoder Java file encoder plugin (like \"gzip\")")
305
- .addUsage("")
306
- .addUsage("examples:")
307
- .addUsage(" new ruby-output hbase")
308
- .addUsage(" new ruby-filter int-to-string")
309
- .setArgumentsRange(2, 2);
310
- break;
311
- case MIGRATE:
312
- parserBuilder
313
- .setMainUsage("embulk migrate <directory>")
314
- .setArgumentsRange(1, 1);
315
- break;
316
- case SELFUPDATE:
317
- parserBuilder
318
- .setMainUsage("embulk selfupdate")
319
- // op.on('-f', "Skip corruption check", TrueClass) do |b|
320
- // options[:force] = true
321
- // end
322
- .addOptionDefinition(OptionDefinition.defineOnlyShortOptionWithoutArgument(
323
- "f", "Skip corruption check",
324
- new OptionBehavior()
325
- {
326
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
327
- {
328
- commandLineBuilder.setForce(true);
329
- }
330
- }))
331
- .setArgumentsRange(0, 1);
332
- break;
333
- case EXAMPLE:
334
- parserBuilder
335
- .setMainUsage("embulk example [directory]")
336
- .setArgumentsRange(0, 1);
337
- break;
338
- default:
339
- parserBuilder.setMainUsage("[FATAL] Unknown subcommand: " + subcommand);
340
- }
341
-
342
- return parserBuilder.build();
343
- }
344
-
345
- private int runSubcommand(final EmbulkSubcommand subcommand,
346
- final List<String> subcommandArguments,
347
- final EmbulkCommandLine commandLine,
348
- final List<String> jrubyOptions)
349
- {
350
- switch (subcommand) {
351
- case EXAMPLE:
352
- final EmbulkExample embulkExample = new EmbulkExample();
353
- try {
354
- embulkExample.createExample(commandLine.getArguments().isEmpty()
355
- ? "embulk-example"
356
- : commandLine.getArguments().get(0));
357
- }
358
- catch (IOException ex) {
359
- ex.printStackTrace(System.err);
360
- return 1;
361
- }
362
- return 0;
363
- case NEW:
364
- final String categoryWithLanguage = commandLine.getArguments().get(0);
365
- final String nameGiven = commandLine.getArguments().get(1);
366
- try {
367
- final EmbulkNew embulkNew = new EmbulkNew(categoryWithLanguage, nameGiven, this.embulkVersion);
368
- embulkNew.newPlugin();
369
- }
370
- catch (IOException ex) {
371
- ex.printStackTrace();
372
- return 1;
373
- }
374
- return 0;
375
- case MIGRATE:
376
- final String path = commandLine.getArguments().get(0);
377
- final EmbulkMigrate embulkMigrate = new EmbulkMigrate();
378
- try {
379
- embulkMigrate.migratePlugin(path, this.embulkVersion);
380
- }
381
- catch (IOException ex) {
382
- ex.printStackTrace();
383
- return 1;
384
- }
385
- return 0;
386
- case SELFUPDATE:
387
- final String specifiedVersionString;
388
- if (commandLine.getArguments().isEmpty()) {
389
- specifiedVersionString = null;
390
- }
391
- else {
392
- specifiedVersionString = commandLine.getArguments().get(0);
393
- }
394
- final EmbulkSelfUpdate embulkSelfUpdate = new EmbulkSelfUpdate();
395
- try {
396
- embulkSelfUpdate.updateSelf(this.embulkVersion, specifiedVersionString, commandLine.getForce());
397
- }
398
- catch (IOException | URISyntaxException ex) {
399
- ex.printStackTrace();
400
- return 1;
401
- }
402
- return 0;
403
- case BUNDLE:
404
- if (!subcommandArguments.isEmpty() && subcommandArguments.get(0).equals("new")) {
405
- if (subcommandArguments.size() != 2) {
406
- printGeneralUsage(System.err);
407
- System.err.println("");
408
- System.err.println("Use `<command> --help` to see description of the commands.");
409
- return 1;
410
- }
411
- newBundle(subcommandArguments.get(1), null);
412
- System.err.println("'embulk bundle new' is deprecated. This will be removed in future release. Please use 'embulk mkbundle' instead.");
413
- }
414
- else {
415
- runBundler(subcommandArguments, null);
416
- }
417
- return 0;
418
- case GEM:
419
- callJRubyGem(subcommandArguments);
420
- return 0;
421
- case MKBUNDLE:
422
- newBundle(commandLine.getArguments().get(0), commandLine.getBundlePath());
423
- break;
424
- case EXEC:
425
- callJRubyExec(subcommandArguments);
426
- return 127;
427
- case IRB:
428
- callJRubyIRB();
429
- return 0;
430
- case RUN:
431
- case CLEANUP:
432
- case PREVIEW:
433
- case GUESS:
434
- // NOTE: When it was in Ruby "require 'embulk'" was required on top for Ruby |Embulk::setup|.
435
- // Ruby |Embulk::setup| is now replaced with Java |org.embulk.EmbulkSetup.setup|.
436
-
437
- // TODO: Move this to initial JRuby instantiation.
438
- // reset context class loader set by org.jruby.Main.main to nil. embulk manages
439
- // multiple classloaders. default classloader should be Plugin.class.getClassloader().
440
- Thread.currentThread().setContextClassLoader(null);
441
-
442
- // NOTE: When it was in Ruby ""require 'json'" was required.
443
-
444
- // NOTE: $LOAD_PATH and $CLASSPATH are set in |EmbulkSetup|.
445
-
446
- // call |EmbulkSetup.setup| after setup_classpaths to allow users to overwrite
447
- // embulk classes
448
- // NOTE: |EmbulkSetup.setup| returns |EmbulkEmbed| while it stores Ruby |Embulk::EmbulkRunner(EmbulkEmbed)|
449
- // into Ruby |Embulk::Runner|.
450
- final EmbulkRunner runner = EmbulkSetup.setup(commandLine.getSystemConfig());
451
-
452
- final Path configDiffPath =
453
- (commandLine.getConfigDiff() == null ? null : Paths.get(commandLine.getConfigDiff()));
454
- final Path outputPath =
455
- (commandLine.getOutput() == null ? null : Paths.get(commandLine.getOutput()));
456
- final Path resumeStatePath =
457
- (commandLine.getResumeState() == null ? null : Paths.get(commandLine.getResumeState()));
458
-
459
- try {
460
- switch (subcommand) {
461
- case GUESS:
462
- runner.guess(Paths.get(commandLine.getArguments().get(0)), outputPath);
463
- break;
464
- case PREVIEW:
465
- runner.preview(Paths.get(commandLine.getArguments().get(0)), commandLine.getFormat());
466
- break;
467
- case RUN:
468
- runner.run(Paths.get(commandLine.getArguments().get(0)),
469
- configDiffPath,
470
- outputPath,
471
- resumeStatePath);
472
- break;
473
- }
474
- }
475
- catch (Throwable ex) {
476
- ex.printStackTrace(System.err);
477
- System.err.println("");
478
- System.err.println("Error: " + ex.getMessage());
479
- return 1;
480
- }
481
- }
482
- return 0;
483
- }
484
-
485
- private int newBundle(final String pathString, final String bundlePath)
486
- {
487
- final Path path = Paths.get(pathString);
488
- if (Files.exists(path)) {
489
- System.err.println("'" + pathString + "' already exists.");
490
- return 1;
491
- }
492
-
493
- System.out.println("Initializing " + pathString + "...");
494
- try {
495
- Files.createDirectories(path);
496
- }
497
- catch (IOException ex) {
498
- ex.printStackTrace();
499
- return 1;
500
- }
501
- boolean success = false;
502
- try {
503
- // TODO: Rewrite this part in Java.
504
- final ScriptingContainer localJRubyContainer = createLocalJRubyScriptingContainer();
505
- localJRubyContainer.runScriptlet("require 'embulk'");
506
- localJRubyContainer.runScriptlet("require 'fileutils'");
507
- localJRubyContainer.runScriptlet("require 'rubygems/gem_runner'");
508
-
509
- // copy embulk/data/bundle/ contents
510
- localJRubyContainer.runScriptlet("require 'embulk/data/package_data'");
511
- localJRubyContainer.put("__internal_path__", pathString);
512
- localJRubyContainer.runScriptlet("pkg = Embulk::PackageData.new('bundle', __internal_path__)");
513
- localJRubyContainer.remove("__internal_path__");
514
- localJRubyContainer.runScriptlet("%w[Gemfile .ruby-version .bundle/config embulk/input/example.rb embulk/output/example.rb embulk/filter/example.rb].each { |file| pkg.cp(file, file) }");
515
- // run the first bundle-install
516
- runBundler(Arrays.asList("install", "--path", bundlePath != null ? bundlePath : "."), path);
517
- success = true;
518
- }
519
- catch (Exception ex) {
520
- ex.printStackTrace();
521
- throw ex;
522
- // success = true;
523
- }
524
- finally {
525
- if (!success) {
526
- try {
527
- Files.walkFileTree(path, new SimpleFileVisitor<Path>()
528
- {
529
- @Override
530
- public FileVisitResult visitFile(Path file, BasicFileAttributes attributes)
531
- {
532
- try {
533
- Files.deleteIfExists(file);
534
- }
535
- catch (IOException ex) {
536
- // Ignore.
537
- }
538
- return FileVisitResult.CONTINUE;
539
- }
540
-
541
- @Override
542
- public FileVisitResult postVisitDirectory(Path dir, IOException exception)
543
- {
544
- try {
545
- Files.deleteIfExists(dir);
546
- }
547
- catch (IOException ex) {
548
- // Ignore.
549
- }
550
- return FileVisitResult.CONTINUE;
551
- }
552
- });
553
- }
554
- catch (IOException ex) {
555
- ex.printStackTrace();
556
- return 1;
557
- }
558
- }
559
- }
560
- return 0;
561
- }
562
-
563
- private void runBundler(final List<String> arguments, final Path path)
564
- {
565
- final ScriptingContainer localJRubyContainer = createLocalJRubyScriptingContainer();
566
- localJRubyContainer.runScriptlet("require 'bundler'"); // bundler is included in embulk-core.jar
567
-
568
- // this hack is necessary to make --help working
569
- localJRubyContainer.runScriptlet("Bundler.define_singleton_method(:which_orig, Bundler.method(:which))");
570
- localJRubyContainer.runScriptlet("Bundler.define_singleton_method(:which) { |executable| (executable == 'man' ? false : which_orig(executable)) }");
571
-
572
- localJRubyContainer.runScriptlet("require 'bundler/friendly_errors'");
573
- localJRubyContainer.runScriptlet("require 'bundler/cli'");
574
-
575
- localJRubyContainer.put("__internal_argv_java__", arguments);
576
- if (path == null) {
577
- localJRubyContainer.runScriptlet("Bundler.with_friendly_errors { Bundler::CLI.start(Array.new(__internal_argv_java__), debug: true) }");
578
- }
579
- else {
580
- localJRubyContainer.put("__internal_working_dir__", path.toString());
581
- localJRubyContainer.runScriptlet("Dir.chdir(__internal_working_dir__) { Bundler.with_friendly_errors { Bundler::CLI.start(__internal_argv__, debug: true) } }");
582
- localJRubyContainer.remove("__internal_working_dir__");
583
- }
584
- localJRubyContainer.remove("__internal_argv_java__");
585
- }
586
-
587
- private void addPluginLoadOptionDefinitions(final EmbulkCommandLineParser.Builder parserBuilder)
588
- {
589
- parserBuilder.addHelpMessageLine("");
590
- parserBuilder.addHelpMessageLine(" Plugin load options:");
591
- // op.on('-L', '--load PATH', 'Add a local plugin path') do |plugin_path|
592
- // plugin_paths << plugin_path
593
- // end
594
- parserBuilder.addOptionDefinition(OptionDefinition.defineOptionWithArgument(
595
- "L", "load", "PATH", "Add a local plugin path",
596
- new OptionBehavior()
597
- {
598
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
599
- {
600
- commandLineBuilder.addLoad(argument);
601
- }
602
- }));
603
- // op.on('-I', '--load-path PATH', 'Add ruby script directory path ($LOAD_PATH)') do |load_path|
604
- // load_paths << load_path
605
- // end
606
- parserBuilder.addOptionDefinition(OptionDefinition.defineOptionWithArgument(
607
- "I", "load-path", "PATH", "Add ruby script directory path ($LOAD_PATH)",
608
- new OptionBehavior()
609
- {
610
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
611
- {
612
- commandLineBuilder.addLoadPath(argument);
613
- }
614
- }));
615
- // op.on('-C', '--classpath PATH', "Add java classpath separated by #{classpath_separator} (CLASSPATH)") do |classpath|
616
- // classpaths.concat classpath.split(classpath_separator)
617
- // end
618
- parserBuilder.addOptionDefinition(OptionDefinition.defineOptionWithArgument(
619
- "C", "classpath", "PATH", "Add java classpath separated by " + java.io.File.pathSeparator + " (CLASSPATH)",
620
- new OptionBehavior()
621
- {
622
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
623
- {
624
- final String[] classpaths = argument.split("\\" + java.io.File.pathSeparator);
625
- for (final String classpath : classpaths) {
626
- commandLineBuilder.addSystemConfig("jruby_classpath", classpath);
627
- }
628
- }
629
- }));
630
- // op.on('-b', '--bundle BUNDLE_DIR', 'Path to a Gemfile directory (create one using "embulk mkbundle" command)') do |path|
631
- // # only for help message. implemented at lib/embulk/command/embulk_bundle.rb
632
- // end
633
- parserBuilder.addOptionDefinition(OptionDefinition.defineOptionWithArgument(
634
- "b", "bundle", "BUNDLE_DIR", "Path to a Gemfile directory (create one using \"embulk mkbundle\" command)",
635
- new OptionBehavior()
636
- {
637
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
638
- {
639
- commandLineBuilder.setSystemConfig("jruby_global_bundler_plugin_source_directory", argument);
640
- }
641
- }));
642
- }
643
-
644
- private void addOtherOptionDefinitions(final EmbulkCommandLineParser.Builder parserBuilder)
645
- {
646
- parserBuilder.addHelpMessageLine("");
647
- parserBuilder.addHelpMessageLine(" Other options:");
648
- // op.on('-l', '--log PATH', 'Output log messages to a file (default: -)') do |path|
649
- // options[:system_config][:log_path] = path
650
- // end
651
- parserBuilder.addOptionDefinition(OptionDefinition.defineOnlyLongOptionWithArgument(
652
- "log", "PATH", "Output log messages to a file (default: -)",
653
- new OptionBehavior()
654
- {
655
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
656
- {
657
- commandLineBuilder.setSystemConfig("log_path", argument);
658
- }
659
- }));
660
- // op.on('-l', '--log-level LEVEL', 'Log level (error, warn, info, debug or trace)') do |level|
661
- // options[:system_config][:log_level] = level
662
- // end
663
- parserBuilder.addOptionDefinition(OptionDefinition.defineOptionWithArgument(
664
- "l", "log-level", "LEVEL", "Log level (error, warn, info, debug or trace)",
665
- new OptionBehavior()
666
- {
667
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
668
- {
669
- commandLineBuilder.setSystemConfig("log_level", argument);
670
- }
671
- }));
672
- // op.on('-X KEY=VALUE', 'Add a performance system config') do |kv|
673
- // k, v = kv.split('=', 2)
674
- // v ||= "true"
675
- // options[:system_config][k] = v
676
- // end
677
- parserBuilder.addOptionDefinition(OptionDefinition.defineOnlyShortOptionWithArgument(
678
- "X", "KEY=VALUE", "Add a performance system config",
679
- new OptionBehavior()
680
- {
681
- public void behave(final EmbulkCommandLine.Builder commandLineBuilder, final String argument)
682
- throws EmbulkCommandLineParseException
683
- {
684
- try {
685
- final String[] keyValue = argument.split("=", 2);
686
- commandLineBuilder.setSystemConfig(keyValue[0], keyValue[1]);
687
- }
688
- catch (Throwable ex) {
689
- throw new EmbulkCommandLineParseException(ex);
690
- }
691
- }
692
- }));
693
- }
694
-
695
- private void printGeneralUsage(final PrintStream out)
696
- {
697
- out.println("Embulk v" + this.embulkVersion);
698
- out.println("Usage: embulk [-vm-options] <command> [--options]");
699
- out.println("Commands:");
700
- out.println(" mkbundle <directory> # create a new plugin bundle environment.");
701
- out.println(" bundle [directory] # update a plugin bundle environment.");
702
- out.println(" run <config.yml> # run a bulk load transaction.");
703
- out.println(" cleanup <config.yml> # cleanup resume state.");
704
- out.println(" preview <config.yml> # dry-run the bulk load without output and show preview.");
705
- out.println(" guess <partial-config.yml> -o <output.yml> # guess missing parameters to create a complete configuration file.");
706
- out.println(" gem <install | list | help> # install a plugin or show installed plugins.");
707
- out.println(" new <category> <name> # generates new plugin template");
708
- out.println(" migrate <path> # modify plugin code to use the latest Embulk plugin API");
709
- out.println(" example [path] # creates an example config file and csv file to try embulk.");
710
- out.println(" selfupdate [version] # upgrades embulk to the latest released version or to the specified version.");
711
- out.println("");
712
- out.println("VM options:");
713
- out.println(" -E... Run an external script to configure environment variables in JVM");
714
- out.println(" (Operations not just setting envs are not recommended nor guaranteed.");
715
- out.println(" Expect side effects by running your external script at your own risk.)");
716
- out.println(" -J-O Disable JVM optimizations to speed up startup time (enabled by default if command is 'run')");
717
- out.println(" -J+O Enable JVM optimizations to speed up throughput");
718
- out.println(" -J... Set JVM options (use -J-help to see available options)");
719
- out.println(" -R... Set JRuby options (use -R--help to see available options)");
720
- }
721
-
722
- private void printEmbulkVersionHeader(final PrintStream out)
723
- {
724
- final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS Z");
725
- final String now = DateTime.now().toString(formatter);
726
- out.println(now + ": Embulk v" + this.embulkVersion);
727
- }
728
-
729
- private void printEmbulkGeneralNotifications(final PrintStream out)
730
- {
731
- out.println("");
732
- out.println("********************************** INFORMATION **********************************");
733
- out.println(" Join us! Embulk-announce mailing list is up for IMPORTANT annoucement such as");
734
- out.println(" compatibility-breaking changes and key feature updates.");
735
- out.println(" https://groups.google.com/forum/#!forum/embulk-announce");
736
- out.println("*********************************************************************************");
737
- out.println("");
738
- }
739
-
740
- // TODO: Check if it is required to process JRuby options.
741
- private ScriptingContainer createLocalJRubyScriptingContainer()
742
- {
743
- // Not |LocalContextScope.SINGLETON| to narrow down considerations.
744
- final ScriptingContainer localJRubyContainer =
745
- new ScriptingContainer(LocalContextScope.SINGLETHREAD, LocalVariableBehavior.PERSISTENT);
746
-
747
- // NOTE: Same done in JRubyScriptingModule.
748
- // Remember to update |org.embulk.jruby.JRubyScriptingModule| when these environment variables are changed.
749
- localJRubyContainer.runScriptlet("ENV.delete('BUNDLE_GEMFILE')");
750
- localJRubyContainer.runScriptlet("ENV['GEM_HOME'] = File.expand_path File.join(Java::java.lang.System.properties['user.home'], '.embulk', Gem.ruby_engine, RbConfig::CONFIG['ruby_version'])");
751
- localJRubyContainer.runScriptlet("ENV['GEM_PATH'] = ''");
752
-
753
- return localJRubyContainer;
754
- }
755
-
756
- private void callJRubyGem(final List<String> subcommandArguments)
757
- {
758
- final ScriptingContainer localJRubyContainer = createLocalJRubyScriptingContainer();
759
-
760
- localJRubyContainer.runScriptlet("puts ''");
761
- localJRubyContainer.runScriptlet("puts 'Gem plugin path is: %s' % (ENV.has_key?('GEM_HOME') ? ENV['GEM_HOME'] : '(empty)')");
762
- localJRubyContainer.runScriptlet("puts ''");
763
-
764
- localJRubyContainer.runScriptlet("require 'rubygems/gem_runner'");
765
- localJRubyContainer.put("__internal_argv_java__", subcommandArguments);
766
- localJRubyContainer.runScriptlet("Gem::GemRunner.new.run Array.new(__internal_argv_java__)");
767
- localJRubyContainer.remove("__internal_argv_java__");
768
- }
769
-
770
- private void callJRubyExec(final List<String> subcommandArguments)
771
- {
772
- final ScriptingContainer localJRubyContainer = createLocalJRubyScriptingContainer();
773
- localJRubyContainer.put("__internal_argv_java__", subcommandArguments);
774
- localJRubyContainer.runScriptlet("exec(*Array.new(__internal_argv_java__))");
775
- localJRubyContainer.remove("__internal_argv_java__");
776
- }
777
-
778
- private void callJRubyIRB()
779
- {
780
- final ScriptingContainer localJRubyContainer = createLocalJRubyScriptingContainer();
781
- localJRubyContainer.runScriptlet("require 'irb'");
782
- localJRubyContainer.runScriptlet("IRB.start");
783
- }
784
-
785
- private final String embulkVersion;
786
- }