Skip to content

Commit

Permalink
fixes for sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel committed Feb 24, 2008
1 parent f4757bd commit f2df06b
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 675 deletions.
39 changes: 28 additions & 11 deletions Manifest.txt
Expand Up @@ -7,25 +7,47 @@ Rakefile
bin/capitate
config/hoe.rb
config/requirements.rb
docs/nginx.README
docs/recipes/centos.txt
docs/recipes/deploy-pending.txt
docs/recipes/deploy-web.txt
docs/recipes/deploy.txt
docs/recipes/docs.txt
docs/recipes/imagemagick-centos.txt
docs/recipes/imagemagick.txt
docs/recipes/index.txt
docs/recipes/memcached-centos.txt
docs/recipes/memcached.txt
docs/recipes/mongrel_cluster-centos.txt
docs/recipes/mongrel_cluster.txt
docs/recipes/monit-centos.txt
docs/recipes/monit.txt
docs/recipes/mysql-centos.txt
docs/recipes/mysql.txt
docs/recipes/nginx-centos.txt
docs/recipes/nginx.txt
docs/recipes/rails.txt
docs/recipes/ruby-centos.txt
docs/recipes/ruby.txt
docs/recipes/sphinx-centos.txt
docs/recipes/sphinx.txt
lib/capitate.rb
lib/capitate/cap_ext/connections.rb
lib/capitate/cap_ext/extension_proxy.rb
lib/capitate/cap_ext/run_via.rb
lib/capitate/cap_ext/variables.rb
lib/capitate/plugins/base.rb
lib/capitate/plugins/gem.rb
lib/capitate/plugins/package.rb
lib/capitate/plugins/profiles.rb
lib/capitate/plugins/prompt.rb
lib/capitate/plugins/script.rb
lib/capitate/plugins/templates.rb
lib/capitate/plugins/upload.rb
lib/capitate/plugins/wget.rb
lib/capitate/plugins/yum.rb
lib/capitate/recipes.rb
lib/capitate/task_node.rb
lib/capitate/version.rb
lib/profiles/centos-sick.rb
lib/recipes/README
lib/recipes/centos/README
lib/deployment/deploy.rb
lib/deployment/install-centos-rubyweb.rb
lib/recipes/centos/centos.rb
lib/recipes/centos/imagemagick.rb
lib/recipes/centos/memcached.rb
Expand All @@ -37,18 +59,13 @@ lib/recipes/centos/ruby.rb
lib/recipes/centos/sphinx.rb
lib/recipes/deploy.rb
lib/recipes/docs.rb
lib/recipes/gems.rb
lib/recipes/memcached.rb
lib/recipes/mongrel_cluster.rb
lib/recipes/mysql.rb
lib/recipes/nginx.rb
lib/recipes/packages.rb
lib/recipes/rails.rb
lib/recipes/recipes.rb
lib/recipes/sphinx.rb
lib/templates/capistrano/Capfile
lib/templates/centos/setup_for_web.sh
lib/templates/centos/sudoers
lib/templates/memcached/memcached.initd.centos.erb
lib/templates/memcached/memcached.monitrc.erb
lib/templates/mongrel/mongrel_cluster.initd.erb
Expand Down
67 changes: 14 additions & 53 deletions bin/capitate
@@ -1,69 +1,30 @@
#!/usr/bin/env ruby

require 'optparse'

OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [path]"

opts.on("-h", "--help", "Displays this help info") do
puts opts
exit 0
end

begin
opts.parse!(ARGV)
rescue OptionParser::ParseError => e
warn e.message
puts opts
exit 1
end
end

begin
require 'capitate'
rescue LoadError
require 'rubygems'
require 'capitate'
require 'capitate'
end

require 'capistrano/cli'

class CapitateBin
class << self
include Capitate::Plugins::Templates
end
end

if ARGV.empty?
abort "Please specify the directory to capify, e.g. `#{File.basename($0)} .'"
elsif !File.exists?(ARGV.first)
abort "`#{ARGV.first}' does not exist."
elsif !File.directory?(ARGV.first)
abort "`#{ARGV.first}' is not a directory."
elsif ARGV.length > 1
abort "Too many arguments; please specify only the directory to capitate."
end
cli = Capistrano::CLI.new(ARGV)
cli.parse_options!

base = ARGV.shift
config = cli.instantiate_configuration
config.logger.level = cli.options[:verbose]

puts <<-EOS
cli.set_pre_vars(config)
cli.load_recipes(config)

Generating capistrano configuration...
config.load do
require 'capitate/recipes'
end

EOS
config.trigger(:load)
cli.execute_requested_actions(config)
config.trigger(:exit)

files = { "Capfile" => "capistrano/Capfile" }

files.each do |file, template|
file = File.join(base, file)
if File.exists?(file)
warn "`#{file}' already exists"
elsif File.exists?(file.downcase)
warn "`#{file.downcase}' exists, which could conflict with `#{file}'"
elsif !File.exists?(File.dirname(file))
warn "Directory `#{File.dirname(file)}' does not exist"
else
# Write Capfile
CapitateBin.write(template, file)
end
end

4 changes: 2 additions & 2 deletions config/hoe.rb
Expand Up @@ -55,7 +55,7 @@ def extra_deps
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
p.test_globs = ["test/**/test_*.rb"]
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
p.clean_globs += ['website/recipes/**', 'docs/recipes/**']
p.clean_globs += ['website/recipes/**']

# == Optional
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
Expand All @@ -69,4 +69,4 @@ def extra_deps
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
hoe.rsync_args = '-av --delete --ignore-errors'
hoe.rsync_args = '-av --delete --ignore-errors'
27 changes: 22 additions & 5 deletions lib/capitate/plugins/script.rb
Expand Up @@ -16,9 +16,12 @@ module Capitate::Plugins::Script
def make_install(name, options)
install(name, options) do |dir|
configure_options = options[:configure_options] || ""
run_via "echo 'Configuring #{name}...' && cd #{dir} && ./configure #{configure_options} > configure.log"
run_via "echo 'Compiling #{name}...' && cd #{dir} && make > make.log"
run_via "echo 'Installing #{name}...' && cd #{dir} && make install > make_install.log"

run_all <<-CMDS
echo 'Configuring #{name}...' && cd #{dir} && ./configure #{configure_options} > configure.log
echo 'Compiling #{name}...' && cd #{dir} && make > make.log
echo 'Installing #{name}...' && cd #{dir} && make install > make_install.log
CMDS
end
end

Expand Down Expand Up @@ -100,8 +103,10 @@ def unpack(url, dest, clean = true, unpack_dir = nil, &block)

unpack_dir ||= file.gsub(/\.tar\.gz|\.tgz/, "")

run_via "echo 'Getting #{url}...' && mkdir -p #{dest} && cd #{dest} && wget -nv #{url}"
run_via "echo 'Unpacking...' && cd #{dest} && tar zxf #{file}"
run_all <<-CMDS
echo 'Getting #{url}...' && mkdir -p #{dest} && cd #{dest} && wget -nv #{url}
run_via "echo 'Unpacking...' && cd #{dest} && tar zxf #{file}
CMDS

if block_given?
yield("#{dest}/#{unpack_dir}")
Expand All @@ -110,6 +115,18 @@ def unpack(url, dest, clean = true, unpack_dir = nil, &block)
end
end

# Run all commands (separated by newlines)
#
# ==== Options
# +cmds+:: Commands (separated by newlines)
# +options+:: See invoke_command options
#
def run_all(cmds, options = {}, &block)
cmds.split("\n").each do |cmd|
run_via(cmd, options, &block)
end
end

end

Capistrano.plugin :script, Capitate::Plugins::Script
4 changes: 2 additions & 2 deletions lib/capitate/version.rb
@@ -1,8 +1,8 @@
module Capitate #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 1
TINY = 9
MINOR = 2
TINY = 1

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down
4 changes: 1 addition & 3 deletions lib/deployment/deploy.rb
Expand Up @@ -10,10 +10,8 @@
set :web_host, "192.168.1.111"
set :db_host, "192.168.1.111"
set :db_user, "sick"
set :db_pass, "sick"
set :db_pass, prompt.password("DB Password: ")
set :db_name, "sick"
set :sphinx_host, "127.0.0.1"
set :sphinx_port, 3312
set :repository, "http://svn.ducktyper.com/scratch/testapp/trunk"
set :mongrel_port, 12000
set :mongrel_size, 3
Expand Down
21 changes: 13 additions & 8 deletions lib/deployment/install-centos-rubyweb.rb
Expand Up @@ -19,12 +19,17 @@
role :install, prompt.ask("Server: ") if find_servers_for_task(current_task).blank?

# Setup for web
script.sh("setup_for_web.sh")

# Install sudoers
put template.load("sudoers"), "/tmp/sudoers"
run "install -o root -m 440 /tmp/sudoers /etc/sudoers && rm -f /tmp/sudoers"

# * Add admin group
# * Change inittab to runlevel 3
# * Create web apps directory
# * Add admin group to suders ALL=(ALL) ALL
script.run_all <<-CMDS
egrep "^admin" /etc/group || /usr/sbin/groupadd admin
sed -i -e 's/^id:5:initdefault:/id:3:initdefault:/g' /etc/inittab
mkdir -p /var/www/apps
egrep "^%admin" /etc/sudoers || echo "%admin ALL=(ALL) ALL" > /etc/sudoers
CMDS

# Package installs
yum.remove [ "openoffice.org-*", "ImageMagick" ]
yum.update
Expand All @@ -43,11 +48,11 @@
# Install monit hooks
nginx.install_monit
mysql.install_monit

# Gem installs
gems.install([ "rake", "mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql --with-mysql-config",
"raspell", "rmagick", "mongrel", "mongrel_cluster","json" ])

# Cleanup
yum.clean
end
Expand Down
13 changes: 0 additions & 13 deletions lib/deployment/templates/setup_for_web.sh

This file was deleted.

95 changes: 0 additions & 95 deletions lib/deployment/templates/sudoers

This file was deleted.

0 comments on commit f2df06b

Please sign in to comment.