mina_extensions 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ build
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@mina_extensions --create
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina_extensions.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 marcosbeirigo
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # MinaExtensions
2
+
3
+ Set of mina extension tasks
4
+
5
+ ## Sidekiq
6
+ Tasks for managing Sidekiq workers.
7
+
8
+ ```ruby
9
+ require 'mina_extensions/sidekiq'
10
+ invoke :'sidekiq:quiet'
11
+ invoke :'sidekiq:stop'
12
+ invoke :'sidekiq:start'
13
+ invoke :'sidekiq:restart'
14
+ ```
15
+ If you are using rvm, you need to invoke `rvm:use` before. That's how I do it:
16
+ ```ruby
17
+ task :enviroment do
18
+ invoke :'rvm:use[ruby-1.9.3@mygemset]'
19
+ end
20
+
21
+ task :deploy => :environment do
22
+ #lots of stuff here
23
+ invoke :'sidekiq:restart'
24
+ end
25
+ ```
26
+
27
+ Credits to @Mic92 https://github.com/Mic92/mina
28
+ ## Resque
29
+ ## Rapns
30
+
31
+ ## Installation
32
+
33
+ Add this line to your application's Gemfile:
34
+
35
+ gem 'mina_extensions'
36
+
37
+ And then execute:
38
+
39
+ $ bundle
40
+
41
+ Or install it yourself as:
42
+
43
+ $ gem install mina_extensions
44
+
45
+ ## Usage
46
+
47
+ TODO: Write usage instructions here
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,38 @@
1
+ # # Modules: Passenger
2
+ # Adds tasks for managing Passenger Workers.
3
+ #
4
+ # ## Usage example
5
+ # require 'mina_extensions/passenger'
6
+ # ...
7
+ #
8
+ # task :deploy => :enviroment do
9
+ # deploy do
10
+ # invoke :'sidekiq:quiet'
11
+ # invoke :'git:clone'
12
+ # ...
13
+ #
14
+ # to :launch do
15
+ # ...
16
+ # invoke :'passenger:restart'
17
+ # end
18
+ # end
19
+ # end
20
+
21
+ require 'mina/bundler'
22
+ require 'mina/rails'
23
+
24
+
25
+ # ## Settings
26
+ # Any and all of these settings can be overriden in your `deploy.rb`.
27
+
28
+ set_default :passenger_file, "#{deploy_to}/tmp/restart.txt"
29
+
30
+ namespace :passenger do
31
+
32
+ desc "Restarts Passenger"
33
+ task :restart do
34
+ queue "touch #{passenger_file}"
35
+ end
36
+
37
+
38
+ end
@@ -0,0 +1,109 @@
1
+ # # Modules: Sidekiq
2
+ # Adds settings and tasks for managing Sidekiq workers.
3
+ #
4
+ # ## Usage example
5
+ # require 'mina_extensions/sidekiq'
6
+ # ...
7
+ #
8
+ # task :deploy => :enviroment do
9
+ # deploy do
10
+ # invoke :'sidekiq:quiet'
11
+ # invoke :'git:clone'
12
+ # ...
13
+ #
14
+ # to :launch do
15
+ # ...
16
+ # invoke :'sidekiq:restart'
17
+ # end
18
+ # end
19
+ # end
20
+
21
+ require 'mina/bundler'
22
+ require 'mina/rails'
23
+
24
+ # ## Settings
25
+ # Any and all of these settings can be overriden in your `deploy.rb`.
26
+
27
+ # ### sidekiq
28
+ # Sets the path to sidekiq.
29
+ set_default :sidekiq, lambda { "#{bundle_bin} exec sidekiq" }
30
+
31
+ # ### sidekiqctl
32
+ # Sets the path to sidekiqctl.
33
+ set_default :sidekiqctl, lambda { "#{bundle_prefix} sidekiqctl" }
34
+
35
+ # ### sidekiq_timeout
36
+ # Sets a upper limit of time a worker is allowed to finish, before it is killed.
37
+ set_default :sidekiq_timeout, 15
38
+
39
+ # ### sidekiq_config
40
+ # Sets the path to the configuration file of sidekiq
41
+ set_default :sidekiq_config, "config/sidekiq.yml"
42
+
43
+ # ### sidekiq_log
44
+ # Sets the path to the log file of sidekiq
45
+ #
46
+ # To disable logging set it to "/dev/null"
47
+ set_default :sidekiq_log, "log/sidekiq.log"
48
+
49
+ # ### sidekiq_pid
50
+ # Sets the path to the pid file of a sidekiq worker
51
+ set_default :sidekiq_pid, lambda { "#{deploy_to}/#{shared_path}/tmp/pids/sidekiq.pid" }
52
+
53
+ # ## Control Tasks
54
+ namespace :sidekiq do
55
+
56
+
57
+
58
+ # ### sidekiq:quiet
59
+ desc "Quiet sidekiq (stop accepting new work)"
60
+ task :quiet do
61
+ queue %[
62
+ if [ -f #{sidekiq_pid} ]
63
+ then
64
+ echo "-----> Quiet sidekiq (stop accepting new work)"
65
+ #{echo_cmd %{(cd #{deploy_to}/#{current_path} && #{sidekiqctl} quiet #{sidekiq_pid})} }
66
+ else
67
+ echo "! ERROR: sidekiq:quiet failed."
68
+ echo "! File #{sidekiq_pid} does not exist."
69
+ fi
70
+ ]
71
+ end
72
+
73
+ # ### sidekiq:stop
74
+ desc "Stop sidekiq"
75
+ task :stop do
76
+ queue %[
77
+ if [ -f #{sidekiq_pid} ]
78
+ then
79
+ echo "-----> Stop sidekiq"
80
+ #{echo_cmd %[(cd #{deploy_to}/#{current_path} && #{sidekiqctl} stop #{sidekiq_pid} #{sidekiq_timeout})]}
81
+ else
82
+ echo "! ERROR: sidekiq:stop failed."
83
+ echo "! File #{sidekiq_pid} does not exist."
84
+ fi
85
+ ]
86
+ end
87
+
88
+ # ### sidekiq:start
89
+ desc "Start sidekiq"
90
+ task :start do
91
+ queue %[
92
+ if [ -f #{deploy_to}/#{current_path}/#{sidekiq_config} ]
93
+ then
94
+ echo "-----> Start sidekiq"
95
+ #{echo_cmd %[(cd #{deploy_to}/#{current_path}; nohup #{sidekiq} -e #{rails_env} -C #{sidekiq_config} -P #{sidekiq_pid} >> #{sidekiq_log} 2>&1 </dev/null &) ] }
96
+ else
97
+ echo "! ERROR: sidekiq:start failed."
98
+ echo "! File #{sidekiq_config} does not exist."
99
+ fi
100
+ ]
101
+ end
102
+
103
+ # ### sidekiq:restart
104
+ desc "Restart sidekiq"
105
+ task :restart do
106
+ invoke :'sidekiq:stop'
107
+ invoke :'sidekiq:start'
108
+ end
109
+ end
@@ -0,0 +1,3 @@
1
+ module MinaExtensions
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "mina_extensions/version"
2
+
3
+ module MinaExtensions
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina_extensions/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "mina_extensions"
8
+ gem.version = MinaExtensions::VERSION
9
+ gem.authors = ["marcosbeirigo"]
10
+ gem.email = ["marcosbeirigo@gmail.com"]
11
+ gem.description = "Set of mina extension tasks"
12
+ gem.summary = "Set of mina extension tasks"
13
+ gem.homepage = "https://github.com/marcosbeirigo/mina_extensions"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina_extensions
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - marcosbeirigo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Set of mina extension tasks
15
+ email:
16
+ - marcosbeirigo@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - .rvmrc
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/mina_extensions.rb
28
+ - lib/mina_extensions/passenger.rb
29
+ - lib/mina_extensions/sidekiq.rb
30
+ - lib/mina_extensions/version.rb
31
+ - mina_extensions.gemspec
32
+ homepage: https://github.com/marcosbeirigo/mina_extensions
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.24
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Set of mina extension tasks
56
+ test_files: []