(#11714) Use `%~dp0` to resolve bat file's install directory

This commit uses the `%~dp0` batch script modifier to resolve the
drive and path of the directory containing the envpuppet.bat
file. This eliminates the need for hard coded paths within the script
itselfIt also uses `%VAR:\=/%` to substitute each backslash for a
forward slash in the RUBYLIB environment

Also added a section about running the spec tests on Windows.

Reviewed-By: Jeff McCune <jeff@puppetlabs.com>
This commit is contained in:
Josh Cooper 2012-01-10 12:54:39 -08:00
Родитель 24af732ef9
Коммит 5accc69fb1
2 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -62,10 +62,9 @@ SyntaxError, invalid multibyte escape as mentioned above.
# Windows #
If you'd like to run Puppet from source on Windows platforms, the include
`ext/envpuppet.bat` will help. NOTE: the RUBYLIB environment variable must
have forward slashes (/) rather than Windows back slashes. All file paths in
the Puppet code base should use a path separator of / regardless of Windows or
If you'd like to run Puppet from source on Windows platforms, the
include `ext/envpuppet.bat` will help. All file paths in the Puppet
code base should use a path separator of / regardless of Windows or
Unix filesystem.
To quickly run Puppet from source, assuming you already have Ruby installed
@ -75,11 +74,17 @@ from [rubyinstaller.org](http://rubyinstaller.org).
gem install win32-service --platform=mswin32 --no-rdoc --no-ri --version 0.7.1
net use Z: "\\vmware-host\Shared Folders" /persistent:yes
Z:
cd \
cd \vagrant\src\puppet\ext
cd <path_to_puppet>
set PATH=%PATH%;Z:\<path_to_puppet>\ext
envpuppet puppet --version
2.7.9
Some spec tests are known to fail on Windows, e.g. no mount provider
on Windows, so use the following rspec exclude filter:
cd <path_to_puppet>
envpuppet rspec --tag ~fails_on_windows spec
This will give you a shared filesystem with your Mac and allow you to run
Puppet directly from source without using install.rb or copying files around.

Просмотреть файл

@ -3,8 +3,11 @@ SETLOCAL
REM net use Z: "\\vmware-host\Shared Folders" /persistent:yes
SET RUBYLIB=Z:/vagrant/src/facter/lib;Z:/vagrant/src/puppet/lib;%RUBYLIB%
SET PATH=Z:/vagrant/src/facter/bin;Z:/vagrant/src/puppet/bin;%PATH%
SET PUPPET_DIR=%~dp0..
SET FACTER_DIR=%PUPPET_DIR%\..\facter
SET PATH=%PUPPET_DIR%\bin;%FACTER_DIR%\bin;%PATH%
SET RUBYLIB=%PUPPET_DIR%\lib;%FACTER_DIR%\lib;%RUBYLIB%
SET RUBYLIB=%RUBYLIB:\=/%
ruby -S %*