rt_capistrano 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +64 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/lib/rt_capistrano.rb +43 -0
- data/test/helper.rb +10 -0
- data/test/test_rt_capistrano.rb +7 -0
- metadata +104 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Andrew Porter
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
= rt_capistrano
|
2
|
+
|
3
|
+
rt_capistrano is based on the mt-capistrano gem (0.0.5). 'after' methods were
|
4
|
+
added to streamline the setup and deployment of Rails apps on (mt) Media Temple's
|
5
|
+
(gs) Grid-Server Ruby on Rails container. This gem makes it as easy as entering the following
|
6
|
+
commands for initial deployment without having to execute any 'mtr' commands in between:
|
7
|
+
|
8
|
+
cap deploy:setup
|
9
|
+
cap deploy:cold
|
10
|
+
|
11
|
+
|
12
|
+
Install
|
13
|
+
=======
|
14
|
+
|
15
|
+
gem install rt_capistrano
|
16
|
+
|
17
|
+
|
18
|
+
Example
|
19
|
+
=======
|
20
|
+
|
21
|
+
## Sample config/deploy.rb file:
|
22
|
+
|
23
|
+
require 'rt_capistrano'
|
24
|
+
|
25
|
+
set :site, "00000"
|
26
|
+
set :application, "app_name"
|
27
|
+
set :webpath, "app_name.your_domain.com"
|
28
|
+
set :domain, "your_domain.com"
|
29
|
+
set :user, "serveradmin%your_domain.com"
|
30
|
+
set :password, "serveradmin_password"
|
31
|
+
|
32
|
+
# repository elsewhere
|
33
|
+
set :scm, :git
|
34
|
+
set :repository, "your_git_repository"
|
35
|
+
set :branch, "master"
|
36
|
+
set :deploy_via, :remote_cache
|
37
|
+
|
38
|
+
# these shouldn't be changed
|
39
|
+
role :web, "#{domain}"
|
40
|
+
role :app, "#{domain}"
|
41
|
+
role :db, "#{domain}", :primary => true
|
42
|
+
set :deploy_to, "/home/#{site}/containers/rails/#{application}"
|
43
|
+
|
44
|
+
|
45
|
+
namespace :deploy do
|
46
|
+
desc "Creates the database configuration file in the application's config directory."
|
47
|
+
task :update_config, :roles => :app do
|
48
|
+
database_yml = <<-CMD
|
49
|
+
production:
|
50
|
+
adapter: mysql
|
51
|
+
database: your_production_database
|
52
|
+
username: your_database_username
|
53
|
+
password: your_database_password
|
54
|
+
host: your_internal_database_url
|
55
|
+
CMD
|
56
|
+
put database_yml, "#{release_path}/config/database.yml"
|
57
|
+
end
|
58
|
+
after "deploy:update_code", "deploy:update_config"
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
== Copyright
|
63
|
+
|
64
|
+
Copyright (c) 2008 Andrew Porter. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "rt_capistrano"
|
8
|
+
gem.summary = %Q{Simple Capistrano deployment on (mt) Media Temple}
|
9
|
+
gem.description = %Q{Use native capistrano tasks with Media Temple's (gs) Grid-Service accounts.}
|
10
|
+
gem.email = "partydrone@me.com"
|
11
|
+
gem.homepage = "http://github.com/partydrone/rt_capistrano"
|
12
|
+
gem.authors = ["Andrew Porter"]
|
13
|
+
gem.add_dependency "capistrano", ">= 0"
|
14
|
+
gem.add_development_dependency "shoulda", ">= 0"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
Rake::TestTask.new(:test) do |test|
|
24
|
+
test.libs << 'lib' << 'test'
|
25
|
+
test.pattern = 'test/**/test_*.rb'
|
26
|
+
test.verbose = true
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'rcov/rcovtask'
|
31
|
+
Rcov::RcovTask.new do |test|
|
32
|
+
test.libs << 'test'
|
33
|
+
test.pattern = 'test/**/test_*.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
task :rcov do
|
38
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
task :test => :check_dependencies
|
43
|
+
|
44
|
+
task :default => :test
|
45
|
+
|
46
|
+
require 'rake/rdoctask'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "rt_capistrano #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
2
|
+
set(:rake) { "PATH=$PATH:/home/#{site}/data/rubygems/bin:/home/#{site}/data/rubygems/gems/bin RUBYLIB=/home/#{site}/data/rubygems/local/lib/site_ruby/1.8:/home/#{site}/data/rubygems/lib GEM_HOME=/home/#{site}/data/rubygems/gems rake" }
|
3
|
+
|
4
|
+
# Set up the mt namespace and tasks
|
5
|
+
namespace :mt do
|
6
|
+
|
7
|
+
desc "Register the application with the (gs) Container using 'mtr add'."
|
8
|
+
task :add do
|
9
|
+
run "mtr -u #{user} -p #{password} add #{application} #{deploy_to}/current #{webpath}"
|
10
|
+
end
|
11
|
+
|
12
|
+
%w{remove start stop restart create_link generate_htaccess info}.each do |command|
|
13
|
+
desc "Runs 'mtr #{command} <appname>' on the (gs) Container."
|
14
|
+
task command.to_sym do
|
15
|
+
run "mtr -u #{user} -p #{password} #{command} #{application}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
%w{list status}.each do |command|
|
20
|
+
desc "Runs 'mtr #{command}' on the (gs) Container."
|
21
|
+
task command.to_sym do
|
22
|
+
run "mtr -u #{user} -p #{password} #{command}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Add a little automation to the process.
|
27
|
+
after "deploy:setup", "mt:add"
|
28
|
+
after "mt:generate_htaccess", "mt:create_link"
|
29
|
+
after "deploy:symlink", "mt:generate_htaccess"
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :deploy do
|
34
|
+
|
35
|
+
%w{start stop restart}.each do |command|
|
36
|
+
desc "#{command.capitalize} the application on the (gs) Container."
|
37
|
+
task command.to_sym do
|
38
|
+
mt.send(command)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/test/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rt_capistrano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andrew Porter
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-04 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: capistrano
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: shoulda
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
description: Use native capistrano tasks with Media Temple's (gs) Grid-Service accounts.
|
50
|
+
email: partydrone@me.com
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files:
|
56
|
+
- LICENSE
|
57
|
+
- README.rdoc
|
58
|
+
files:
|
59
|
+
- .document
|
60
|
+
- .gitignore
|
61
|
+
- LICENSE
|
62
|
+
- README.rdoc
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- lib/rt_capistrano.rb
|
66
|
+
- test/helper.rb
|
67
|
+
- test/test_rt_capistrano.rb
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://github.com/partydrone/rt_capistrano
|
70
|
+
licenses: []
|
71
|
+
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options:
|
74
|
+
- --charset=UTF-8
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
requirements: []
|
96
|
+
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 1.3.7
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Simple Capistrano deployment on (mt) Media Temple
|
102
|
+
test_files:
|
103
|
+
- test/helper.rb
|
104
|
+
- test/test_rt_capistrano.rb
|