Sha256: 74d759b5dcc98dbd272e66522175a5434b0c4157af09b615a4556a28235899c6

Contents?: true

Size: 1.38 KB

Versions: 99

Compression:

Stored size: 1.38 KB

Contents

#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "mortar/local/installutil"

class Mortar::Local::Java
  include Mortar::Local::InstallUtil

  @command = nil

  def check_install
    jbin = File.join(ENV['JAVA_HOME']||'', "bin", "java")
    if ENV['JAVA_HOME'] and File.exists?(jbin)
      @command = jbin
      return true
    elsif File.exists?("/usr/libexec/java_home")
      # OSX has a nice little tool for finding this value, assuming
      # that it won't give us a bad value
      java_home = run_java_home
      if java_home != ""
        ENV['JAVA_HOME'] = java_home
        @command = File.join(ENV['JAVA_HOME'], "bin", "java")
        return true
      end
    end
    return false
  end

  # Runs the java_home command line tool which on osx will
  # return the appropriate JAVA_home value
  def run_java_home
    `/usr/libexec/java_home`.to_s.strip
  end

end

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
mortar-0.15.53 lib/mortar/local/java.rb
mortar-0.15.52 lib/mortar/local/java.rb
mortar-0.15.51 lib/mortar/local/java.rb
mortar-0.15.50 lib/mortar/local/java.rb
mortar-0.15.49 lib/mortar/local/java.rb
mortar-0.15.48 lib/mortar/local/java.rb
mortar-0.15.47 lib/mortar/local/java.rb
mortar-0.15.46 lib/mortar/local/java.rb
mortar-0.15.45 lib/mortar/local/java.rb
mortar-0.15.44 lib/mortar/local/java.rb
mortar-0.15.43 lib/mortar/local/java.rb
mortar-0.15.42 lib/mortar/local/java.rb
mortar-0.15.41 lib/mortar/local/java.rb
mortar-0.15.40 lib/mortar/local/java.rb
mortar-0.15.39 lib/mortar/local/java.rb
mortar-0.15.38 lib/mortar/local/java.rb
mortar-0.15.37 lib/mortar/local/java.rb
mortar-0.15.36 lib/mortar/local/java.rb
mortar-0.15.35 lib/mortar/local/java.rb
mortar-0.15.34 lib/mortar/local/java.rb