Class: Mortar::Local::Jython
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
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
#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
Instance Method Details
#install ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/mortar/local/jython.rb', line 44
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
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/mortar/local/jython.rb', line 28
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
67
68
69
70
|
# File 'lib/mortar/local/jython.rb', line 67
def jython_jar_url
default_url = full_host + "/" + JYTHON_JAR_DEFAULT_URL_PATH
ENV.fetch('JYTHON_JAR_URL', default_url)
end
|
#should_install ⇒ Object
40
41
42
|
# File 'lib/mortar/local/jython.rb', line 40
def should_install
not File.exists?(jython_directory)
end
|
#should_update ⇒ Object
58
59
60
|
# File 'lib/mortar/local/jython.rb', line 58
def should_update
return is_newer_version('jython', jython_jar_url)
end
|
#update ⇒ Object
62
63
64
65
|
# File 'lib/mortar/local/jython.rb', line 62
def update
FileUtils.rm_r(jython_directory)
install
end
|