xendeploy 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ h1. XEN:Deploy
2
+
3
+ A collection of recipes, tasks, and strategies for managing non-rails applications specifically WordPress, WP-MU and BuddyPress.
4
+
5
+ <hr />
6
+
7
+ h2. Install
8
+
9
+ *Dependencies*
10
+
11
+ *railsless-deploy*
12
+ For making the default tasks a bit more app agnostic.
13
+ <code>gem install railsless-deploy -s http://gemcutter.org</code>
14
+
15
+ *capistrano-ext*
16
+ For doing multistage configurations
17
+
18
+ h3. Use
19
+
20
+ XEN:Deploy ships with its own capify script. This script should be run from the root of your application. It will create a standard enough Capfile, but put the deploy.rb script in "_assets/" instead of config.
21
+
22
+ h4. Configuration
23
+
24
+ Configure your deployment in deploy.rb, setting the values of the symbols there-in.
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'fileutils'
5
+
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: #{File.basename($0)} [path]"
8
+
9
+ opts.on("-h", "--help", "Displays this help info") do
10
+ puts opts
11
+ exit 0
12
+ end
13
+
14
+ begin
15
+ opts.parse!(ARGV)
16
+ rescue OptionParser::ParseError => e
17
+ warn e.message
18
+ puts opts
19
+ exit 1
20
+ end
21
+ end
22
+
23
+ if ARGV.empty?
24
+ abort "Please specify the directory to xenify, e.g. `#{File.basename($0)} .'"
25
+ elsif !File.exists?(ARGV.first)
26
+ abort "`#{ARGV.first}' does not exist."
27
+ elsif !File.directory?(ARGV.first)
28
+ abort "`#{ARGV.first}' is not a directory."
29
+ elsif ARGV.length > 1
30
+ abort "Too many arguments; please specify only the directory to xenify."
31
+ end
32
+
33
+ def unindent(string)
34
+ indentation = string[/\A\s*/]
35
+ string.strip.gsub(/^#{indentation}/, "")
36
+ end
37
+
38
+ def writefile(file,content)
39
+ puts "[add] writing `#{file}'"
40
+ File.open(file, "w") { |f| f.write(content) }
41
+ end
42
+
43
+ files = {
44
+ "Capfile" => unindent(<<-FILE),
45
+ load 'deploy' if respond_to?(:namespace) # cap2 differentiator
46
+ load '_assets/deploy'
47
+ require 'rubygems'
48
+ require 'railsless-deploy'
49
+
50
+ FILE
51
+
52
+ "_assets/deploy/prod.rb" => unindent(<<-FILE),
53
+ set :application, ""
54
+ set :homeuser, ""
55
+ set :location, "/home/\#{homeuser}/www/\#{application}"
56
+ set :deploy_to, "\#{location}/.deploy"
57
+
58
+ set :repository, ""
59
+ set :scm, :subversion
60
+ set :scm_verbose, true
61
+
62
+ # uncomment these lines if you have a multi-tier set up
63
+ # role :app, "your app-server here"
64
+ # role :web, "your web-server here"
65
+ # role :db, "your db-server here", :primary => true
66
+
67
+ # if everything's on one server, then it will use the application value
68
+ server application, :app, :web, :db, :primary => true
69
+
70
+ # set your db credentials for dumping and restoring sql files
71
+ set :dbname, ""
72
+ set :dbuser, ""
73
+
74
+ # this should make it a bit easier to use your public key on all your servers
75
+ set :ssh_options, { :forward_agent => true }
76
+ ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")]
77
+
78
+ FILE
79
+ }
80
+
81
+ base = ARGV.shift
82
+ files.each do |file, content|
83
+ file = File.join(base, file)
84
+ if File.exists?(file)
85
+ warn "[skip] `#{file}' already exists"
86
+ elsif File.exists?(file.downcase)
87
+ warn "[skip] `#{file.downcase}' exists, which could conflict with `#{file}'"
88
+ elsif !File.exists?(File.dirname(file))
89
+ FileUtils.mkdir(File.dirname(file))
90
+ warn "[add] directory `#{File.dirname(file)}' did not exist. created."
91
+ writefile(file,content)
92
+ else
93
+ writefile(file,content)
94
+ end
95
+ end
96
+
97
+ puts "[done] xenified!"
File without changes
@@ -0,0 +1,7 @@
1
+ unless Capistrano::Configuration.respond_to?(:instance)
2
+ abort "xen:deploy requires Capistrano 2"
3
+ end
4
+
5
+ require "#{File.dirname(__FILE__)}/xen/deploy"
6
+ require "#{File.dirname(__FILE__)}/xen/server"
7
+ require "#{File.dirname(__FILE__)}/xen/build"
@@ -0,0 +1,3 @@
1
+ unless Capistrano::Configuration.respond_to?(:instance)
2
+ abort "xen:deploy requires Capistrano 2"
3
+ end
@@ -0,0 +1,32 @@
1
+ # require 'capistrano'
2
+ #
3
+ # unless Capistrano::Configuration.respond_to?(:instance)
4
+ # abort "xen:deploy requires Capistrano 2"
5
+ # end
6
+
7
+ namespace :xen do
8
+ namepace :deploy do
9
+
10
+ task :default do
11
+ update
12
+ update_code
13
+ strategy.deploy!
14
+ finalize_update
15
+ symlink
16
+ restart
17
+ end
18
+
19
+ desc "Symlinks the current release to the public directory"
20
+ task :makepublic, :roles => :app do
21
+ run "rm -f #{location}/public && ln -nfs #{deploy_to}/current #{location}/public"
22
+ end
23
+
24
+ namespace :wordpress do
25
+ desc "Symlink the uploads folder"
26
+ task :uploads, :roles => :app do
27
+ run "ln -nfs #{deploy_to}/#{shared_dir}/uploads #{deploy_to}/current/wp-content/uploads"
28
+ end
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,57 @@
1
+ # require 'capistrano'
2
+ #
3
+ # unless Capistrano::Configuration.respond_to?(:instance)
4
+ # abort "xen:deploy requires Capistrano 2"
5
+ # end
6
+ #
7
+ # namespace :xen do
8
+ # namespace :server do
9
+ #
10
+ # namespace :apache do
11
+ # task :restart, :roles => :web do
12
+ # sudo "/etc/init.d/apache restart"
13
+ # end
14
+ # end
15
+ #
16
+ # namespace :nginx do
17
+ # task :restart, :roles => :web do
18
+ # sudo "/etc/init.d/nginx restart"
19
+ # end
20
+ # end
21
+ #
22
+ # namespace :php do
23
+ # task :restart, :roles => :cache do
24
+ # sudo "/etc/init.d/php-fcgi restart"
25
+ # end
26
+ # end
27
+ #
28
+ # namespace :cache do
29
+ # namespace :squid do
30
+ # task :restart, :roles => :cache do
31
+ # sudo "/etc/init.d/squid restart"
32
+ # end
33
+ # end
34
+ #
35
+ # namespace :memcached do
36
+ # task :restart, :roles => :cache do
37
+ # sudo "/etc/init.d/memcached restart"
38
+ # end
39
+ # end
40
+ # end
41
+ #
42
+ # namespace :mysql do
43
+ # task :restart, :roles => db do
44
+ # sudo "/etc/init.d/mysql restart"
45
+ # end
46
+ #
47
+ # task :backup, :roles => db do
48
+ # run "mysqldump --add-drop-database #{dbname} > #{shared_path}/sql/#{dbname}-#{release_name}.sql"
49
+ # end
50
+ #
51
+ # task :restore, :roles =>db do
52
+ # run "mysql -u #{dbuser} -p < #{shared_path}/sql/#{dbname}-#{release_name}.sql"
53
+ # end
54
+ # end
55
+ #
56
+ # end
57
+ # end
@@ -0,0 +1,5 @@
1
+ unless Capistrano::Configuration.respond_to?(:instance)
2
+ abort "xen:deploy requires Capistrano 2"
3
+ end
4
+
5
+ require "#{File.dirname(__FILE__)}/recipes/xen"
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xendeploy
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Eric Marden
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-02 00:00:00 -06:00
13
+ default_executable: xenify
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: capistrano
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 2.5.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: deprec
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.5
34
+ version:
35
+ description: |
36
+ Building on the backs of Capistrano and Deprec, this is a collection of Recipes and other customizations for managing non-rails applications, specifically WordPress, WordPress-MU, and BuddyPress.
37
+
38
+ email: ruby@xentek.net
39
+ executables:
40
+ - xenify
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - bin/xenify
47
+ - docs/empty
48
+ - lib/recipes/xen/build.rb
49
+ - lib/recipes/xen/deploy.rb
50
+ - lib/recipes/xen/server.rb
51
+ - lib/recipes/xen.rb
52
+ - lib/xendeploy.rb
53
+ - README.textile
54
+ has_rdoc: true
55
+ homepage: http://xentek.net/
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ requirements: []
76
+
77
+ rubyforge_project:
78
+ rubygems_version: 1.3.5
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: custom recipes for capistrano+deprec
82
+ test_files: []
83
+