Skip to content
This repository
Newer
Older
100644 55 lines (46 sloc) 1.562 kb
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
1
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
2 module Rake
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
3 require 'rake/alt_system'
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
4
5 # Win 32 interface methods for Rake. Windows specific functionality
6 # will be placed here to collect that knowledge in one spot.
7 module Win32
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
8
9 # Error indicating a problem in locating the home directory on a
10 # Win32 system.
11 class Win32HomeError < RuntimeError
12 end
13
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
14 class << self
15 # True if running on a windows system.
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
16 def windows?
17 AltSystem::WINDOWS
18 end
19
20 # Run a command line on windows.
21 def rake_system(*cmd)
22 AltSystem.system(*cmd)
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
23 end
24
25 # The standard directory containing system wide rake files on
26 # Win 32 systems. Try the following environment variables (in
27 # order):
28 #
29 # * HOME
30 # * HOMEDRIVE + HOMEPATH
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
31 # * APPDATA
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
32 # * USERPROFILE
33 #
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
34 # If the above are not defined, the return nil.
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
35 def win32_system_dir #:nodoc:
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
36 win32_shared_path = ENV['HOME']
37 if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
38 win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
39 end
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
40
41 win32_shared_path ||= ENV['APPDATA']
42 win32_shared_path ||= ENV['USERPROFILE']
43 raise Win32HomeError, "Unable to determine home path environment variable." if
44 win32_shared_path.nil? or win32_shared_path.empty?
45 normalize(File.join(win32_shared_path, 'Rake'))
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
46 end
467bc1b0 » Thibault Martin-Lagardette
2010-05-18 Update library and removing working tags
47
48 # Normalize a win32 path so that the slashes are all forward slashes.
49 def normalize(path)
ac1087e6 » Watson1978
2012-02-12 import rake v0.9.2.2
50 path.gsub(/\\/, '/')
467bc1b0 » Thibault Martin-Lagardette
2010-05-18 Update library and removing working tags
51 end
52
53 end
54 end
8f211620 » richkilmer
2009-03-02 bring lib up to r22701 (ruby 1.9.1_0 tag). there are build issues usi…
55 end
Something went wrong with that request. Please try again.