bakeConv 1.2.2 → 1.3.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: 52b4f2a1ff3c69ac8093291b4d8ace6342b5f011
4
- data.tar.gz: 969558efc184b693f78d5ce6e301909ab92d6c5d
3
+ metadata.gz: 54c74fa0b572d947cfc10c64e2cb9bdde2b65cdb
4
+ data.tar.gz: 2063ac52ef08aded42b620c16bd2c41fddc110ca
5
5
  SHA512:
6
- metadata.gz: e786e52fdad316208fbdd8d93acf5f685bd9b938e3fb5069c4e41e82e3592bb0c46ec1d17b6f191e5e5f033a6c144039643a67ec006cb94b74cd251fbd28b1b0
7
- data.tar.gz: 211d6aac9f67465dd75b8cc47307cefbd8fcd9cb7fcbd30a58e769e458b52cf117ca59fd504f9d64aaf99b93d95d80757ba39cd76c4446169a3e52caa768287a
6
+ metadata.gz: 97f2d4efcdec98c419a6d3e43c0a67efee0dd795713ee7d6d02dcfe2d091155a494741d7e38fb9584eef4e7a4afb681ae31a1037b503bfdb8c9a54ee833c7d89
7
+ data.tar.gz: 3785de4d0adc21601ee3accf9b844b4cd03e31d8e769c0416f83c51ba316c91515023732a4c9385d5b86d94cfe702b9cc772fa9c475f64652f2cff05c952fa42
data/lib/Bake.rb CHANGED
@@ -17,10 +17,11 @@ module BConv
17
17
  BEFORE_INFO = 3
18
18
  VAR = 4
19
19
 
20
- def initialize(map, setMock, configFile)
20
+ def initialize(map, setMock, configFile, debugMode)
21
21
  @map = map
22
22
  @setMock = setMock
23
23
  @configFile = configFile
24
+ @debugMode = debugMode
24
25
  end
25
26
 
26
27
  def run
@@ -39,11 +40,10 @@ module BConv
39
40
 
40
41
  rescue Exception => e
41
42
  puts e.message
42
- puts e.back_trace #for debug mode
43
+ puts e.back_trace if @debugMode == true
43
44
  abort
44
- end
45
-
46
- abort "Error while trying to call bake!" unless $?.success?
45
+ end
46
+
47
47
  return bakeLines
48
48
  end
49
49
 
@@ -67,20 +67,10 @@ module BConv
67
67
  value = []
68
68
  key = line.strip
69
69
  b_hash.store(key,value)
70
-
71
- # if key != "BAKE_INCLUDES" && key != "BAKE_SOURCES" && key != "BAKE_DEFINES"
72
- # state = Bake::START_INFO
73
- # else
74
- state = VAR
75
- #end
70
+ state = VAR
76
71
  end
77
- #elsif line.start_with?("") && !line.match("START_INFO") && !line.match("END_INFO")
78
- # puts "Error: Nothing else than START_INFO and END_INFO starting without blanks!"
79
72
  else
80
73
  if line.match("START_INFO") && line[0] != " "
81
- # if state != Bake::BEFORE_INFO
82
- # abort "Error!"
83
- # end
84
74
  state = Bake::START_INFO
85
75
  elsif line.match("END_INFO")
86
76
  state = Bake::END_INFO
@@ -91,14 +81,7 @@ module BConv
91
81
  if state != Bake::END_INFO
92
82
  puts "Error: There is a problem with END_INFO. No output file could be generated!"
93
83
  return nil
94
- #raise ParseException.new("END_INFO missing")
95
84
  end
96
-
97
- # begin
98
- # ...
99
- # rescue ParseException
100
- # exit(-1)
101
- # end
102
85
 
103
86
  return b_hash
104
87
  end
data/lib/ConfigParser.rb CHANGED
@@ -6,9 +6,10 @@ module BConv
6
6
 
7
7
  class ConfigParser
8
8
 
9
- def initialize(filename, projToConvert)
9
+ def initialize(filename, projToConvert, debugMode)
10
10
  @filename = filename
11
11
  @projToConvert = projToConvert
12
+ @debugMode = debugMode
12
13
  end
13
14
 
14
15
  def readConfig
@@ -73,7 +74,7 @@ module BConv
73
74
  end
74
75
  rescue Exception => e
75
76
  puts e.message
76
- #puts e.back_trace #for debug mode
77
+ puts e.back_trace if @debugMode == true
77
78
  abort
78
79
  end
79
80
  end
data/lib/Converter.rb CHANGED
@@ -8,9 +8,10 @@ module BConv
8
8
 
9
9
  class Converter
10
10
 
11
- def initialize(map, configFile)
11
+ def initialize(map, configFile, debugMode)
12
12
  @configFile = configFile
13
13
  @map = map
14
+ @debugMode = debugMode
14
15
  end
15
16
 
16
17
  def convert
@@ -85,7 +86,7 @@ module BConv
85
86
  raise "Error: Template file #{File.basename(templatefilename)} is empty!" if File.zero?(templatefilename)
86
87
  rescue Exception => e
87
88
  puts e.message
88
- puts e.backtrace
89
+ puts e.back_trace if @debugMode == true
89
90
  abort
90
91
  end
91
92
  end
data/lib/Help.rb CHANGED
@@ -13,7 +13,8 @@ module BConv
13
13
  puts "-v, --version Print version."
14
14
  puts "-h, --help Print this help."
15
15
  puts "--show_doc Open documentation."
16
- puts "--show_license Print the license."
16
+ puts "--show_license Print the license."
17
+ puts "--debug Print debug output."
17
18
 
18
19
  end
19
20
 
data/lib/PathAdapt.rb CHANGED
@@ -10,12 +10,12 @@ module BConv
10
10
  SLASH = "/"
11
11
  COLON = ":"
12
12
 
13
- def self.adapt_path(outputFilePath, bhash)
13
+ def self.adapt_path(outputFilePath, bhash, cfgFleFromCmdLne)
14
14
  diffPathLevels, diffPathLevelsDown = 0, 0
15
15
  dir, diffUp = "", ""
16
16
  diffArr = []
17
17
 
18
- splitOutputFile = File.expand_path(File.dirname(outputFilePath)).split("/")
18
+ splitOutputFile = File.expand_path(File.dirname(outputFilePath),File.dirname(cfgFleFromCmdLne)).split("/")
19
19
  splitProjMeta = bhash['BAKE_PROJECTDIR'][0].split("/")
20
20
 
21
21
  if splitOutputFile.length > splitProjMeta.length
data/lib/Version.rb CHANGED
@@ -2,7 +2,7 @@ module BConv
2
2
 
3
3
  class Version
4
4
  def self.number
5
- "1.2.2"
5
+ "1.3.0"
6
6
  end
7
7
  end
8
8
 
data/lib/bakeConverter.rb CHANGED
@@ -18,7 +18,9 @@ def main
18
18
  #-------------------------------------------------------
19
19
  converterConfigFile = ""
20
20
  projToConvert = ""
21
- setMock = false
21
+ cfgFleFromCmdLne = ""
22
+ setMock = false
23
+ debugMode = false
22
24
 
23
25
  begin
24
26
  args = ARGV.select.each_with_index{|str, i| i.even? && str[0] == "-"}
@@ -45,7 +47,8 @@ def main
45
47
  Hash[(args.zip opts)].each do |k,v|
46
48
  case k
47
49
  when "-f"
48
- converterConfigFile = v
50
+ cfgFleFromCmdLne = v
51
+ converterConfigFile = File.expand_path(v)
49
52
  abort "Error: Config file is missing!" if converterConfigFile == nil
50
53
  when "--file"
51
54
  converterConfigFile = v
@@ -70,6 +73,8 @@ def main
70
73
  when "-h"
71
74
  BConv::Help.printHelp
72
75
  exit(0)
76
+ when "--debug"
77
+ debugMode = true
73
78
  when "--show_doc"
74
79
  #Launchy.open(File.expand_path("../doc/doc.html", File.dirname(__FILE__)))
75
80
  Launchy.open("http://esrlabs.github.io/bakeConv/")
@@ -90,16 +95,17 @@ def main
90
95
 
91
96
  rescue => e
92
97
  puts "Error in arguments!"
93
- #puts e.to_s #for debug mode
98
+ puts e.to_s if debug_mode == true
94
99
  exit(-1)
95
100
  end
96
101
 
97
- configFile = converterConfigFile.gsub('\\','/')
102
+ configFile = converterConfigFile.gsub('\\','/')
103
+ cfgFleFromCmdLne = cfgFleFromCmdLne.gsub('\\','/')
98
104
 
99
105
  #-------------------------------------------------------
100
106
  # Starting converting process:
101
107
  #-------------------------------------------------------
102
- cp = BConv::ConfigParser.new(configFile, projToConvert)
108
+ cp = BConv::ConfigParser.new(configFile, projToConvert, debugMode)
103
109
 
104
110
  puts "Reading config..."
105
111
  mappings = cp.readConfig
@@ -113,9 +119,10 @@ def main
113
119
  idxCnt += 1
114
120
  puts "Convert #{idxCnt} from #{mappings.length}: #{map['Proj2Convert']} (#{map['BuildConfig']})"
115
121
  puts "Call Bake..."
116
- bake = BConv::Bake.new(map, setMock, configFile)
122
+ bake = BConv::Bake.new(map, setMock, configFile, debugMode)
117
123
  bakeLines = bake.run
118
- #puts bakeLines
124
+ puts bakeLines if debugMode == true
125
+ abort "Error while trying to call bake!" unless $?.success?
119
126
  bhash = bake.getHash(bakeLines)
120
127
  if bhash != nil
121
128
  map.each do |k,v|
@@ -124,11 +131,11 @@ def main
124
131
  end
125
132
  end
126
133
  end
127
- bhash_adapted = BConv::PathAdapt.adapt_path(map['OutputFileName'], bhash)
134
+ bhash_adapted = BConv::PathAdapt.adapt_path(map['OutputFileName'], bhash, cfgFleFromCmdLne)
128
135
 
129
136
  if bhash_adapted != nil
130
137
  bhash_adapted.each {|k,v| map[k] = v unless (map.has_key?k && k!="DEPENDENCIES_FILTER")}
131
- conv = BConv::Converter.new(map, configFile)
138
+ conv = BConv::Converter.new(map, configFile, debugMode)
132
139
  puts "Convert..."
133
140
  conv.convert
134
141
  end
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.2.2
4
+ version: 1.3.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-08-11 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy