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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e68c85e6781a04dfb388cf37a9d081f857eebfa
4
- data.tar.gz: 6eb976e87c4c74627e96a972027dadd66fd3eaec
3
+ metadata.gz: bfeaf67856899c361fe42f64862e7dd6ce3a4cd1
4
+ data.tar.gz: e6fc8199b2777b52e1fb4b46e61ea7198f98a276
5
5
  SHA512:
6
- metadata.gz: 5a2c5f72c106bc26dc7aa9998a6152e0f02ed8d41e1d71635aff7deb4dd71fde9098a5b782bb4ac696a8af44f581901a7c0e8d4679ed5d218f8da0d54b64c9ca
7
- data.tar.gz: 990100d6894e33043688e9ea00c5c90557dfe48a8d2c26c23a795559db62f1457564ced2a146d78e864203ba9a1405bafe274960f3af3f3538f3a2dce14341d0
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?(INSOMNIA)
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.mv('insomnia/64-bit/Insomnia.exe', Dir.pwd + '/Insomnia.exe')
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
- system(EXE)
62
+ `#{COMMAND_INSOMNIA}`
58
63
  end
59
64
  end
60
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windows-shutdown-timer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Carlson