visual_studio 0.0.0.6 → 0.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40f26054ca552b0d0f0215323683f4fdbe850693
4
- data.tar.gz: 980f9dff84fbbe766fee4692939d3fce7c3476f3
3
+ metadata.gz: 38c15ded9a23970f8ebd645bae32928356583bcb
4
+ data.tar.gz: 015f9f7e2367f5623b8fa49aa86d8d3d6c047721
5
5
  SHA512:
6
- metadata.gz: e6f49ec8e989dd15173293ee3c19ca242c454b29aba857c444c27c7ebf34c62054e7f9935f7b118c248bf14e39a4d41d9696b388a04108e0b8e4db5c5bdfc442
7
- data.tar.gz: fec2c8dfd37b1f174a470d18c287cb164df32a785b51600ebaace30a217e70934927b94d0f4374019aa499c6ce0c114fa7778e02d7b103bb761bcdefcbf7e13f
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
- cwd = base.include?('.') || overlay.include?('.')
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 cwd
24
+ path = ['.'] + path if should_include_cwd
25
25
 
26
26
  path.join(';')
27
27
  else
28
- # Default to the overlay, or right-hand side.
28
+ # Right-hand side takes precedence.
29
29
  overlay
30
30
  end
31
31
  end
@@ -41,7 +41,7 @@ module VisualStudio
41
41
  end
42
42
 
43
43
  module VERSION #:nodoc:
44
- MAJOR, MINOR, PATCH, PRE = [0, 0, 0, 6]
44
+ MAJOR, MINOR, PATCH, PRE = [0, 1, 0, 0]
45
45
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
46
46
  end
47
47
 
@@ -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 VisualStudio::VERSION_TO_NAME[version],
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visual_studio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.6
4
+ version: 0.1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Williams