vcvars 0.1.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 +7 -0
- data/CHANGELOG.md +27 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/exe/vcvars +6 -0
- data/lib/vcvars/cli.rb +234 -0
- data/lib/vcvars/doctor.rb +242 -0
- data/lib/vcvars/environment.rb +148 -0
- data/lib/vcvars/locator.rb +171 -0
- data/lib/vcvars/rake.rb +42 -0
- data/lib/vcvars/scaffold.rb +324 -0
- data/lib/vcvars/version.rb +5 -0
- data/lib/vcvars.rb +48 -0
- metadata +94 -0
data/lib/vcvars.rb
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
require "vcvars/version"
|
|
5
|
+
require "vcvars/locator"
|
|
6
|
+
require "vcvars/environment"
|
|
7
|
+
|
|
8
|
+
# vcvars — locate Visual Studio and load the MSVC build environment so that
|
|
9
|
+
# native C extensions build under an mswin (MSVC) Ruby without first opening a
|
|
10
|
+
# "Developer Command Prompt".
|
|
11
|
+
#
|
|
12
|
+
# require "vcvars"
|
|
13
|
+
# Vcvars.activate! # cl.exe / nmake.exe now on PATH in this process
|
|
14
|
+
#
|
|
15
|
+
# Or, in a Rakefile that uses rake-compiler:
|
|
16
|
+
#
|
|
17
|
+
# require "vcvars/rake" # auto-activates; then Rake::ExtensionTask.new ...
|
|
18
|
+
module Vcvars
|
|
19
|
+
class Error < StandardError; end
|
|
20
|
+
|
|
21
|
+
module_function
|
|
22
|
+
|
|
23
|
+
# True when the running Ruby is a native MSVC (mswin) build.
|
|
24
|
+
def mswin?
|
|
25
|
+
RbConfig::CONFIG["target_os"].to_s =~ /mswin/ ? true : false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Locate VS and import the MSVC environment into this process's ENV.
|
|
29
|
+
# No-op (returns false) if a developer environment is already active.
|
|
30
|
+
def activate!(arch: Locator.default_arch, force: false)
|
|
31
|
+
Environment.activate!(arch: arch, force: force)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Is a developer environment already active in this process?
|
|
35
|
+
def active?
|
|
36
|
+
Environment.active?
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Locate the Visual Studio installation. Returns a Locator::Installation or nil.
|
|
40
|
+
def locate(arch: Locator.default_arch)
|
|
41
|
+
Locator.find(arch: arch)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# The MSVC environment variables vcvars would add/change (without mutating ENV).
|
|
45
|
+
def env(arch: Locator.default_arch)
|
|
46
|
+
Environment.delta(arch: arch)
|
|
47
|
+
end
|
|
48
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: vcvars
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- ned
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: minitest
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '5.0'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '5.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rake
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '13.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '13.0'
|
|
40
|
+
description: |
|
|
41
|
+
vcvars locates a Visual Studio / Build Tools install via vswhere and loads the
|
|
42
|
+
MSVC toolchain (vcvars*.bat) into the current process, so C extensions build
|
|
43
|
+
under an mswin Ruby without first opening a "Developer Command Prompt".
|
|
44
|
+
|
|
45
|
+
It provides a library API (Vcvars.activate!), a Rake integration
|
|
46
|
+
(require "vcvars/rake"), a `vcvars exec -- <cmd>` runner, a `vcvars doctor`
|
|
47
|
+
that diagnoses the classic MSVC extension-build failures, a `vcvars env`
|
|
48
|
+
shell-env emitter, and a `vcvars new` scaffolder for MSVC-ready extension gems.
|
|
49
|
+
It is "ridk enable", but for MSVC. Pure Ruby, no compiler required to install.
|
|
50
|
+
executables:
|
|
51
|
+
- vcvars
|
|
52
|
+
extensions: []
|
|
53
|
+
extra_rdoc_files: []
|
|
54
|
+
files:
|
|
55
|
+
- CHANGELOG.md
|
|
56
|
+
- LICENSE.txt
|
|
57
|
+
- README.md
|
|
58
|
+
- exe/vcvars
|
|
59
|
+
- lib/vcvars.rb
|
|
60
|
+
- lib/vcvars/cli.rb
|
|
61
|
+
- lib/vcvars/doctor.rb
|
|
62
|
+
- lib/vcvars/environment.rb
|
|
63
|
+
- lib/vcvars/locator.rb
|
|
64
|
+
- lib/vcvars/rake.rb
|
|
65
|
+
- lib/vcvars/scaffold.rb
|
|
66
|
+
- lib/vcvars/version.rb
|
|
67
|
+
homepage: https://github.com/main-path/vcvars
|
|
68
|
+
licenses:
|
|
69
|
+
- MIT
|
|
70
|
+
metadata:
|
|
71
|
+
homepage_uri: https://github.com/main-path/vcvars
|
|
72
|
+
source_code_uri: https://github.com/main-path/vcvars
|
|
73
|
+
changelog_uri: https://github.com/main-path/vcvars/blob/main/CHANGELOG.md
|
|
74
|
+
bug_tracker_uri: https://github.com/main-path/vcvars/issues
|
|
75
|
+
rubygems_mfa_required: 'true'
|
|
76
|
+
rdoc_options: []
|
|
77
|
+
require_paths:
|
|
78
|
+
- lib
|
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '3.0'
|
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
requirements: []
|
|
90
|
+
rubygems_version: 3.6.9
|
|
91
|
+
specification_version: 4
|
|
92
|
+
summary: Load the MSVC (Visual Studio) build environment for native Ruby extensions
|
|
93
|
+
on Windows.
|
|
94
|
+
test_files: []
|