raykit 0.0.496 → 0.0.498
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +20 -20
- data/bin/raykit +6 -6
- data/lib/raykit/auto_setup.rb +69 -69
- data/lib/raykit/command.rb +371 -341
- data/lib/raykit/conan/buildinfo.rb +69 -69
- data/lib/raykit/conanpackage.rb +49 -49
- data/lib/raykit/configuration.rb +48 -0
- data/lib/raykit/console.rb +272 -272
- data/lib/raykit/default_content.rb +227 -227
- data/lib/raykit/dir.rb +49 -49
- data/lib/raykit/dotnet.rb +174 -174
- data/lib/raykit/environment.rb +114 -109
- data/lib/raykit/filesystem.rb +34 -34
- data/lib/raykit/git/commit.rb +16 -16
- data/lib/raykit/git/directory.rb +216 -216
- data/lib/raykit/git/files.rb +46 -46
- data/lib/raykit/git/repositories.rb +89 -89
- data/lib/raykit/git/repository.rb +278 -244
- data/lib/raykit/installer.rb +17 -17
- data/lib/raykit/log.rb +80 -80
- data/lib/raykit/logevent.rb +49 -49
- data/lib/raykit/logging.rb +57 -57
- data/lib/raykit/markdown.rb +21 -21
- data/lib/raykit/msbuild.rb +54 -54
- data/lib/raykit/nugetpackage.rb +54 -54
- data/lib/raykit/nunit.rb +13 -13
- data/lib/raykit/project.rb +343 -339
- data/lib/raykit/rake.rb +39 -39
- data/lib/raykit/runner.rb +42 -42
- data/lib/raykit/secrets.rb +38 -38
- data/lib/raykit/sourceImport.rb +74 -74
- data/lib/raykit/sourceImports.rb +43 -43
- data/lib/raykit/string.rb +18 -18
- data/lib/raykit/tasks.rb +99 -99
- data/lib/raykit/text.rb +32 -32
- data/lib/raykit/timer.rb +31 -31
- data/lib/raykit/version.rb +103 -103
- data/lib/raykit/vstest.rb +24 -24
- data/lib/raykit/wt.rb +28 -28
- data/lib/raykit/zip.rb +73 -73
- data/lib/raykit.rb +125 -125
- metadata +3 -2
@@ -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
|
data/lib/raykit/conanpackage.rb
CHANGED
@@ -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
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module Raykit
|
4
|
+
class Configuration
|
5
|
+
attr_accessor :root_dir, :auto_setup, :backup_dir
|
6
|
+
|
7
|
+
# Define a subdirectory and filename for the config file in a cross-platform manner.
|
8
|
+
CONFIG_DIR = File.join(Dir.home, ".config", "raykit")
|
9
|
+
CONFIG_FILE = File.join(CONFIG_DIR, "config.json")
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
if File.exist?(CONFIG_FILE)
|
13
|
+
load_configuration
|
14
|
+
else
|
15
|
+
set_default_configuration
|
16
|
+
save_configuration # Save the default configuration if no configuration file exists.
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_configuration
|
21
|
+
config_data = JSON.parse(File.read(CONFIG_FILE))
|
22
|
+
@root_dir = config_data["root_dir"]
|
23
|
+
@auto_setup = config_data["auto_setup"]
|
24
|
+
@backup_dir = config_data["backup_dir"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_default_configuration
|
28
|
+
@root_dir = ""
|
29
|
+
@auto_setup = false
|
30
|
+
@backup_dir = "backup"
|
31
|
+
end
|
32
|
+
|
33
|
+
def save_configuration
|
34
|
+
# Create the config directory if it doesn't exist.
|
35
|
+
FileUtils.mkdir_p(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
|
36
|
+
|
37
|
+
File.write(CONFIG_FILE, {
|
38
|
+
root_dir: @root_dir,
|
39
|
+
auto_setup: @auto_setup,
|
40
|
+
backup_dir: @backup_dir,
|
41
|
+
}.to_json)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
"Root Directory: #{@root_dir}\nAuto Setup: #{@auto_setup}\nBackup Directory: #{@backup_dir}"
|
46
|
+
end
|
47
|
+
end # class Configuration
|
48
|
+
end # module Raykit
|