irust 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/irust.gemspec +2 -0
- data/lib/irust.rb +16 -10
- data/lib/irust/template.rs.erb +4 -6
- data/lib/irust/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9debcb414133ceb3d964ef6e18d61b4fc2d638d
|
4
|
+
data.tar.gz: e39312da8354aba888c2e55d0c8c60dfaf3f54e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba493d4832c350dfb4cd22191fc1a4f22eec0f25e09fd3b06d7ebca552dc139423b98f133df3cc71bb265d5b9af3b30b9390f387a8acc85f6644e12522ddde98
|
7
|
+
data.tar.gz: eb0ef17740eea2ac4f688a6a6c81e650302a6a47ce7d8e7c3dc0bd178b7fd4c583c564151584eb4682acd1bdbf7323320f1b97f02ed19f6e655a6ef10c14ff14
|
data/CHANGES.md
CHANGED
data/irust.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_runtime_dependency "colorize", ">= 0.6.0"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
24
|
spec.add_development_dependency "rake"
|
23
25
|
end
|
data/lib/irust.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "readline"
|
2
2
|
require "tmpdir"
|
3
3
|
require "open3"
|
4
|
+
require "colorize"
|
4
5
|
|
5
6
|
require "irust/template_renderer"
|
6
7
|
|
@@ -24,16 +25,20 @@ module IRust
|
|
24
25
|
IRust::TemplateRenderer.new(line, history).render
|
25
26
|
end
|
26
27
|
|
27
|
-
def compile(tmpdir)
|
28
|
+
def compile(tmpdir, src)
|
28
29
|
Dir.chdir(tmpdir) do
|
29
30
|
stdin, stderr, status = Open3.capture3("rustc irust.rs")
|
31
|
+
return true if status.success?
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
STDERR.puts stderr
|
35
|
-
false
|
33
|
+
error = "--- BEGIN FAILED PROGRAM ---\n"
|
34
|
+
src.split("\n").each_with_index do |line, i|
|
35
|
+
error << "#{i + 1}: #{line}\n"
|
36
36
|
end
|
37
|
+
error << "---- END FAILED PROGRAM ----"
|
38
|
+
|
39
|
+
STDERR.puts error.red
|
40
|
+
STDERR.puts stderr
|
41
|
+
false
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
@@ -41,11 +46,12 @@ module IRust
|
|
41
46
|
exit 0 if line.nil?
|
42
47
|
|
43
48
|
Dir.mktmpdir do |tmpdir|
|
44
|
-
|
45
|
-
File.
|
49
|
+
src = rust_program(line, history)
|
50
|
+
srcfile = File.join(tmpdir, "irust.rs")
|
51
|
+
File.write(srcfile, src)
|
46
52
|
|
47
|
-
if compile(tmpdir)
|
48
|
-
system
|
53
|
+
if compile(tmpdir, src)
|
54
|
+
system srcfile.sub(/\.rs$/, '')
|
49
55
|
history + ";\n" + line
|
50
56
|
else
|
51
57
|
history
|
data/lib/irust/template.rs.erb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
#[feature(globs, macro_rules, struct_variant)];
|
2
2
|
extern mod extra;
|
3
3
|
|
4
|
-
fn
|
5
|
-
|
6
|
-
|
7
|
-
(*std::unstable::intrinsics::get_tydesc::<T>()).name
|
8
|
-
}
|
9
|
-
} struct Foo<T>(T);
|
4
|
+
fn type_of<T>(_: &T) -> &'static str {
|
5
|
+
unsafe { (*std::unstable::intrinsics::get_tydesc::<T>()).name }
|
6
|
+
}
|
10
7
|
|
8
|
+
fn main() {
|
11
9
|
<%= history %>;
|
12
10
|
|
13
11
|
<% if let_var %>
|
data/lib/irust/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.6.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|