raykit 0.0.467 → 0.0.468

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,69 +1,69 @@
1
- module Raykit
2
- module Conan
3
- # Functionality to manage a git commit
4
- class BuildInfo < Hash
5
- def initialize(filename)
6
- current_section = ""
7
- current_list = Array.new()
8
- File.readlines(filename).each do |line|
9
- #puts line
10
- if (line.index("[") == 0)
11
- if (current_section.length > 0)
12
- self.store(current_section, current_list)
13
- current_list = Array.new()
14
- end
15
- current_section = line.strip()
16
- else
17
- item = line.strip()
18
- if (item.length > 0)
19
- current_list << item
20
- end
21
- end
22
- #
23
- end
24
- end
25
-
26
- def section(name)
27
- items = Array.new()
28
- if (self.has_key?(name))
29
- return self[name]
30
- end
31
- items
32
- end
33
-
34
- def pdbs
35
- items = Array.new()
36
- self.section("[builddirs]").each { |dir|
37
- Dir.glob("#{dir}/**/*.pdb").sort.each { |pdb|
38
- items << pdb
39
- }
40
- }
41
- items
42
- end
43
-
44
- def copy_pdbs(dir)
45
- FileUtils.mkdir_p(dir) if !Dir.exist?(dir)
46
- self.pdbs.each { |pdb|
47
- target = "#{dir}/#{File.basename(pdb)}"
48
- if (!File.exist?(target))
49
- puts " copying #{pdb} to #{target}"
50
- FileUtils.cp(pdb, "#{target}")
51
- end
52
- }
53
- end
54
-
55
- def source_dirs(pattern)
56
- items = Array.new()
57
- self.section("[builddirs]").each { |dir|
58
- if (dir.include?(pattern))
59
- parts = dir.split("package/")
60
- if (parts.length == 2)
61
- items << "#{parts[0]}source"
62
- end
63
- end
64
- }
65
- items
66
- end
67
- end
68
- end
69
- end
1
+ module Raykit
2
+ module Conan
3
+ # Functionality to manage a git commit
4
+ class BuildInfo < Hash
5
+ def initialize(filename)
6
+ current_section = ""
7
+ current_list = Array.new()
8
+ File.readlines(filename).each do |line|
9
+ #puts line
10
+ if (line.index("[") == 0)
11
+ if (current_section.length > 0)
12
+ self.store(current_section, current_list)
13
+ current_list = Array.new()
14
+ end
15
+ current_section = line.strip()
16
+ else
17
+ item = line.strip()
18
+ if (item.length > 0)
19
+ current_list << item
20
+ end
21
+ end
22
+ #
23
+ end
24
+ end
25
+
26
+ def section(name)
27
+ items = Array.new()
28
+ if (self.has_key?(name))
29
+ return self[name]
30
+ end
31
+ items
32
+ end
33
+
34
+ def pdbs
35
+ items = Array.new()
36
+ self.section("[builddirs]").each { |dir|
37
+ Dir.glob("#{dir}/**/*.pdb").sort.each { |pdb|
38
+ items << pdb
39
+ }
40
+ }
41
+ items
42
+ end
43
+
44
+ def copy_pdbs(dir)
45
+ FileUtils.mkdir_p(dir) if !Dir.exist?(dir)
46
+ self.pdbs.each { |pdb|
47
+ target = "#{dir}/#{File.basename(pdb)}"
48
+ if (!File.exist?(target))
49
+ puts " copying #{pdb} to #{target}"
50
+ FileUtils.cp(pdb, "#{target}")
51
+ end
52
+ }
53
+ end
54
+
55
+ def source_dirs(pattern)
56
+ items = Array.new()
57
+ self.section("[builddirs]").each { |dir|
58
+ if (dir.include?(pattern))
59
+ parts = dir.split("package/")
60
+ if (parts.length == 2)
61
+ items << "#{parts[0]}source"
62
+ end
63
+ end
64
+ }
65
+ items
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,49 +1,49 @@
1
- # frozen_string_literal: true
2
-
3
- module Raykit
4
- class ConanPackage
5
- attr_accessor :name, :version
6
-
7
- def initialize(name, version)
8
- @name = name
9
- @version = version
10
- end
11
-
12
- def self.get_version(text, name)
13
- # "gtest/0.0.14@my+channel.com/branch"
14
- # gtest/1.10.0
15
- [/\b#{name}\/([\d\.]+)/].each { |regex|
16
- matches = text.scan(regex)
17
- if matches.length > 0 && matches[0].length > 0
18
- return matches[0][0]
19
- end
20
- }
21
- ""
22
- end
23
-
24
- def self.set_version(text, name, version)
25
- #puts "ConanPackage::set_version"
26
- new_text = text
27
- [/(\b#{name}\/[\d\.]+)/].each { |regex|
28
- matches = text.scan(regex)
29
- if matches.length > 0 && matches[0].length > 0
30
- orig = matches[0][0]
31
- oversion = get_version(orig, name)
32
- mod = orig.sub(oversion, version)
33
- #puts "match[0][0] " + matches[0][0]
34
- #puts "old version " + oversion
35
- #puts "new version " + version
36
- #puts "updating from #{orig} to #{mod}"
37
- new_text = new_text.gsub(orig, mod)
38
- end
39
- }
40
- new_text
41
- end
42
-
43
- def self.set_version_in_file(filename, name, version)
44
- text = set_version(IO.read(filename), name, version)
45
- orig = IO.read(filename)
46
- File.open(filename, "w") { |f| f.puts text } if (text != orig)
47
- end
48
- end
49
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Raykit
4
+ class ConanPackage
5
+ attr_accessor :name, :version
6
+
7
+ def initialize(name, version)
8
+ @name = name
9
+ @version = version
10
+ end
11
+
12
+ def self.get_version(text, name)
13
+ # "gtest/0.0.14@my+channel.com/branch"
14
+ # gtest/1.10.0
15
+ [/\b#{name}\/([\d\.]+)/].each { |regex|
16
+ matches = text.scan(regex)
17
+ if matches.length > 0 && matches[0].length > 0
18
+ return matches[0][0]
19
+ end
20
+ }
21
+ ""
22
+ end
23
+
24
+ def self.set_version(text, name, version)
25
+ #puts "ConanPackage::set_version"
26
+ new_text = text
27
+ [/(\b#{name}\/[\d\.]+)/].each { |regex|
28
+ matches = text.scan(regex)
29
+ if matches.length > 0 && matches[0].length > 0
30
+ orig = matches[0][0]
31
+ oversion = get_version(orig, name)
32
+ mod = orig.sub(oversion, version)
33
+ #puts "match[0][0] " + matches[0][0]
34
+ #puts "old version " + oversion
35
+ #puts "new version " + version
36
+ #puts "updating from #{orig} to #{mod}"
37
+ new_text = new_text.gsub(orig, mod)
38
+ end
39
+ }
40
+ new_text
41
+ end
42
+
43
+ def self.set_version_in_file(filename, name, version)
44
+ text = set_version(IO.read(filename), name, version)
45
+ orig = IO.read(filename)
46
+ File.open(filename, "w") { |f| f.puts text } if (text != orig)
47
+ end
48
+ end
49
+ end