kuniri 0.0.1 → 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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -7
- data/COPYING +160 -656
- data/Gemfile +4 -3
- data/README.md +57 -27
- data/Rakefile +3 -1
- data/bin/kuniri +50 -26
- data/data/aggregation_lang.rb +33 -0
- data/data/attribute_lang.rb +14 -87
- data/data/class_lang.rb +19 -41
- data/data/comment_lang.rb +52 -0
- data/data/conditional_lang.rb +14 -41
- data/data/constructor_lang.rb +4 -12
- data/data/end_block_lang.rb +7 -6
- data/data/extern_requirement_lang.rb +10 -17
- data/data/function_behavior_lang.rb +17 -66
- data/data/global_function_lang.rb +26 -0
- data/data/lang_syntax.rb +82 -49
- data/data/method_lang.rb +26 -0
- data/data/module_namespace_lang.rb +8 -13
- data/data/repetition_lang.rb +19 -32
- data/data/token_lang.rb +2 -44
- data/data/variable_behaviour_lang.rb +43 -0
- data/data/variable_global_lang.rb +13 -72
- data/kuniri.gemspec +4 -4
- data/lib/kuniri/core/configuration/language_available.rb +2 -2
- data/lib/kuniri/core/kuniri.rb +32 -24
- data/lib/kuniri/core/setting.rb +51 -85
- data/lib/kuniri/error/parser_error.rb +9 -0
- data/lib/kuniri/language/abstract_container/structured_and_oo/aggregation.rb +29 -0
- data/lib/kuniri/language/abstract_container/structured_and_oo/attribute.rb +0 -40
- data/lib/kuniri/language/abstract_container/structured_and_oo/global_tokens.rb +20 -0
- data/lib/kuniri/language/abstract_container/structured_and_oo/repetition.rb +9 -1
- data/lib/kuniri/language/abstract_container/structured_and_oo/variable_global.rb +0 -35
- data/lib/kuniri/language/container_data/structured_and_oo/aggregation_data.rb +23 -0
- data/lib/kuniri/language/container_data/structured_and_oo/attribute_data.rb +4 -2
- data/lib/kuniri/language/container_data/structured_and_oo/basic_structure.rb +24 -0
- data/lib/kuniri/language/container_data/structured_and_oo/class_data.rb +13 -19
- data/lib/kuniri/language/container_data/structured_and_oo/conditional_data.rb +2 -13
- data/lib/kuniri/language/container_data/structured_and_oo/constructor_data.rb +2 -0
- data/lib/kuniri/language/container_data/structured_and_oo/extern_requirement_data.rb +11 -6
- data/lib/kuniri/language/container_data/structured_and_oo/{file_element.rb → file_element_data.rb} +11 -9
- data/lib/kuniri/language/container_data/structured_and_oo/function_abstract.rb +58 -11
- data/lib/kuniri/language/container_data/structured_and_oo/function_data.rb +3 -3
- data/lib/kuniri/language/container_data/structured_and_oo/manager_basic_structure_data.rb +55 -0
- data/lib/kuniri/language/container_data/structured_and_oo/method_data.rb +5 -4
- data/lib/kuniri/language/container_data/structured_and_oo/module_namespace_data.rb +3 -1
- data/lib/kuniri/language/container_data/structured_and_oo/repetition_data.rb +2 -13
- data/lib/kuniri/language/container_data/structured_and_oo/variable_global_data.rb +2 -0
- data/lib/kuniri/language/language.rb +37 -11
- data/lib/kuniri/language/metadata.rb +29 -0
- data/lib/kuniri/language/ruby/aggregation_ruby.rb +37 -0
- data/lib/kuniri/language/ruby/attribute_ruby.rb +23 -38
- data/lib/kuniri/language/ruby/class_ruby.rb +2 -10
- data/lib/kuniri/language/ruby/conditional_ruby.rb +20 -6
- data/lib/kuniri/language/ruby/constructor_ruby.rb +5 -7
- data/lib/kuniri/language/ruby/end_block_ruby.rb +1 -1
- data/lib/kuniri/language/ruby/function_behavior_ruby.rb +1 -9
- data/lib/kuniri/language/ruby/global_function_ruby.rb +32 -0
- data/lib/kuniri/language/ruby/method_ruby.rb +33 -0
- data/lib/kuniri/language/ruby/repetition_ruby.rb +60 -14
- data/lib/kuniri/language/ruby/ruby_syntax.rb +76 -49
- data/lib/kuniri/parser/output_factory.rb +29 -0
- data/lib/kuniri/parser/output_format.rb +134 -0
- data/lib/kuniri/parser/parser.rb +3 -7
- data/lib/kuniri/parser/xml_builder_engine.rb +94 -0
- data/lib/kuniri/parser/xml_output_format.rb +143 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/aggregation_state.rb +45 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb +0 -1
- data/lib/kuniri/state_machine/OO_structured_fsm/basic_structure_state.rb +182 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/class_state.rb +12 -3
- data/lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb +11 -68
- data/lib/kuniri/state_machine/OO_structured_fsm/constructor_state.rb +7 -52
- data/lib/kuniri/state_machine/OO_structured_fsm/function_behaviour_state.rb +86 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/include_state.rb +2 -3
- data/lib/kuniri/state_machine/OO_structured_fsm/method_state.rb +8 -50
- data/lib/kuniri/state_machine/OO_structured_fsm/oo_structured_state.rb +6 -1
- data/lib/kuniri/state_machine/OO_structured_fsm/repetition_state.rb +10 -59
- data/lib/kuniri/state_machine/OO_structured_fsm/token_state_machine.rb +4 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb +0 -1
- data/lib/kuniri/version.rb +1 -1
- data/other/analyseFile.asta +0 -0
- data/spec/core/kuniri_spec.rb +2 -1
- data/spec/core/setting_spec.rb +35 -61
- data/spec/language/abstract_container/aggregation_spec.rb +13 -0
- data/spec/language/abstract_container/extern_requirement_spec.rb +13 -0
- data/spec/language/container_data/structured_and_oo/aggregation_data_spec.rb +29 -0
- data/spec/language/container_data/structured_and_oo/attribute_data_spec.rb +9 -2
- data/spec/language/container_data/structured_and_oo/class_data_spec.rb +1 -46
- data/spec/language/container_data/structured_and_oo/constructor_data_spec.rb +32 -2
- data/spec/language/container_data/structured_and_oo/extern_requirement_data_spec.rb +31 -7
- data/spec/language/container_data/structured_and_oo/{file_element_spec.rb → file_element_data_spec.rb} +21 -5
- data/spec/language/container_data/structured_and_oo/function_abstract_spec.rb +213 -0
- data/spec/language/container_data/structured_and_oo/function_data_spec.rb +31 -2
- data/spec/language/container_data/structured_and_oo/manager_basic_structure_data_spec.rb +150 -0
- data/spec/language/container_data/structured_and_oo/method_data_spec.rb +80 -0
- data/spec/language/container_data/structured_and_oo/module_namespace_spec.rb +7 -1
- data/spec/language/container_data/structured_and_oo/variable_global_data_spec.rb +9 -0
- data/spec/language/language_factory_spec.rb +1 -1
- data/spec/language/language_spec.rb +46 -9
- data/spec/language/ruby/aggregation_ruby_spec.rb +80 -0
- data/spec/language/ruby/class_ruby_spec.rb +66 -6
- data/spec/language/ruby/constructor_ruby_spec.rb +1 -1
- data/spec/language/ruby/end_block_ruby_spec.rb +11 -0
- data/spec/language/ruby/extern_requirement_ruby_spec.rb +59 -0
- data/spec/language/ruby/function_behavior_ruby_spec.rb +54 -2
- data/spec/language/ruby/global_test/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/complete_class_ruby_spec.rb +161 -0
- data/spec/language/ruby/global_test/conditional/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri1.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri2.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri3.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri4.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri5.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri6.yml +4 -0
- data/spec/language/ruby/global_test/conditional/a_lot_of_conditionals_spec.rb +92 -0
- data/spec/language/ruby/global_test/conditional/constructor_very_mix_conditional_spec.rb +105 -0
- data/spec/language/ruby/global_test/conditional/function_with_conditional_spec.rb +94 -0
- data/spec/language/ruby/global_test/conditional/function_with_nested_conditional_spec.rb +56 -0
- data/spec/language/ruby/global_test/conditional/method_very_mix_conditional_spec.rb +109 -0
- data/spec/language/ruby/global_test/conditional/very_deep_conditional_structure_spec.rb +61 -0
- data/spec/language/ruby/global_test/conditional/very_mix_conditional_spec.rb +105 -0
- data/spec/language/ruby/global_test/conditionalAndRepetition/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/conditionalAndRepetition/mix_conditional_repetition_spec.rb +57 -0
- data/spec/language/ruby/global_test/repetition/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri2.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri3.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri4.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri5.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri6.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri7.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri8.yml +4 -0
- data/spec/language/ruby/global_test/repetition/complete_class_integrity.rb +41 -0
- data/spec/language/ruby/global_test/repetition/complete_class_until_loop_spec.rb +42 -0
- data/spec/language/ruby/global_test/repetition/complete_class_while_loop_spec.rb +41 -0
- data/spec/language/ruby/global_test/repetition/complete_class_with_repetition_spec.rb +42 -0
- data/spec/language/ruby/global_test/repetition/constructor_with_mix_repetition_spec.rb +57 -0
- data/spec/language/ruby/global_test/repetition/method_with_mix_repetition_spec.rb +59 -0
- data/spec/language/ruby/global_test/repetition/very_mix_repetition_spec.rb +61 -0
- data/spec/language/ruby/global_test/repetition/very_nested_repetition_spec.rb +65 -0
- data/spec/language/ruby/method_ruby_spec.rb +52 -0
- data/spec/language/ruby/repetition_ruby_spec.rb +175 -8
- data/spec/language/ruby/ruby_syntax_spec.rb +213 -84
- data/spec/parser/output_factory_spec.rb +32 -0
- data/spec/parser/output_format_spec.rb +83 -0
- data/spec/parser/parser_spec.rb +7 -0
- data/spec/parser/xmlSchemaValidate/.kuniri1.yml +3 -0
- data/spec/parser/xmlSchemaValidate/.kuniri2.yml +3 -0
- data/spec/parser/xmlSchemaValidate/.kuniri3.yml +3 -0
- data/spec/parser/xmlSchemaValidate/class_data.xsd +99 -0
- data/spec/parser/xmlSchemaValidate/fullCodeTwo.xsd +119 -0
- data/spec/parser/xmlSchemaValidate/fullCodeWithComments.xsd +146 -0
- data/spec/parser/xmlSchemaValidate/simpleFunction.xsd +25 -0
- data/spec/parser/xmlSchemaValidate/validate_xml_spec.rb +52 -0
- data/spec/parser/xml_builder_engine_spec.rb +258 -0
- data/spec/parser/xml_output_format_spec.rb +274 -0
- data/spec/samples/rubySyntaxParts/aggregation/classAggregation.rb +37 -0
- data/spec/samples/rubySyntaxParts/aggregation/constructorAggregation.rb +36 -0
- data/spec/samples/rubySyntaxParts/aggregation/methodAggregation.rb +36 -0
- data/spec/samples/rubySyntaxParts/aggregation/multipleAggregation.rb +59 -0
- data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_class.rb +7 -0
- data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_class.rb +2 -1
- data/spec/samples/rubySyntaxParts/conditionalStatment/aLotOfConditionals.rb +42 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/commonCasesOfConditionals.rb +47 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/constructorConditional.rb +1 -1
- data/spec/samples/rubySyntaxParts/conditionalStatment/constructorMixConditional.rb +41 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/methodMixConditional.rb +41 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/mixConditionalWithRepetition.rb +20 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/nestedConditional.rb +61 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/veryDeepConditionalStructure.rb +48 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/veryMixConditional.rb +37 -0
- data/spec/samples/rubySyntaxParts/fullCode/fullCodeTwo.rb +56 -0
- data/spec/samples/rubySyntaxParts/fullCode/fullCodeWithComments.rb +64 -0
- data/spec/samples/rubySyntaxParts/fullCode/simpleFullCode.rb +9 -1
- data/spec/samples/rubySyntaxParts/method/simpleMethod.rb +2 -0
- data/spec/samples/rubySyntaxParts/repetition/beginWithWhileLoopInClass.rb +10 -0
- data/spec/samples/rubySyntaxParts/repetition/constructorWithMixRepetition.rb +22 -0
- data/spec/samples/rubySyntaxParts/repetition/forLoopInClass.rb +7 -0
- data/spec/samples/rubySyntaxParts/repetition/methodWithMixRepetition.rb +19 -0
- data/spec/samples/rubySyntaxParts/repetition/mixConditionalRepetition.rb +17 -0
- data/spec/samples/rubySyntaxParts/repetition/untilLoopInClass.rb +16 -0
- data/spec/samples/rubySyntaxParts/repetition/veryMixRepetition.rb +28 -0
- data/spec/samples/rubySyntaxParts/repetition/veryNestedRepetition.rb +17 -0
- data/spec/samples/rubySyntaxParts/repetition/whileLoopInClass.rb +12 -0
- data/spec/state_machine/OO_structured_fsm/aggregation_state_spec.rb +67 -0
- data/spec/state_machine/OO_structured_fsm/class_state_spec.rb +15 -0
- data/spec/state_machine/OO_structured_fsm/conditional_state_spec.rb +64 -0
- data/spec/state_machine/OO_structured_fsm/include_state_spec.rb +3 -3
- data/spec/state_machine/OO_structured_fsm/method_state_spec.rb +18 -0
- data/spec/state_machine/OO_structured_fsm/repetition_state_spec.rb +27 -0
- metadata +195 -28
- data/lib/kuniri/core/configuration/monitor_available.rb +0 -13
- data/lib/kuniri/language/abstract_container/structured_and_oo/constructor.rb +0 -52
- data/lib/kuniri/parser/parser_xml.rb +0 -128
- data/spec/language/abstract_container/constructor_spec.rb +0 -13
- data/spec/util/html_logger_spec.rb +0 -31
- data/spec/util/logger_spec.rb +0 -20
- data/spec/util/txt_logger_spec.rb +0 -31
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Configuration module keep all the constants for make the system works.
|
|
2
|
-
# | __Configure__ | __Description__ |
|
|
3
|
-
# |---|---|
|
|
4
|
-
# | Monitor | Types of monitoring available. |
|
|
5
|
-
# | Language | Languages available. |
|
|
6
|
-
# | Watchdog | Types of watchdog. |
|
|
7
|
-
module Configuration
|
|
8
|
-
# Configuration for the monitor available.
|
|
9
|
-
class Monitor_Available
|
|
10
|
-
public
|
|
11
|
-
MONITORS = ["uml", "traceability"] #List with monitors types.
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
module Languages
|
|
2
|
-
|
|
3
|
-
# @abstract Constructor.
|
|
4
|
-
class Constructor
|
|
5
|
-
|
|
6
|
-
public
|
|
7
|
-
|
|
8
|
-
# Inspect line for trying to find a constructor.
|
|
9
|
-
# @param pLine String with potential function.
|
|
10
|
-
# @return Returns ConstructorData, or nil if line doesn't have method.
|
|
11
|
-
def get_constructor(pLine)
|
|
12
|
-
raise NotImplementedError
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
protected
|
|
16
|
-
|
|
17
|
-
@type
|
|
18
|
-
|
|
19
|
-
# Detect constructor in line
|
|
20
|
-
# @param pLine Line string with the potential constructor inside.
|
|
21
|
-
# @return Return the constructor if it is find in the string, otherwise
|
|
22
|
-
# return nil
|
|
23
|
-
def detect_constructor(pLine)
|
|
24
|
-
raise NotImplementedError
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Trim unnecessary information from the string.
|
|
28
|
-
# @param pLine String for handling.
|
|
29
|
-
# @return Return an string.
|
|
30
|
-
def remove_unnecessary_information(pLine)
|
|
31
|
-
raise NotImplementedError
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Handling default parameters.
|
|
35
|
-
# @param pLine String with parameters.
|
|
36
|
-
# @return Return an array with default parameters.
|
|
37
|
-
def handling_default_parameter(pLine)
|
|
38
|
-
raise NotImplementedError
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# Handling parameters.
|
|
42
|
-
# @param pLine String to try to find the parameters.
|
|
43
|
-
# @return Return a list with all the parameter, otherwise return nil
|
|
44
|
-
def handling_parameter(pLine)
|
|
45
|
-
raise NotImplementedError
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Class
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# Languages
|
|
52
|
-
end
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
require 'nokogiri'
|
|
2
|
-
require_relative '../language/container_data/structured_and_oo/class_data'
|
|
3
|
-
|
|
4
|
-
module Parser
|
|
5
|
-
|
|
6
|
-
# Class responsible for generate xml output
|
|
7
|
-
class XML
|
|
8
|
-
|
|
9
|
-
def initialize(path = "kuniri.xml")
|
|
10
|
-
@log = @settings = Kuniri::Setting.create.log
|
|
11
|
-
set_path(path)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Set path to save the output.
|
|
15
|
-
# @param pPath Output path.
|
|
16
|
-
def set_path(pPath)
|
|
17
|
-
@parser_path = pPath
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Create the xml output file, only saves a single ClassData for now
|
|
21
|
-
# @param class_data [ClassData] Receives the ClassData to save
|
|
22
|
-
def create_class_data(class_data)
|
|
23
|
-
@log.write_log("---- PARSER XML ----")
|
|
24
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
|
25
|
-
generate_class(xml, class_data)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
@builder = builder
|
|
29
|
-
|
|
30
|
-
File.open(@parser_path, 'w') do |file|
|
|
31
|
-
file.write(builder.to_xml)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Create the xml output file, only saves a ClassData for now.
|
|
36
|
-
# @param parser - Receives the parser
|
|
37
|
-
def create_all_data(parser)
|
|
38
|
-
@log.write_log("---- PARSER XML ----")
|
|
39
|
-
|
|
40
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
|
41
|
-
xml.kuniri {
|
|
42
|
-
for elements in parser.fileLanguage do
|
|
43
|
-
if(elements.fileElements[0].classes.length() > 0)
|
|
44
|
-
generate_class(xml, elements.fileElements[0].classes[0])
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
}
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
@builder = builder
|
|
51
|
-
|
|
52
|
-
File.open(@parser_path, 'w') do |file|
|
|
53
|
-
file.write(builder.to_xml)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# returns the builder if create method already executed
|
|
58
|
-
def get_builder
|
|
59
|
-
@builder
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Parse a ClassData to xml
|
|
63
|
-
# @param xml [Nokogiri::XML::Builder] xml builder to edit
|
|
64
|
-
# @param class_data [ClassData] the ClassData to save
|
|
65
|
-
def generate_class(xml, class_data)
|
|
66
|
-
@log.write_log(class_data.name)
|
|
67
|
-
xml.class_data(:name => class_data.name) {
|
|
68
|
-
class_data.methods.each do |o|
|
|
69
|
-
generate_method(xml, o)
|
|
70
|
-
end
|
|
71
|
-
class_data.constructors.each do |c|
|
|
72
|
-
generate_constructor(xml, c)
|
|
73
|
-
end
|
|
74
|
-
class_data.inheritances.each do |i|
|
|
75
|
-
generate_inheritance(xml, i)
|
|
76
|
-
end
|
|
77
|
-
}
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Parse a InheritanceData to xml
|
|
81
|
-
# @param xml builder to edit
|
|
82
|
-
# @param inheritance_data the InheritanceData to save
|
|
83
|
-
def generate_inheritance(xml, inheritance_data)
|
|
84
|
-
xml.inheritance(:name => inheritance_data[0].strip()) {}
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
# Parse a ConstructorData to xml
|
|
88
|
-
# @param xml xml builder to edit
|
|
89
|
-
# @param constructor_data the ConstructorData to save
|
|
90
|
-
def generate_constructor(xml, constructor_data)
|
|
91
|
-
xml.method_(:name => constructor_data.name) {
|
|
92
|
-
constructor_data.parameters.each do |p|
|
|
93
|
-
generate_parameter(xml, p)
|
|
94
|
-
end
|
|
95
|
-
}
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# Parse a MethodData to xml
|
|
99
|
-
# @param xml builder to edit
|
|
100
|
-
# @param method_data the MethodData to save
|
|
101
|
-
def generate_method(xml, method_data)
|
|
102
|
-
xml.method_(:name => method_data.name, :visibility => method_data.visibility) {
|
|
103
|
-
method_data.parameters.each do |p|
|
|
104
|
-
generate_parameter(xml, p)
|
|
105
|
-
end
|
|
106
|
-
}
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# Parse a MethodData to xml
|
|
110
|
-
# @param xml builder to edit
|
|
111
|
-
# @param parameter the Attribute to save
|
|
112
|
-
def generate_parameter(xml, parameter)
|
|
113
|
-
if parameter.kind_of?(String)
|
|
114
|
-
xml.parameter(:name => parameter) {}
|
|
115
|
-
else
|
|
116
|
-
# Is a hash parameter=>defaultValue
|
|
117
|
-
for p in parameter do
|
|
118
|
-
xml.parameter(:name => p[0]+'='+p[1]) {}
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
private
|
|
124
|
-
|
|
125
|
-
@log
|
|
126
|
-
|
|
127
|
-
end
|
|
128
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require_relative '../../spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe Languages::Constructor do
|
|
4
|
-
|
|
5
|
-
context "When not implemented" do
|
|
6
|
-
it "Get constructor" do
|
|
7
|
-
constructorAbstract = Languages::Constructor.new
|
|
8
|
-
expect{constructorAbstract.get_constructor("xpto")}.to raise_error(
|
|
9
|
-
NotImplementedError)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require_relative '../spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe Util::HtmlLogger do
|
|
4
|
-
context "Write html log" do
|
|
5
|
-
|
|
6
|
-
before :all do
|
|
7
|
-
@html = Util::HtmlLogger.new("log.html")
|
|
8
|
-
@html.write_log("HTML log")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "Create file" do
|
|
12
|
-
expect(File.exists?("log.html")).to eq (true)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "Write message" do
|
|
16
|
-
message = Array.new
|
|
17
|
-
File.open("log.html").each_line do |line|
|
|
18
|
-
if line.include?("<i>")
|
|
19
|
-
message = line
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
expect(message).to eq ("\t<i>HTML log</i>\n")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
after :all do
|
|
26
|
-
File.delete("log.html")
|
|
27
|
-
@html = nil
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
|
31
|
-
end
|
data/spec/util/logger_spec.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
require_relative '../spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe Util::Logger do
|
|
4
|
-
|
|
5
|
-
before :all do
|
|
6
|
-
@abstractLogger = Util::Logger.new
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
context "Try to write." do
|
|
10
|
-
it "Try to access implemented error." do
|
|
11
|
-
expect{@abstractLogger.write_log("xpto")}.to raise_error(
|
|
12
|
-
NotImplementedError)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
after :all do
|
|
17
|
-
@abstractLogger = nil
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require_relative '../spec_helper'
|
|
2
|
-
|
|
3
|
-
RSpec.describe Util::TxtLogger do
|
|
4
|
-
context "Write txt log" do
|
|
5
|
-
|
|
6
|
-
before :all do
|
|
7
|
-
@txt = Util::TxtLogger.new("kuniri_log.txt")
|
|
8
|
-
@txt.write_log("Text file log")
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "Create file" do
|
|
12
|
-
expect(File.exists?("kuniri_log.txt")).to eq (true)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
it "Write message" do
|
|
16
|
-
message = Array.new
|
|
17
|
-
File.open("kuniri_log.txt").each_line do |line|
|
|
18
|
-
if line.include?("message:")
|
|
19
|
-
message = line.split(':')
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
expect(message[1]).to eq (" Text file log\n")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
after :all do
|
|
26
|
-
File.delete("kuniri_log.txt")
|
|
27
|
-
@txt = nil
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
|
31
|
-
end
|