48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/scriptlandia.rb', line 48
def launch
script_name = ARGV[0]
language = Launcher.language_folder(@ext_mapping, script_name)
if(language == nil)
puts "Unsupported language/extension: " + Launcher.extension(script_name)
else
lang_config = YAML::load File.open(File.dirname(__FILE__) + '/languages/' +
language + '/config.yaml')
ENV['JAVA_HOME'] = @settings['java_home']
local_repository = @settings['repositories']['local']
vars = {'repositories.local' => local_repository }
jvm_args = lang_config['jvmargs']
jvm_args = [] if jvm_args == nil
jvm_args = jvm_args.collect { |arg| arg.interpolate(vars) }
classpath = lang_config['classpath']
classpath = [] if classpath == nil
lang_config['artifacts'].each do |name, artifact|
group, id, type,version = artifact.split(':')
file_name = local_repository + '/' +
group.gsub('.', '/') + '/' +
id.gsub('.', '/') + '/' +
version + '/' +
id.gsub('.', '/') + '-' + version + '.' + type
unless File.exist? file_name
puts 'File ' + file_name + ' does not exists.'
else
classpath << file_name
end
end
pause = false
if(ARGV.include? '--wait')
ARGV.delete '--wait'
pause = true
end
Rjb::load(classpath.join(File::PATH_SEPARATOR), jvmargs = jvm_args)
ARGV[0, 0] = lang_config['command_line'] if lang_config['command_line']
Rjb::import(lang_config['start_class']).main(ARGV)
STDIN.gets if pause
end
end
|