capedia 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capedia/active_messaging.rb +18 -14
- data/lib/capedia/config.rb +25 -21
- data/lib/capedia/crontab.rb +12 -8
- data/lib/capedia/gems.rb +12 -8
- data/lib/capedia/passenger.rb +11 -7
- data/lib/capedia/rails.rb +4 -3
- data/lib/capedia/rails_gems_install.rb +11 -7
- data/lib/capedia.rb +3 -3
- metadata +3 -4
- data/lib/capedia/rails_setup.rb +0 -18
@@ -1,24 +1,28 @@
|
|
1
|
-
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
|
-
namespace :
|
3
|
+
namespace :deploy do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
namespace :pollers do
|
6
|
+
|
7
|
+
task :start, :roles => :app do
|
8
|
+
fetch(:poller_count, 0).times do
|
9
|
+
run "#{current_path}/script/poller start"
|
10
|
+
end
|
8
11
|
end
|
9
|
-
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
task :stop, :roles => :app do
|
14
|
+
run "#{current_path}/script/poller stop"
|
15
|
+
end
|
16
|
+
|
17
|
+
task :restart, :roles => :app do
|
18
|
+
deploy.pollers.stop
|
19
|
+
deploy.pollers.start
|
20
|
+
end
|
14
21
|
|
15
|
-
task :restart, :roles => :app do
|
16
|
-
deploy.pollers.stop
|
17
|
-
deploy.pollers.start
|
18
22
|
end
|
19
23
|
|
20
24
|
end
|
21
25
|
|
22
|
-
|
26
|
+
after 'deploy:restart', 'deploy:pollers:restart'
|
23
27
|
|
24
|
-
|
28
|
+
end
|
data/lib/capedia/config.rb
CHANGED
@@ -1,30 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
namespace :
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
files
|
8
|
-
|
9
|
-
|
10
|
-
files.
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
namespace :deploy do
|
4
|
+
|
5
|
+
namespace :config do
|
6
|
+
|
7
|
+
desc 'Creates shared config files using templates stored in the deploy/config'
|
8
|
+
task :setup, :except => { :no_release => true } do
|
9
|
+
files = fetch(:config_files, [])
|
10
|
+
unless files.empty?
|
11
|
+
run "mkdir -p #{shared_path}/config"
|
12
|
+
files.each do |file|
|
13
|
+
template = File.join('config', 'deploy', 'config', "#{file}.erb")
|
14
|
+
raise "Template for #{file} does not exist" unless File.exists?(template)
|
15
|
+
put ERB.new(File.read(template)).result(binding), "#{shared_path}/config/#{file}"
|
16
|
+
end
|
14
17
|
end
|
15
18
|
end
|
16
|
-
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
desc 'Symlink shared config files to current release.'
|
21
|
+
task :symlink, :except => { :no_release => true } do
|
22
|
+
fetch(:config_files, []).each do |file|
|
23
|
+
run "ln -nfs #{shared_path}/config/#{file} #{release_path}/config/#{file}"
|
24
|
+
end
|
22
25
|
end
|
26
|
+
|
23
27
|
end
|
24
28
|
|
25
29
|
end
|
26
30
|
|
27
|
-
|
31
|
+
after 'deploy:setup', 'deploy:config:setup'
|
32
|
+
after 'deploy:symlink', 'deploy:config:symlink'
|
28
33
|
|
29
|
-
|
30
|
-
after 'deploy:symlink', 'deploy:config:symlink'
|
34
|
+
end
|
data/lib/capedia/crontab.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
namespace :deploy do
|
4
|
+
|
5
|
+
desc 'Updates the crontab for each role where a crontab file exists in config/crontab/<stage>/<role>.crontab'
|
6
|
+
task :crontab, :except => { :no_release => true } do
|
7
|
+
roles.each do |role|
|
8
|
+
crontab_file = "#{current_path}/config/crontab/#{fetch(:stage)}/#{role[0]}.crontab"
|
9
|
+
run "if [ -f #{crontab_file} ]; then crontab #{crontab_file}; fi", :roles => role[0]
|
10
|
+
end
|
8
11
|
end
|
12
|
+
|
9
13
|
end
|
10
14
|
|
11
|
-
|
15
|
+
after 'deploy:restart', 'deploy:crontab'
|
12
16
|
|
13
|
-
|
17
|
+
end
|
data/lib/capedia/gems.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
-
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
|
-
namespace :
|
3
|
+
namespace :deploy do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
namespace :gems do
|
6
|
+
|
7
|
+
desc 'One time gem install for gems that need to be installed before a gem autoinstaller can be invoked (i.e. bundler, rails db adapters, etc.)'
|
8
|
+
task :setup, :except => { :no_release => true } do
|
9
|
+
fetch(:setup_gems, {}).each do |gem_name, version|
|
10
|
+
ruby_gems.install gem_name, version
|
11
|
+
end
|
9
12
|
end
|
13
|
+
|
10
14
|
end
|
11
15
|
|
12
16
|
end
|
13
17
|
|
14
|
-
|
18
|
+
after 'deploy:setup', 'deploy:gems:setup'
|
15
19
|
|
16
|
-
|
20
|
+
end
|
data/lib/capedia/passenger.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
|
-
|
4
|
-
end
|
3
|
+
namespace :deploy do
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
task :start do
|
6
|
+
end
|
7
|
+
|
8
|
+
task :stop do
|
9
|
+
end
|
10
|
+
|
11
|
+
task :restart, :roles => :web, :except => { :no_release => true } do
|
12
|
+
run "#{try_sudo} touch #{File.join(current_path, 'tmp', 'restart.txt')}"
|
13
|
+
end
|
8
14
|
|
9
|
-
task :restart, :roles => :web, :except => { :no_release => true } do
|
10
|
-
run "#{try_sudo} touch #{File.join(current_path, 'tmp', 'restart.txt')}"
|
11
15
|
end
|
12
16
|
|
13
17
|
end
|
data/lib/capedia/rails.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'capedia/config'
|
2
2
|
require 'capedia/gems'
|
3
|
-
require 'capedia/rails_setup'
|
4
3
|
require 'capedia/rails_gems_install'
|
5
4
|
|
6
|
-
|
7
|
-
after 'deploy:
|
5
|
+
Capistrano::Configuration.instance.load do
|
6
|
+
after 'deploy:gems:install', 'deploy:migrate'
|
7
|
+
after 'deploy:restart', 'deploy:cleanup'
|
8
|
+
end
|
@@ -1,14 +1,18 @@
|
|
1
|
-
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
|
-
namespace :
|
3
|
+
namespace :deploy do
|
4
|
+
|
5
|
+
namespace :gems do
|
6
|
+
|
7
|
+
desc 'Installs all gems for the current release (uses rake gems:install)'
|
8
|
+
task :install, :except => { :no_release => true } do
|
9
|
+
run "cd #{current_path}; rake gems:install"
|
10
|
+
end
|
4
11
|
|
5
|
-
desc 'Installs all gems for the current release (uses rake gems:install)'
|
6
|
-
task :install, :except => { :no_release => true } do
|
7
|
-
run "cd #{current_path}; rake gems:install"
|
8
12
|
end
|
9
13
|
|
10
14
|
end
|
11
15
|
|
12
|
-
|
16
|
+
after 'deploy:symlink', 'deploy:gems:install'
|
13
17
|
|
14
|
-
|
18
|
+
end
|
data/lib/capedia.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Capedia
|
2
|
-
VERSION = '0.0.
|
2
|
+
VERSION = '0.0.2'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Gems
|
5
5
|
|
6
6
|
def install(gem_name, version = nil)
|
7
7
|
version_cmd = version.nil? ? '' : "-v=#{version}"
|
@@ -12,4 +12,4 @@ module Capedia
|
|
12
12
|
|
13
13
|
end
|
14
14
|
|
15
|
-
Capistrano.plugin :
|
15
|
+
Capistrano.plugin :ruby_gems, Capedia::Gems
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capedia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Wilson
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- lib/capedia/passenger.rb
|
36
36
|
- lib/capedia/rails.rb
|
37
37
|
- lib/capedia/rails_gems_install.rb
|
38
|
-
- lib/capedia/rails_setup.rb
|
39
38
|
- lib/capedia.rb
|
40
39
|
has_rdoc: true
|
41
40
|
homepage: ""
|
data/lib/capedia/rails_setup.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
namespace :deploy do
|
2
|
-
|
3
|
-
namespace :rails do
|
4
|
-
|
5
|
-
desc 'Installs rails gem and other gems that cannot be installed via rake gems:install'
|
6
|
-
task :setup do
|
7
|
-
if File.read(File.join(File.dirname(__FILE__), 'environment.rb')).match(/RAILS_GEM_VERSION = '(\d+.\d+.\d+)'/)
|
8
|
-
gem.install 'rails', $1
|
9
|
-
else
|
10
|
-
raise 'Could not install rails gem because the gem version could not be detected'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
after 'deploy:setup', 'deploy:rails:setup'
|