sidekiq-client-cli 0.1.2 → 0.1.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGIzNWE2MTRhMTM0ODcxZDQ0YjlmYTZiMmQxYTI3OThmOGJmMWM0Ng==
4
+ NTgyYzgzOGEyYzEwMGJhM2FiNGNjZDE0NDFmN2U4ZjQ2YTIzMGUxYg==
5
5
  data.tar.gz: !binary |-
6
- OWRkMmRkMmE3OTcyY2U1NTE0MzE3MjlhZThkNjA3ZGZkMWI5MTQ3MA==
6
+ ZTdiZDI4YTNkYTZlM2Y4ZWJjOTM1MzU4ZDg1MWQyMzNmNTQyODQ5NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDAyNTZmMTc4NDllZmU5NTdiMjBmNTk3ZWVhMWNkNjk4MjcxODc5YzcyYmZk
10
- Mzg3OTllMTdlYzZkOTczZWZjMWQwOTA4NTM5NWJlNGMxYTQ5ZjZkOGU4OTk4
11
- NWUzZWNjZjI1YjU1ZGUxZGQ2ZTAzNTljZmU4YjM3OTQ1YmUwNzg=
9
+ NWVkODk5YzcwMDE2Y2Y0NTY4NmY4Mjc3NmRmMDBmNDk5ZDBhYTBmNjVlMDZh
10
+ MGUzNGRlOGU1YTIyYzdhYmM2YzhkYzExNWE0ZGE2ZGMyZGI5ZTJkYWYxMWY0
11
+ MWMwZDJkMmMyZDEyYzRiN2U5MWIwOWJjMzNjYWE0NDhkNjFiMGU=
12
12
  data.tar.gz: !binary |-
13
- MzdjNWNhM2QyNGYyMjU2Y2RlY2U3NTQ3NzZiM2I2MWNiNTQ0MGIxMjhkZWRj
14
- ZjE3NjhjOTZiZTViNTNiM2ExOGQ2Yjc5NjY4YTg0NWZjMDczOTY0Yjc5ZTU0
15
- MDAyYWJjYmExZTdlOWZkZTdhMDFkOGUzZWU3M2QwMTBhMGIwZTY=
13
+ NzdmMDU3Y2YyMTE0N2U0NTZmMTVkMGM2Y2MzYjAwYjY2MmNkYjVhY2QzOTM4
14
+ NTAzNmQ0ZWE0NWQxMzI3N2NiMTRkNzZmYTE4ZjZiM2I3Y2I5OTk5NjEwMTQ2
15
+ NDk2NzFjOWY3MzE1MGMxNzM2ZGU1ZWIzZjQ1ZmMxZjM5ZmUzODk=
data/README.md CHANGED
@@ -19,6 +19,10 @@ Or install it yourself as:
19
19
 
20
20
  $ gem install sidekiq-client-cli
21
21
 
22
+ ## Dependencies
23
+
24
+ Requires sidekiq >= 2.15.0
25
+
22
26
  ## Usage
23
27
 
24
28
  Push worker classes to Sidekiq :
@@ -5,18 +5,13 @@ require_relative 'sidekiq_client_cli/version'
5
5
  class SidekiqClientCLI
6
6
  COMMANDS = %w{push}
7
7
  DEFAULT_CONFIG_PATH = "config/initializers/sidekiq.rb"
8
- DEFAULT_QUEUE = Sidekiq::Worker::ClassMethods::DEFAULT_OPTIONS['queue']
9
8
 
10
9
  attr_accessor :settings
11
10
 
12
- def initialize
13
-
14
- end
15
-
16
11
  def parse
17
12
  @settings = CLI.new do
18
13
  option :config_path, :short => :c, :default => DEFAULT_CONFIG_PATH, :description => "Sidekiq client config file path"
19
- option :queue, :short => :q, :default => DEFAULT_QUEUE, :description => "Queue to place job on"
14
+ option :queue, :short => :q, :description => "Queue to place job on"
20
15
  argument :command, :description => "'push' to push a job to the queue"
21
16
  arguments :command_args, :required => false, :description => "command arguments"
22
17
  end.parse! do |settings|
@@ -30,7 +25,10 @@ class SidekiqClientCLI
30
25
 
31
26
  def run
32
27
  # load the config file
33
- load settings.config_path if File.exists? settings.config_path
28
+ load settings.config_path if File.exists?(settings.config_path)
29
+
30
+ # set queue if not given
31
+ settings.queue ||= Sidekiq.default_worker_options['queue']
34
32
 
35
33
  self.send settings.command.to_sym
36
34
  end
@@ -45,5 +43,5 @@ class SidekiqClientCLI
45
43
  end
46
44
  end
47
45
  end
48
- end
49
46
 
47
+ end
@@ -1,3 +1,3 @@
1
1
  class SidekiqClientCLI
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "simplecov"
25
25
 
26
- spec.add_dependency "sidekiq"
26
+ spec.add_dependency "sidekiq", "~> 2.15.0"
27
27
  spec.add_dependency "cli"
28
28
 
29
29
  end
@@ -1,9 +1,9 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe SidekiqClientCLI do
4
- before(:each) do
5
- @client = SidekiqClientCLI.new
6
- end
4
+ let(:default_queue) { Sidekiq.default_worker_options['queue'] }
5
+
6
+ before(:each) { @client = SidekiqClientCLI.new }
7
7
 
8
8
  describe "ARGV parsing" do
9
9
  it "fails if no command" do
@@ -46,7 +46,7 @@ describe SidekiqClientCLI do
46
46
  @client.settings.command.should eq "push"
47
47
  @client.settings.command_args.should eq worker_klasses
48
48
  @client.settings.config_path.should eq SidekiqClientCLI::DEFAULT_CONFIG_PATH
49
- @client.settings.queue.should eq SidekiqClientCLI::DEFAULT_QUEUE
49
+ @client.settings.queue.should eq nil
50
50
  end
51
51
 
52
52
  it "parses push with a configuration file" do
@@ -56,7 +56,7 @@ describe SidekiqClientCLI do
56
56
  @client.settings.command.should eq "push"
57
57
  @client.settings.command_args.should eq worker_klasses
58
58
  @client.settings.config_path.should eq "mysidekiq.conf"
59
- @client.settings.queue.should eq SidekiqClientCLI::DEFAULT_QUEUE
59
+ @client.settings.queue.should eq nil
60
60
  end
61
61
 
62
62
  it "parses push with a queue" do
@@ -66,7 +66,7 @@ describe SidekiqClientCLI do
66
66
  @client.settings.command.should eq "push"
67
67
  @client.settings.command_args.should eq worker_klasses
68
68
  @client.settings.config_path.should eq SidekiqClientCLI::DEFAULT_CONFIG_PATH
69
- @client.settings.queue.should eq "my_queue"
69
+ @client.settings.queue.should eq "my_queue"
70
70
  end
71
71
 
72
72
  end
@@ -77,6 +77,7 @@ describe SidekiqClientCLI do
77
77
  config_path = "sidekiq.conf"
78
78
  @client.settings.stub(:config_path).and_return(config_path)
79
79
  @client.settings.stub(:command).and_return("mycommand")
80
+ @client.settings.stub(:queue).and_return(default_queue)
80
81
  @client.should_receive(:mycommand)
81
82
 
82
83
  File.should_receive(:exists?).with(config_path).and_return true
@@ -90,6 +91,7 @@ describe SidekiqClientCLI do
90
91
  settings = double("settings")
91
92
  settings.stub(:config_path).and_return(config_path)
92
93
  settings.stub(:command).and_return("mycommand")
94
+ settings.stub(:queue).and_return(default_queue)
93
95
 
94
96
  @client.settings = settings
95
97
  @client.should_receive(:mycommand)
@@ -108,17 +110,17 @@ describe SidekiqClientCLI do
108
110
  klass2 = "SecondWorker"
109
111
  settings = double("settings")
110
112
  settings.stub(:command_args).and_return [klass1, klass2]
111
- settings.stub(:queue).and_return SidekiqClientCLI::DEFAULT_QUEUE
113
+ settings.stub(:queue).and_return default_queue
112
114
  @client.settings = settings
113
115
 
114
- Sidekiq::Client.should_receive(:push).with('class' => klass1, 'args' => [], 'queue' => SidekiqClientCLI::DEFAULT_QUEUE)
115
- Sidekiq::Client.should_receive(:push).with('class' => klass2, 'args' => [], 'queue' => SidekiqClientCLI::DEFAULT_QUEUE)
116
+ Sidekiq::Client.should_receive(:push).with('class' => klass1, 'args' => [], 'queue' => default_queue)
117
+ Sidekiq::Client.should_receive(:push).with('class' => klass2, 'args' => [], 'queue' => default_queue)
116
118
 
117
119
  @client.push
118
120
  end
119
121
 
120
122
  it "pushes the worker classes to the correct queue" do
121
- queue = "Queue"
123
+ queue = "Queue"
122
124
  klass1 = "FirstWorker"
123
125
  klass2 = "SecondWorker"
124
126
  settings = double("settings")
@@ -137,11 +139,11 @@ describe SidekiqClientCLI do
137
139
  klass2 = "SecondWorker"
138
140
  settings = double("settings")
139
141
  settings.stub(:command_args).and_return [klass1, klass2]
140
- settings.stub(:queue).and_return SidekiqClientCLI::DEFAULT_QUEUE
142
+ settings.stub(:queue).and_return default_queue
141
143
  @client.settings = settings
142
144
 
143
- Sidekiq::Client.should_receive(:push).with('class' => klass1, 'args' => [], 'queue' => SidekiqClientCLI::DEFAULT_QUEUE).and_raise
144
- Sidekiq::Client.should_receive(:push).with('class' => klass2, 'args' => [], 'queue' => SidekiqClientCLI::DEFAULT_QUEUE)
145
+ Sidekiq::Client.should_receive(:push).with('class' => klass1, 'args' => [], 'queue' => default_queue).and_raise
146
+ Sidekiq::Client.should_receive(:push).with('class' => klass2, 'args' => [], 'queue' => default_queue)
145
147
 
146
148
  out = IOHelper.stdout_read do
147
149
  @client.push
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-client-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adil Haritah
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-21 00:00:00.000000000 Z
11
+ date: 2013-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: sidekiq
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 2.15.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 2.15.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: cli
85
85
  requirement: !ruby/object:Gem::Requirement