smartcloud 0.1.0.rc2 → 0.1.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c64a7f9f51c65b33a4050aac2fb4f6da349e81e40e6164473c77578325b414f2
4
- data.tar.gz: c0a3eaaa4d22184ad0f960c64f9f7d643569cd32357ce9300889904bbe294520
3
+ metadata.gz: 1bc0f44f2fa9ea9d6145f30db4d8c96a143e839801e8f821df13fbaa533cb2b3
4
+ data.tar.gz: 51bd95740b92513e81ab404007a7b5544c98285b956ad08f445614e4ab938b12
5
5
  SHA512:
6
- metadata.gz: a92aab2ee7c5f84891a4e2d35f95d73156d2c599dc241c6b19a841b90f700a1ff4d5eae14e9f93c828b4a24d22db33a463ecf2a119f4ac933816959c6e49fd95
7
- data.tar.gz: 975db8d42620902882a9d48eb124328da600288565c12312b6bfd48bd24bbe07522c799a7f415fa4989453001e6db0543f2e640f0e5de19fb9f02311a6e56ea0
6
+ metadata.gz: cce759ba90e0745bbff91afdd1a470564ca272b59bbee308dcb0f7cd9a36dc0094d6e565ba9bda11ca96fb4df7721bccfce42d60811da2c79566933025b8afe5
7
+ data.tar.gz: a3d9b46b5566bc8bbad7db19e3e4c3e9bea6ac005e2a17f734349ef6a70870a85c324cd43b617c0bd4b32f008c290e605abc6642aac42c44183f5db6bf7ad913
@@ -17,11 +17,20 @@ module Smartcloud
17
17
  end
18
18
 
19
19
  def pack_rails
20
- return unless bundle_install?
21
- return unless precompile_assets?
22
- return unless start_web_server?
20
+ if File.exist? "tmp/smartcloud/packed"
21
+ begin
22
+ pid = File.read('tmp/smartcloud/packed').to_i
23
+ Process.kill('QUIT', pid)
24
+ rescue Errno::ESRCH # No such process
25
+ end
26
+ exec "bundle", "exec", "puma", "--config", "config/puma.rb"
27
+ else
28
+ return unless bundle_install?
29
+ return unless precompile_assets?
30
+ return unless test_web_server?
23
31
 
24
- exit 0
32
+ exit 0
33
+ end
25
34
  end
26
35
 
27
36
  # Perform bundle install
@@ -64,9 +73,13 @@ module Smartcloud
64
73
  end
65
74
  end
66
75
 
67
- # Perform starting of web server
68
- def start_web_server?
69
- logger.debug "Starting Web Server ..."
76
+ # Perform testing of web server
77
+ def test_web_server?
78
+ logger.info "Setting up Web Server ..."
79
+
80
+ # tmp folder
81
+ FileUtils.mkdir_p("tmp/smartcloud")
82
+ FileUtils.rm_f("tmp/smartcloud/packed")
70
83
 
71
84
  # Spawn Process
72
85
  pid = Process.spawn("bundle", "exec", "puma", "--config", "config/puma.rb")
@@ -79,10 +92,10 @@ module Smartcloud
79
92
  status = nil
80
93
  begin
81
94
  Process.kill(0, pid)
82
- puts "Web Server started successfully."
95
+ system("#{pid}" > "tmp/smartcloud/packed")
83
96
  status = true
84
97
  rescue Errno::ESRCH # No such process
85
- puts "Web Server cound not start"
98
+ logger.info "Web Server could not start"
86
99
  status = false
87
100
  end
88
101
 
@@ -332,10 +332,15 @@ module Smartcloud
332
332
  system("docker network connect mysql-network #{new_container}")
333
333
 
334
334
  if system("docker start --attach #{new_container}")
335
- self.stop_app(old_container)
336
- self.clean_up(container_path)
337
- logger.info "Launched Application ... Success."
338
- exit 10
335
+ logger.debug "Starting Web Server ..."
336
+ if system("docker start #{new_container}")
337
+ sleep 5
338
+ puts "Web Server started successfully."
339
+ self.stop_app(old_container)
340
+ self.clean_up(container_path)
341
+ logger.info "Launched Application ... Success."
342
+ exit 10
343
+ end
339
344
  else
340
345
  self.stop_app("#{new_container}")
341
346
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc2
4
+ version: 0.1.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timeboard