raykit 0.0.513 → 0.0.515
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raykit/version.rb +1 -1
- data/lib/raykit/wix.rb +63 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92ad48b8fb6eda2c2e01400444ad5fa88f0ce8a6b1496e8aa46034cd05943b2
|
4
|
+
data.tar.gz: 9f1889ec8b541812be94028a1372891262b722aa364b8c31edb12e29e87e8744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea3a96f188ca5e34261402375dd40cebbbbe2c50688a4350c326bbdee194985c093a93fe1a9651b513e01b8dad054ccf90edf56e032c23c226ed0cdf1f3c8fc
|
7
|
+
data.tar.gz: 04e3c2a3fc80fce7e37de288fca03febcd2ea4113771ce0fbab439115860d0ae39bf20b33ba662f744a369ee0860f0673cd9fa97ef7125aa4d5ec86c062cd598
|
data/lib/raykit/version.rb
CHANGED
@@ -52,7 +52,7 @@ module Raykit
|
|
52
52
|
new_text = text.gsub(/version\s?=\s?['|"]([.\d]+)['|"]/, "version='#{version}'") if filename.include?(".gemspec")
|
53
53
|
new_text = text.gsub(/<Version>([-\w\d.]+)</, "<Version>#{version}<") if filename.include?(".csproj")
|
54
54
|
new_text = text.gsub(/<version>([-\w\d.]+)</, "<version>#{version}<") if filename.include?(".nuspec")
|
55
|
-
new_text = text.gsub(/Version="([\d\.]+)"/, "Version=\"#{version}\"") if filename.include?(".wxs")
|
55
|
+
new_text = text.gsub(/ Version="([\d\.]+)"/, " Version=\"#{version}\"") if filename.include?(".wxs")
|
56
56
|
# new_text=text.gsub(/<Version>([-\w\d.]+)</,"<Version>#{version}<")
|
57
57
|
# new_text=new_text.gsub(/version[\s]+=\s?['|"]([.\d]+)['|"]/,"version='#{version}'")
|
58
58
|
# new_text=new_text.gsub(/Version="([.\d]+)"/,"Version=\"#{version}\"")
|
data/lib/raykit/wix.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Raykit
|
4
|
+
class Wix
|
5
|
+
def self.get_directory_elements(directory)
|
6
|
+
get_nested_directory_element("", directory)
|
7
|
+
end
|
8
|
+
def self.get_nested_directory_element(id_prefix, directory)
|
9
|
+
Dir.chdir(directory) do
|
10
|
+
results = Array::new
|
11
|
+
Dir.glob("*").reject { |f| !File.directory? f }.each { |d|
|
12
|
+
directoryId = "#{d.upcase.gsub("/", "_").gsub("-", "_")}DIR"
|
13
|
+
directoryId = "#{id_prefix}#{directoryId}"
|
14
|
+
child_elements = get_nested_directory_element("#{directoryId[0...-3]}_", d)
|
15
|
+
if (child_elements.length > 0)
|
16
|
+
results.push("<Directory Id=\"#{directoryId}\" Name=\"#{d}\">")
|
17
|
+
child_elements.each { |child_element|
|
18
|
+
results.push("\t#{child_element}")
|
19
|
+
}
|
20
|
+
results.push("</Directory>")
|
21
|
+
else
|
22
|
+
results.push("<Directory Id=\"#{directoryId}\" Name=\"#{d}\"/>")
|
23
|
+
end
|
24
|
+
}
|
25
|
+
results
|
26
|
+
end
|
27
|
+
end
|
28
|
+
# given a directory, return an array of string the represent wix components for each file in the directory
|
29
|
+
# each string should look like this:
|
30
|
+
# <Component Id="IndexHtmlComponent" Directory="WWWDIR" Guid="*">
|
31
|
+
# <File Id="IndexHtmlFile" Source="path\to\index.html" KeyPath="yes"/>
|
32
|
+
# </Component>
|
33
|
+
def self.get_file_components(directory)
|
34
|
+
components = Array::new
|
35
|
+
Dir.chdir(directory) do
|
36
|
+
index = 0
|
37
|
+
Dir.glob("**/*").reject { |f| File.directory? f }.each { |f|
|
38
|
+
puts "file: #{f}"
|
39
|
+
index += 1
|
40
|
+
component = get_indexed_file_components(f, index)
|
41
|
+
puts "component: #{component}"
|
42
|
+
components.push(component)
|
43
|
+
}
|
44
|
+
components
|
45
|
+
end
|
46
|
+
end
|
47
|
+
# given a file and an index, return a string that represents a wix component
|
48
|
+
def self.get_indexed_file_component(file, index)
|
49
|
+
componentId = "c#{index}"
|
50
|
+
guid = SecureRandom.uuid
|
51
|
+
fileId = "f#{index}"
|
52
|
+
directory = File.dirname(file)
|
53
|
+
directory = directory.split(/[\/\\]/).last if File.dirname(file).include?("\\") || File.dirname(file).include?("/")
|
54
|
+
directory = "" if directory == "."
|
55
|
+
directoryId = "#{File.dirname(file).upcase.gsub("/", "_").gsub("-", "_")}DIR"
|
56
|
+
component = "<Component Id=\"#{componentId}\" Guid=\"#{guid}\"><File Id=\"#{fileId}\" Source=\"#{file}\" /></Component>"
|
57
|
+
if (directory.length > 0)
|
58
|
+
component = "<Component Id=\"#{componentId}\" Guid=\"#{guid}\" Directory=\"#{directoryId}\"><File Id=\"#{fileId}\" Source=\"#{file}\" /></Component>"
|
59
|
+
end
|
60
|
+
component
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raykit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.515
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/raykit/timer.rb
|
130
130
|
- lib/raykit/version.rb
|
131
131
|
- lib/raykit/vstest.rb
|
132
|
+
- lib/raykit/wix.rb
|
132
133
|
- lib/raykit/wt.rb
|
133
134
|
- lib/raykit/zip.rb
|
134
135
|
homepage: http://rubygems.org/gems/raykit
|