bakeConv 1.4.0 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a564dfac3eb6816f428188a0ab0b3674be29d392
4
- data.tar.gz: fe91e06eb189d0399d00f7cbad600b3374a0d4ba
3
+ metadata.gz: 639d6ef31d173fc0127249318e67e142d2219482
4
+ data.tar.gz: d589a78f7eb5284a04aef9af05fbb43407fbc9f1
5
5
  SHA512:
6
- metadata.gz: 50d3805099bb35d0095317ef413611f13002309950759e412db711948ccbe2c2a55209ceb23382687a2f815b868c6132a53cba713540a03445521ad378b41717
7
- data.tar.gz: 53ecea82597d2200b8cd72ca90f6d9a014229d08d64585c82249d5cff185558e673edc6c8fedf66a0c4c16294305e50875ae9e077e7dacc9246cc540f087262e
6
+ metadata.gz: 51a1bb0cce8b76e32e3487358761037a9743d758b5a6254c4782cc738cbe0f88a9185af87a8f1f04e846ce88beb3d9341c6ad981921371ed0ab28a7986739636
7
+ data.tar.gz: be2cf880163d53549c9bfb9ca9a88cb6547e45ba93ad2368152f83947d875ce9a0a32dd450ef09d7f3fd6a37ec4faa529994031de40b770ced2a207d62695d2a
data/lib/Bake.rb CHANGED
@@ -6,12 +6,8 @@ require_relative 'Converter'
6
6
 
7
7
  module BConv
8
8
 
9
- # class ParserException < Exception
10
- # end
11
-
12
9
  class Bake
13
-
14
- #enums
10
+
15
11
  START_INFO = 1
16
12
  END_INFO = 2
17
13
  BEFORE_INFO = 3
data/lib/ConfigParser.rb CHANGED
@@ -14,59 +14,54 @@ module BConv
14
14
 
15
15
  def readConfig
16
16
  begin
17
+ mapping = []
18
+ mappings = []
19
+ bracket = false
20
+ i=0
21
+ j=0
22
+
17
23
  File.open(@filename) do |l|
18
- mappings = []
19
- mapForProj = {}
20
- while(line = l.gets) != nil
21
- mapping = {}
22
- ar = []
23
- setEndLabel = false
24
- if line.match(/^Mapping/)
24
+ while(line = l.gets) != nil
25
+ if line.include?("{")
26
+ mapping.push({})
27
+ i = i+1
28
+ mapping[i] = mapping[i-1].clone
29
+ bracket = true
25
30
  lineNumber = l.lineno
26
- while(line = l.gets) != nil
27
- line.gsub!('\\','/')
28
- ar = line.split("=")
29
-
30
- if (ar.length == 2)
31
- if ar[0].strip[0] != "#"
32
- comPos = ar[1].index("#")
33
- ar[1] = ar[1][0..comPos-1] if comPos != nil
34
- mapping.store(ar[0].strip,ar[1].strip)
35
- end
36
- elsif ar[1] == ""
37
- mapping.store(ar[0].strip,"")
31
+ elsif line.include?("}")
32
+ if bracket == true
33
+ if @projToConvert != "" && @projToConvert != mapping[i]['Proj2Convert']
34
+ #do nothing and continue
35
+ elsif @projToConvert != "" && @projToConvert == mapping[i]['Proj2Convert']
36
+ mappings.push({})
37
+ mappings[j] = mapping[i].clone
38
+ break
39
+ else
40
+ mappings.push({})
41
+ mappings[j] = mapping[i].clone
38
42
  end
39
43
 
40
- if line.match(/^}$/)
41
- raise "Error: Workspace parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('Workspace') == false
42
- raise "Error: MainProj parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('MainProj') == false
43
- raise "Error: BuildConfig parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('BuildConfig') == false
44
- raise "Error: Proj2Convert parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('Proj2Convert') == false
45
- raise "Error: OutputFile parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('OutputFile') == false
46
- raise "Error: TemplateFile parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('TemplateFile') == false
47
-
48
- #raise "Error: Parameter in #{File.basename(@filename)}, Mapping line #{lineNumber} is missing!" if ar[0].strip == ""
49
-
50
- if @projToConvert != "" && @projToConvert != mapping['Proj2Convert']
51
- mapping = {}
52
- else
53
- mappings << mapping
44
+ if mappings.length != 0
45
+ mappings[j].each do |key,value|
46
+ raise "Error: Workspace parameter from Mapping in line #{lineNumber} is missing!" if mappings[j].has_key?('Workspace') == false
47
+ raise "Error: MainProj parameter from Mapping in line #{lineNumber} is missing!" if mappings[j].has_key?('MainProj') == false
48
+ raise "Error: BuildConfig parameter from Mapping in line #{lineNumber} is missing!" if mappings[j].has_key?('BuildConfig') == false
49
+ raise "Error: Proj2Convert parameter from Mapping in line #{lineNumber} is missing!" if mappings[j].has_key?('Proj2Convert') == false
50
+ raise "Error: OutputFile parameter from Mapping in line #{lineNumber} is missing!" if mappings[j].has_key?('OutputFile') == false
51
+ raise "Error: TemplateFile parameter from Mapping in line #{lineNumber} is missing!" if mappings[j].has_key?('TemplateFile') == false
54
52
  end
55
- setEndLabel = true
56
- break
57
-
58
- elsif line.include?("Mapping")
59
- raise "Error: end label } from Mapping in line #{lineNumber} is missing!"
53
+ j = j+1
60
54
  end
61
55
  end
62
- raise "Error: end label } from Mapping in line #{lineNumber} is missing!" if setEndLabel == false
63
- elsif line.match(/^( *)Workspace/)
64
- lineNumber = l.lineno
65
- raise "Error: Mapping keyword in front of line #{lineNumber} is missing?"
56
+ mapping.delete_at(i)
57
+ i = i-1
58
+ bracket = false
59
+ else
60
+ getKeyValuePairs(line,mapping[i],lineNumber)
66
61
  end
67
62
  end
68
- return 0, mappings
69
63
  end
64
+ return 0, mappings
70
65
  rescue Exception => e
71
66
  puts e.message
72
67
  puts e.back_trace if @debugMode == true
@@ -74,9 +69,27 @@ module BConv
74
69
  end
75
70
  end
76
71
 
72
+ def getKeyValuePairs(line,hash,lineNumber)
73
+ arr = []
74
+ line.gsub!('\\','/')
75
+ arr = line.split("=")
76
+
77
+ if (arr.length == 2)
78
+ if arr[0].strip[0] != "#"
79
+ comPos = arr[1].index("#")
80
+ arr[1] = arr[1][0..comPos-1] if comPos != nil
81
+ hash.store(arr[0].strip,arr[1].strip)
82
+ raise "Error: Parameter in #{File.basename(@filename)} from Mapping in line #{lineNumber} is missing!" if arr[0].strip == ""
83
+ end
84
+ elsif arr[1] == ""
85
+ hash.store(arr[0].strip,"")
86
+ end
87
+ return hash
88
+ end
89
+
77
90
  end
78
91
 
79
- end
92
+ end
80
93
 
81
94
 
82
95
 
data/lib/Converter.rb CHANGED
@@ -39,9 +39,7 @@ module BConv
39
39
  if preAndPostfix.length == 1
40
40
  prefix = preAndPostfix[0][0]
41
41
  postfix = preAndPostfix[0][1]
42
- end
43
- #need some cosmetics!
44
- if preAndPostfixOpt.length == 1
42
+ elsif preAndPostfixOpt.length == 1
45
43
  prefix = preAndPostfixOpt[0][0]
46
44
  postfix = preAndPostfixOpt[0][1]
47
45
  end
data/lib/Version.rb CHANGED
@@ -2,7 +2,7 @@ module BConv
2
2
 
3
3
  class Version
4
4
  def self.number
5
- return "1.4.0"
5
+ return "1.5.0"
6
6
  end
7
7
  end
8
8
 
data/lib/bakeConverter.rb CHANGED
@@ -63,10 +63,10 @@ def main
63
63
  when "--mock"
64
64
  setMock = true
65
65
  when "--version"
66
- puts "bakeConverter #{BConv::Version.number}"
66
+ puts "bakeConv #{BConv::Version.number}"
67
67
  exit(0)
68
68
  when "-v"
69
- puts "bakeConverter #{BConv::Version.number}"
69
+ puts "bakeConv #{BConv::Version.number}"
70
70
  exit(0)
71
71
  when "--help"
72
72
  BConv::Help.printHelp
@@ -94,7 +94,6 @@ def main
94
94
  end
95
95
 
96
96
  rescue Exception => e
97
- puts "Error in arguments!"
98
97
  puts e.backtrace if debugMode == true
99
98
  exit(-1)
100
99
  end
data/license.txt CHANGED
@@ -1,4 +1,4 @@
1
- bakeConverter License:
1
+ bakeConv License:
2
2
 
3
3
  Copyright (c) 2015 E.S.R. Labs AG
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bakeConv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frauke Blossey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy