Class: Mortar::Local::Jython
- Inherits:
-
Object
- Object
- Mortar::Local::Jython
show all
- Includes:
- InstallUtil
- Defined in:
- lib/mortar/local/jython.rb
Constant Summary
collapse
- JYTHON_VERSION =
'2.5.2'
- JYTHON_JAR_NAME =
'jython_installer-' + JYTHON_VERSION + '.jar'
- JYTHON_JAR_DEFAULT_URL_PATH =
"resource/jython"
Instance Method Summary
collapse
#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, #get_terminal_environment, #home_directory, #host, #hprint, #hputs, included, included_into, #installed_with_omnibus?, #json_decode, #json_encode, #line_formatter, #longest, #output_with_bang, #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
#install ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/mortar/local/jython.rb', line 42
def install
jython_file = File.join(local_install_directory, JYTHON_JAR_NAME)
unless File.exists?(jython_file)
download_file(jython_jar_url, jython_file)
end
`$JAVA_HOME/bin/java -jar #{local_install_directory + '/' + JYTHON_JAR_NAME} -s -d #{jython_directory}`
FileUtils.mkdir_p jython_cache_directory
FileUtils.chmod_R 0777, jython_cache_directory
FileUtils.rm(jython_file)
note_install('jython')
end
|
#install_or_update ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/mortar/local/jython.rb', line 26
def install_or_update
if should_install
action("Installing jython to #{local_install_directory_name}") do
install
end
elsif should_update
action("Updating jython in #{local_install_directory_name}") do
update
end
end
end
|
#jython_jar_url ⇒ Object
65
66
67
68
69
|
# File 'lib/mortar/local/jython.rb', line 65
def jython_jar_url
full_host = (host =~ /^http/) ? host : "https://api.#{host}"
default_url = full_host + "/" + JYTHON_JAR_DEFAULT_URL_PATH
ENV.fetch('JYTHON_JAR_URL', default_url)
end
|
#should_install ⇒ Object
38
39
40
|
# File 'lib/mortar/local/jython.rb', line 38
def should_install
not File.exists?(jython_directory)
end
|
#should_update ⇒ Object
56
57
58
|
# File 'lib/mortar/local/jython.rb', line 56
def should_update
return is_newer_version('jython', jython_jar_url)
end
|
#update ⇒ Object
60
61
62
63
|
# File 'lib/mortar/local/jython.rb', line 60
def update
FileUtils.rm_r(jython_directory)
install
end
|