mina-sidekiq 0.4.1 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f110d06a373caf157e7ad1ab5813aa8d567bfffd
4
- data.tar.gz: f00cd8d8d44198bb991c70d0748dad73042c1448
3
+ metadata.gz: d6a002d492fb54e6a01583a09efe302e1546e2b7
4
+ data.tar.gz: 1048b8227cd914a3f026c4d251bbbf88c8f41c53
5
5
  SHA512:
6
- metadata.gz: 09813f8ebdb01e318e6c547e756a7fd3bbb9180c21d66d229cf8228c80b4eadf9e0af69b104597b6162798ef339b5ed2d6b42f97f07d75cad945b9c8085cb5d4
7
- data.tar.gz: 5f1a6964a8204656b6a9bab472e4fdac368321550248ac01845d84281cf565e84d09ce725009882507f1423ce557182034985f57fd2728affc4a36e148b13644
6
+ metadata.gz: e6e261d3d3cdf3f5fd4363290cbdb54dd78a5152b2715f6e94529ce61a69b72faa477a02c599e9465695ebeb6302545ec311297e9033f7c34ef690056229ba13
7
+ data.tar.gz: b66da6613c2382ab9a362009fceb5cef9bb7f5bb5e2b0f756e2b19b42537ff05a069cc0b39e9546c4387218e4e7fd1416536d3bdc920d3ebd1ea22aa7e33ebaa
data/.travis.yml CHANGED
@@ -1,8 +1,13 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - "1.9.3"
5
- - "2.0.0"
6
- - "2.1.0"
4
+ - "2.2.5"
5
+ - "2.3.1"
7
6
  services: redis
8
- env: FORCE_ADD_SSH_KEY=1
7
+
8
+ before_install:
9
+ - ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa
10
+ - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
11
+ - echo "Host localhost" >> /home/travis/.ssh/config
12
+ - echo " StrictHostKeyChecking no" >> /home/travis/.ssh/config
13
+ - chmod g-rw,o-rw /home/travis/.ssh/*
data/Changelog.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.0.0 2016-10-10
5
+ ----------------
6
+ * support for mina 1.0 (thanks @devvmh)
7
+
4
8
  0.4.1 2016-06-27
5
9
  ----------------
6
10
  * Default `sidekiq_concurrency` to nil. It now needs explicitly set to
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://www.rubygems.org"
1
+ source "https://www.rubygems.org"
2
2
 
3
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,20 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mina-sidekiq (0.3.1)
5
- mina
4
+ mina-sidekiq (1.0.0)
5
+ mina (>= 1.0.0)
6
6
 
7
7
  GEM
8
- remote: http://www.rubygems.org/
8
+ remote: https://www.rubygems.org/
9
9
  specs:
10
- mina (0.3.1)
10
+ byebug (9.0.6)
11
+ coderay (1.1.1)
12
+ method_source (0.8.2)
13
+ mina (1.0.0)
11
14
  open4 (~> 1.3.4)
12
15
  rake
16
+ minitest (5.9.1)
13
17
  open4 (1.3.4)
14
- rake (10.4.2)
18
+ pry (0.10.4)
19
+ coderay (~> 1.1.0)
20
+ method_source (~> 0.8.1)
21
+ slop (~> 3.4)
22
+ pry-byebug (3.4.0)
23
+ byebug (~> 9.0)
24
+ pry (~> 0.10)
25
+ rake (11.3.0)
26
+ slop (3.6.0)
15
27
 
16
28
  PLATFORMS
17
29
  ruby
18
30
 
19
31
  DEPENDENCIES
20
32
  mina-sidekiq!
33
+ minitest
34
+ pry-byebug
35
+
36
+ BUNDLED WITH
37
+ 1.13.1
data/README.md CHANGED
@@ -6,10 +6,7 @@ mina-sidekiq
6
6
  mina-sidekiq is a gem that adds tasks to aid in the deployment of [Sidekiq] (http://mperham.github.com/sidekiq/)
7
7
  using [Mina] (http://nadarei.co/mina).
8
8
 
9
- ##CURRENTLY UNMAINTAINED
10
-
11
- The original author of this library do not use mina nor sidekiq at the moment.
12
- If you want to further develop this project please contact <joerg@higgsboson.tk>
9
+ Starting with 1.0.0 this gem requires Mina 1.0!
13
10
 
14
11
  # Getting Start
15
12
 
@@ -70,7 +67,7 @@ If you want to further develop this project please contact <joerg@higgsboson.tk>
70
67
 
71
68
  The test requires a local running ssh server with the ssh keys of the current
72
69
  user added to its `~/.ssh/authorized_keys`. In OS X, this is "Remote Login"
73
- under the Sharing pref pane.
70
+ under the Sharing pref pane. You will also need a working rvm installation.
74
71
 
75
72
  To run the full blown test suite use:
76
73
 
@@ -83,6 +80,6 @@ For faster release cycle use
83
80
 
84
81
  ## Copyright
85
82
 
86
- Copyright (c) 2013 Jörg Thalheim http://higgsboson.tk/joerg
83
+ Copyright (c) 2016 Jörg Thalheim <joerg@higgsboson.tk>
87
84
 
88
85
  See LICENSE for further details.
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
- require "rake"
2
- require "rake/testtask"
1
+ require 'rake/testtask'
3
2
 
4
3
  Rake::TestTask.new do |t|
5
4
  t.libs << "test"
@@ -6,7 +6,7 @@
6
6
  # ...
7
7
  # task :setup do
8
8
  # # sidekiq needs a place to store its pid file
9
- # queue! %[mkdir -p "#{deploy_to}/shared/pids/"]
9
+ # command %[mkdir -p "#{fetch(:deploy_to)}/shared/pids/"]
10
10
  # end
11
11
  #
12
12
  # task :deploy do
@@ -22,54 +22,51 @@
22
22
  # end
23
23
  # end
24
24
 
25
- require 'mina/bundler'
26
- require 'mina/rails'
27
-
28
25
  # ## Settings
29
26
  # Any and all of these settings can be overriden in your `deploy.rb`.
30
27
 
31
28
  # ### sidekiq
32
29
  # Sets the path to sidekiq.
33
- set_default :sidekiq, lambda { "#{bundle_bin} exec sidekiq" }
30
+ set :sidekiq, -> { "#{fetch(:bundle_bin)} exec sidekiq" }
34
31
 
35
32
  # ### sidekiqctl
36
33
  # Sets the path to sidekiqctl.
37
- set_default :sidekiqctl, lambda { "#{bundle_prefix} sidekiqctl" }
34
+ set :sidekiqctl, -> { "#{fetch(:bundle_prefix)} sidekiqctl" }
38
35
 
39
36
  # ### sidekiq_timeout
40
37
  # Sets a upper limit of time a process is allowed to finish, before it is killed by sidekiqctl.
41
- set_default :sidekiq_timeout, 11
38
+ set :sidekiq_timeout, 11
42
39
 
43
40
  # ### sidekiq_config
44
41
  # Sets the path to the configuration file of sidekiq
45
- set_default :sidekiq_config, lambda { "#{deploy_to}/#{current_path}/config/sidekiq.yml" }
42
+ set :sidekiq_config, -> { "#{fetch(:current_path)}/config/sidekiq.yml" }
46
43
 
47
44
  # ### sidekiq_log
48
45
  # Sets the path to the log file of sidekiq
49
46
  #
50
47
  # To disable logging set it to "/dev/null"
51
- set_default :sidekiq_log, lambda { "#{deploy_to}/#{current_path}/log/sidekiq.log" }
48
+ set :sidekiq_log, -> { "#{fetch(:current_path)}/log/sidekiq.log" }
52
49
 
53
50
  # ### sidekiq_pid
54
51
  # Sets the path to the pid file of a sidekiq worker
55
- set_default :sidekiq_pid, lambda { "#{deploy_to}/#{shared_path}/pids/sidekiq.pid" }
52
+ set :sidekiq_pid, -> { "#{fetch(:shared_path)}/pids/sidekiq.pid" }
56
53
 
57
54
  # ### sidekiq_processes
58
55
  # Sets the number of sidekiq processes launched
59
- set_default :sidekiq_processes, 1
56
+ set :sidekiq_processes, 1
60
57
 
61
58
  # ### sidekiq_concurrency
62
59
  # Sets the number of sidekiq threads per process (overrides value in sidekiq.yml)
63
- set_default :sidekiq_concurrency, nil
60
+ set :sidekiq_concurrency, nil
64
61
 
65
62
  # ## Control Tasks
66
63
  namespace :sidekiq do
67
64
  def for_each_process(&block)
68
- sidekiq_processes.times do |idx|
65
+ fetch(:sidekiq_processes).times do |idx|
69
66
  pid_file = if idx == 0
70
- sidekiq_pid
67
+ fetch(:sidekiq_pid)
71
68
  else
72
- "#{sidekiq_pid}-#{idx}"
69
+ "#{fetch(:sidekiq_pid)}-#{idx}"
73
70
  end
74
71
  yield(pid_file, idx)
75
72
  end
@@ -78,49 +75,49 @@ namespace :sidekiq do
78
75
  # ### sidekiq:quiet
79
76
  desc "Quiet sidekiq (stop accepting new work)"
80
77
  task :quiet => :environment do
81
- queue %[echo "-----> Quiet sidekiq (stop accepting new work)"]
78
+ comment 'Quiet sidekiq (stop accepting new work)'
82
79
  for_each_process do |pid_file, idx|
83
- queue %{
84
- if [ -f #{pid_file} ] && kill -0 `cat #{pid_file}`> /dev/null 2>&1; then
85
- cd "#{deploy_to}/#{current_path}"
86
- #{echo_cmd %{#{sidekiqctl} quiet #{pid_file}} }
80
+ command %{
81
+ if [ -f #{pid_file} ] && kill -0 `cat #{pid_file}` > /dev/null 2>&1; then
82
+ cd "#{fetch(:current_path)}"
83
+ #{fetch(:sidekiqctl)} quiet #{pid_file}
87
84
  else
88
85
  echo 'Skip quiet command (no pid file found)'
89
86
  fi
90
- }
87
+ }.strip
91
88
  end
92
89
  end
93
90
 
94
91
  # ### sidekiq:stop
95
92
  desc "Stop sidekiq"
96
93
  task :stop => :environment do
97
- queue %[echo "-----> Stop sidekiq"]
94
+ comment 'Stop sidekiq'
98
95
  for_each_process do |pid_file, idx|
99
- queue %[
96
+ command %{
100
97
  if [ -f #{pid_file} ] && kill -0 `cat #{pid_file}`> /dev/null 2>&1; then
101
- cd "#{deploy_to}/#{current_path}"
102
- #{echo_cmd %[#{sidekiqctl} stop #{pid_file} #{sidekiq_timeout}]}
98
+ cd #{fetch(:current_path)}
99
+ #{fetch(:sidekiqctl)} stop #{pid_file} #{fetch(:sidekiq_timeout)}
103
100
  else
104
101
  echo 'Skip stopping sidekiq (no pid file found)'
105
102
  fi
106
- ]
103
+ }.strip
107
104
  end
108
105
  end
109
106
 
110
107
  # ### sidekiq:start
111
108
  desc "Start sidekiq"
112
109
  task :start => :environment do
113
- queue %[echo "-----> Start sidekiq"]
110
+ comment 'Start sidekiq'
114
111
  for_each_process do |pid_file, idx|
112
+ sidekiq_concurrency = fetch(:sidekiq_concurrency)
115
113
  concurrency_arg = if sidekiq_concurrency.nil?
116
114
  ""
117
115
  else
118
116
  "-c #{sidekiq_concurrency}"
119
117
  end
120
- queue %{
121
- cd "#{deploy_to}/#{current_path}"
122
- #{echo_cmd %[#{sidekiq} -d -e #{rails_env} #{concurrency_arg} -C #{sidekiq_config} -i #{idx} -P #{pid_file} -L #{sidekiq_log}] }
123
- }
118
+ in_path(fetch(:current_path)) do
119
+ command %[#{fetch(:sidekiq)} -d -e #{fetch(:rails_env)} #{concurrency_arg} -C #{fetch(:sidekiq_config)} -i #{idx} -P #{pid_file} -L #{fetch(:sidekiq_log)}]
120
+ end
124
121
  end
125
122
  end
126
123
 
@@ -133,7 +130,6 @@ namespace :sidekiq do
133
130
 
134
131
  desc "Tail log from server"
135
132
  task :log => :environment do
136
- queue %[tail -f #{sidekiq_log}]
133
+ command %[tail -f #{sidekiq_log}]
137
134
  end
138
-
139
135
  end
@@ -1,5 +1,5 @@
1
1
  module MinaSidekiq
2
2
  def self.version
3
- "0.4.1"
3
+ '1.0.0'
4
4
  end
5
5
  end
data/mina-sidekiq.gemspec CHANGED
@@ -16,13 +16,8 @@ Gem::Specification.new do |s|
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
- s.post_install_message = <<-MESSAGE
20
- Starting with 0.2.0, you have to add:
21
19
 
22
- require "mina_sidekiq/tasks"
23
-
24
- in your deploy.rb to load the library
25
- MESSAGE
26
-
27
- s.add_runtime_dependency "mina"
20
+ s.add_runtime_dependency 'mina', '>= 1.0.0'
21
+ s.add_development_dependency 'pry-byebug'
22
+ s.add_development_dependency 'minitest'
28
23
  end
data/test/deploy_test.rb CHANGED
@@ -16,6 +16,7 @@ describe "mina_sidekiq" do
16
16
  end
17
17
 
18
18
  def check_process(pid)
19
+ pid = pid.to_i
19
20
  begin
20
21
  Process.kill(0, pid)
21
22
  return true
@@ -40,7 +41,7 @@ describe "mina_sidekiq" do
40
41
  mina "deploy"
41
42
  rescue Exception => e
42
43
  log = "./deploy/shared/sidekiq.log"
43
- if File.exists?(log)
44
+ if File.exist?(log)
44
45
  puts "cat #{log}"
45
46
  puts File.open(log).read
46
47
  end
@@ -50,12 +51,13 @@ describe "mina_sidekiq" do
50
51
  it "should start/stop sidekiq" do
51
52
  sidekiq_pid_path = @env_root.join("deploy", "shared", "pids", "sidekiq.pid")
52
53
  # fresh deploy
54
+ mina "deploy"
53
55
  mina "sidekiq:start"
54
56
  pid = File.read(sidekiq_pid_path)
55
57
  check_process(pid).must_equal true
56
58
  # second deploy
57
59
  mina "sidekiq:stop"
58
- check_process(pid).must_equal true
60
+ check_process(pid).must_equal false
59
61
  end
60
62
  end
61
63
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "minitest/spec"
2
1
  require "minitest/autorun"
3
2
  require 'pathname'
4
3
 
@@ -1,12 +1,9 @@
1
- require 'mina'
1
+ require 'mina/rails'
2
2
  require 'mina/git'
3
- require 'mina_sidekiq/tasks'
4
- require 'mina/git'
5
- require 'mina/bundler'
6
3
  require 'mina/rvm'
4
+ require 'mina_sidekiq/tasks'
7
5
  require 'fileutils'
8
6
 
9
-
10
7
  FileUtils.mkdir_p "#{Dir.pwd}/deploy"
11
8
 
12
9
  set :ssh_options, '-o StrictHostKeyChecking=no'
@@ -17,31 +14,35 @@ set :repository, 'https://github.com/Mic92/mina-sidekiq-test-rails.git'
17
14
  set :keep_releases, 2
18
15
  set :sidekiq_processes, 2
19
16
 
20
- set :shared_paths, ['log']
17
+ set :shared_dirs, fetch(:shared_dirs, []).push('log')
21
18
 
22
19
  task :environment do
23
- invoke :'rvm:use[ruby-2.1.2]'
20
+ # this line is disabled because of a bug in mina 1.0.0
21
+ # invoke :'rvm:use', ENV.fetch('RUBY_VERSION', 'ruby-2.3.1')
22
+ env = ENV.fetch('RUBY_VERSION', 'ruby-2.3.1')
23
+ command %{source #{fetch(:rvm_use_path)}}
24
+ command %{rvm use "#{env}" --create}
24
25
  end
25
26
 
26
27
  task setup: :environment do
27
- queue! %[mkdir -p "#{deploy_to}/shared/pids/"]
28
- queue! %[mkdir -p "#{deploy_to}/shared/log/"]
28
+ command %(mkdir -p "#{fetch(:deploy_to)}/shared/pids/")
29
+ command %(mkdir -p "#{fetch(:deploy_to)}/shared/log/")
29
30
  end
30
31
 
31
- task deploy: :environment do
32
+ task :deploy do
32
33
  deploy do
33
34
  invoke :'git:clone'
34
35
  invoke :'deploy:link_shared_paths'
35
36
  invoke :'bundle:install'
36
37
 
37
- to :launch do
38
+ on :launch do
38
39
  invoke :'sidekiq:start'
39
- queue! %[sleep 3; kill -0 `cat #{sidekiq_pid}`]
40
+ command %(sleep 3; kill -0 `cat #{fetch(:sidekiq_pid)}`)
40
41
 
41
42
  invoke :'sidekiq:quiet'
42
43
 
43
44
  invoke :'sidekiq:stop'
44
- queue! %[(kill -0 `cat #{sidekiq_pid}`) 2> /dev/null && exit 1 || exit 0]
45
+ command %((kill -0 `cat #{fetch(:sidekiq_pid)}`) 2> /dev/null && exit 1 || exit 0)
45
46
  end
46
47
  end
47
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joerg Thalheim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-27 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mina
@@ -16,9 +16,37 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry-byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - ">="
@@ -50,12 +78,7 @@ homepage: http://github.com/Mic92/mina-sidekiq
50
78
  licenses:
51
79
  - MIT
52
80
  metadata: {}
53
- post_install_message: |
54
- Starting with 0.2.0, you have to add:
55
-
56
- require "mina_sidekiq/tasks"
57
-
58
- in your deploy.rb to load the library
81
+ post_install_message:
59
82
  rdoc_options: []
60
83
  require_paths:
61
84
  - lib
@@ -71,11 +94,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
94
  version: '0'
72
95
  requirements: []
73
96
  rubyforge_project:
74
- rubygems_version: 2.5.1
97
+ rubygems_version: 2.6.6
75
98
  signing_key:
76
99
  specification_version: 4
77
100
  summary: Tasks to deploy Sidekiq with mina.
78
101
  test_files:
79
102
  - test/deploy_test.rb
80
103
  - test/test_helper.rb
81
- has_rdoc: