mnky 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/helpers/computer.rb +20 -0
- data/lib/helpers/file_paths.rb +21 -1
- data/lib/monkey/clock.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4f952e25528755a6bd5b82e96c426f9a3723715
|
4
|
+
data.tar.gz: 55ab58bfbf1282d7ee8fed17d7a44a9ae6352210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcda50273f4f7146ce93e92a992880947d1d50339d1b841c173aa7680a536e44e953180821a6cd2dee39aa950560461d64b1b91a1c2ec9a572a903d4eb4ca52f
|
7
|
+
data.tar.gz: 5c7fa815019e5d4d79a9a6eab216e46d75391734c89c19145cb20745f872e0a461d420b6e7404d5b79d8b2ca7bedf5e4032c6c015f052be7364299c77c9727ca
|
data/lib/helpers/computer.rb
CHANGED
@@ -57,6 +57,26 @@ module Monkey
|
|
57
57
|
ensure
|
58
58
|
Socket.do_not_reverse_lookup = orig
|
59
59
|
end
|
60
|
+
|
61
|
+
def self.architecture
|
62
|
+
if windows?
|
63
|
+
os_arch = ENV['PROCESSOR_ARCHITECTURE']
|
64
|
+
return :bit64 if os_arch.include? '64'
|
65
|
+
return :bit32 if os_arch.include? '86'
|
66
|
+
elsif mac?
|
67
|
+
os_arch = `uname -a`
|
68
|
+
return :bit64 if os_arch.include? '64'
|
69
|
+
return :bit32 if os_arch.include? 'i386'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.bit64?
|
74
|
+
(self.architecture == :bit64)
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.bit32?
|
78
|
+
(self.architecture == :bit32)
|
79
|
+
end
|
60
80
|
end
|
61
81
|
|
62
82
|
end
|
data/lib/helpers/file_paths.rb
CHANGED
@@ -9,9 +9,29 @@ module Monkey
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.global_bit64_apps
|
13
|
+
return nil if Computer.bit32?
|
14
|
+
return ENV['programfiles'].gsub(File::ALT_SEPARATOR, File::SEPARATOR) if Computer.windows?
|
15
|
+
return File.join(root, '/Applications') if Computer.mac?
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.global_bit32_apps
|
19
|
+
if Computer.windows?
|
20
|
+
path = ENV['programfiles(x86)'] if Computer.bit64?
|
21
|
+
path = ENV['programfiles'] if Computer.bit32?
|
22
|
+
return path.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
|
23
|
+
elsif Computer.mac?
|
24
|
+
return File.join(root, '/Applications')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.global_apps
|
29
|
+
global_bit64_apps || global_bit32_apps
|
30
|
+
end
|
31
|
+
|
12
32
|
def self.hosts_file
|
13
33
|
return File.join(root, 'windows/system32/drivers/etc/hosts') if Computer.windows?
|
14
|
-
return '/private/etc/hosts' if Computer.mac?
|
34
|
+
return File.join(root, '/private/etc/hosts') if Computer.mac?
|
15
35
|
end
|
16
36
|
end
|
17
37
|
|
data/lib/monkey/clock.rb
CHANGED