windows-shutdown-timer 1.0.0 → 1.0.1
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 +4 -4
- data/lib/windows-shutdown-timer.rb +9 -4
- 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: bfeaf67856899c361fe42f64862e7dd6ce3a4cd1
|
4
|
+
data.tar.gz: e6fc8199b2777b52e1fb4b46e61ea7198f98a276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45b12dfbed05f2a7570905f4138e18c276ee1020e590f5be2d6365f0ee883edd9adb797cda807496eb11560727371e3530c7406c16db56e9887f3da811d580e2
|
7
|
+
data.tar.gz: b8c3b9b89187faf03bf34a8e4412eba21b079c1463a7c8a7486b6db2da0dad6ecc1b59deb0a466831a703db751bc1f3f25c627f8a61d708d8d9be511cdd8dd9e
|
@@ -7,11 +7,13 @@ module WindowsShutdownTimer
|
|
7
7
|
# Shutdown!
|
8
8
|
class ShutdownStarter
|
9
9
|
|
10
|
-
EXE = 'start Insomnia.exe'
|
11
10
|
INSOMNIA = 'Insomnia.exe'
|
11
|
+
PATH_TO_TEMP = Dir.tmpdir + '/windows-shutdown-timer'
|
12
|
+
PATH_TO_INSOMNIA = PATH_TO_TEMP + '/' + INSOMNIA
|
12
13
|
PATH = 'insomnia/64-bit'
|
13
14
|
COMMAND_SHUTDOWN = 'shutdown /s /t '
|
14
15
|
COMMAND_CANCEL_SHUTDOWN = 'shutdown /a'
|
16
|
+
COMMAND_INSOMNIA = "start #{PATH_TO_INSOMNIA}"
|
15
17
|
|
16
18
|
def initialize(arguments)
|
17
19
|
|
@@ -38,10 +40,13 @@ module WindowsShutdownTimer
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def start_timer
|
41
|
-
unless File.file?(
|
43
|
+
unless File.file?(PATH_TO_INSOMNIA)
|
44
|
+
puts 'Downloading Insomnia.exe'
|
42
45
|
download('dlaa.me', '/Samples/Insomnia/Insomnia.zip', 'Insomnia.zip')
|
43
46
|
unzip('Insomnia.zip', 'insomnia')
|
44
|
-
FileUtils.
|
47
|
+
FileUtils.mkdir(PATH_TO_TEMP)
|
48
|
+
FileUtils.mv('insomnia/64-bit/Insomnia.exe', PATH_TO_INSOMNIA)
|
49
|
+
# Cleanup
|
45
50
|
FileUtils.rm_rf('insomnia')
|
46
51
|
FileUtils.rm('Insomnia.zip')
|
47
52
|
end
|
@@ -54,7 +59,7 @@ module WindowsShutdownTimer
|
|
54
59
|
else
|
55
60
|
time_in_seconds = @time.to_i * 60
|
56
61
|
`#{COMMAND_SHUTDOWN} #{time_in_seconds}`
|
57
|
-
|
62
|
+
`#{COMMAND_INSOMNIA}`
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|