infraruby-core 3.7.1

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,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.platform = "ruby"
3
+ s.name = "infraruby-core"
4
+ s.version = "3.7.1"
5
+ s.licenses = ["MIT"]
6
+ s.author = "InfraRuby Vision"
7
+ s.email = "rubygems@infraruby.com"
8
+ s.homepage = "http://infraruby.com/"
9
+ s.summary = "InfraRuby statically typed Ruby"
10
+ s.description = "InfraRuby statically typed Ruby"
11
+ s.executables = ["infraruby-core-compile", "infraruby-core-execute"]
12
+ s.files = Dir["**/*"]
13
+ s.add_runtime_dependency "infraruby-base", "~> 3.7"
14
+ s.add_runtime_dependency "infraruby-core-compiler", "~> 3.7"
15
+ s.add_runtime_dependency "infraruby-core-runtime", "~> 3.7"
16
+ s.add_runtime_dependency "bundler", "~> 1.7"
17
+ s.add_development_dependency "infraruby-task", "~> 3.7"
18
+ s.add_development_dependency "rspec", "~> 3.0"
19
+ end
@@ -0,0 +1,5 @@
1
+ require "infraruby-base"
2
+
3
+ require "bundler"
4
+
5
+ InfraRuby.load_parent_library(__dir__)
data/ruby/InfraRuby.rb ADDED
@@ -0,0 +1,12 @@
1
+ module InfraRuby
2
+ class << self
3
+ def core_context
4
+ name = InfraRuby.gemspec_name
5
+ specs = Bundler.environment.specs.to_a
6
+ unless name.nil?
7
+ specs.reject! { |spec| spec.name == name }
8
+ end
9
+ return CoreContext.new(specs)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,123 @@
1
+ module InfraRuby
2
+ class CoreContext
3
+ class << self
4
+ def find_runtime_spec
5
+ begin
6
+ return Gem::Specification.find_by_name("infraruby-core-runtime")
7
+ rescue Gem::LoadError
8
+ return nil
9
+ end
10
+ end
11
+
12
+ def find_compiler_spec
13
+ begin
14
+ return Gem::Specification.find_by_name("infraruby-core-compiler")
15
+ rescue Gem::LoadError
16
+ return nil
17
+ end
18
+ end
19
+ end
20
+
21
+ RUNTIME_SPEC = find_runtime_spec
22
+ COMPILER_SPEC = find_compiler_spec
23
+
24
+ def initialize(specs)
25
+ @specs = specs
26
+ return
27
+ end
28
+
29
+ def files_from_specs(ext)
30
+ files = []
31
+ @specs.each do |spec|
32
+ file = File.join(spec.gem_dir, "pool", spec.name + ext)
33
+ if File.exist?(file)
34
+ files.push(file)
35
+ end
36
+ end
37
+ return files
38
+ end
39
+
40
+ def find_runtime_spec
41
+ return @specs.find { |spec| spec.name == "infraruby-core-runtime" }
42
+ end
43
+
44
+ def find_compiler_spec
45
+ return @specs.find { |spec| spec.name == "infraruby-core-compiler" }
46
+ end
47
+
48
+ def find_runtime_spec!
49
+ return find_runtime_spec || RUNTIME_SPEC || raise("cannot find infraruby-core-runtime")
50
+ end
51
+
52
+ def find_compiler_spec!
53
+ return find_compiler_spec || COMPILER_SPEC || raise("cannot find infraruby-core-compiler")
54
+ end
55
+
56
+ def compiler_command
57
+ spec = find_compiler_spec!
58
+ return File.join(spec.gem_dir, "bin", "infraruby-core-compiler-#{spec.platform}.exe")
59
+ end
60
+
61
+ def runtime_cutfiles
62
+ spec = find_runtime_spec!
63
+ dir = File.dirname(File.dirname(__dir__))
64
+ cutfiles = [
65
+ File.join(dir, "etc", "openjdk-7.cut"),
66
+ File.join(spec.gem_dir, "etc", "infraruby-core-runtime.cut"),
67
+ ]
68
+ return cutfiles
69
+ end
70
+
71
+ def runtime_jarfiles
72
+ spec = find_runtime_spec!
73
+ jarfiles = [
74
+ File.join(spec.gem_dir, "etc", "infraruby-core-runtime.jar"),
75
+ ]
76
+ return jarfiles
77
+ end
78
+
79
+ def dependency_cutfiles
80
+ cutfiles = runtime_cutfiles
81
+ cutfiles.concat(files_from_specs(".cut"))
82
+ return cutfiles
83
+ end
84
+
85
+ def dependency_jarfiles
86
+ jarfiles = runtime_jarfiles
87
+ jarfiles.concat(files_from_specs(".jar"))
88
+ return jarfiles
89
+ end
90
+
91
+ def expand_srcpath(srcpath)
92
+ srcfiles = []
93
+ dirs = srcpath.split(File::PATH_SEPARATOR)
94
+ dirs.each do |dir|
95
+ if File.directory?(dir)
96
+ srcfiles.concat(InfraRuby.library_paths(dir))
97
+ else
98
+ srcfiles.push(dir)
99
+ end
100
+ end
101
+ return srcfiles
102
+ end
103
+
104
+ def compile(prefix, srcpath, cutpath = nix)
105
+ srcfiles = expand_srcpath(srcpath)
106
+ cutfiles = dependency_cutfiles
107
+ unless cutpath.nix?
108
+ unless cutpath.nil?
109
+ cutfiles.concat(cutpath.split(File::PATH_SEPARATOR))
110
+ end
111
+ end
112
+ command = compiler_command
113
+ return InfraRuby.system!(command, prefix, srcfiles.join(File::PATH_SEPARATOR), cutfiles.join(File::PATH_SEPARATOR))
114
+ end
115
+
116
+ def execute(jarpath, rubyclass, *argv)
117
+ jarfiles = dependency_jarfiles
118
+ jarfiles.concat(jarpath.split(File::PATH_SEPARATOR))
119
+ command = "java"
120
+ return InfraRuby.system!(command, "-classpath", jarfiles.join(File::PATH_SEPARATOR), "ruby/InfraRuby$Main$eigen", rubyclass, *argv)
121
+ end
122
+ end
123
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: infraruby-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.7.1
5
+ platform: ruby
6
+ authors:
7
+ - InfraRuby Vision
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: infraruby-base
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: infraruby-core-compiler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: infraruby-core-runtime
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.7'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: infraruby-task
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: InfraRuby statically typed Ruby
98
+ email: rubygems@infraruby.com
99
+ executables:
100
+ - infraruby-core-compile
101
+ - infraruby-core-execute
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - MIT-LICENSE
106
+ - README.md
107
+ - bin/infraruby-core-compile
108
+ - bin/infraruby-core-execute
109
+ - etc/openjdk-7.cut
110
+ - infraruby-core.gemspec
111
+ - lib/infraruby-core.rb
112
+ - ruby/InfraRuby.rb
113
+ - ruby/InfraRuby/CoreContext.rb
114
+ homepage: http://infraruby.com/
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.2.2
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: InfraRuby statically typed Ruby
138
+ test_files: []