osth 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +19 -0
  3. data/README.md +23 -0
  4. data/bin/ost +58 -0
  5. data/makefile +2 -0
  6. data/osth.gemspec +14 -0
  7. metadata +52 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ab8b6dd29154560c5e3b252c61174b998924b7ff
4
+ data.tar.gz: d1cd7b76f23972aad8d6784fa022f3e385837679
5
+ SHA512:
6
+ metadata.gz: 59c11eb7f92eaaf452e839b75582b48aeb2233501f6d232161fe45fd9359b938d2ddf78dd872266732e0758c82431b0f1f3c45dfe6aa337cc7b4685e43b095eb
7
+ data.tar.gz: 8c0385b0f70a0ff83b9921533299be75e03c9f0a3a2d7a6be2369d5f80c059cc9849d91b7e12c886b258299045db7b02890c9be8c067e22c3f74863c58ff3a95
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Francesco Rodríguez, Mayn Kjær
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ osth
2
+ ====
3
+
4
+ How Harmoni runs Ost.
5
+
6
+ Usage
7
+ -----
8
+
9
+ ```
10
+ $ ost
11
+ usage:
12
+ ost start <worker>
13
+ ost stop <worker>
14
+ ```
15
+
16
+ Installation
17
+ ------------
18
+
19
+ ```
20
+ $ gem install osth
21
+ ```
22
+
23
+ [ost-bin]: https://github.com/djanowski/ost-bin/tree/v0.0.3
data/bin/ost ADDED
@@ -0,0 +1,58 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ stop = proc do |worker|
4
+ if defined?(Ost)
5
+ Ost.stop
6
+ else
7
+ exit(0)
8
+ end
9
+ end
10
+
11
+ trap(:INT, &stop)
12
+ trap(:TERM, &stop)
13
+
14
+ usage = <<-EOS
15
+ usage:
16
+ ost start <worker>
17
+ ost stop <worker>
18
+ EOS
19
+
20
+ if ARGV.length != 2
21
+ $stderr.puts(usage)
22
+
23
+ exit(1)
24
+ end
25
+
26
+ command = ARGV[0]
27
+ worker = ARGV[1][/.*(?=\..+$)/]
28
+
29
+ wrk_path = File.expand_path("workers/#{ worker }")
30
+ pid_path = File.expand_path(".ost/#{ worker }.pid")
31
+ log_path = File.expand_path(".ost/#{ worker }.log")
32
+
33
+ case command
34
+ when "start"
35
+ Process.daemon(true)
36
+
37
+ File.open(pid_path, File::RDWR|File::EXCL|File::CREAT, 0600) do |io|
38
+ io.write(Process.pid)
39
+ end
40
+
41
+ at_exit do
42
+ File.delete(pid_path) if File.exists?(pid_path)
43
+ end
44
+
45
+ $stdout.reopen(log_path, "a")
46
+ $stderr.reopen(log_path, "a")
47
+
48
+ require wrk_path
49
+ when "stop"
50
+ pid = Integer(File.read(pid_path).chomp)
51
+
52
+ Process.kill(:TERM, pid)
53
+ else
54
+ $stderr.puts("unknown command: #{ command }")
55
+ $stderr.puts(usage)
56
+
57
+ exit(1)
58
+ end
data/makefile ADDED
@@ -0,0 +1,2 @@
1
+ install:
2
+ install ./bin/ost $$BIN
data/osth.gemspec ADDED
@@ -0,0 +1,14 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "osth"
3
+ s.version = "1.0.0"
4
+ s.summary = "How Harmoni runs Ost"
5
+ s.description = s.summary
6
+ s.authors = ["Francesco Rodríguez", "Mayn Kjær"]
7
+ s.email = ["frodsan@me.com", "mayn.kjaer@gmail.com"]
8
+ s.homepage = "https://github.com/harmoni-io/osth"
9
+ s.license = "MIT"
10
+
11
+ s.files = `git ls-files`.split("\n")
12
+
13
+ s.executables << "ost"
14
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: osth
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Francesco Rodríguez
8
+ - Mayn Kjær
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-08-27 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: How Harmoni runs Ost
15
+ email:
16
+ - frodsan@me.com
17
+ - mayn.kjaer@gmail.com
18
+ executables:
19
+ - ost
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - LICENSE
24
+ - README.md
25
+ - bin/ost
26
+ - makefile
27
+ - osth.gemspec
28
+ homepage: https://github.com/harmoni-io/osth
29
+ licenses:
30
+ - MIT
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 2.2.2
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: How Harmoni runs Ost
52
+ test_files: []