sidekiq-bossman 0.0.3 → 0.1.0

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.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Sidekiq::Bossman
2
2
 
3
+ [![Build Status](https://travis-ci.org/techwhizbang/sidekiq-bossman.png)](https://travis-ci.org/techwhizbang/sidekiq-bossman)
4
+
3
5
  The goal of Sidekiq::Bossman is to provide an easy programmatic approach
4
6
  to starting and stopping Sidekiq workers. Everything in Sidekiq::Bossman
5
7
  is nothing more than an idiomatic Ruby abstraction atop what already exists in Sidekiq.
@@ -1,13 +1,11 @@
1
1
  require 'rubygems'
2
- require 'sidekiq/cli'
3
2
 
4
3
  module Sidekiq
5
4
  class Bossman
6
5
 
7
6
  attr_accessor :config, :pidfile,
8
7
  :logfile, :require,
9
- :daemon, :timeout,
10
- :verbose, :concurrency,
8
+ :timeout, :verbose, :concurrency,
11
9
  :queue, :environment
12
10
 
13
11
 
@@ -15,7 +13,7 @@ module Sidekiq
15
13
  # Takes the following options that currently match the version
16
14
  # of Sidekiq this gem depends upon:
17
15
  # :config, :pidfile, :logfile, :require, :timeout, :verbose, :queue,
18
- # :concurrency, :daemon
16
+ # :concurrency
19
17
  def initialize(project_root, options = {})
20
18
 
21
19
  default_options = {:config => "#{project_root}/config/sidekiq.yml",
@@ -26,31 +24,23 @@ module Sidekiq
26
24
  :timeout => 10,
27
25
  :verbose => false,
28
26
  :queue => nil,
29
- :concurrency => nil,
30
- :daemon => true}
27
+ :concurrency => nil}
31
28
  options = default_options.merge(options)
32
29
  options.each { |k, v| send("#{k}=", v) }
33
30
  end
34
31
 
32
+ ##
33
+ # Starts the workers as a daemon with either the default or given
34
+ # options hash in the initializer
35
35
  def start_workers
36
- sidekiq = Sidekiq::CLI.instance
37
-
38
- args = []
39
-
40
- ["-r", @require].each { |arg| args << arg } unless @require.nil?
41
- ["-t", @timeout.to_s].each { |arg| args << arg } unless @timeout.nil?
42
- ["-L", @logfile].each { |arg| args << arg } unless @logfile.nil?
43
- ["-C", @config].each { |arg| args << arg } unless @config.nil?
44
- ["-P", @pidfile].each { |arg| args << arg } unless @pidfile.nil?
45
- ["-q", @queue].each { |arg| args << arg } unless @queue.nil?
46
- ["-c", @concurrency].each { |arg| args << arg } unless @concurrency.nil?
47
- ["-e", @environment].each { |arg| args << arg } unless @environment.nil?
48
- args << "-d" if @daemon == true
49
- args << "-v" if @verbose == true
50
-
51
- sidekiq.parse args
52
-
53
- sidekiq.run
36
+ start_cmd = "nohup bundle exec sidekiq -e #{@environment} -t #{@timeout} -P #{@pidfile}"
37
+ start_cmd << " -v" if @verbose == true
38
+ start_cmd << " -r #{@require}" unless @require.nil?
39
+ start_cmd << " -C #{@config}" unless @config.nil?
40
+ start_cmd << " -q #{@queue}" unless @queue.nil?
41
+ start_cmd << " -c #{@concurrency}" unless @concurrency.nil?
42
+ start_cmd << " >> #{@logfile} 2>&1 &"
43
+ system start_cmd
54
44
  end
55
45
 
56
46
  def stop_workers
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  class Bossman
3
- VERSION = "0.0.3"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -4,10 +4,10 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/sidekiq-bossman")
4
4
  describe Sidekiq::Bossman do
5
5
 
6
6
  before do
7
+ FileUtils.touch(File.dirname(__FILE__) + "/sidekiq_project/log/sidekiq.log")
7
8
  @sidekiq_bossman = Sidekiq::Bossman.new(File.expand_path(File.dirname(__FILE__) + "/sidekiq_project"),
8
9
  :require => "#{File.expand_path(File.dirname(__FILE__) + "/sidekiq_project")}/boot.rb",
9
- :environment => "test",
10
- :daemon => true)
10
+ :environment => "test")
11
11
  end
12
12
 
13
13
  after do
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-bossman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-08 00:00:00.000000000 Z
12
+ date: 2013-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -79,6 +79,8 @@ files:
79
79
  - spec/sidekiq_bossman_spec.rb
80
80
  - spec/sidekiq_project/boot.rb
81
81
  - spec/sidekiq_project/config/sidekiq.yml
82
+ - spec/sidekiq_project/log/.keepme
83
+ - spec/sidekiq_project/tmp/pids/.keepme
82
84
  homepage: https://github.com/techwhizbang/sidekiq-bossman
83
85
  licenses: []
84
86
  post_install_message:
@@ -93,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
95
  version: '0'
94
96
  segments:
95
97
  - 0
96
- hash: 1911942347009138160
98
+ hash: 3406515744558690802
97
99
  required_rubygems_version: !ruby/object:Gem::Requirement
98
100
  none: false
99
101
  requirements:
@@ -102,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
104
  version: '0'
103
105
  segments:
104
106
  - 0
105
- hash: 1911942347009138160
107
+ hash: 3406515744558690802
106
108
  requirements: []
107
109
  rubyforge_project:
108
110
  rubygems_version: 1.8.25
@@ -113,3 +115,5 @@ test_files:
113
115
  - spec/sidekiq_bossman_spec.rb
114
116
  - spec/sidekiq_project/boot.rb
115
117
  - spec/sidekiq_project/config/sidekiq.yml
118
+ - spec/sidekiq_project/log/.keepme
119
+ - spec/sidekiq_project/tmp/pids/.keepme