kurangu 0.0.1 → 0.0.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kurangu.rb +10 -9
  3. data/lib/trace.rb +5 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98ec8f13829b78125818e91a6b78163f40b295a6
4
- data.tar.gz: f06990a2e564dd4531e7813fa415911ddc5b40f1
3
+ metadata.gz: c878be455c92153388c28789fa52dd75cf8af897
4
+ data.tar.gz: 11199180b1f492e70c92e479c0435ad4e30c594f
5
5
  SHA512:
6
- metadata.gz: b9a82fe613d3926dc7acbd4a71bd4b88c910bbdf9b62a010d3d5eaf7f31dfb06ee6512aec26c531466fd40a74ff1350da7528a636ddb583e0f5179d0f3185274
7
- data.tar.gz: 4594ab0b230bad1bd51a65ec995de2c42ba049eba823fdcbd7816800544c8e204235529c602ee67f6c470574816127f14461e673a40dbd243303352cd8912258
6
+ metadata.gz: c965377a60f1e88885d69b9a5b092534441ab008c3ed3c439c2534e47f83735b53625c7e588254168c26439ef4a0850fe96045371a1440d9bb76fe75a6a70c32
7
+ data.tar.gz: 860f00f76c6513fff33f7711a85355388339a69cace2a469664442891edd7ac2dc61e4695f844d85dad71031cf4944fcf880f81de3c1f6365435605f97efb2ce
@@ -9,9 +9,9 @@ class Kurangu
9
9
  system(ruby, "-r", trace_file, input_file)
10
10
  end
11
11
 
12
- def print_annotations
12
+ def print_annotations(paths_file)
13
13
  puts "\nthe annotations generated are:\n"
14
- File.open("annotations_paths.txt", "r") do |f|
14
+ File.open(paths_file, "r") do |f|
15
15
  f.each_line do |annotation_file|
16
16
  puts annotation_file
17
17
  File.open(annotation_file, "r") do |f|
@@ -25,8 +25,8 @@ class Kurangu
25
25
  end
26
26
  end
27
27
 
28
- def generate_annotated_files
29
- File.open("annotations_paths.txt", "r") do |f|
28
+ def generate_annotated_files(paths_file)
29
+ File.open(paths_file, "r") do |f|
30
30
  f.each_line do |annotation_path|
31
31
  original_path = annotation_path.chomp('.annotations')
32
32
  annotated_path = "#{original_path}.annotated"
@@ -61,8 +61,8 @@ class Kurangu
61
61
  FileUtils.mv(annotated_path, original_path)
62
62
  end
63
63
 
64
- def apply_annotations
65
- File.open("annotations_paths.txt", "r") do |f|
64
+ def apply_annotations(paths_file)
65
+ File.open(paths_file, "r") do |f|
66
66
  f.each_line do |annotation_path|
67
67
  original_path = annotation_path.chomp('.annotations')
68
68
  annotated_path = "#{original_path}.annotated"
@@ -79,10 +79,11 @@ class Kurangu
79
79
 
80
80
  def run(input_file_path)
81
81
  input_file = File.expand_path(input_file_path)
82
+ paths_file = "#{File.dirname(input_file)}/annotations_paths.txt"
82
83
  self.generate_annotations(input_file)
83
- self.print_annotations
84
- self.generate_annotated_files
85
- self.apply_annotations
84
+ self.print_annotations(paths_file)
85
+ self.generate_annotated_files(paths_file)
86
+ self.apply_annotations(paths_file)
86
87
  self.run_rdl(input_file)
87
88
  end
88
89
  end
@@ -13,8 +13,9 @@ def generate_signature(line, parameters, parameter_types, return_types)
13
13
  "#{line} type '(#{joined_parameters.join(", ")}) -> #{return_types.join(" or ")}'"
14
14
  end
15
15
 
16
- def write_annotations_paths(paths)
17
- IO.write("annotations_paths.txt", paths.to_a.join("\n"))
16
+ def write_annotations_paths(dir, paths)
17
+ paths_file = "#{dir}/annotations_paths.txt"
18
+ IO.write(paths_file, paths.to_a.join("\n"))
18
19
  end
19
20
 
20
21
  def write_annotations(path, signatures)
@@ -33,7 +34,8 @@ trace_return = TracePoint.new(:return) do |t|
33
34
  line = t.self.method(t.method_id).source_location[1]
34
35
  signatures[s] = generate_signature(line, parameter_list[s], parameter_types[s], return_types[s])
35
36
  path = "#{t.path}.annotations"
36
- write_annotations_paths(paths.add(path))
37
+ dir = File.dirname(t.path)
38
+ write_annotations_paths(dir, paths.add(path))
37
39
  write_annotations(path, signatures)
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kurangu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arpith Siromoney