visual_studio 0.0.0.6 → 0.1.0.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 +4 -4
- data/lib/visual_studio/environment.rb +3 -3
- data/lib/visual_studio/gem.rb +1 -1
- data/lib/visual_studio/product.rb +29 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38c15ded9a23970f8ebd645bae32928356583bcb
|
4
|
+
data.tar.gz: 015f9f7e2367f5623b8fa49aa86d8d3d6c047721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08d288974cf0bf71856357445f97515c5004059970120161aa912d7c1b924812267850ca06ffb096289b0da3d097b7f49adbe30d3b9f27917e2a1d77e7b3237f
|
7
|
+
data.tar.gz: 96e52c28e3201f69dfd979cc4bcc1794be2f0e95feaaa67d6d3e63597b9bb1c5ae40da4540ba14e52e39787feb7e3ce8e97f6622dd17fd72499caef5b93b7b6b
|
@@ -12,7 +12,7 @@ module VisualStudio
|
|
12
12
|
base = base.split(';')
|
13
13
|
overlay = overlay.split(';')
|
14
14
|
|
15
|
-
|
15
|
+
should_include_cwd = base.include?('.') || overlay.include?('.')
|
16
16
|
|
17
17
|
# HACK(mtwilliams): We're using File.expand_path here to "normalize"
|
18
18
|
# paths to prevent duplicates, but this could very likely have
|
@@ -21,11 +21,11 @@ module VisualStudio
|
|
21
21
|
overlay = overlay.reject{|p| p=='.'}.map{|p| File.expand_path(p)}
|
22
22
|
|
23
23
|
path = base | overlay
|
24
|
-
path = ['.'] + path if
|
24
|
+
path = ['.'] + path if should_include_cwd
|
25
25
|
|
26
26
|
path.join(';')
|
27
27
|
else
|
28
|
-
#
|
28
|
+
# Right-hand side takes precedence.
|
29
29
|
overlay
|
30
30
|
end
|
31
31
|
end
|
data/lib/visual_studio/gem.rb
CHANGED
@@ -24,9 +24,37 @@ module VisualStudio
|
|
24
24
|
@supports = desc[:supports]
|
25
25
|
end
|
26
26
|
|
27
|
+
def environment(opts={})
|
28
|
+
# TODO(mtwilliams): Raise an exception.
|
29
|
+
return nil unless @name.to_s == 'VC'
|
30
|
+
|
31
|
+
# HACK(mtwilliams): We should reimplement this logic inside this gem.
|
32
|
+
require 'open3'
|
33
|
+
require 'json'
|
34
|
+
|
35
|
+
target = opts[:target] || {platform: :windows,
|
36
|
+
architecture: :x86}
|
37
|
+
# TODO(mtwilliams): Handle other platforms.
|
38
|
+
platform = :windows
|
39
|
+
arch = {:x86 => 'x86', :x86_64 => 'amd64', :arm => 'arm'}[target[:architecture]]
|
40
|
+
# TODO(mtwilliams): Check if the architecture is supported.
|
41
|
+
# @supports.include?(target[:architecture])
|
42
|
+
|
43
|
+
delim = "d33b66512b1a01e9e3ee46e5f96a8036"
|
44
|
+
cmd = "call \"#{File.join(@root, 'vcvarsall.bat')}\" #{arch} & " +
|
45
|
+
"echo puts '#{delim}'; require('json'); print JSON.generate(ENV.to_h); | ruby\n"
|
46
|
+
out, _, status = Open3.capture3(opts[:base] || ENV.to_h, "cmd.exe /C \"#{cmd}\"")
|
47
|
+
return nil unless status == 0
|
48
|
+
|
49
|
+
env = JSON.parse(out.split(delim)[1])
|
50
|
+
env = VisualStudio::Environment.merge(env, opts[:overlay] || {})
|
51
|
+
|
52
|
+
env
|
53
|
+
end
|
54
|
+
|
27
55
|
def self.find(product, version)
|
28
56
|
if VisualStudio::Product::NAMES.include?(product)
|
29
|
-
name = Helpers::PrettyString.new
|
57
|
+
name = Helpers::PrettyString.new product,
|
30
58
|
pretty: VisualStudio::VERSION_TO_PRETTY_NAME[version]
|
31
59
|
|
32
60
|
root = self._find_via_registry(product, version)
|