Class: Mortar::Local::Java
- Inherits:
-
Object
- Object
- Mortar::Local::Java
- Includes:
- InstallUtil
- Defined in:
- lib/mortar/local/java.rb
Instance Method Summary collapse
- #check_install ⇒ Object
-
#run_java_home ⇒ Object
Runs the java_home command line tool which on osx will return the appropriate JAVA_home value.
Methods included from InstallUtil
#download_file, #ensure_mortar_local_directory, #extract_tgz, #get_resource, #gitignore_template_path, #head_resource, #http_date_to_epoch, #install_date, #install_file_for, #is_newer_version, #jython_cache_directory, #jython_directory, #local_install_directory, #local_install_directory_name, #local_log_dir, #local_project_gitignore, #local_udf_log_dir, #make_call, #make_call_sleep_seconds, #note_install, #osx?, #project_root, #render_script_template, #reset_local_logs, #run_templated_script, #unset_hadoop_env_vars, #url_date
Methods included from Helpers
#action, #ask, #confirm, #copy_if_not_present_at_dest, #default_host, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #display_with_indent, #download_to_file, #ensure_dir_exists, #error, error_with_failure, error_with_failure=, extended, extended_into, #format_bytes, #format_date, #format_with_bang, #full_host, #get_terminal_environment, #home_directory, #host, #hprint, #hputs, included, included_into, #installed_with_omnibus?, #json_decode, #json_encode, #line_formatter, #longest, #output_with_bang, #pending_github_team_state_message, #quantify, #redisplay, #retry_on_exception, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #test_name, #ticking, #time_ago, #truncate, #warning, #with_tty, #write_to_file
Instance Method Details
#check_install ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mortar/local/java.rb', line 24 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 |
#run_java_home ⇒ Object
Runs the java_home command line tool which on osx will return the appropriate JAVA_home value
44 45 46 |
# File 'lib/mortar/local/java.rb', line 44 def run_java_home `/usr/libexec/java_home`.to_s.strip end |