ciat 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/README.rdoc +4 -4
  2. data/lib/ciat.rb +3 -5
  3. data/lib/ciat/differs/html_differ.rb +3 -4
  4. data/lib/ciat/erb_helpers.rb +6 -4
  5. data/lib/ciat/feedback/composite.rb +2 -2
  6. data/lib/ciat/feedback/feedback_counter.rb +2 -2
  7. data/lib/ciat/feedback/html_feedback.rb +25 -8
  8. data/lib/ciat/feedback/html_feedback_builder.rb +28 -0
  9. data/lib/ciat/feedback/return_status.rb +1 -1
  10. data/lib/ciat/feedback/standard_output.rb +1 -1
  11. data/lib/ciat/io.rb +17 -0
  12. data/lib/ciat/processors/basic_processing.rb +21 -30
  13. data/lib/ciat/{executors → processors}/java.rb +7 -8
  14. data/lib/ciat/{executors → processors}/parrot.rb +9 -10
  15. data/lib/ciat/rake_task.rb +1 -1
  16. data/lib/ciat/subresult.rb +20 -0
  17. data/lib/ciat/suite.rb +27 -38
  18. data/lib/ciat/suite_builder.rb +54 -0
  19. data/lib/ciat/test.rb +32 -18
  20. data/lib/ciat/test_element.rb +7 -2
  21. data/lib/ciat/{crate.rb → test_file.rb} +24 -16
  22. data/lib/ciat/test_result.rb +24 -0
  23. data/lib/ciat/traffic_light.rb +6 -0
  24. data/lib/templates/detail_row.html.erb +5 -4
  25. data/lib/templates/group_header.html.erb +2 -2
  26. data/lib/templates/report.html.erb +1 -1
  27. data/lib/templates/summary_row.html.erb +4 -4
  28. data/spec/ciat/erb_helpers_spec.rb +71 -0
  29. data/spec/ciat/feedback/composite_spec.rb +28 -0
  30. data/spec/ciat/feedback/feedback_counter_spec.rb +91 -0
  31. data/spec/ciat/feedback/html_feedback_spec.rb +48 -0
  32. data/spec/ciat/feedback/return_status_spec.rb +90 -0
  33. data/spec/ciat/feedback/standard_output_spec.rb +109 -0
  34. data/spec/ciat/processors/basic_processing_spec.rb +146 -0
  35. data/spec/ciat/processors/java_spec.rb +31 -0
  36. data/spec/ciat/processors/parrot_spec.rb +40 -0
  37. data/spec/ciat/subresult_spec.rb +40 -0
  38. data/spec/ciat/suite_builder_spec.rb +70 -0
  39. data/spec/ciat/suite_spec.rb +64 -0
  40. data/spec/ciat/test_element_spec.rb +78 -0
  41. data/spec/ciat/test_file_spec.rb +96 -0
  42. data/spec/ciat/test_spec.rb +127 -0
  43. data/spec/ciat/traffic_light_spec.rb +41 -0
  44. data/spec/ciat_spec.rb +2 -0
  45. data/spec/spec_helper.rb +134 -0
  46. data/spec/templates/detail_row/elements_html_erb_spec.rb +60 -0
  47. data/spec/templates/detail_row_html_erb_spec.rb +73 -0
  48. data/spec/templates/elements/diff_html_erb_spec.rb +28 -0
  49. data/spec/templates/elements/plain_element_html_erb_spec.rb +36 -0
  50. data/spec/templates/report_html_erb_spec.rb +85 -0
  51. data/spec/templates/summary_row_html_erb_spec.rb +93 -0
  52. data/spec/templates/test_numbers_html_erb_spec.rb +82 -0
  53. metadata +54 -32
  54. data/History.txt +0 -96
  55. data/Rakefile +0 -40
  56. data/ciat.gemspec +0 -53
  57. data/lib/ciat/cargo.rb +0 -55
  58. data/lib/ciat/compilers/java.rb +0 -54
  59. data/lib/ciat/processors/copy.rb +0 -37
  60. data/lib/ciat/version.rb +0 -7
data/lib/ciat/cargo.rb DELETED
@@ -1,55 +0,0 @@
1
- class CIAT::Cargo #:nodoc:all
2
- OUTPUT_FOLDER = "temp"
3
- REPORT_FILENAME = "report.html"
4
-
5
- attr_reader :output_folder
6
- attr_reader :crates
7
- attr_reader :report_filename
8
-
9
- def initialize(options={})
10
- @output_folder = options[:output_folder] || OUTPUT_FOLDER
11
- if options[:files]
12
- filenames = options[:files]
13
- else
14
- folder = options[:folder] || "ciat"
15
- pattern = options[:pattern] || "*.ciat"
16
- filenames = Dir[File.join(folder, "**", pattern)]
17
- end
18
- @crates = filenames.map { |filename| CIAT::Crate.new(filename, @output_folder) }
19
- @report_filename = File.join(@output_folder, options[:report_filename] || REPORT_FILENAME)
20
- end
21
-
22
- def size
23
- crates.size
24
- end
25
-
26
- def copy_suite_data
27
- FileUtils.mkdir_p(output_folder)
28
- FileUtils.cp(File.join(File.dirname(__FILE__), "..", "data", "ciat.css"), output_folder)
29
- FileUtils.cp(File.join(File.dirname(__FILE__), "..", "data", "prototype.js"), output_folder)
30
- end
31
-
32
- # TODO: get rid of this in favor of the class method
33
- def write_file(filename, content)
34
- FileUtils.mkdir_p(File.dirname(filename))
35
- File.open(filename, "w") do |file|
36
- file.write content
37
- end
38
- end
39
-
40
- # TODO: get rid of this in favor of the class method
41
- def read_file(filename)
42
- File.read(filename)
43
- end
44
-
45
- def self.write_file(filename, content)
46
- FileUtils.mkdir_p(File.dirname(filename))
47
- File.open(filename, "w") do |file|
48
- file.write content
49
- end
50
- end
51
-
52
- def self.read_file(filename)
53
- File.read(filename)
54
- end
55
- end
@@ -1,54 +0,0 @@
1
- module CIAT
2
- module Compilers
3
- # Implements a processor written in Java.
4
- #
5
- # It requires <code>source</code> and <code>compilation</code> elements.
6
- # * <code>source</code> is used as source to the Java compiler.
7
- # * <code>compilation</code> is used for comparsion.
8
- #
9
- # == Best Practices
10
- #
11
- # Suppose you use Eclipse to develop your compiler or interpreter, and you
12
- # have this folder structure:
13
- # * +bin+ stores your compiled classes (under test)
14
- # * +lib+ contains support JAR files
15
- # * +acceptance+ is a root folder for your CIAT tests with your +Rakefile+
16
- # You may find this classpath useful:
17
- # Dir.glob('../lib/*.jar').join(':') + ":../bin"
18
- class Java
19
- include CIAT::Processors::BasicProcessing
20
- include CIAT::Differs::HtmlDiffer
21
-
22
- # The traffic light to indicate the success or failure of the processor.
23
- attr :light, true
24
- attr_reader :processor_kind
25
-
26
- # Constructs a "Java compiler" object. +classpath+ is the complete
27
- # classpath to execute the compiler. +compiler_class+ is the fully
28
- # qualified name of the class that executes your compiler; this driver
29
- # should take two command-line arguments: the name of the source file
30
- # and the name of the generated target-code file.
31
- #
32
- # Possible options:
33
- # * <code>description</code> specifies a descriptive name for your
34
- # compiler; used in the HTML report.
35
- def initialize(classpath, compiler_class, options={})
36
- @processor_kind = options[:processor_kind] || CIAT::Processors::Compiler.new
37
- @classpath = classpath
38
- @compiler_class = compiler_class
39
- @descriptions = {}
40
- @description = options[:description] || "compiler (implemented in Java)"
41
- @light = options[:light] || TrafficLight.new
42
- end
43
-
44
- # Return a description of the processor.
45
- def describe
46
- @description
47
- end
48
-
49
- def executable
50
- "java -cp '#{@classpath}' #{@compiler_class}"
51
- end
52
- end
53
- end
54
- end
@@ -1,37 +0,0 @@
1
- module CIAT
2
- module Processors
3
- # A simple processor that just simply copies the code from one file to the other
4
- # using the Unix +cp+ command.
5
- class Copy
6
- attr :light, true
7
-
8
- def initialize(original, copy)
9
- @original = original
10
- @copy = copy
11
- @light = CIAT::TrafficLight.new
12
- end
13
-
14
- def for_test
15
- copy = clone
16
- copy.light = light.clone
17
- copy
18
- end
19
-
20
- def describe
21
- "copy processor"
22
- end
23
-
24
- def process(crate)
25
- if system( "cp '#{crate.element(@original).as_file}' '#{crate.element(@copy).as_file}'")
26
- light.green!
27
- else
28
- light.red!
29
- end
30
- end
31
-
32
- def relevant_elements(crate)
33
- [@original, @copy].map { |e| crate.element(e) }
34
- end
35
- end
36
- end
37
- end
data/lib/ciat/version.rb DELETED
@@ -1,7 +0,0 @@
1
- module CIAT::VERSION #:nodoc:
2
- MAJOR = 0
3
- MINOR = 3
4
- TINY = 0
5
-
6
- STRING = [MAJOR, MINOR, TINY].join('.')
7
- end