scriptlandia-r 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ #
2
+ require 'rubygems'
3
+ require 'rbconfig'
4
+ require 'find'
5
+ require 'ftools'
6
+ require 'rake/gempackagetask'
7
+
8
+ include Config
9
+
10
+ def prepare
11
+ $bindir = CONFIG["bindir"]
12
+
13
+ $my_bindir = CONFIG['bindir']
14
+
15
+ unless File.writable? $my_bindir
16
+ $my_bindir = [ENV['HOME'], '.gem', 'ruby', CONFIG["MAJOR"]+"."+CONFIG["MINOR"], 'bin'].join(File::SEPARATOR)
17
+ end
18
+
19
+ $libdir = CONFIG["libdir"]
20
+
21
+ my_gems_path = [CONFIG['libdir'], 'ruby', 'gems'].join(File::SEPARATOR)
22
+
23
+ unless File.writable? my_gems_path
24
+ my_gems_path = [ENV['HOME'], '.gem', 'ruby'].join(File::SEPARATOR)
25
+ end
26
+
27
+ $ruby = CONFIG['ruby_install_name']
28
+
29
+ $spec = Gem::Specification.load('scriptlandia-r.gemspec')
30
+
31
+ $my_libdir = File.join(my_gems_path, CONFIG["MAJOR"]+"."+CONFIG["MINOR"],
32
+ 'gems', $spec.name + '-' + $spec.version.to_s, 'lib')
33
+ end
34
+
35
+ def tmp_file
36
+ tmp_dir = nil
37
+ for t in [".", "/tmp", "c:/temp", $my_bindir]
38
+ stat = File.stat(t) rescue next
39
+ if stat.directory? and stat.writable?
40
+ tmp_dir = t
41
+ break
42
+ end
43
+ end
44
+
45
+ fail "Cannot find a temporary directory" unless tmp_dir
46
+
47
+ File.join(tmp_dir, "_tmp")
48
+ end
49
+
50
+ def install_file from_file, to_dir, to_file, settings
51
+ File.makedirs to_dir
52
+
53
+ #File::install(from_file, File.join(to_dir, to_file), 0755, true)
54
+
55
+ tmp = tmp_file()
56
+
57
+ File.open(from_file) do |ip|
58
+ File.open(tmp, "w") do |op|
59
+
60
+ op.write ip.read..gsub('C:/Ruby/ruby-1.8.7/bin/sl', $bindir + '/sl')
61
+ end
62
+ end
63
+
64
+ File::install(tmp, to_file, 0755, true)
65
+ File::unlink(tmp)
66
+ end
67
+
68
+ def install_file_with_header(from_file, to_file, settings)
69
+ tmp = tmp_file()
70
+
71
+ File.open(from_file) do |ip|
72
+ File.open(tmp, "w") do |op|
73
+ ruby = File.join($bindir, $ruby)
74
+ op.puts "#!#{ruby} -w"
75
+ op.puts "name = '" + $spec.name + "'"
76
+ op.puts "version = '" + $spec.version.to_s + "'"
77
+ op.puts "ENV['JAVA_HOME'] = '" + settings['java_home'].chomp + "'"
78
+
79
+ op.write ip.read
80
+ end
81
+ end
82
+
83
+ File::install(tmp, to_file, 0755, true)
84
+ File::unlink(tmp)
85
+ end
86
+
87
+ def install_settings from_file, to_file
88
+ require 'yaml'
89
+
90
+ orig_settings_file_name = $my_libdir + "/settings.yaml"
91
+
92
+ if(File.exist? orig_settings_file_name)
93
+ settings = YAML::load File.open(orig_settings_file_name)
94
+ else
95
+ settings = YAML::load File.open(from_file)
96
+ end
97
+
98
+ orig_java_home = settings['java_home'].chomp
99
+ orig_repository_home = settings['repositories']['local'].chomp
100
+
101
+ puts 'Enter Java Home (' + orig_java_home + "):"
102
+
103
+ java_home = gets
104
+
105
+ if(java_home.chomp.empty?)
106
+ java_home = orig_java_home
107
+ end
108
+
109
+ puts 'Enter Repository Home (' + orig_repository_home + "):"
110
+
111
+ repository_home = gets
112
+
113
+ if(repository_home.chomp.empty?)
114
+ repository_home = orig_repository_home
115
+ end
116
+
117
+ settings = YAML::load File.open(from_file)
118
+ settings['java_home'] = java_home
119
+ settings['repositories']['local'] = repository_home
120
+
121
+ File.open( to_file, 'w' ) do |out|
122
+ YAML.dump(settings, out)
123
+ end
124
+ end
125
+
126
+ prepare()
127
+
128
+ install_settings("lib/settings.yaml", $my_libdir + "/settings.yaml")
129
+
130
+ settings = YAML::load File.open($my_libdir + "/settings.yaml")
131
+
132
+ install_file("bin/sl.bat", $my_bindir, "sl.bat", settings) if CONFIG['host_os'] =~ /mswin/
133
+
134
+ install_file_with_header("bin/sl", $my_bindir + "/sl", settings)
135
+
@@ -0,0 +1,59 @@
1
+ # buildfile
2
+
3
+ require 'yaml'
4
+
5
+ settings = YAML::load File.open(File.dirname(__FILE__) + '/settings.yaml')
6
+
7
+ ENV['JAVA_HOME'] = settings['java_home']
8
+
9
+ repositories.local = settings['repositories']['local']
10
+
11
+ settings['repositories']['remote'].each do |repository|
12
+ repositories.remote << repository
13
+ end
14
+
15
+ #options.proxy.http = ''
16
+ #options.proxy.exclude << '*.mycompany.com'
17
+ #options.proxy.exclude << 'localhost'
18
+ #ENV['http_proxy'] = ''
19
+
20
+ define 'buildr' do
21
+ def language_folder ext_mapping, ext
22
+ ext_mapping.each do |folder, extensions|
23
+ if folder == ext
24
+ return folder
25
+ end
26
+
27
+ if extensions.include?(ext)
28
+ return folder
29
+ end
30
+ end
31
+ end
32
+
33
+ def build dep
34
+ extension = ENV['EXT']
35
+
36
+ if(extension == nil)
37
+ puts "Please specify language name or extension."
38
+ else
39
+ puts "ext: " + extension
40
+
41
+ ext_mapping = YAML::load File.open(File.dirname(__FILE__) + '/languages/extension_mapping.yaml')
42
+
43
+ language = language_folder(ext_mapping, extension)
44
+
45
+ puts "language: " + language.to_s
46
+
47
+ lang_config = YAML::load File.open(File.dirname(__FILE__) + '/languages/' + language + '/config.yaml')
48
+
49
+ puts 'Installing ' + language + ' language...'
50
+
51
+ lang_config['artifacts'].each do |name, a|
52
+ artifact(a).invoke
53
+ end
54
+
55
+ puts 'Language ' + language + ' installed.'
56
+ end
57
+ end
58
+ end
59
+
@@ -0,0 +1,44 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ bsh: bsh:bsh:jar:2.0b5
5
+ bcel: bcel:bcel:jar:5.1
6
+ bsf: bsf:bsf:jar:2.4.0
7
+ log4j: log4j:log4j:jar:1.2.13
8
+ oro: oro:oro:jar:2.0.8
9
+ regexp: regexp:regexp:jar:1.3
10
+ xml-resolver: xml-resolver:xml-resolver:jar:1.1
11
+ mail: javax.mail:mail:jar:1.4
12
+ activation: javax.activation:activation:jar:1.1
13
+ jdepend: jdepend:jdepend:jar:2.7
14
+ jsch: com.jcraft:jsch:jar:0.1.29
15
+ junit: junit:junit:jar:3.8.2
16
+ commons-logging-api: commons-logging:commons-logging-api:jar:1.0.4
17
+ commons-net: commons-net:commons-net:jar:1.4.0
18
+
19
+ ant: org.apache.ant:ant:jar:1.7.1
20
+ ant-apache-bcel: org.apache.ant:ant-apache-bcel:jar:1.7.1
21
+ ant-apache-bsf: org.apache.ant:ant-apache-bsf:jar:1.7.1
22
+ ant-apache-log4j: org.apache.ant:ant-apache-log4j:jar:1.7.1
23
+ ant-apache-oro: org.apache.ant:ant-apache-oro:jar:1.7.1
24
+ ant-apache-regexp: org.apache.ant:ant-apache-regexp:jar:1.7.1
25
+ ant-apache-resolver: org.apache.ant:ant-apache-resolver:jar:1.7.1
26
+ ant-commons-logging: org.apache.ant:ant-commons-logging:jar:1.7.1
27
+ ant-commons-net: org.apache.ant:ant-commons-net:jar:1.7.1
28
+ ant-javamail: org.apache.ant:ant-javamail:jar:1.7.1
29
+ ant-jdepend: org.apache.ant:ant-jdepend:jar:1.7.1
30
+ ant-jsch: org.apache.ant:ant-jsch:jar:1.7.1
31
+ ant-junit: org.apache.ant:ant-junit:jar:1.7.1
32
+ ant-launcher: org.apache.ant:ant-launcher:jar:1.7.1
33
+ ant-nodeps: org.apache.ant:ant-nodeps:jar:1.7.1
34
+ ant-swing: org.apache.ant:ant-swing:jar:1.7.1
35
+ ant-testutil: org.apache.ant:ant-testutil:jar:1.7.1
36
+ ant-trax: org.apache.ant:ant-trax:jar:1.7.1
37
+ ant-pack200: org.apache.ant:ant-pack200:jar:1.7.1
38
+ ant-apt: org.apache.ant:ant-apt:jar:1.7.1
39
+ ant-antlr: org.apache.ant:ant-antlr:jar:1.7.1
40
+
41
+ start_class: org.apache.tools.ant.Main
42
+
43
+ command_line:
44
+ ['-f']
@@ -0,0 +1,6 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ bsh: bsh:bsh:jar:2.0b5
5
+
6
+ start_class: bsh.Interpreter
@@ -0,0 +1,7 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ clojure: clojure:clojure:jar:20080916
5
+ asm: asm:asm:jar:3.0
6
+
7
+ start_class: clojure.lang.Script
@@ -0,0 +1,51 @@
1
+ # extension_mapping.yaml
2
+
3
+ ant: [ant, build.xml]
4
+
5
+ beanshell: [bsh]
6
+
7
+ class: [class]
8
+
9
+ clojure: [clj]
10
+
11
+ etl: [etl]
12
+
13
+ fan: [fan, pod]
14
+
15
+ fortress: [fss]
16
+
17
+ freemarker: [ftl, freemarker]
18
+
19
+ groovy: [groovy]
20
+
21
+ jaskell: [jsl, jaskell]
22
+
23
+ javascript: [js, javascript]
24
+
25
+ jawk: [jawk, awk]
26
+
27
+ jelly: [jelly]
28
+
29
+ judo: [judo]
30
+
31
+ jython: [py, python, jython]
32
+
33
+ lolcode: [lol, lcd]
34
+
35
+ maven: [mvn, maven, pom.xml]
36
+
37
+ pnuts: [pnut]
38
+
39
+ ptilde: [p7e, p7ei]
40
+
41
+ jruby: [rb, ruby]
42
+
43
+ scala: [scala]
44
+
45
+ sleep: [sl, sleep]
46
+
47
+ tcl: [tcl]
48
+
49
+ velocity: [vm, velocity]
50
+
51
+ yoix: [yx]
@@ -0,0 +1,8 @@
1
+ jvmargs:
2
+ ['-Dfan.home=#{repositories.local}/fan/fan-sys/1.0.29']
3
+
4
+ artifacts:
5
+ fan: fan:fan-sys:jar:1.0.29
6
+ fan-lib: fan:fan-lib:jar:1.0.29
7
+
8
+ start_class: fanx.tools.Fan
@@ -0,0 +1,11 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ fortress: com.sun.fortress:fortress:jar:588
5
+ fortress-lib: com.sun.fortress:fortress-lib:jar:588
6
+ xtc: xtc:xtc:jar:1.10.0
7
+ concurrent: concurrent:concurrent:jar:1.3.4
8
+ bcel: bcel:bcel:jar:5.2
9
+ plt: edu.rice:plt:jar:20070717-1913
10
+
11
+ start_class: com.sun.fortress.interpreter.drivers.fs
@@ -0,0 +1,7 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ groovy-all: org.codehaus.groovy:groovy-all:jar:1.5.6
5
+ commons: commons-cli:commons-cli:jar:1.1
6
+
7
+ start_class: groovy.ui.GroovyMain
@@ -0,0 +1,9 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ jaskell: jaskell:jaskell:jar:1.0
5
+ jfunutil: jaskell:jfunutil:jar:1.0
6
+ jparsec: jaskell:jparsec:jar:1.0
7
+ commons-lang: commons-lang:commons-lang:jar:2.1
8
+
9
+ start_class: jfun.jaskell.shell.Shell
@@ -0,0 +1,6 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ javascript: rhino:js:jar:1.6R4
5
+
6
+ start_class: org.mozilla.javascript.tools.shell.Main
@@ -0,0 +1,9 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ jawk: org.jawk:jawk:jar:0.14
5
+
6
+ start_class: org.jawk.Awk
7
+
8
+ command_line:
9
+ ['-f']
@@ -0,0 +1,6 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ jruby: org.jruby:jruby:jar:1.1.4
5
+
6
+ start_class: org.jruby.Main
@@ -0,0 +1,7 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ judo: judo:judo:jar:0.9
5
+ commons-lang: commons-lang:commons-lang:jar:2.3
6
+
7
+ start_class: judo
@@ -0,0 +1,9 @@
1
+ jvmargs:
2
+ ['-Dpython.home=#{repositories.local}/jython/jython/2.2.1',
3
+ '-Dpython.cachedir=#{repositories.local}/jython/jython/2.2.1/cachedir']
4
+
5
+ artifacts:
6
+ jython: jython:jython:jar:2.2.1
7
+ jython-lib: jython:jython-lib:jar:2.2.1
8
+
9
+ start_class: org.python.util.jython
@@ -0,0 +1,6 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ lolcode: lolcode:lolcode:jar:0.11
5
+
6
+ start_class: com.lolcode.Run
@@ -0,0 +1,7 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ pnuts: pnuts:pnuts:jar:1.2
5
+ pnuts-modules: pnuts:pnuts-modules:jar:1.2
6
+
7
+ start_class: pnuts.tools.Main
@@ -0,0 +1,8 @@
1
+ jvmargs:
2
+ [-Djava.library.path=#{repositories.local}/ptilde/ptilde-lib/0.90]
3
+
4
+ artifacts:
5
+ ptilde: ptilde:ptilde:jar:0.90
6
+ ptilde-lib: ptilde:ptilde-lib:jar:0.90
7
+
8
+ start_class: p7e.engine.Engine
@@ -0,0 +1,12 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ scala-lirary: org.scala-lang:scala-library:jar:2.7.1
5
+ scala-compiler: org.scala-lang:scala-compiler:jar:2.7.1
6
+ scala-dbc: org.scala-lang:scala-dbc:jar:2.7.1
7
+ scala-decoder: org.scala-lang:scala-decoder:jar:2.7.1
8
+
9
+ start_class: scala.tools.nsc.MainGenericRunner
10
+
11
+ command_line:
12
+ ['-nocompdaemon', '-howtorun:script']
@@ -0,0 +1,6 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ sleep: sleep:sleep:jar:2.1
5
+
6
+ start_class: sleep.console.TextConsole
@@ -0,0 +1,9 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ jacl: tcl:jacl:jar:1.4.0
5
+ tcljava: tcl:tcljava:jar:1.4.0
6
+ itcl: tcl:itcl:jar:1.4.0
7
+ tjc: tcl:tjc:jar:1.4.0
8
+
9
+ start_class: tcl.lang.Shell
@@ -0,0 +1,6 @@
1
+ jvmargs:
2
+
3
+ artifacts:
4
+ yoix: att.research:yoix:jar:2.1.10
5
+
6
+ start_class: att.research.yoix.YoixMain
@@ -0,0 +1,105 @@
1
+ # scriptlandia.rb
2
+
3
+ require 'yaml'
4
+ require 'rubygems'
5
+ require 'rjb'
6
+
7
+ class String
8
+ def interpolate vars
9
+ s_i = self.dup
10
+
11
+ vars.each do |key, value|
12
+ regexp = Regexp.new('#\{' + key + '\}')
13
+
14
+ s_i.gsub! regexp, value
15
+ end
16
+
17
+ s_i
18
+ end
19
+
20
+ end
21
+
22
+ module Scriptlandia
23
+ class Launcher
24
+ def initialize
25
+ @settings = YAML::load File.open(File.dirname(__FILE__) + '/settings.yaml')
26
+ @ext_mapping = YAML::load File.open(File.dirname(__FILE__) + '/languages/extension_mapping.yaml')
27
+ end
28
+
29
+ def self.extension name
30
+ name[name.rindex('.')+1, name.length]
31
+ end
32
+
33
+ def self.language_folder ext_mapping, name
34
+ language_folder = nil
35
+
36
+ ext = extension(name)
37
+
38
+ ext_mapping.each do |folder, extensions|
39
+ if extensions.include?(ext) or extensions.include?(name)
40
+ language_folder = folder
41
+ break
42
+ end
43
+ end
44
+
45
+ language_folder
46
+ end
47
+
48
+ def launch
49
+ script_name = ARGV[0]
50
+
51
+ language = Launcher.language_folder(@ext_mapping, script_name)
52
+
53
+ if(language == nil)
54
+ puts "Unsupported language/extension: " + Launcher.extension(script_name)
55
+ else
56
+ lang_config = YAML::load File.open(File.dirname(__FILE__) + '/languages/' +
57
+ language + '/config.yaml')
58
+
59
+ ENV['JAVA_HOME'] = @settings['java_home']
60
+ local_repository = @settings['repositories']['local']
61
+
62
+ vars = {'repositories.local' => local_repository }
63
+
64
+ jvm_args = lang_config['jvmargs']
65
+ jvm_args = [] if jvm_args == nil
66
+
67
+ jvm_args = jvm_args.collect { |arg| arg.interpolate(vars) }
68
+
69
+ classpath = lang_config['classpath']
70
+ classpath = [] if classpath == nil
71
+
72
+ lang_config['artifacts'].each do |name, artifact|
73
+ group, id, type,version = artifact.split(':')
74
+
75
+ file_name = local_repository + '/' +
76
+ group.gsub('.', '/') + '/' +
77
+ id.gsub('.', '/') + '/' +
78
+ version + '/' +
79
+ id.gsub('.', '/') + '-' + version + '.' + type
80
+
81
+ unless File.exist? file_name
82
+ puts 'File ' + file_name + ' does not exists.'
83
+ else
84
+ classpath << file_name
85
+ end
86
+ end
87
+
88
+ pause = false
89
+
90
+ if(ARGV.include? '--wait')
91
+ ARGV.delete '--wait'
92
+ pause = true
93
+ end
94
+
95
+ Rjb::load(classpath.join(File::PATH_SEPARATOR), jvmargs = jvm_args)
96
+
97
+ ARGV[0, 0] = lang_config['command_line'] if lang_config['command_line']
98
+
99
+ Rjb::import(lang_config['start_class']).main(ARGV)
100
+
101
+ STDIN.gets if pause
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,33 @@
1
+ java_home:
2
+ c:/Java/jdk1.5.0
3
+
4
+ repositories:
5
+
6
+ # customize user local maven2 repository location
7
+ local: c:/Work/maven-repository
8
+
9
+ # prefer the local or nearest mirrors
10
+ remote:
11
+ - file://c:/Work/maven-repository-accelerator
12
+ - http://scriptlandia-repository.googlecode.com/svn/trunk/languages
13
+ - http://scriptlandia-repository.googlecode.com/svn/trunk/tools
14
+ - http://repository.springsource.com/maven/bundles/release
15
+ - http://repository.springsource.com/maven/bundles/external
16
+ - http://repository.springsource.com/maven/libraries/release
17
+ - http://repository.springsource.com/maven/libraries/external
18
+ - http://repository.jboss.com/maven2
19
+ - http://repo.mergere.com/maven2
20
+ - http://repo1.maven.org/maven2
21
+ - http://repo1.maven.org/maven-spring
22
+ - http://dist.codehaus.org
23
+ - http://repository.codehaus.org
24
+ - http://download.java.net/maven/2
25
+ - https://maven-repository.dev.java.net/nonav/repository
26
+ - http://download.java.net/maven/2
27
+ - http://jyaml.sourceforge.net/m2-repo
28
+ - http://dist.codehaus.org/mule/dependencies/maven2
29
+ - http://scala-tools.org/repo-releases
30
+
31
+ #options:
32
+ # proxy:
33
+ # http: ''
@@ -0,0 +1,135 @@
1
+ #
2
+ require 'rubygems'
3
+ require 'rbconfig'
4
+ require 'find'
5
+ require 'ftools'
6
+ require 'rake/gempackagetask'
7
+
8
+ include Config
9
+
10
+ def prepare
11
+ $bindir = CONFIG["bindir"]
12
+
13
+ $my_bindir = CONFIG['bindir']
14
+
15
+ unless File.writable? $my_bindir
16
+ $my_bindir = [ENV['HOME'], '.gem', 'ruby', CONFIG["MAJOR"]+"."+CONFIG["MINOR"], 'bin'].join(File::SEPARATOR)
17
+ end
18
+
19
+ $libdir = CONFIG["libdir"]
20
+
21
+ my_gems_path = [CONFIG['libdir'], 'ruby', 'gems'].join(File::SEPARATOR)
22
+
23
+ unless File.writable? my_gems_path
24
+ my_gems_path = [ENV['HOME'], '.gem', 'ruby'].join(File::SEPARATOR)
25
+ end
26
+
27
+ $ruby = CONFIG['ruby_install_name']
28
+
29
+ $spec = Gem::Specification.load('scriptlandia-r.gemspec')
30
+
31
+ $my_libdir = File.join(my_gems_path, CONFIG["MAJOR"]+"."+CONFIG["MINOR"],
32
+ 'gems', $spec.name + '-' + $spec.version.to_s, 'lib')
33
+ end
34
+
35
+ def tmp_file
36
+ tmp_dir = nil
37
+ for t in [".", "/tmp", "c:/temp", $my_bindir]
38
+ stat = File.stat(t) rescue next
39
+ if stat.directory? and stat.writable?
40
+ tmp_dir = t
41
+ break
42
+ end
43
+ end
44
+
45
+ fail "Cannot find a temporary directory" unless tmp_dir
46
+
47
+ File.join(tmp_dir, "_tmp")
48
+ end
49
+
50
+ def install_file from_file, to_dir, to_file, settings
51
+ File.makedirs to_dir
52
+
53
+ #File::install(from_file, File.join(to_dir, to_file), 0755, true)
54
+
55
+ tmp = tmp_file()
56
+
57
+ File.open(from_file) do |ip|
58
+ File.open(tmp, "w") do |op|
59
+
60
+ op.write ip.read..gsub('C:/Ruby/ruby-1.8.7/bin/sl', $bindir + '/sl')
61
+ end
62
+ end
63
+
64
+ File::install(tmp, to_file, 0755, true)
65
+ File::unlink(tmp)
66
+ end
67
+
68
+ def install_file_with_header(from_file, to_file, settings)
69
+ tmp = tmp_file()
70
+
71
+ File.open(from_file) do |ip|
72
+ File.open(tmp, "w") do |op|
73
+ ruby = File.join($bindir, $ruby)
74
+ op.puts "#!#{ruby} -w"
75
+ op.puts "name = '" + $spec.name + "'"
76
+ op.puts "version = '" + $spec.version.to_s + "'"
77
+ op.puts "ENV['JAVA_HOME'] = '" + settings['java_home'].chomp + "'"
78
+
79
+ op.write ip.read
80
+ end
81
+ end
82
+
83
+ File::install(tmp, to_file, 0755, true)
84
+ File::unlink(tmp)
85
+ end
86
+
87
+ def install_settings from_file, to_file
88
+ require 'yaml'
89
+
90
+ orig_settings_file_name = $my_libdir + "/settings.yaml"
91
+
92
+ if(File.exist? orig_settings_file_name)
93
+ settings = YAML::load File.open(orig_settings_file_name)
94
+ else
95
+ settings = YAML::load File.open(from_file)
96
+ end
97
+
98
+ orig_java_home = settings['java_home'].chomp
99
+ orig_repository_home = settings['repositories']['local'].chomp
100
+
101
+ puts 'Enter Java Home (' + orig_java_home + "):"
102
+
103
+ java_home = gets
104
+
105
+ if(java_home.chomp.empty?)
106
+ java_home = orig_java_home
107
+ end
108
+
109
+ puts 'Enter Repository Home (' + orig_repository_home + "):"
110
+
111
+ repository_home = gets
112
+
113
+ if(repository_home.chomp.empty?)
114
+ repository_home = orig_repository_home
115
+ end
116
+
117
+ settings = YAML::load File.open(from_file)
118
+ settings['java_home'] = java_home
119
+ settings['repositories']['local'] = repository_home
120
+
121
+ File.open( to_file, 'w' ) do |out|
122
+ YAML.dump(settings, out)
123
+ end
124
+ end
125
+
126
+ prepare()
127
+
128
+ install_settings("lib/settings.yaml", $my_libdir + "/settings.yaml")
129
+
130
+ settings = YAML::load File.open($my_libdir + "/settings.yaml")
131
+
132
+ install_file("bin/sl.bat", $my_bindir, "sl.bat", settings) if CONFIG['host_os'] =~ /mswin/
133
+
134
+ install_file_with_header("bin/sl", $my_bindir + "/sl", settings)
135
+
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scriptlandia-r
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Shvets
8
+ autorequire: scriptlandia-r
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-02 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Scriptlandia launcher.
17
+ email: alexander.shvets@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/buildfile
26
+ - lib/languages
27
+ - lib/languages/ant
28
+ - lib/languages/ant/config.yaml
29
+ - lib/languages/beanshell
30
+ - lib/languages/beanshell/config.yaml
31
+ - lib/languages/clojure
32
+ - lib/languages/clojure/config.yaml
33
+ - lib/languages/extension_mapping.yaml
34
+ - lib/languages/fan
35
+ - lib/languages/fan/config.yaml
36
+ - lib/languages/fortress
37
+ - lib/languages/fortress/config.yaml
38
+ - lib/languages/groovy
39
+ - lib/languages/groovy/config.yaml
40
+ - lib/languages/jaskell
41
+ - lib/languages/jaskell/config.yaml
42
+ - lib/languages/javascript
43
+ - lib/languages/javascript/config.yaml
44
+ - lib/languages/jawk
45
+ - lib/languages/jawk/config.yaml
46
+ - lib/languages/jruby
47
+ - lib/languages/jruby/config.yaml
48
+ - lib/languages/judo
49
+ - lib/languages/judo/config.yaml
50
+ - lib/languages/jython
51
+ - lib/languages/jython/config.yaml
52
+ - lib/languages/lolcode
53
+ - lib/languages/lolcode/config.yaml
54
+ - lib/languages/pnuts
55
+ - lib/languages/pnuts/config.yaml
56
+ - lib/languages/ptilde
57
+ - lib/languages/ptilde/config.yaml
58
+ - lib/languages/scala
59
+ - lib/languages/scala/config.yaml
60
+ - lib/languages/sleep
61
+ - lib/languages/sleep/config.yaml
62
+ - lib/languages/tcl
63
+ - lib/languages/tcl/config.yaml
64
+ - lib/languages/yoix
65
+ - lib/languages/yoix/config.yaml
66
+ - lib/scriptlandia.rb
67
+ - lib/settings.yaml
68
+ - install.rb
69
+ - setup.rb
70
+ has_rdoc: false
71
+ homepage:
72
+ post_install_message:
73
+ rdoc_options: []
74
+
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ version:
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ requirements:
90
+ - none
91
+ rubyforge_project:
92
+ rubygems_version: 1.0.1
93
+ signing_key:
94
+ specification_version: 2
95
+ summary: .
96
+ test_files: []
97
+