shutup 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/shutup +1 -1
- data/lib/shutup/server.rb +34 -0
- data/lib/shutup/version.rb +1 -1
- data/lib/shutup.rb +9 -29
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed38d3ad472c3617454780095ffbc75051d9c9dd
|
4
|
+
data.tar.gz: da39132e53d2ec826a14264a3ec538f6fec6f527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ef42ca39c93993318d627ffe10b8abc8b3248cc818fa27e99825246b748f0c8afd072a9bb3401ce6fe032a024c6447338cbd310b583e6e6643658fbd0fff55
|
7
|
+
data.tar.gz: ba18c94c1b689ce8675e8e9461ff501b69318098f604ea05de8e519ae18c7bdf7824dbe79e9322f81e19cb964de5a0b99df510f9a59a6ec43dc45ebc24c995b6
|
data/exe/shutup
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Shutup
|
2
|
+
class Server
|
3
|
+
class << self
|
4
|
+
def current_dir
|
5
|
+
File.expand_path(File.dirname('.'))
|
6
|
+
end
|
7
|
+
|
8
|
+
def pid_file
|
9
|
+
"#{current_dir}/tmp/pids/server.pid"
|
10
|
+
end
|
11
|
+
|
12
|
+
def pid
|
13
|
+
begin
|
14
|
+
File.read(pid_file)
|
15
|
+
rescue => e
|
16
|
+
e.message << ' Are you sure that the process is running?'
|
17
|
+
raise(e)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def hit!
|
22
|
+
if pid
|
23
|
+
system "kill -9 #{pid}"
|
24
|
+
puts "Killed process id: #{pid}"
|
25
|
+
true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete_pid
|
30
|
+
File.delete(pid_file) if File.exist?(pid_file)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/shutup/version.rb
CHANGED
data/lib/shutup.rb
CHANGED
@@ -1,35 +1,15 @@
|
|
1
1
|
require "shutup/version"
|
2
|
-
|
3
|
-
class Rails
|
4
|
-
class << self
|
5
|
-
def current_dir
|
6
|
-
File.expand_path(File.dirname(File.dirname('.')))
|
7
|
-
end
|
8
|
-
|
9
|
-
def pid_file
|
10
|
-
"#{current_dir}/tmp/pids/server.pid"
|
11
|
-
end
|
2
|
+
require "shutup/server"
|
12
3
|
|
13
|
-
|
14
|
-
|
15
|
-
File.read(pid_file)
|
16
|
-
rescue => e
|
17
|
-
e.message << ' Are you sure that the process is running?'
|
18
|
-
raise(e)
|
19
|
-
end
|
20
|
-
end
|
4
|
+
module Shutup
|
5
|
+
ALLOWED_SERVICES = %w(server)
|
21
6
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
puts "Killed process id: #{pid}"
|
26
|
-
true
|
27
|
-
end
|
28
|
-
end
|
7
|
+
def self.process(name:)
|
8
|
+
ALLOWED_SERVICES.include?(name) && send(name)
|
9
|
+
end
|
29
10
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
11
|
+
def self.server
|
12
|
+
Shutup::Server.hit! && Shutup::Server.delete_pid
|
34
13
|
end
|
14
|
+
|
35
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shutup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorenzo Sinisi
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- bin/setup
|
72
72
|
- exe/shutup
|
73
73
|
- lib/shutup.rb
|
74
|
+
- lib/shutup/server.rb
|
74
75
|
- lib/shutup/version.rb
|
75
76
|
- shutup.gemspec
|
76
77
|
homepage: https://github.com/lorenzosinisi/shutup
|