capedia 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capedia.rb +15 -0
- data/lib/capedia/active_messaging.rb +24 -0
- data/lib/capedia/config.rb +30 -0
- data/lib/capedia/crontab.rb +13 -0
- data/lib/capedia/gems.rb +16 -0
- data/lib/capedia/passenger.rb +13 -0
- data/lib/capedia/rails.rb +7 -0
- data/lib/capedia/rails_gems_install.rb +14 -0
- data/lib/capedia/rails_setup.rb +18 -0
- metadata +75 -0
data/lib/capedia.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Capedia
|
2
|
+
VERSION = '0.0.1'
|
3
|
+
|
4
|
+
module Gem
|
5
|
+
|
6
|
+
def install(gem_name, version = nil)
|
7
|
+
version_cmd = version.nil? ? '' : "-v=#{version}"
|
8
|
+
run "#{try_sudo} gem install #{gem_name} #{version_cmd} --no-ri --no-rdoc"
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
Capistrano.plugin :gem, Capedia::Gem
|
@@ -0,0 +1,24 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
namespace :pollers do
|
4
|
+
|
5
|
+
task :start, :roles => :app do
|
6
|
+
fetch(:poller_count, 0).times do
|
7
|
+
run "#{current_path}/script/poller start"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
task :stop, :roles => :app do
|
12
|
+
run "#{current_path}/script/poller stop"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :restart, :roles => :app do
|
16
|
+
deploy.pollers.stop
|
17
|
+
deploy.pollers.start
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
after 'deploy:restart', 'deploy:pollers:restart'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
namespace :config do
|
4
|
+
|
5
|
+
desc 'Creates shared config files using templates stored in the deploy/config'
|
6
|
+
task :setup, :except => { :no_release => true } do
|
7
|
+
files = fetch(:config_files, [])
|
8
|
+
unless files.empty?
|
9
|
+
run "mkdir -p #{shared_path}/config"
|
10
|
+
files.each do |file|
|
11
|
+
template = File.join('config', 'deploy', 'config', "#{file}.erb")
|
12
|
+
raise "Template for #{file} does not exist" unless File.exists?(template)
|
13
|
+
put ERB.new(File.read(template)).result(binding), "#{shared_path}/config/#{file}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Symlink shared config files to current release.'
|
19
|
+
task :symlink, :except => { :no_release => true } do
|
20
|
+
fetch(:config_files, []).each do |file|
|
21
|
+
run "ln -nfs #{shared_path}/config/#{file} #{release_path}/config/#{file}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
after 'deploy:setup', 'deploy:config:setup'
|
30
|
+
after 'deploy:symlink', 'deploy:config:symlink'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
desc 'Updates the crontab for each role where a crontab file exists in config/crontab/<stage>/<role>.crontab'
|
4
|
+
task :crontab, :except => { :no_release => true } do
|
5
|
+
roles.each do |role|
|
6
|
+
crontab_file = "#{current_path}/config/crontab/#{fetch(:stage)}/#{role[0]}.crontab"
|
7
|
+
run "if [ -f #{crontab_file} ]; then crontab #{crontab_file}; fi", :roles => role[0]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
after 'deploy:restart', 'deploy:crontab'
|
data/lib/capedia/gems.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
namespace :gems do
|
4
|
+
|
5
|
+
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.)'
|
6
|
+
task :setup, :except => { :no_release => true } do
|
7
|
+
fetch(:setup_gems, {}).each do |gem_name, version|
|
8
|
+
gem.install gem_name, version
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
after 'deploy:setup', 'deploy:gems:setup'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
namespace :gems do
|
4
|
+
|
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
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
after 'deploy:symlink', 'deploy:gems:install'
|
@@ -0,0 +1,18 @@
|
|
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'
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capedia
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Wilson
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-11 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: "\n A collection of capistrano plugins and recipes. Recipes include passenger, pre installing gems like bundler, \n installing gems (i.e. rake gems:install), symlinking config files, updating crontab, and more ...\n "
|
23
|
+
email: rwilson@corpedia.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/capedia/active_messaging.rb
|
32
|
+
- lib/capedia/config.rb
|
33
|
+
- lib/capedia/crontab.rb
|
34
|
+
- lib/capedia/gems.rb
|
35
|
+
- lib/capedia/passenger.rb
|
36
|
+
- lib/capedia/rails.rb
|
37
|
+
- lib/capedia/rails_gems_install.rb
|
38
|
+
- lib/capedia/rails_setup.rb
|
39
|
+
- lib/capedia.rb
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: ""
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project: ""
|
70
|
+
rubygems_version: 1.3.7
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: Common capistrano plugins and recipes
|
74
|
+
test_files: []
|
75
|
+
|