marklogic-community / roxy

Deployment tool for MarkLogic applications. Also provides optional unit test and XQuery MVC structure
Other
87 stars 66 forks source link

Exception creating roxy jar #579

Open joecrean opened 8 years ago

joecrean commented 8 years ago

This was a bug I previously discussed with @grtjn and @paxtonhare - here finally is the bug report...sorry it took so long

Testing on my local Mac environment. When I run ml jar i see the following exception:

~/Workspace/Thieme/ps-src-main/core-services/trunk -> ml jar

ERROR: You must be using JRuby to create a jar
Usage: ml jar

General options:
  -v, [--verbose]                   # Verbose output

Prerequisites:
  - You must be running JRuby http://jruby.org/
  - You must have the warbler gem installed
    > gem install warbler

This makes no sense to me - why should i be running JRuby to create the roxy jar file. The only pre-requisite should be that I have the jruby and warbler gems installed - which i do...

~/Workspace/Thieme/ps-src-main/core-services/trunk -> gem list

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler (1.6.2)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.4)
io-console (0.4.2)
jruby-jars (9.0.1.0, 1.7.22)
jruby-rack (1.1.19)
json (1.8.1)
minitest (4.7.5)
psych (2.0.5)
rake (10.1.0)
rchardet (1.6.1)
rdoc (4.1.0)
rubygems-bundler (1.4.4)
rubygems-update (2.2.3)
rubyzip (1.1.7)
rvm (1.11.3.9)
test-unit (2.1.2.0)
warbler (1.4.9)

In order to workaround this problem i just commented out the first line in the self.jar method in server_config.rb - see below...

  def self.jar
    # raise HelpException.new("jar", "You must be using JRuby to create a jar") unless RUBY_PLATFORM == "java"
    begin
      # ensure warbler gem is installed
      gem 'warbler'
      require 'warbler'

      jar_file = ServerConfig.expand_path("#{@@path}/../roxy.jar")
      logger.debug(jar_file)
      Dir.mktmpdir do |tmp_dir|
        logger.debug(tmp_dir)

        temp_roxy_dir = tmp_dir + "/roxy"
        Dir.mkdir temp_roxy_dir

        FileUtils.mkdir_p temp_roxy_dir + "/bin"
        FileUtils.cp(ServerConfig.expand_path("#{@@path}/lib/ml.rb"), temp_roxy_dir + "/bin/roxy.rb")

        FileUtils.cp_r(ServerConfig.expand_path("#{@@path}/lib"), temp_roy_dir)

        FileUtils.cp_r(ServerConfig.expand_path("#{@@path}/sample"), temp_roy_dir)

        Dir.chdir(temp_roxy_dir) do
          Warbler::Application.new.run
          FileUtils.cp(Dir.glob("*.jar")[0], jar_file)
        end
      end
      return true
    rescue Gem::LoadError
      raise HelpException.new("jar", "Please install the warbler gem")
    end
  end
joecrean commented 8 years ago

I see this error on my Mac with Roxy 1.7.2

grtjn commented 7 years ago

Looks like you are right. The raiseexception, and mention of running with jruby are unnecessary. Perhaps jruby did not get bundled with warbler before?

RobertSzkutak commented 7 years ago

I ran into this last night when working on a discrepancy in our JRuby integration and I will address it in the near future.