visual_studio 0.0.0.0 → 0.0.0.1

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: 75645ec6361687d82aefad85257fbb67275722b6
4
- data.tar.gz: 35e5558a8d6596a7d4f38822345c2d66f46a28f8
3
+ metadata.gz: 6891bd4f1a9085fae52467f5bed6cb34811db9c3
4
+ data.tar.gz: eaac0c5a88ec84b0d4c2557e0f4e2f08839bc5bd
5
5
  SHA512:
6
- metadata.gz: 30ef1aa5fd7bf994f1d68741134f3d2f662ea0e887609d9190277d6ce37bd2d43d6eaf50550be69b9b66f0d2372441ed768e7334861e0e250577af0156703791
7
- data.tar.gz: 84a9001a40364500956f6f2db518de866bd03193b5c2ad78f29e7a72c6425dcbc92aa80284be098d32cddb86cb2458e68130ed313eb77198fed561a2fab7da53
6
+ metadata.gz: e1d832e5983dd2553dffb347019f0a3a2e2d79b228b2e9b9420de36533c0d396f46ceac2eaff1cfe991b6f0fceae8e50a04493d1ce13802b84e14269a3a5284b
7
+ data.tar.gz: 2fd6b8ef6f648f20b6df6dc7b4d263aad2b36b74fcd75158e51135a2f5fb6a15dfad0d3c029d3cdb260aa7fa4a05711d418fb1e359380ffcb3d7f3d96e136525
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ visual_studio (0.0.0.0)
5
+ hashie
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aruba (0.9.0)
11
+ childprocess (~> 0.5.6)
12
+ contracts (~> 0.9)
13
+ cucumber (>= 1.3.19)
14
+ ffi (~> 1.9.10)
15
+ rspec-expectations (>= 2.99)
16
+ thor (~> 0.19)
17
+ builder (3.2.2)
18
+ childprocess (0.5.6)
19
+ ffi (~> 1.0, >= 1.0.11)
20
+ contracts (0.11.0)
21
+ cucumber (2.0.2)
22
+ builder (>= 2.1.2)
23
+ cucumber-core (~> 1.2.0)
24
+ diff-lcs (>= 1.1.3)
25
+ gherkin (~> 2.12)
26
+ multi_json (>= 1.7.5, < 2.0)
27
+ multi_test (>= 0.1.2)
28
+ cucumber-core (1.2.0)
29
+ gherkin (~> 2.12.0)
30
+ diff-lcs (1.2.5)
31
+ ffi (1.9.10-x86-mingw32)
32
+ gherkin (2.12.2-x86-mingw32)
33
+ multi_json (~> 1.3)
34
+ hashie (3.4.2)
35
+ multi_json (1.11.2)
36
+ multi_test (0.1.2)
37
+ rspec (3.3.0)
38
+ rspec-core (~> 3.3.0)
39
+ rspec-expectations (~> 3.3.0)
40
+ rspec-mocks (~> 3.3.0)
41
+ rspec-core (3.3.2)
42
+ rspec-support (~> 3.3.0)
43
+ rspec-expectations (3.3.1)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.3.0)
46
+ rspec-mocks (3.3.2)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.3.0)
49
+ rspec-support (3.3.0)
50
+ thor (0.19.1)
51
+
52
+ PLATFORMS
53
+ x86-mingw32
54
+
55
+ DEPENDENCIES
56
+ aruba
57
+ cucumber
58
+ rspec
59
+ visual_studio!
60
+
61
+ BUNDLED WITH
62
+ 1.10.6
@@ -1,7 +1,7 @@
1
1
  class VisualStudio
2
2
  module Gem
3
3
  module VERSION #:nodoc:
4
- MAJOR, MINOR, PATCH, PRE = [0, 0, 0, 0]
4
+ MAJOR, MINOR, PATCH, PRE = [0, 0, 0, 1]
5
5
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
6
6
  end
7
7
 
@@ -0,0 +1,9 @@
1
+ class VisualStudio
2
+ class Name < String
3
+ attr_reader :pretty
4
+ def initialize(name, opts={})
5
+ super(name)
6
+ @pretty = opts[:pretty] || nil
7
+ end
8
+ end
9
+ end
data/lib/visual_studio.rb CHANGED
@@ -1,2 +1,82 @@
1
+ require 'hashie'
2
+
1
3
  class VisualStudio
4
+ NAMES = ['vs2015', 'vs2013', 'vs2012', 'vs2010', 'vs2008', 'vs2005', 'vs2003', 'vs2002', 'vs6']
5
+ PRETTY_NAMES = ['Visual Studio 2015', 'Visual Studio 2013', 'Visual Studio 2012', 'Visual Studio 2010',
6
+ 'Visual Studio 2008', 'Visual Studio 2005', 'Visual Studio .NET 2003', 'Visual Studio 6.0']
7
+ VERSIONS = ['14.0', '12.0', '11.0', '10.0', '9.0', '8.0', '7.1', '7.0', '6.0']
8
+ NAME_TO_VERSION = Hash[NAMES.zip(VERSIONS)]
9
+ NAME_TO_PRETTY_NAME = Hash[NAMES.zip(PRETTY_NAMES)]
10
+ VERSION_TO_NAME = Hash[VERSIONS.zip(NAMES)]
11
+
12
+ attr_reader :name
13
+ attr_reader :version
14
+ attr_reader :install
15
+ attr_reader :toolsets
16
+ attr_reader :sdks
17
+
18
+ def initialize(opts={})
19
+ require 'visual_studio/name'
20
+ @name = VisualStudio::Name.new(opts[:name], pretty: NAME_TO_PRETTY_NAME[opts[:name]])
21
+ @version = opts[:version]
22
+ @install = opts[:install]
23
+ @toolsets = opts[:toolsets]
24
+ @sdks = opts[:sdks]
25
+ end
26
+
27
+ def self.available?
28
+ VERSIONS.any? { |version| installed?(version) }
29
+ end
30
+
31
+ def self.installed?(name_or_version)
32
+ !!(find(name_or_version))
33
+ end
34
+
35
+ def self.find(name_or_version)
36
+ return find_by_name(name_or_version) if NAMES.include?(name_or_version)
37
+ return find_by_version(name_or_version) if VERSIONS.include?(name_or_version)
38
+ end
39
+
40
+ def self.find_by_name(name)
41
+ find_by_version(NAME_TO_VERSION[name]) if NAMES.include?(name)
42
+ end
43
+
44
+ def self.find_by_version(version)
45
+ install = _find_install_via_registry(version)
46
+ return if install.nil?
47
+
48
+ # HACK(mtwilliams): Assume C/C++ is installed.
49
+ c_and_cpp = File.join(install, 'VC')
50
+ # TODO(mtwilliams): Search for other toolsets, notably C#.
51
+ csharp = nil # File.join(install, 'VC#')
52
+
53
+ # TODO(mtwilliams): Look for SDKs, including packaged ones.
54
+ sdk = nil # ...
55
+
56
+ # TODO(mtwilliams): Cache.
57
+ VisualStudio.new(name: VERSION_TO_NAME[version],
58
+ version: version,
59
+ install: install,
60
+ toolsets: Hashie::Mash.new({
61
+ c: c_and_cpp,
62
+ cpp: c_and_cpp,
63
+ csharp: csharp }),
64
+ sdks: Hashie::Mash.new({
65
+ windows: nil }))
66
+ end
67
+
68
+ private
69
+ def self._find_install_via_registry(version)
70
+ # TODO(mtwilliams): Try other products, like C#.
71
+ keys = ["SOFTWARE\\Microsoft\\VisualStudio\\#{version}\\Setup\\VC",
72
+ "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\#{version}\\Setup\\VC"]
73
+ keys.each do |key|
74
+ begin
75
+ require 'win32/registry'
76
+ return File.expand_path(File.join(::Win32::Registry::HKEY_LOCAL_MACHINE.open(key, ::Win32::Registry::KEY_READ)['ProductDir'], '..')).to_s
77
+ rescue
78
+ return nil
79
+ end
80
+ end
81
+ end
2
82
  end
@@ -19,6 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = %w(lib)
21
21
 
22
+ s.add_dependency 'hashie'
23
+
22
24
  s.add_development_dependency 'rspec'
23
25
  s.add_development_dependency 'cucumber'
24
26
  s.add_development_dependency 'aruba'
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.0
4
+ version: 0.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Williams
@@ -10,6 +10,20 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rspec
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,10 +75,12 @@ extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
63
77
  - Gemfile
78
+ - Gemfile.lock
64
79
  - README.md
65
80
  - Rakefile
66
81
  - lib/visual_studio.rb
67
82
  - lib/visual_studio/gem/version.rb
83
+ - lib/visual_studio/name.rb
68
84
  - visual_studio.gemspec
69
85
  - visual_studio.sublime-project
70
86
  homepage: https://github.com/mtwilliams/visual_studio