raad_totem 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6cc5ec492a3a7e4ff5ee49cf38c01826f0efb27
4
- data.tar.gz: df041b77a669ce3a6abf6443f9a186ef215a775d
3
+ metadata.gz: b772d074bcc80584f4bb8f0bcb48b32521f04f84
4
+ data.tar.gz: 08a63c2fe519d1ec7d6002bc0e68be0027161862
5
5
  SHA512:
6
- metadata.gz: 8aaf81a66fbe9eb507da57698f2d36f49507f49f3af90dfd3cda219d39222b2426f226a13660d242ae8c11242d122eef060822b87eb48da5e66882fb34cb4eed
7
- data.tar.gz: 76cb583b22e8bbbc7981edf97b5566c3ebaf480e5d237c67eafc08dabb2f825f81b55cff52b96ab4a640eae8cf79b549ba7f6bc0d073cec2f43ac1e695c47ef3
6
+ metadata.gz: 9ca7a0a6f3d8dcbf1fce64706d9efed240d5b34565bdd4fca5a8caadb394453222a971e9d2a4f7e377b8a29161b42abe69842f348e9f4b2469918c5f6e40c188
7
+ data.tar.gz: 260c1543892a3d7d31d990352307d6faf2697afb5669a98076b31f3ee76dce3814c042aef5c02f940b056fa6e83fba39b4508f5b83116b3dcb6c21109bf2c35e
data/LICENSE.md CHANGED
@@ -1,5 +1,5 @@
1
1
  Raad - Totem
2
- Authored by Chad Remesch (chad@remesch.com) as a derivate of the original Raad Ruby gem.
2
+ Authored by Chad Remesch as a derivate of the original Raad Ruby gem.
3
3
 
4
4
  Copyright 2014 Chad Remesch
5
5
 
data/README.md CHANGED
@@ -7,26 +7,76 @@ This is a fork of the [Raad](https://github.com/colinsurprenant/raad) gem that i
7
7
  ## Changes from the original Raad v0.5.0:
8
8
 
9
9
  - Removal of log4j since Totem already has a built in logger.
10
- - Integration with Totem's environment setting.
10
+ - Integration with Totem.
11
11
  - Change namespaces so as not to conflict with Raad if both gems are installed.
12
+ - Removal of various command line options and use Totem defaults instead.
12
13
 
13
14
  ## Installation
14
15
 
15
- Add this line to your application's Gemfile:
16
+ Add this line to your Totem project's Gemfile:
16
17
 
17
- gem 'raad-totem'
18
+ gem 'raad_totem', :require => 'raad_totem/shell_cmds/service'
18
19
 
19
20
  And then execute:
20
21
 
21
22
  $ bundle
22
23
 
23
- Or install it yourself as:
24
+ ## Usage
24
25
 
25
- $ gem install raad-totem
26
+ Create a new service file `service/hello_world_service.rb` in the project root directory:
26
27
 
27
- ## Usage
28
+ #!/usr/bin/env ruby
29
+
30
+ require_relative '../config/environment.rb'
31
+
32
+ require 'raad_totem'
33
+
34
+ class HelloWorldService
35
+ def self.options_parser(parser, options)
36
+ parser.separator('')
37
+ parser.separator('App Options:')
38
+
39
+ parser.on('-c', '--custom', 'Some custom option') {|val| options[:custom] = val }
40
+
41
+ return parser
42
+ end
43
+
44
+ def start
45
+ Totem.logger.info('Service start.')
46
+
47
+ while !RaadTotem.stopped?
48
+ Totem.logger.info('Hello World.')
49
+ sleep 5
50
+ end
51
+ end
52
+
53
+ def stop
54
+ Totem.logger.info('Service stop.')
55
+ end
56
+ end
57
+
58
+ Make sure you set executable permissions on your service file:
59
+
60
+ chmod +x service/hello_world_service.rb
61
+
62
+ You can run your service in the foreground (press ctrl+c to kill it and wait a few seconds):
63
+
64
+ ./service/hello_world_service.rb start
65
+
66
+ You can also run your service in the background:
67
+
68
+ ./service/hello_world_service.rb -d start
69
+
70
+ To stop the background service:
71
+
72
+ ./service/hello_world_service.rb stop
73
+
74
+ By default, your service will log to a custom log in the `log` directory.
75
+ It will also create a PID file in the `tmp/pid` directory.
76
+
77
+ To view all available options (including custom ones you define):
28
78
 
29
- Coming soon.
79
+ ./service/hello_world_service.rb --help
30
80
 
31
81
  ## Contributing
32
82
 
@@ -170,8 +170,6 @@ module RaadTotem
170
170
  opts.separator "Service Options:"
171
171
 
172
172
  opts.on('-d', '--daemonize', "run daemonized in the background (default: no)") { |v| @parsed_options[:daemonize] = v }
173
- opts.on('-P', '--pid FILE', "pid file when daemonized (default: tmp/pids directory)") { |file| @parsed_options[:pid_file] = file }
174
- opts.on('-r', '--redirect FILE', "redirect stdout when daemonized (default: log directory)") { |v| @parsed_options[:redirect] = v }
175
173
  opts.on('-e', '--environment ENVIRONMENT', "Totem environment") { |v| Totem.env = v }
176
174
  opts.on('-i', '--instance INSTANCE', "Totem instance") { |v| Totem.instance = v }
177
175
  opts.on(nil, '--timeout SECONDS', "seconds to wait before force stopping the service (default: 60)") { |v| @parsed_options[:stop_timeout] = v }
@@ -1,3 +1,3 @@
1
1
  module RaadTotem
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end unless defined?(RaadTotem::VERSION)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raad_totem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Surprenant