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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9bfb0bc7d02ab895c1997bce90ae057e5b1d9a1
4
- data.tar.gz: b2cd75e03c51dfb488e66b0b3b4675c8e06cd3d7
3
+ metadata.gz: b9debcb414133ceb3d964ef6e18d61b4fc2d638d
4
+ data.tar.gz: e39312da8354aba888c2e55d0c8c60dfaf3f54e6
5
5
  SHA512:
6
- metadata.gz: a38e74bdc5b51192509ac5dd9351a9a5cb0f85fd43f86be395ad7de16aa5c6419aa9177917d8c19049bebdf9d38dd83c4330ddcf2f74a73e294d41da5aa9ab29
7
- data.tar.gz: 5d0d7c5236e5a776a05dcf3e18b4c8e22e6a242e35c1704ef16526dac4248a430752ffc797967106d7add89032c382b508f37fc24c6867bc60bea353e0a7b77f
6
+ metadata.gz: ba493d4832c350dfb4cd22191fc1a4f22eec0f25e09fd3b06d7ebca552dc139423b98f133df3cc71bb265d5b9af3b30b9390f387a8acc85f6644e12522ddde98
7
+ data.tar.gz: eb0ef17740eea2ac4f688a6a6c81e650302a6a47ce7d8e7c3dc0bd178b7fd4c583c564151584eb4682acd1bdbf7323320f1b97f02ed19f6e655a6ef10c14ff14
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ 1.1.2 (2014-01-23)
2
+ ------------------
3
+ * Display failing program (with line numbers) for debugging assistance
4
+
1
5
  1.1.1 (2014-01-05)
2
6
  ------------------
3
7
  * Detect and display installed Rust version
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
- if status.success?
32
- true
33
- else
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
- input_src = File.join(tmpdir, "irust.rs")
45
- File.write input_src, rust_program(line, history)
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 input_src.sub(/\.rs$/, '')
53
+ if compile(tmpdir, src)
54
+ system srcfile.sub(/\.rs$/, '')
49
55
  history + ";\n" + line
50
56
  else
51
57
  history
@@ -1,13 +1,11 @@
1
1
  #[feature(globs, macro_rules, struct_variant)];
2
2
  extern mod extra;
3
3
 
4
- fn main() {
5
- fn type_of<T>(_: &T) -> &'static str {
6
- unsafe {
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
@@ -1,3 +1,3 @@
1
1
  module IRust
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
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.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-05 00:00:00.000000000 Z
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