capistrano-shoryuken 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDdkOTI4NTY4MmFiMmFkOTU5NDRhZDJlZTkwZjM2ZDI5MTc4YzIzMQ==
5
+ data.tar.gz: !binary |-
6
+ N2U5ZmY0MGNiZmQwZGI5MjVlNjAxNWIyN2UzMDhjMDMzMTFiYTA2Yw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OWNkMTVkNGMyMjk5Y2JiYzcyMjdlNGUwY2Y5YTMwOGExN2Y2NzlmZGFkNzE5
10
+ MTQ1NzIwMTJmNzM2ZTkxNGY0MDRjZDdmMDM5MTNiMjlhNTdlMjQ1YjMzMGJh
11
+ NjU3NjJmNTk4NzI0MDMxMTY4MDllMDVlZGY4MzMwMDIxMjc0NzY=
12
+ data.tar.gz: !binary |-
13
+ OGU2ZTA3NTZlOWFiMWFmM2I5NmJlNjczMjJjYTlmMGI0N2JhODZiNGRkOTVl
14
+ YjYxOTVhYWQ5YjY3NDhjYjg0MjVhMTVmZjZhMzc5Mzg4ZGU5OGM0ZmU1NDg2
15
+ YzY2ZTM2MWM3MTkzYjRlOGY4MTgzMDY0Y2FjMWNhNmMzZWJmNDY=
data/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ .buildpath
2
+ .project
3
+ .settings
4
+ *.gem
5
+ *.rbc
6
+ /.config
7
+ /coverage/
8
+ /InstalledFiles
9
+ /pkg/
10
+ /spec/reports/
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+
15
+ ## Specific to RubyMotion:
16
+ .dat*
17
+ .repl_history
18
+ build/
19
+
20
+ ## Documentation cache and generated files:
21
+ /.yardoc/
22
+ /_yardoc/
23
+ /doc/
24
+ /rdoc/
25
+
26
+ ## Environment normalisation:
27
+ /.bundle/
28
+ /lib/bundler/man/
29
+
30
+ # for a library or gem, you might want to ignore these files since the code is
31
+ # intended to run in multiple environments; otherwise, check them in:
32
+ # Gemfile.lock
33
+ # .ruby-version
34
+ # .ruby-gemset
35
+
36
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
37
+ .rvmrc
data/LICENSE ADDED
@@ -0,0 +1,166 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
166
+
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # capistrano-shoryuken
2
+ Shoryuken integration for Capistrano
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "capistrano/shoryuken/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-shoryuken"
8
+ spec.version = Capistrano::Shoryuken::VERSION
9
+ spec.authors = ["Joe Khoobyar"]
10
+ spec.email = ["joe@khoobyar.name"]
11
+ spec.homepage = "http://github.com/joekhoobyar/capistrano-shoryuken"
12
+ spec.summary = 'Shoryuken integration for Capistrano'
13
+ spec.description = 'Shoryuken integration for Capistrano'
14
+
15
+ spec.license = "LGPL-3.0"
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.required_ruby_version = '>= 1.9.3'
21
+
22
+ spec.add_dependency 'capistrano'
23
+ end
@@ -0,0 +1 @@
1
+ require 'capistrano/shoryuken'
@@ -0,0 +1,5 @@
1
+ if Gem::Specification.find_by_name('capistrano').version >= Gem::Version.new('3.0.0')
2
+ load File.expand_path('../tasks/shoryuken.cap', __FILE__)
3
+ else
4
+ require_relative 'tasks/capistrano2'
5
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Shoryuken
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,78 @@
1
+ Capistrano::Configuration.instance.load do
2
+
3
+ _cset(:shoryuken_default_hooks) { true }
4
+
5
+ _cset(:shoryuken_pid) { File.join(shared_path, 'pids', 'shoryuken.pid') }
6
+ _cset(:shoryuken_env) { fetch(:rack_env, fetch(:rails_env, 'production')) }
7
+ _cset(:shoryuken_log) { File.join(shared_path, 'log', 'shoryuken.log') }
8
+
9
+ _cset(:shoryuken_config) { "#{current_path}/config/shoryuken.yml" }
10
+ _cset(:shoryuken_options) { nil }
11
+ _cset(:shoryuken_queues) { nil }
12
+
13
+ _cset(:shoryuken_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec shoryuken" }
14
+
15
+ _cset(:shoryuken_role) { :app }
16
+
17
+ if fetch(:shoryuken_default_hooks)
18
+ after 'deploy:stop', 'shoryuken:stop'
19
+ after 'deploy:start', 'shoryuken:start'
20
+ before 'deploy:restart', 'shoryuken:restart'
21
+ end
22
+
23
+ namespace :shoryuken do
24
+ desc 'Stop the shoryuken process, gracefully'
25
+ task :stop, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
26
+ pid_file = fetch(:shoryuken_pid)
27
+
28
+ run "cd #{current_path} ; kill -USR1 `cat '#{pid_file}'` >/dev/null 2>&1"
29
+ print 'Waiting for shoryuken to shutdown...'
30
+ run "cd #{current_path} && while [ -f '#{pid_file}' ] && kill -0 `cat '#{pid_file}'` >/dev/null 2>&1; do sleep 1; done && rm -f '#{pid_file}'"
31
+ end
32
+
33
+ desc 'Shutdown the shoryuken process, immediately'
34
+ task :shutdown, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
35
+ run "cd #{current_path} && [ -f '#{pid_file}' ] && kill `cat '#{pid_file}'`"
36
+ end
37
+
38
+ desc 'Start the shoryuken process'
39
+ task :start, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
40
+ pid_file = fetch(:shoryuken_pid)
41
+
42
+ args = ['--rails --daemon']
43
+ args.push "--pidfile '#{pid_file}'"
44
+ logfile = fetch(:shoryuken_log) and args.push "--logfile '#{logfile}'"
45
+ config = fetch(:shoryuken_config) and args.push "--config '#{config}'"
46
+ queues = Array(fetch(:shoryuken_queues)) and queues.each{|queue| args.push "--queue #{queue}" }
47
+ options = fetch(:shoryuken_options) and args.push Array(options).join(' ')
48
+
49
+ cmd = fetch(:shoryuken_cmd)
50
+ env = fetch(:shoryuken_env) and cmd = "RAILS_ENV=#{env} #{cmd}"
51
+
52
+ run "cd #{current_path} && if [ -f '#{pid_file}' ] && kill -0 `cat '#{pid_file}'` >/dev/null 2>&1 ; then echo 'shoryuken is already running'; else #{cmd} #{args.compact.join(' ')} ; fi"
53
+ end
54
+
55
+ desc 'Restart shoryuken'
56
+ task :restart, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
57
+ stop
58
+ start
59
+ end
60
+
61
+ desc 'Make the shoryuken process log detailed status information'
62
+ task :log_status, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
63
+ pid_file = fetch(:shoryuken_pid)
64
+
65
+ run "cd #{current_path} && [ -f '#{pid_file}' ] && kill -TTIN `cat '#{pid_file}'`"
66
+ end
67
+
68
+ desc 'Tail the shoryuken log forever'
69
+ task :tail_log, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
70
+ run "tail -f '#{fetch(:shoryuken_log)}'"
71
+ end
72
+
73
+ desc 'Tail ENV[number] lines of the shoryuken log'
74
+ task :tail_log_lines, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
75
+ run "tail -n #{ENV.fetch('number',20)} '#{fetch(:shoryuken_log)}'"
76
+ end
77
+ end
78
+ end
File without changes
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-shoryuken
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joe Khoobyar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Shoryuken integration for Capistrano
28
+ email:
29
+ - joe@khoobyar.name
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - capistrano-shoryuken.gemspec
39
+ - lib/capistrano-shoryuken.rb
40
+ - lib/capistrano/shoryuken.rb
41
+ - lib/capistrano/shoryuken/version.rb
42
+ - lib/capistrano/tasks/capistrano2.rb
43
+ - lib/capistrano/tasks/shoryuken.cap
44
+ homepage: http://github.com/joekhoobyar/capistrano-shoryuken
45
+ licenses:
46
+ - LGPL-3.0
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: 1.9.3
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.0.3
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Shoryuken integration for Capistrano
68
+ test_files: []
69
+ has_rdoc: