bakeConv 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Bake.rb +2 -2
- data/lib/ConfigParser.rb +18 -1
- data/lib/Converter.rb +3 -6
- data/lib/PathAdapt.rb +12 -2
- data/lib/Util.rb +2 -1
- data/lib/Version.rb +1 -1
- data/lib/bakeConverter.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccbe0e179c3e775a3f7f819cd68a82c4409fd60d
|
4
|
+
data.tar.gz: 60b8a47bd1e81898a0c044f8f536e5fc93f29e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d82e02edacee0453483d6031f29b0cbe1ec1388c1792637270857659cf0331d9720b99bd2e44edc0756e539fe8175c13d768fa8b1b95eb15e4846171a555e212
|
7
|
+
data.tar.gz: 96f207a4d45a0168495aa865df982b136f8f92989977031eb14b6b1a24ae179502310e37f7700a1644acd77dbb2b7f1017c9ac384b5a191acb5b9440e3e4001c
|
data/lib/Bake.rb
CHANGED
@@ -30,9 +30,9 @@ module BConv
|
|
30
30
|
cmd << '--conversion_info'
|
31
31
|
Util.strToArray('Workspace', @map).each { |w| cmd << '-w' << w }
|
32
32
|
|
33
|
-
|
33
|
+
Dir.chdir(File.dirname(@configFile)) do
|
34
34
|
bakeLines = `#{cmd.join(' ')}`
|
35
|
-
|
35
|
+
end
|
36
36
|
|
37
37
|
rescue Exception => e
|
38
38
|
puts e.message
|
data/lib/ConfigParser.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
# Author: Frauke Blossey
|
3
3
|
# 23.03.2015
|
4
4
|
|
5
|
+
require_relative 'Util'
|
6
|
+
|
5
7
|
module BConv
|
6
8
|
|
7
9
|
class ConfigParser
|
@@ -21,7 +23,7 @@ module BConv
|
|
21
23
|
j=0
|
22
24
|
|
23
25
|
File.open(@filename) do |l|
|
24
|
-
|
26
|
+
while(line = l.gets) != nil
|
25
27
|
if line.include?("{")
|
26
28
|
mapping.push({})
|
27
29
|
i = i+1
|
@@ -32,6 +34,7 @@ module BConv
|
|
32
34
|
if bracket == true
|
33
35
|
if @projToConvert != "" && @projToConvert != mapping[i]['Proj2Convert']
|
34
36
|
#do nothing and continue
|
37
|
+
bracket = false
|
35
38
|
elsif @projToConvert != "" && @projToConvert == mapping[i]['Proj2Convert']
|
36
39
|
mappings.push({})
|
37
40
|
mappings[j] = mapping[i].clone
|
@@ -39,6 +42,7 @@ module BConv
|
|
39
42
|
else
|
40
43
|
mappings.push({})
|
41
44
|
mappings[j] = mapping[i].clone
|
45
|
+
bracket = false
|
42
46
|
end
|
43
47
|
|
44
48
|
if mappings.length != 0
|
@@ -60,6 +64,7 @@ module BConv
|
|
60
64
|
getKeyValuePairs(line,mapping[i],lineNumber)
|
61
65
|
end
|
62
66
|
end
|
67
|
+
replaceWorkspaceElmInPath(mappings)
|
63
68
|
end
|
64
69
|
return 0, mappings
|
65
70
|
rescue Exception => e
|
@@ -87,6 +92,18 @@ module BConv
|
|
87
92
|
return hash
|
88
93
|
end
|
89
94
|
|
95
|
+
def replaceWorkspaceElmInPath(mappings)
|
96
|
+
for j in 0..(mappings.length-1)
|
97
|
+
workspaceArr = Util.strToArray('Workspace',mappings[j])
|
98
|
+
mappings[j].each do |key,value|
|
99
|
+
match = value.match(/Workspace\s*\[\s*(\d+)\s*\]/)
|
100
|
+
if match != nil
|
101
|
+
value.gsub!(/Workspace\s*\[\s*(\d+)\s*\]/,workspaceArr[match[1].to_i])
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
90
107
|
end
|
91
108
|
|
92
109
|
end
|
data/lib/Converter.rb
CHANGED
@@ -15,13 +15,11 @@ module BConv
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def convert
|
18
|
-
pwd = @
|
18
|
+
pwd = @configFile
|
19
19
|
|
20
|
-
|
21
|
-
outputfilename = Util.makeAbsolute(@map['OutputFile'], pwd)
|
22
|
-
#templatefilename = Util.makeAbsolute(@map['TemplateFile'], @configFile)
|
20
|
+
outputfilename = @map['OutputFile']
|
23
21
|
templatefilename = Util.makeAbsolute(@map['TemplateFile'], pwd)
|
24
|
-
|
22
|
+
|
25
23
|
lineIdx = 0
|
26
24
|
tmpLineIdx = 0
|
27
25
|
set = true
|
@@ -48,7 +46,6 @@ module BConv
|
|
48
46
|
postfix = preAndPostfixOpt[0][1]
|
49
47
|
end
|
50
48
|
|
51
|
-
#filename = Util.makeAbsolute(@map[key], @configFile)
|
52
49
|
filename = Util.makeAbsolute(@map[key], pwd)
|
53
50
|
raise "Error: Template file #{File.basename(filename)} is empty!" if File.zero?(filename)
|
54
51
|
raise "Error: File #{File.basename(filename)} does not exist!" if !File.exist?(filename)
|
data/lib/PathAdapt.rb
CHANGED
@@ -10,14 +10,24 @@ module BConv
|
|
10
10
|
SLASH = "/"
|
11
11
|
COLON = ":"
|
12
12
|
|
13
|
+
def self.adapt_outputPath(bhash,outputFile)
|
14
|
+
bhash.each do |key,value|
|
15
|
+
if key == "BAKE_PROJECTDIR"
|
16
|
+
outputFile.gsub!("$$(BAKE_PROJECTDIR)",value[0])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
return outputFile
|
21
|
+
end
|
22
|
+
|
13
23
|
def self.adapt_path(outputFilePath, bhash, pwd, debugMode)
|
14
24
|
diffPathLevels, diffPathLevelsDown = 0, 0
|
15
25
|
dir, diffUp = "", ""
|
16
26
|
diffArr = []
|
17
27
|
|
18
28
|
begin
|
19
|
-
|
20
|
-
splitOutputFile = File.expand_path(File.dirname(outputFilePath),pwd).split("/")
|
29
|
+
splitOutputFile = File.expand_path(File.dirname(outputFilePath),File.dirname(pwd)).split("/")
|
30
|
+
#splitOutputFile = File.expand_path(File.dirname(outputFilePath),pwd).split("/")
|
21
31
|
splitProjMeta = bhash['BAKE_PROJECTDIR'][0].split("/") if bhash['BAKE_PROJECTDIR'][0].include?("/") && bhash['BAKE_PROJECTDIR'] != nil
|
22
32
|
#raise "Error: BAKE_PROJDIR is missing!" if bhash['BAKE_PROJECTDIR'] == nil
|
23
33
|
|
data/lib/Util.rb
CHANGED
data/lib/Version.rb
CHANGED
data/lib/bakeConverter.rb
CHANGED
@@ -125,14 +125,16 @@ def main
|
|
125
125
|
puts bakeLines if debugMode == true
|
126
126
|
abort "Error while trying to call bake!" unless $?.success?
|
127
127
|
bhash = bake.getHash(bakeLines)
|
128
|
+
outputFile = BConv::PathAdapt.adapt_outputPath(bhash,map['OutputFile'])
|
129
|
+
map['OutputFile'] = outputFile
|
128
130
|
if bhash != nil
|
129
131
|
map.each do |k,v|
|
130
132
|
if (k == "EXCLUDE_BAKE_SOURCES") || (k == "EXCLUDE_BAKE_INCLUDES") || (k == "EXCLUDE_BAKE_DEPENDENCIES")
|
131
133
|
bhash = BConv::Filter.hashFilter(k, v, bhash)
|
132
134
|
end
|
133
135
|
end
|
134
|
-
|
135
|
-
|
136
|
+
bhash_adapted = BConv::PathAdapt.adapt_path(map['OutputFile'], bhash, cfgFleFromCmdLne, debugMode)
|
137
|
+
# bhash_adapted = BConv::PathAdapt.adapt_path(map['OutputFile'], bhash, map['Workspace'][1..-2], debugMode)
|
136
138
|
end
|
137
139
|
|
138
140
|
if bhash_adapted != nil
|
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.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frauke Blossey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|