bakeConv 1.1.1
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 +7 -0
- data/bin/bakeConv +7 -0
- data/doc/doc.html +44 -0
- data/lib/Bake.rb +101 -0
- data/lib/ConfigParser.rb +86 -0
- data/lib/Converter.rb +123 -0
- data/lib/File_ext.rb +11 -0
- data/lib/Help.rb +22 -0
- data/lib/Util.rb +21 -0
- data/lib/Version.rb +9 -0
- data/lib/bakeConverter.rb +146 -0
- data/license.txt +21 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: de0d62b2e4b4cb0a0d2031a14bd2d7b06c2e1021
|
4
|
+
data.tar.gz: 355d0d8980667abe73f3796a29f8984ae5182259
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f2bd923915408545869109aaa1474f3e31726b07ba1e0ee5c313d82fc69cd687ecfb455c6ca8e2fdcaee5ac3fb327089196a9672bc13a8c41247d042ed259c04
|
7
|
+
data.tar.gz: 85000592bd3b112b6648bbb87ccc588c9696d3a0d636d8eb2d43b202f5a749ca46b8e60474c1d0d00372b52f4a7d1d8d588e18e8396fb92336680a2384e6e8de
|
data/bin/bakeConv
ADDED
data/doc/doc.html
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Documentation of bakeConv</title>
|
5
|
+
<style type="text/css">
|
6
|
+
#rundrum {
|
7
|
+
border-width:1px;
|
8
|
+
border-style:dashed;
|
9
|
+
border-color:blue;
|
10
|
+
padding:0.2cm;
|
11
|
+
text-align:justify; }
|
12
|
+
</style>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
|
17
|
+
<h1>bakeConv</h1>
|
18
|
+
bake converter is used to convert from bake to some other file, e.g. CMake file, which depends on your template file.
|
19
|
+
|
20
|
+
<h2>GuideLines</h2>
|
21
|
+
<h3>Concepts</h3>
|
22
|
+
<ul>
|
23
|
+
<li><a href="concepts/configfile.html">The configuration file Converter.config</a>
|
24
|
+
<li><a href="concepts/templatefile.html">The template file</a>
|
25
|
+
</ul>
|
26
|
+
|
27
|
+
<h3>Command Line</h3>
|
28
|
+
<ul>
|
29
|
+
<li><a href="cmd/install.html">How to install bake converter</a>
|
30
|
+
<li><a href="cmd/usecmd.html">How to use bake converter on command line</a>
|
31
|
+
</ul>
|
32
|
+
|
33
|
+
<h3>Further readings</h3>
|
34
|
+
<ul>
|
35
|
+
<li><a href="further/change.html">Changelog</a>
|
36
|
+
</ul>
|
37
|
+
|
38
|
+
<p>
|
39
|
+
<hr>
|
40
|
+
<table width="100%" border="0"><tr><td align="left">Described bakeConv version: 1.0.2</td><td align="right">June 11, 2015</td></tr></table>
|
41
|
+
|
42
|
+
|
43
|
+
</body>
|
44
|
+
</html>
|
data/lib/Bake.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Class Bake
|
2
|
+
# Author: Frauke Blossey
|
3
|
+
# 24.03.2015
|
4
|
+
|
5
|
+
require_relative 'Converter'
|
6
|
+
|
7
|
+
module BConv
|
8
|
+
|
9
|
+
# class ParserException < Exception
|
10
|
+
# end
|
11
|
+
|
12
|
+
class Bake
|
13
|
+
|
14
|
+
#enums
|
15
|
+
START_INFO = 1
|
16
|
+
END_INFO = 2
|
17
|
+
BEFORE_INFO = 3
|
18
|
+
VAR = 4
|
19
|
+
|
20
|
+
def initialize(map, setMock, configFile)
|
21
|
+
@map = map
|
22
|
+
@setMock = setMock
|
23
|
+
@configFile = configFile
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
bakeLines = ''
|
28
|
+
cmd = @setMock ? ['ruby','C:/_dev/projects/bakeMock/bakeMock/bakeMock.rb'] : ['bake']
|
29
|
+
cmd << '-b' << @map['BuildConfig']
|
30
|
+
cmd << '-m' << @map['MainProj']
|
31
|
+
cmd << '-p' << @map['Proj2Convert']
|
32
|
+
cmd << '--conversion_info'
|
33
|
+
Util.strToArray('Workspace', @map).each { |w| cmd << '-w' << w }
|
34
|
+
|
35
|
+
Dir.chdir(File.dirname(@configFile)) do
|
36
|
+
bakeLines = `#{cmd.join(' ')}`
|
37
|
+
end
|
38
|
+
|
39
|
+
abort "Error while trying to call bake!" unless $?.success?
|
40
|
+
return bakeLines
|
41
|
+
end
|
42
|
+
|
43
|
+
def getHash(bakeLines)
|
44
|
+
b_hash = {}
|
45
|
+
key = ""
|
46
|
+
value = []
|
47
|
+
state = Bake::BEFORE_INFO
|
48
|
+
|
49
|
+
bakeLines.each_line do |line|
|
50
|
+
if line.start_with?(" ") && line[2] != " "
|
51
|
+
if state == Bake::VAR
|
52
|
+
value << line.strip if value != nil
|
53
|
+
value = line.strip if value == nil
|
54
|
+
b_hash.store(key,value)
|
55
|
+
|
56
|
+
end
|
57
|
+
elsif line.start_with?(" ") && line[1] != " "
|
58
|
+
if state == Bake::START_INFO || state == Bake::VAR
|
59
|
+
key = ""
|
60
|
+
value = []
|
61
|
+
key = line.strip
|
62
|
+
b_hash.store(key,value)
|
63
|
+
|
64
|
+
# if key != "BAKE_INCLUDES" && key != "BAKE_SOURCES" && key != "BAKE_DEFINES"
|
65
|
+
# state = Bake::START_INFO
|
66
|
+
# else
|
67
|
+
state = VAR
|
68
|
+
#end
|
69
|
+
end
|
70
|
+
#elsif line.start_with?("") && !line.match("START_INFO") && !line.match("END_INFO")
|
71
|
+
# puts "Error: Nothing else than START_INFO and END_INFO starting without blanks!"
|
72
|
+
else
|
73
|
+
if line.match("START_INFO") && line[0] != " "
|
74
|
+
# if state != Bake::BEFORE_INFO
|
75
|
+
# abort "Error!"
|
76
|
+
# end
|
77
|
+
state = Bake::START_INFO
|
78
|
+
elsif line.match("END_INFO")
|
79
|
+
state = Bake::END_INFO
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if state != Bake::END_INFO
|
85
|
+
puts "Error: There is a problem with END_INFO. No output file could be generated!"
|
86
|
+
return nil
|
87
|
+
#raise ParseException.new("END_INFO missing")
|
88
|
+
end
|
89
|
+
|
90
|
+
# begin
|
91
|
+
# ...
|
92
|
+
# rescue ParseException
|
93
|
+
# exit(-1)
|
94
|
+
# end
|
95
|
+
|
96
|
+
return b_hash
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
data/lib/ConfigParser.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Class ConfigParser
|
2
|
+
# Author: Frauke Blossey
|
3
|
+
# 23.03.2015
|
4
|
+
|
5
|
+
module BConv
|
6
|
+
|
7
|
+
class ConfigParser
|
8
|
+
|
9
|
+
def initialize(filename, projToConvert)
|
10
|
+
@filename = filename
|
11
|
+
@projToConvert = projToConvert
|
12
|
+
end
|
13
|
+
|
14
|
+
def readConfig
|
15
|
+
begin
|
16
|
+
File.open(@filename) do |l|
|
17
|
+
mappings = []
|
18
|
+
mapForProj = {}
|
19
|
+
while(line = l.gets) != nil
|
20
|
+
mapping = {}
|
21
|
+
ar = []
|
22
|
+
setEndLabel = false
|
23
|
+
if line.match(/^Mapping/)
|
24
|
+
lineNumber = l.lineno
|
25
|
+
while(line = l.gets) != nil
|
26
|
+
line.gsub!('\\','/')
|
27
|
+
ar = line.split("=")
|
28
|
+
if (ar.length == 2)
|
29
|
+
comPos = ar[1].index("#")
|
30
|
+
ar[1] = ar[1][0..comPos-1] if comPos != nil
|
31
|
+
mapping.store(ar[0].strip,ar[1].strip)
|
32
|
+
elsif ar[1] == ""
|
33
|
+
mapping.store(ar[0].strip,"")
|
34
|
+
end
|
35
|
+
|
36
|
+
if line.match(/^}$/)
|
37
|
+
raise "Error: Workspace parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('Workspace') == false
|
38
|
+
raise "Error: MainProj parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('MainProj') == false
|
39
|
+
raise "Error: BuildConfig parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('BuildConfig') == false
|
40
|
+
raise "Error: Proj2Convert parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('Proj2Convert') == false
|
41
|
+
raise "Error: OutputFileName parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('OutputFileName') == false
|
42
|
+
raise "Error: TemplateFile parameter from Mapping in line #{lineNumber} is missing!" if mapping.has_key?('TemplateFile') == false
|
43
|
+
|
44
|
+
if @projToConvert != "" && @projToConvert != mapping['Proj2Convert']
|
45
|
+
mapping = {}
|
46
|
+
else
|
47
|
+
mappings << mapping
|
48
|
+
end
|
49
|
+
|
50
|
+
# if @projToConvert.length != 0
|
51
|
+
# @projToConvert.each do |val|
|
52
|
+
# if val == mapping['Proj2Convert']
|
53
|
+
# mappings << mapping
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
# else
|
57
|
+
# mappings << mapping
|
58
|
+
# end
|
59
|
+
|
60
|
+
setEndLabel = true
|
61
|
+
break
|
62
|
+
elsif line.include?("Mapping")
|
63
|
+
raise "Error: end label } from Mapping in line #{lineNumber} is missing!"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
raise "Error: end label } from Mapping in line #{lineNumber} is missing!" if setEndLabel == false
|
67
|
+
elsif line.match(/^( *)Workspace/)
|
68
|
+
lineNumber = l.lineno
|
69
|
+
raise "Error: Mapping keyword in front of line #{lineNumber} is missing?"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
return mappings
|
73
|
+
end
|
74
|
+
rescue Exception => e
|
75
|
+
puts e.message
|
76
|
+
#puts e.back_trace #for debug mode
|
77
|
+
abort
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
|
data/lib/Converter.rb
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
# Class Converter
|
2
|
+
# Author: Frauke Blossey
|
3
|
+
# 24.03.2015
|
4
|
+
|
5
|
+
require_relative 'Util'
|
6
|
+
|
7
|
+
module BConv
|
8
|
+
|
9
|
+
class Converter
|
10
|
+
|
11
|
+
def initialize(map, configFile)
|
12
|
+
@configFile = configFile
|
13
|
+
@map = map
|
14
|
+
end
|
15
|
+
|
16
|
+
def convert
|
17
|
+
outputfilename = Util.makeAbsolute(@map['OutputFileName'], @configFile)
|
18
|
+
templatefilename = Util.makeAbsolute(@map['TemplateFile'], @configFile)
|
19
|
+
|
20
|
+
lineIdx = 0
|
21
|
+
tmpLineIdx = 0
|
22
|
+
set = true
|
23
|
+
begin
|
24
|
+
File.open(outputfilename, 'w') do |fout|
|
25
|
+
File.open(templatefilename) do |fread|
|
26
|
+
File.readlines(fread).each do |line|
|
27
|
+
lineIdx += 1
|
28
|
+
wroteLine = false
|
29
|
+
@map.keys.each do |key|
|
30
|
+
|
31
|
+
if line.include?(key.to_s) && @map[key].include?(".txt")
|
32
|
+
preAndPostfix = line.scan(/(.*)\$\$\(#{key}\)(.*)/)
|
33
|
+
if preAndPostfix.length == 1
|
34
|
+
prefix = preAndPostfix[0][0]
|
35
|
+
postfix = preAndPostfix[0][1]
|
36
|
+
end
|
37
|
+
|
38
|
+
filename = Util.makeAbsolute(@map[key], @configFile)
|
39
|
+
raise "Error: Template file #{File.basename(filename)} is empty!" if File.zero?(filename)
|
40
|
+
raise "Error: File #{File.basename(filename)} does not exist!" if !File.exist?(filename)
|
41
|
+
|
42
|
+
File.open(filename) do |fr|
|
43
|
+
File.readlines(fr).each do |l|
|
44
|
+
tmpLineIdx += 1
|
45
|
+
@map.keys.each do |k|
|
46
|
+
wroteLine = findAndReplace(k, l, fout, prefix, postfix)
|
47
|
+
break if wroteLine == true
|
48
|
+
end
|
49
|
+
if wroteLine == false
|
50
|
+
l.strip!
|
51
|
+
l = prefix + l + postfix + "\n"
|
52
|
+
m = l.match(/\$\$\((.*)\)/)
|
53
|
+
if m
|
54
|
+
puts "Info: Key $$(#{m[1]}) in #{File.basename(filename)}, line #{tmpLineIdx.to_s} wasn\'t replaced!" if m
|
55
|
+
end
|
56
|
+
puts l
|
57
|
+
fout.write(l)
|
58
|
+
set = false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
elsif (@map[key][0] == "[") && (@map[key][-1] == "]")
|
63
|
+
@map.store(key,Util.strToArray(key, @map))
|
64
|
+
wroteLine = findAndReplace(key, line, fout, "", "")
|
65
|
+
break
|
66
|
+
elsif line.match(/#{key.to_s}/)
|
67
|
+
wroteLine = findAndReplace(key, line, fout, "", "")
|
68
|
+
break
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
if wroteLine == false
|
73
|
+
if set == true
|
74
|
+
m = line.match(/\$\$\((.*)\)/)
|
75
|
+
if m
|
76
|
+
puts "Info: Key $$(#{m[1]}) in #{File.basename(templatefilename)}, line #{lineIdx.to_s} wasn\'t replaced!"
|
77
|
+
end
|
78
|
+
fout.write(line)
|
79
|
+
end
|
80
|
+
set = true
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
raise "Error: Output file #{File.basename(outputfilename)} is empty!" if File.zero?(outputfilename)
|
86
|
+
raise "Error: Template file #{File.basename(templatefilename)} is empty!" if File.zero?(templatefilename)
|
87
|
+
rescue Exception => e
|
88
|
+
puts e.message
|
89
|
+
puts e.backtrace
|
90
|
+
abort
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def findAndReplace(key, line, fout, prefix, postfix)
|
95
|
+
wroteLine = false
|
96
|
+
found = line.scan(/(.*)\$\$\(#{key}\)(.*)/)
|
97
|
+
|
98
|
+
if found.length == 1
|
99
|
+
pre = found[0][0]
|
100
|
+
post = found[0][1]
|
101
|
+
|
102
|
+
if @map[key].kind_of?(Array)
|
103
|
+
@map[key].each do |val|
|
104
|
+
line = prefix + pre + val.to_s + post + postfix + "\n"
|
105
|
+
fout.write(line)
|
106
|
+
end
|
107
|
+
wroteLine = true
|
108
|
+
else
|
109
|
+
line = prefix + pre + @map[key] + post + postfix + "\n"
|
110
|
+
fout.write(line)
|
111
|
+
wroteLine = true
|
112
|
+
end
|
113
|
+
elsif line.include?("/\$\$\(#{key}\)/") && found.length == 0
|
114
|
+
line.gsub!(/\$\$\(#{key}\)/, @map[key].to_s)
|
115
|
+
fout.write(line)
|
116
|
+
wroteLine = true
|
117
|
+
end
|
118
|
+
return wroteLine
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
data/lib/File_ext.rb
ADDED
data/lib/Help.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module BConv
|
2
|
+
|
3
|
+
require_relative 'Version'
|
4
|
+
|
5
|
+
class Help
|
6
|
+
|
7
|
+
def self.printHelp
|
8
|
+
|
9
|
+
puts "bakeConv #{BConv::Version.number}\n\n"
|
10
|
+
puts "Usage: bakeConv [options]"
|
11
|
+
puts "-f, --file <configFile> Config name for your conversion."
|
12
|
+
puts "[-p, --project] <projName> Project to convert (default are all projects mentioned in the config file).\n\n"
|
13
|
+
puts "-v, --version Print version."
|
14
|
+
puts "-h, --help Print this help."
|
15
|
+
puts "--show_doc Open documentation."
|
16
|
+
puts "--show_license Print the license."
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/Util.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Class Util (contains utility methods)
|
2
|
+
# Author: Frauke Blossey
|
3
|
+
# 15.04.2015
|
4
|
+
|
5
|
+
require_relative 'File_ext'
|
6
|
+
|
7
|
+
class Util
|
8
|
+
|
9
|
+
def self.makeAbsolute(file, configFile)
|
10
|
+
if File.isAbsolute?(file)
|
11
|
+
outputfilename = file
|
12
|
+
else
|
13
|
+
outputfilename = File.dirname(configFile) + "/" + file
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.strToArray(key, map)
|
18
|
+
map[key][1..-2].split(",").map {|elem| elem.strip}
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/lib/Version.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# BakeConverter
|
2
|
+
# Author: Frauke Blossey
|
3
|
+
# 12.03.2015
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'launchy'
|
7
|
+
require_relative 'ConfigParser'
|
8
|
+
require_relative 'Bake'
|
9
|
+
require_relative 'Converter'
|
10
|
+
require_relative 'Version'
|
11
|
+
require_relative 'Help'
|
12
|
+
|
13
|
+
def main
|
14
|
+
#-------------------------------------------------------
|
15
|
+
# Get command line arguments:
|
16
|
+
#-------------------------------------------------------
|
17
|
+
converterConfigFile = ""
|
18
|
+
projToConvert = ""
|
19
|
+
setMock = false
|
20
|
+
|
21
|
+
begin
|
22
|
+
args = ARGV.select.each_with_index{|str, i| i.even? && str[0] == "-"}
|
23
|
+
opts = ARGV.select.each_with_index{|str, i| i.odd? && str[0] != "-"}
|
24
|
+
|
25
|
+
#puts Hash[(args.zip opts)]
|
26
|
+
|
27
|
+
if ARGV[0] != "--help" && ARGV[0] != "-h" && ARGV[0] != "--show_doc" && ARGV[0] != "--version" && ARGV[0] != "-v" && ARGV[0] != "--show_license" && ARGV[0] != "--mock"
|
28
|
+
if (!ARGV.include?("-f") && !ARGV.include?("--file")) && ARGV.length != 0
|
29
|
+
puts "Error: \'-f\' is missing! (try --help)"
|
30
|
+
exit(-1)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if ARGV.length == 1 && ARGV[0] != "--help" && ARGV[0] != "-h" && ARGV[0] != "--show_doc" && ARGV[0] != "--version" && ARGV[0] != "-v" && ARGV[0] != "--show_license" && ARGV[0] != "--mock"
|
35
|
+
puts "Error: Too less arguments! (try --help)"
|
36
|
+
puts "Config file is missing!" if opts[0] == nil
|
37
|
+
exit(-1)
|
38
|
+
elsif ARGV.length == 0 || (ARGV.length == 1 && ARGV[0] == "--mock")
|
39
|
+
puts "Error: Too less arguments! (try --help)"
|
40
|
+
exit(-1)
|
41
|
+
end
|
42
|
+
|
43
|
+
Hash[(args.zip opts)].each do |k,v|
|
44
|
+
case k
|
45
|
+
when "-f"
|
46
|
+
converterConfigFile = v
|
47
|
+
abort "Error: Config file is missing!" if converterConfigFile == nil
|
48
|
+
when "--file"
|
49
|
+
converterConfigFile = v
|
50
|
+
abort "Error: Config file is missing!" if converterConfigFile == nil
|
51
|
+
when "-p"
|
52
|
+
projToConvert = v
|
53
|
+
abort "Error: project is missing!" if projToConvert == nil
|
54
|
+
when "--project"
|
55
|
+
projToConvert = v
|
56
|
+
abort "Error: project is missing!" if projToConvert == nil
|
57
|
+
when "--mock"
|
58
|
+
setMock = true
|
59
|
+
when "--version"
|
60
|
+
puts "bakeConverter #{BConv::Version.number}"
|
61
|
+
exit(0)
|
62
|
+
when "-v"
|
63
|
+
puts "bakeConverter #{BConv::Version.number}"
|
64
|
+
exit(0)
|
65
|
+
when "--help"
|
66
|
+
BConv::Help.printHelp
|
67
|
+
exit(0)
|
68
|
+
when "-h"
|
69
|
+
BConv::Help.printHelp
|
70
|
+
exit(0)
|
71
|
+
when "--show_doc"
|
72
|
+
Launchy.open(File.expand_path("../doc/doc.html", File.dirname(__FILE__)))
|
73
|
+
exit(0)
|
74
|
+
when "--show_license"
|
75
|
+
puts
|
76
|
+
File.open(File.expand_path("../license.txt", File.dirname(__FILE__))) do |l|
|
77
|
+
while(line = l.gets) != nil
|
78
|
+
puts line
|
79
|
+
end
|
80
|
+
end
|
81
|
+
exit(0)
|
82
|
+
else
|
83
|
+
puts "Error: don't know '#{k}'! (try --help)"
|
84
|
+
exit(-1)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
rescue => e
|
89
|
+
puts "Error in arguments!"
|
90
|
+
#puts e.to_s #for debug mode
|
91
|
+
exit(-1)
|
92
|
+
end
|
93
|
+
|
94
|
+
configFile = converterConfigFile.gsub('\\','/')
|
95
|
+
|
96
|
+
#-------------------------------------------------------
|
97
|
+
# Starting converting process:
|
98
|
+
#-------------------------------------------------------
|
99
|
+
cp = BConv::ConfigParser.new(configFile, projToConvert)
|
100
|
+
|
101
|
+
puts "Reading config..."
|
102
|
+
mappings = cp.readConfig
|
103
|
+
|
104
|
+
abort "Error: Config file is empty OR the requested project(s) is commented out!" if mappings.length == 0
|
105
|
+
puts "Converting #{mappings.length} projects..."
|
106
|
+
|
107
|
+
idxCnt = 0
|
108
|
+
|
109
|
+
mappings.each do |map|
|
110
|
+
idxCnt += 1
|
111
|
+
puts "Convert #{idxCnt} from #{mappings.length}: #{map['Proj2Convert']} (#{map['BuildConfig']})"
|
112
|
+
puts "Call Bake..."
|
113
|
+
bake = BConv::Bake.new(map, setMock, configFile)
|
114
|
+
bakeLines = bake.run
|
115
|
+
bhash = bake.getHash(bakeLines)
|
116
|
+
if bhash != nil
|
117
|
+
bhash.each {|k,v| map[k] = v unless map.has_key?k}
|
118
|
+
#map.merge!(bhash)
|
119
|
+
conv = BConv::Converter.new(map, configFile)
|
120
|
+
puts "Convert..."
|
121
|
+
conv.convert
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
puts "Done"
|
126
|
+
end
|
127
|
+
|
128
|
+
#-------------------------------------------------------
|
129
|
+
# Call the bakeConverter:
|
130
|
+
#-------------------------------------------------------
|
131
|
+
main
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
data/license.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
bakeConverter License:
|
2
|
+
|
3
|
+
Copyright (c) 2015 E.S.R. Labs AG
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bakeConv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Frauke Blossey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: launchy
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.4.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.4.3
|
27
|
+
description: bake converter is used to convert from bake to some other file, e.g.
|
28
|
+
CMake file, which depends on your template file.
|
29
|
+
email: frauke.blossey@esrlabs.com
|
30
|
+
executables:
|
31
|
+
- bakeConv
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- lib/Bake.rb
|
36
|
+
- lib/ConfigParser.rb
|
37
|
+
- lib/Converter.rb
|
38
|
+
- lib/File_ext.rb
|
39
|
+
- lib/Help.rb
|
40
|
+
- lib/Util.rb
|
41
|
+
- lib/Version.rb
|
42
|
+
- lib/bakeConverter.rb
|
43
|
+
- doc/doc.html
|
44
|
+
- license.txt
|
45
|
+
- bin/bakeConv
|
46
|
+
homepage:
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata: {}
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options:
|
52
|
+
- -x
|
53
|
+
- doc
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.9'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.0.15
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: tbd
|
72
|
+
test_files: []
|