uc 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 08086a7afb6bf1747aa12a730de0a066abc76b6b
4
- data.tar.gz: 063a437998e41fee47b5b2d069ca9431bedf0f28
3
+ metadata.gz: 9b014d5e3c765fe33228740740ae2958bf71a640
4
+ data.tar.gz: 95f11a19e3ce11bb22ade1dd40b949012def6a23
5
5
  SHA512:
6
- metadata.gz: a24f77d4061bd57356651c20e68e68aec828634ad1abdef341112bbfe12d414c8a8f054910c230f8665cf5d05a3fdd666d3e05e5501aed0a0b28198fc0437e3a
7
- data.tar.gz: c681b851bc6cd25a2a8231314d84b1d51df68b98679662eccd91bdb7f1df2a763f95b502c39a18b89cf63f8648e91ef605238c76b9d5313869893eceb0bdcb38
6
+ metadata.gz: 192b9b75ba2de23da8b1d93d8833fe949b772c2d1396e3f2ea509717bfdbac6f80f43d922de44c05a4e26ac87bbbda0bcaeadc44dc4c0c10c382b4dcb114e6b5
7
+ data.tar.gz: 3cc61a9e330adf224018c21ec643c78cc71abbd7c80a86cf39a1d3f3b12d7362345657e72fe8ebede0861ad5deba44b55814dcadc844265e365bc98e74cc572a
data/.gitignore CHANGED
@@ -15,3 +15,35 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ /.config
19
+ /coverage/
20
+ /InstalledFiles
21
+ /pkg/
22
+ /spec/reports/
23
+ /test/tmp/
24
+ /test/version_tmp/
25
+ /tmp/
26
+
27
+ ## Specific to RubyMotion:
28
+ .dat*
29
+ .repl_history
30
+ build/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalisation:
39
+ /.bundle/
40
+ /lib/bundler/man/
41
+
42
+ # for a library or gem, you might want to ignore these files since the code is
43
+ # intended to run in multiple environments; otherwise, check them in:
44
+ # Gemfile.lock
45
+ # .ruby-version
46
+ # .ruby-gemset
47
+
48
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
49
+ .rvmrc
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 forksaber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,29 +1 @@
1
- # Uc
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'uc'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install uc
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it ( http://github.com/<my-github-username>/uc/fork )
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
1
+ A wrapper for unicorn
data/bin/uc CHANGED
@@ -2,6 +2,8 @@
2
2
  lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
3
3
  $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
4
4
 
5
+ Signal.trap("INT") { exit 1 }
6
+
5
7
  require 'optparse'
6
8
  require 'uc/error'
7
9
  require 'uc/version'
data/lib/uc/unicorn.rb CHANGED
@@ -10,6 +10,7 @@ module Uc
10
10
  queue_name ||= get_queue_name
11
11
  old_pid = "#{server.config[:pid]}.oldbin"
12
12
  if old_pid != server.pid
13
+ sleep sleep_secs
13
14
  begin
14
15
  sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
15
16
  Process.kill(sig, File.read(old_pid).to_i)
@@ -20,7 +21,6 @@ module Uc
20
21
  if sig == :QUIT
21
22
  writer.send("fin")
22
23
  end
23
- sleep sleep_secs
24
24
  rescue Errno::ENOENT, Errno::ESRCH, Errno::EAGAIN => e
25
25
  end
26
26
  end
@@ -51,6 +51,20 @@ module Uc
51
51
  return queue_name
52
52
  end
53
53
 
54
+ def self.pre_start(server, worker, url: "/")
55
+ app = server.instance_variable_get("@app")
56
+ response = app.call(rack_request(url))
57
+ body = response[2]
58
+ body.close
59
+ rescue => e
60
+ puts "WARN: pre start url failed : #{e.message}"
61
+ end
62
+
63
+ private
64
+
65
+ def self.rack_request(url)
66
+ Rack::MockRequest.env_for("http://127.0.0.1/#{url}")
67
+ end
54
68
 
55
69
  end
56
70
  end
data/lib/uc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Uc
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neeraj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-13 00:00:00.000000000 Z
11
+ date: 2014-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - Gemfile
64
+ - LICENSE
64
65
  - LICENSE.txt
65
66
  - README.md
66
67
  - Rakefile