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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77a23202d00aacf618f97272a61931f882fa737f
4
- data.tar.gz: 8e4fc77e651741768e88d69a666b77edee2e1917
3
+ metadata.gz: ccbe0e179c3e775a3f7f819cd68a82c4409fd60d
4
+ data.tar.gz: 60b8a47bd1e81898a0c044f8f536e5fc93f29e49
5
5
  SHA512:
6
- metadata.gz: 0aa01576efe2c7b8ffb74d35eaf7b1e6410d2cf912f55de0006da535d64cf4b308b14a17f395c9785b892c3a14a3dad72a95bfd888bb49a6b8a043975a5a961e
7
- data.tar.gz: b8fa9751fac12a72ab778cdde8d168dac74a99df26cab54ecc8a93bfa4456101a9b822e436cf681f489b949ab4e6328ef40f699efecab3f2ba53db70ccc57acb
6
+ metadata.gz: d82e02edacee0453483d6031f29b0cbe1ec1388c1792637270857659cf0331d9720b99bd2e44edc0756e539fe8175c13d768fa8b1b95eb15e4846171a555e212
7
+ data.tar.gz: 96f207a4d45a0168495aa865df982b136f8f92989977031eb14b6b1a24ae179502310e37f7700a1644acd77dbb2b7f1017c9ac384b5a191acb5b9440e3e4001c
@@ -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
- #Dir.chdir(File.dirname(@configFile)) do
33
+ Dir.chdir(File.dirname(@configFile)) do
34
34
  bakeLines = `#{cmd.join(' ')}`
35
- #end
35
+ end
36
36
 
37
37
  rescue Exception => e
38
38
  puts e.message
@@ -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
- while(line = l.gets) != nil
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
@@ -15,13 +15,11 @@ module BConv
15
15
  end
16
16
 
17
17
  def convert
18
- pwd = @map['Workspace'][1..-2]
18
+ pwd = @configFile
19
19
 
20
- #outputfilename = Util.makeAbsolute(@map['OutputFile'], @configFile)
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)
@@ -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
- #splitOutputFile = File.expand_path(File.dirname(outputFilePath),File.dirname(pwd)).split("/")
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
 
@@ -10,7 +10,8 @@ class Util
10
10
  if File.isAbsolute?(file)
11
11
  outputfilename = file
12
12
  else
13
- outputfilename = File.join(pwd,file)
13
+ #outputfilename = File.dirname(pwd) + "/" + file
14
+ outputfilename = File.expand_path(file)
14
15
  end
15
16
  return outputfilename
16
17
  end
@@ -2,7 +2,7 @@ module BConv
2
2
 
3
3
  class Version
4
4
  def self.number
5
- return "1.5.3"
5
+ return "1.5.4"
6
6
  end
7
7
  end
8
8
 
@@ -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
- # bhash_adapted = BConv::PathAdapt.adapt_path(map['OutputFile'], bhash, cfgFleFromCmdLne, debugMode)
135
- bhash_adapted = BConv::PathAdapt.adapt_path(map['OutputFile'], bhash, map['Workspace'][1..-2], debugMode)
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.3
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-27 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy