func_e 0.0.6 → 0.0.7
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/func_e/http.rb +19 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf3d794b61b361924e275872acc6e494f8ffd636d67b8270e024fc8d5bcbca15
|
4
|
+
data.tar.gz: 1832b1fa89c5a55af3c9cfc078f77b22fca9aaad118487cbb55dfc0ff13ae484
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec48dbbc2838b5bd799d62d04fcda789a0cf45d5a92f76af2ab22c7c6b1430db7c9d89526b4a3dae3cae52581140c3238ad2ff74cf5b0c7c971e327087af7167
|
7
|
+
data.tar.gz: adf4ef50a1c9c9b5024f0528ba34b9807cd19801fd71c612f83a20369d1937eb8a736553ae077cfc7554658a109253a29cf076bd2a885a451bbe92d75a22ccc8
|
data/lib/func_e/http.rb
CHANGED
@@ -10,24 +10,35 @@ module FuncE
|
|
10
10
|
{ 'Content-Type': 'application/json' }
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.active_pid
|
14
|
-
`lsof -i:#{Config.config.local_server_port} -t`.to_i
|
15
|
-
end
|
16
|
-
|
17
13
|
def self.post(func)
|
18
14
|
Net::HTTP.post(uri, { name: func.name, payload: func.payload }.to_json, headers)
|
19
15
|
end
|
20
16
|
|
21
17
|
def self.start_server
|
22
18
|
kill_server
|
23
|
-
|
24
|
-
Thread.new {
|
25
|
-
system("node #{FuncE::SERVER_PATH} --port=#{Config.config.local_server_port} --functions_path=#{Config.install_path}")
|
26
|
-
}
|
19
|
+
npm_install if has_dependencies?
|
20
|
+
Thread.new { node_serve }
|
27
21
|
end
|
28
22
|
|
29
23
|
def self.kill_server
|
30
24
|
active_pid.tap { |pid| system("kill -9 #{pid}") unless pid.zero? }
|
31
25
|
end
|
26
|
+
|
27
|
+
def self.npm_install
|
28
|
+
puts "Installing func_e dependencies..."
|
29
|
+
system("cd #{Config.install_path} && npm i && cd #{`pwd`.strip}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.node_serve
|
33
|
+
system("node #{FuncE::SERVER_PATH} --port=#{Config.config.local_server_port} --functions_path=#{Config.install_path}")
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.active_pid
|
37
|
+
`lsof -i:#{Config.config.local_server_port} -t`.to_i
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.has_dependencies?
|
41
|
+
File.exist?("#{Config.install_path}/package.json")
|
42
|
+
end
|
32
43
|
end
|
33
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: func_e
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Scholl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: terrapin
|