test/prepare_embulk.rb in embulk-input-mixpanel-0.3.1 vs test/prepare_embulk.rb in embulk-input-mixpanel-0.3.2

- old
+ new

@@ -1,10 +1,17 @@ -require "embulk/command/embulk_run" +module PrepareEmbulk + require "embulk/command/embulk_run" -classpath_dir = Embulk.home("classpath") -jars = Dir.entries(classpath_dir).select{|f| f =~ /\.jar$/ }.sort -jars.each do |jar| - require File.join(classpath_dir, jar) + if Embulk.respond_to?(:home) + # keep compatibility for Embulk 0.6.x + classpath_dir = Embulk.home("classpath") + jars = Dir.entries(classpath_dir).select{|f| f =~ /\.jar$/ }.sort + jars.each do |jar| + require File.join(classpath_dir, jar) + end + require "embulk/java/bootstrap" + require "embulk" + else + require "embulk" + Embulk.setup + end end -require "embulk/java/bootstrap" - -require "embulk"