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
|
@@ -16,7 +16,7 @@ module StateMachine
|
|
|
16
16
|
# @see OOStructuredState
|
|
17
17
|
def handle_line(pLine)
|
|
18
18
|
idle_capture
|
|
19
|
-
# TODO: HANDLING MULTIPLE LINE
|
|
19
|
+
# TODO: HANDLING MULTIPLE LINE.
|
|
20
20
|
#if @language.idleHandler.get_idle(pLine)
|
|
21
21
|
# idle_capture
|
|
22
22
|
#else
|
|
@@ -34,11 +34,10 @@ module StateMachine
|
|
|
34
34
|
|
|
35
35
|
requirement = @language.externRequirementHandler.get_requirement(pLine)
|
|
36
36
|
|
|
37
|
-
if requirement
|
|
37
|
+
if requirement
|
|
38
38
|
pElementFile.add_extern_requirement(requirement)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
# TODO: You have to handler the return state.
|
|
42
41
|
idle_capture
|
|
43
42
|
|
|
44
43
|
if (@language.state.is_a? StateMachine::OOStructuredFSM::IdleState)
|
|
@@ -1,62 +1,20 @@
|
|
|
1
1
|
require_relative 'oo_structured_state'
|
|
2
|
+
require_relative 'token_state_machine'
|
|
3
|
+
require_relative 'function_behaviour_state'
|
|
2
4
|
|
|
3
5
|
module StateMachine
|
|
4
6
|
|
|
5
7
|
module OOStructuredFSM
|
|
6
8
|
|
|
7
9
|
# Class responsible for handling Method state.
|
|
8
|
-
class MethodState <
|
|
9
|
-
|
|
10
|
-
@language
|
|
10
|
+
class MethodState < FunctionBehaviourState
|
|
11
11
|
|
|
12
12
|
def initialize(pLanguage)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if @language.conditionalHandler.get_conditional(pLine)
|
|
19
|
-
conditional_capture
|
|
20
|
-
elsif @language.repetitionHandler.get_repetition(pLine)
|
|
21
|
-
repetition_capture
|
|
22
|
-
else
|
|
23
|
-
return
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# @see OOStructuredState
|
|
28
|
-
def class_capture
|
|
29
|
-
@language.rewind_state
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# @see OOStructuredState
|
|
33
|
-
def conditional_capture
|
|
34
|
-
@language.flagFunctionBehaviour = StateMachine::METHOD_STATE
|
|
35
|
-
@language.set_state(@language.conditionalState)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# @see OOStructuredState
|
|
39
|
-
def repetition_capture
|
|
40
|
-
@language.flagFunctionBehaviour = StateMachine::METHOD_STATE
|
|
41
|
-
@language.set_state(@language.repetitionState)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# @see OOStructuredState
|
|
45
|
-
def execute(pElementFile, pLine)
|
|
46
|
-
methodElement = @language.methodHandler.get_function(pLine)
|
|
47
|
-
|
|
48
|
-
if (methodElement)
|
|
49
|
-
lastIndex = pElementFile.classes.length - 1 # We want the index
|
|
50
|
-
methodElement.comments = @language.string_comment_to_transfer
|
|
51
|
-
@language.string_comment_to_transfer = ""
|
|
52
|
-
pElementFile.classes[lastIndex].add_method(methodElement)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
if (@language.endBlockHandler.has_end_of_block?(pLine))
|
|
56
|
-
class_capture
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
return pElementFile
|
|
13
|
+
super(
|
|
14
|
+
pLanguage,
|
|
15
|
+
flagState: StateMachine::METHOD_STATE,
|
|
16
|
+
functionId: StateMachine::METHOD_LABEL
|
|
17
|
+
)
|
|
60
18
|
end
|
|
61
19
|
|
|
62
20
|
# End class
|
|
@@ -64,7 +64,12 @@ module StateMachine
|
|
|
64
64
|
raise NotImplementedError
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
# Handling
|
|
67
|
+
# Handling aggregation state
|
|
68
|
+
def aggregation_capture
|
|
69
|
+
raise NotImplementedError
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Handling repetition state
|
|
68
73
|
def repetition_capture
|
|
69
74
|
raise NotImplementedError
|
|
70
75
|
end
|
|
@@ -1,79 +1,30 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'basic_structure_state'
|
|
2
|
+
require_relative '../../language/abstract_container/structured_and_oo/global_tokens.rb'
|
|
2
3
|
|
|
3
4
|
module StateMachine
|
|
4
5
|
|
|
5
6
|
module OOStructuredFSM
|
|
6
7
|
|
|
7
8
|
# Class responsible for handling Repetition state.
|
|
8
|
-
class RepetitionState <
|
|
9
|
+
class RepetitionState < BasicStructureState
|
|
9
10
|
|
|
10
11
|
@language
|
|
11
12
|
|
|
12
13
|
def initialize(pLanguage)
|
|
13
14
|
@language = pLanguage
|
|
15
|
+
@whoAmI = "repetition"
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# @see OOStructuredState
|
|
20
|
-
def method_capture
|
|
21
|
-
reset_flag
|
|
22
|
-
@language.rewind_state
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# @see OOStructuredState
|
|
26
|
-
def constructor_capture
|
|
27
|
-
reset_flag
|
|
28
|
-
@language.rewind_state
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# @see OOStructuredState
|
|
32
|
-
def function_capture
|
|
33
|
-
reset_flag
|
|
34
|
-
@language.rewind_state
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# @see OOStructuredState
|
|
38
|
-
def execute(pElementFile, pLine)
|
|
39
|
-
repetition = @language.repetitionHandler.get_repetition(pLine)
|
|
40
|
-
|
|
41
|
-
flag = @language.flagFunctionBehaviour
|
|
18
|
+
protected
|
|
42
19
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
elsif (flag == StateMachine::METHOD_STATE)
|
|
49
|
-
pElementFile.classes.last.methods.last.add_repetition(repetition)
|
|
50
|
-
#Constructor
|
|
51
|
-
elsif (flag == StateMachine::CONSTRUCTOR_STATE)
|
|
52
|
-
pElementFile.classes.last.constructors
|
|
53
|
-
.last.add_repetition(repetition)
|
|
20
|
+
# @see basic_structure_state
|
|
21
|
+
def addBasicStructure(pLine, pFlag, pClassIndex, pElementFile)
|
|
22
|
+
repetition = @language.repetitionHandler.get_repetition(pLine)
|
|
23
|
+
if (repetition)
|
|
24
|
+
addToCorrectElement(repetition, pElementFile, pFlag, pClassIndex)
|
|
54
25
|
end
|
|
55
26
|
end
|
|
56
27
|
|
|
57
|
-
if (@language.endBlockHandler.has_end_of_block?(pLine))
|
|
58
|
-
if (flag == StateMachine::GLOBAL_FUNCTION_STATE)
|
|
59
|
-
function_capture
|
|
60
|
-
elsif (flag == StateMachine::METHOD_STATE)
|
|
61
|
-
method_capture
|
|
62
|
-
elsif (flag == StateMachine::CONSTRUCTOR_STATE)
|
|
63
|
-
constructor_capture
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
return pElementFile
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
private
|
|
72
|
-
|
|
73
|
-
# @see OOStructuredState
|
|
74
|
-
def reset_flag
|
|
75
|
-
@language.flagFunctionBehaviour = StateMachine::NONE_HANDLING_STATE
|
|
76
|
-
end
|
|
77
28
|
|
|
78
29
|
# End class
|
|
79
30
|
end
|
data/lib/kuniri/version.rb
CHANGED
data/other/analyseFile.asta
CHANGED
|
Binary file
|
data/spec/core/kuniri_spec.rb
CHANGED
|
@@ -4,7 +4,8 @@ RSpec.describe Kuniri::Kuniri do
|
|
|
4
4
|
|
|
5
5
|
context "When path for run_analysis is wrong." do
|
|
6
6
|
it "Wrong path to " do
|
|
7
|
-
@kuniriTest = Kuniri::Kuniri.new
|
|
7
|
+
@kuniriTest = Kuniri::Kuniri.new
|
|
8
|
+
@kuniriTest.read_configuration_file('./wrong/path')
|
|
8
9
|
defaultPath = @kuniriTest.run_analysis
|
|
9
10
|
folderFiles = Dir[File.join("./", "**", "**.rb")]
|
|
10
11
|
expect(defaultPath).to match_array(folderFiles)
|
data/spec/core/setting_spec.rb
CHANGED
|
@@ -3,24 +3,20 @@ require_relative '../spec_helper'
|
|
|
3
3
|
RSpec.describe Kuniri::Setting do
|
|
4
4
|
|
|
5
5
|
def write_kuniri_file(parameter)
|
|
6
|
-
File.open(".kuniri", 'w') do |file|
|
|
7
|
-
file.write("language" + parameter[0] + "\n")
|
|
8
|
-
file.write("source" + parameter[1] + "\n")
|
|
9
|
-
file.write("output" + parameter[2] + "\n")
|
|
10
|
-
file.write("extract" + parameter[3] + "\n")
|
|
11
|
-
file.write("log" + parameter[4] + "\n")
|
|
6
|
+
File.open(".kuniri-test.yml", 'w') do |file|
|
|
7
|
+
file.write(":language: " + parameter[0] + "\n")
|
|
8
|
+
file.write(":source: " + parameter[1] + "\n")
|
|
9
|
+
file.write(":output: " + parameter[2] + "\n")
|
|
12
10
|
end
|
|
13
11
|
end
|
|
14
12
|
|
|
15
|
-
before :
|
|
16
|
-
File.open(".kuniri", 'w') do |file|
|
|
17
|
-
file.write("language:ruby" + "\n")
|
|
18
|
-
file.write("source:xpto" + "\n")
|
|
19
|
-
file.write("output:xpto/2" + "\n")
|
|
20
|
-
file.write("extract:uml,traceability" + "\n")
|
|
21
|
-
file.write("log:html\n")
|
|
13
|
+
before :each do
|
|
14
|
+
File.open(".kuniri-test.yml", 'w') do |file|
|
|
15
|
+
file.write(":language: ruby" + "\n")
|
|
16
|
+
file.write(":source: xpto" + "\n")
|
|
17
|
+
file.write(":output: xpto/2" + "\n")
|
|
22
18
|
end
|
|
23
|
-
@settings = Kuniri::Setting.create
|
|
19
|
+
@settings = Kuniri::Setting.create
|
|
24
20
|
end
|
|
25
21
|
|
|
26
22
|
context "When setting is created." do
|
|
@@ -34,81 +30,59 @@ RSpec.describe Kuniri::Setting do
|
|
|
34
30
|
it "Wrong path, get default configuration" do
|
|
35
31
|
defaultConf = @settings.read_configuration_file("wrong/path")
|
|
36
32
|
expect(defaultConf).to include(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"extract" => "uml",
|
|
41
|
-
"log" => "html")
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "Syntax error: not use ':'." do
|
|
45
|
-
write_kuniri_file(["=ruby", ":../app/", ":./", ">uml", ":html"])
|
|
46
|
-
expect{@settings.read_configuration_file(".kuniri")}.to raise_error(
|
|
47
|
-
Error::ConfigurationFileError)
|
|
33
|
+
:language => "ruby",
|
|
34
|
+
:source => "./",
|
|
35
|
+
:output => "./")
|
|
48
36
|
end
|
|
49
37
|
|
|
50
38
|
it "Syntax error: not valid language." do
|
|
51
|
-
write_kuniri_file(["
|
|
52
|
-
expect{@settings.read_configuration_file(".kuniri")}.to raise_error(
|
|
39
|
+
write_kuniri_file(["k", "../app/", "./"])
|
|
40
|
+
expect{@settings.read_configuration_file(".kuniri-test.yml")}.to raise_error(
|
|
53
41
|
Error::ConfigurationFileError)
|
|
54
42
|
end
|
|
55
43
|
|
|
56
44
|
it "Syntax error: wrong source directory." do
|
|
57
|
-
write_kuniri_file(["
|
|
58
|
-
expect{@settings.read_configuration_file(".kuniri")}.to raise_error(
|
|
45
|
+
write_kuniri_file(["ruby", "xpto/", "./"])
|
|
46
|
+
expect{@settings.read_configuration_file(".kuniri-test.yml")}.to raise_error(
|
|
59
47
|
Error::ConfigurationFileError)
|
|
60
48
|
end
|
|
61
49
|
|
|
62
50
|
it "Syntax error: wrong output directory." do
|
|
63
|
-
write_kuniri_file(["
|
|
64
|
-
expect{@settings.read_configuration_file(".kuniri")}.to raise_error(
|
|
51
|
+
write_kuniri_file(["ruby", "../app/", "xpto/"])
|
|
52
|
+
expect{@settings.read_configuration_file(".kuniri-test.yml")}.to raise_error(
|
|
65
53
|
Error::ConfigurationFileError)
|
|
66
54
|
end
|
|
67
55
|
|
|
68
|
-
it "Syntax error: wrong extract." do
|
|
69
|
-
write_kuniri_file([":ruby", ":../app/", ":./", ":umg", ":html"])
|
|
70
|
-
expect{@settings.read_configuration_file(".kuniri")}.to raise_error(
|
|
71
|
-
Error::ConfigurationFileError)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
56
|
end
|
|
75
57
|
|
|
76
58
|
context "When input is correct." do
|
|
77
59
|
it "Correct return." do
|
|
78
|
-
write_kuniri_file(["
|
|
79
|
-
hash_config = @settings.read_configuration_file(".kuniri")
|
|
60
|
+
write_kuniri_file(["ruby", "./", "./"])
|
|
61
|
+
hash_config = @settings.read_configuration_file(".kuniri-test.yml")
|
|
80
62
|
expect(hash_config).to include(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"extract" => "uml",
|
|
85
|
-
"log" => "html")
|
|
63
|
+
:language => "ruby",
|
|
64
|
+
:source => "./",
|
|
65
|
+
:output => "./")
|
|
86
66
|
end
|
|
87
67
|
|
|
88
68
|
it "Correct return, different parameters." do
|
|
89
|
-
write_kuniri_file(["
|
|
90
|
-
hash_config = @settings.read_configuration_file(".kuniri")
|
|
69
|
+
write_kuniri_file(["ruby", "./", "./"])
|
|
70
|
+
hash_config = @settings.read_configuration_file(".kuniri-test.yml")
|
|
91
71
|
expect(hash_config).to include(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"extract" => "uml",
|
|
96
|
-
"log" => "txt")
|
|
72
|
+
:language => "ruby",
|
|
73
|
+
:source => "./",
|
|
74
|
+
:output => "./")
|
|
97
75
|
end
|
|
98
76
|
|
|
99
77
|
|
|
100
|
-
it "
|
|
101
|
-
write_kuniri_file(["
|
|
102
|
-
expect
|
|
103
|
-
|
|
104
|
-
"source" => "lib/",
|
|
105
|
-
"output" => "./",
|
|
106
|
-
"extract" => "uml,traceability",
|
|
107
|
-
"log" => "txt")
|
|
78
|
+
it "Not right: Case sensitive language." do
|
|
79
|
+
write_kuniri_file(["ruBy", "lib/", "./"])
|
|
80
|
+
expect{@settings.read_configuration_file(".kuniri-test.yml")}.to raise_error(
|
|
81
|
+
Error::ConfigurationFileError)
|
|
108
82
|
end
|
|
109
83
|
end
|
|
110
84
|
|
|
111
|
-
after :
|
|
112
|
-
File.delete(".kuniri")
|
|
85
|
+
after :each do
|
|
86
|
+
File.delete(".kuniri-test.yml")
|
|
113
87
|
end
|
|
114
88
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative '../../spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Languages::Aggregation do
|
|
4
|
+
|
|
5
|
+
context "When not implemented" do
|
|
6
|
+
it "Get aggregation" do
|
|
7
|
+
aggregationAbstract = Languages::Aggregation.new
|
|
8
|
+
expect{aggregationAbstract.get_aggregation("abc.new")}.to raise_error(
|
|
9
|
+
NotImplementedError)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative '../../spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Languages::ExternRequirement do
|
|
4
|
+
|
|
5
|
+
context "When not implemented" do
|
|
6
|
+
it "Get requirement" do
|
|
7
|
+
externAbstract = Languages::ExternRequirement.new
|
|
8
|
+
expect{externAbstract.get_requirement("nothing")}.to raise_error(
|
|
9
|
+
NotImplementedError)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require_relative '../../../spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Languages::AggregationData do
|
|
4
|
+
|
|
5
|
+
before :all do
|
|
6
|
+
@aggregationData = Languages::AggregationData.new("xpto")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
context "# Aggregation data" do
|
|
10
|
+
it "Get name" do
|
|
11
|
+
expect(@aggregationData.name).to eq("xpto")
|
|
12
|
+
|
|
13
|
+
@aggregationData.name = "banana"
|
|
14
|
+
expect(@aggregationData.name).to eq("banana")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "Does not set name" do
|
|
18
|
+
@aggregationData = Languages::AggregationData.new(nil)
|
|
19
|
+
expect(@aggregationData.name).to be_nil
|
|
20
|
+
@aggregationData = Languages::AggregationData.new(1)
|
|
21
|
+
expect(@aggregationData.name).to be_nil
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
after :all do
|
|
26
|
+
@aggregationData = nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -23,10 +23,17 @@ RSpec.describe Languages::AttributeData do
|
|
|
23
23
|
@attributeData.visibility = "protected"
|
|
24
24
|
expect(@attributeData.visibility).to eq("protected")
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
it "Does not set name" do
|
|
28
|
+
@attributeData = Languages::AttributeData.new(nil)
|
|
29
|
+
expect(@attributeData.name).to be_nil
|
|
30
|
+
@attributeData = Languages::AttributeData.new(1)
|
|
31
|
+
expect(@attributeData.name).to be_nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
27
34
|
|
|
28
35
|
after :all do
|
|
29
36
|
@attributeData = nil
|
|
30
37
|
end
|
|
31
38
|
|
|
32
|
-
end
|
|
39
|
+
end
|