cap-hacks 0.0.1 → 0.0.2

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.
data/History.txt CHANGED
@@ -1,5 +1,9 @@
1
+ == 0.0.2 2008-01-27
2
+
3
+ * 1 major enhancement:
4
+ * Switched from hoe to newgem (which also uses hoe)
5
+
1
6
  == 0.0.1 / 2008-01-26
2
7
 
3
8
  * First version
4
9
  * Multi server plugin added
5
-
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Ben Marini
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/Manifest.txt CHANGED
@@ -1,7 +1,12 @@
1
1
  History.txt
2
+ License.txt
2
3
  Manifest.txt
3
4
  README.txt
4
- Rakefile
5
- bin/cap-hacks
6
5
  lib/cap-hacks.rb
7
- test/test_cap-hacks.rb
6
+ lib/cap-hacks/plugins/multiserver.rb
7
+ lib/cap-hacks/recipes/caphacks.rb
8
+ lib/cap-hacks/version.rb
9
+ test/Capfile
10
+ test/cap_servers.example.rb
11
+ test/test_cap-hacks.rb
12
+ test/test_helper.rb
data/README.txt CHANGED
@@ -1,45 +1,25 @@
1
- cap-hacks
2
- by Ben Marini
3
- FIX (url)
1
+ h1. Capistrano Hacks
4
2
 
5
- == DESCRIPTION:
6
-
7
- cap-hacks is a collection of plugins and recipes for capistrano, to aid
8
- in sysadmin related tasks.
3
+ h2. Usage
9
4
 
10
- == SYNOPSIS:
5
+ Create a new file in same directory as your Capfile called cap_servers.rb that looks like this:
11
6
 
12
- FIX (code sample of usage)
7
+ <pre syntax="ruby">
8
+ servers.define :serv1, 'ben@serv1.example.com'
9
+ servers.define :serv2, 'ben@serv2.example.com'
10
+ servers.define :serv3, 'ben@serv3.example.com'
11
+ </pre>
13
12
 
14
- == REQUIREMENTS:
13
+ Add this to your Capfile:
15
14
 
16
- capistrano 2.1.0 or greater
15
+ <pre syntax="ruby">
16
+ require 'cap-hacks'
17
+ load 'cap_servers.rb'
18
+ </pre>
17
19
 
18
- == INSTALL:
20
+ Use like so:
19
21
 
20
- sudo gem install cap-hacks
21
-
22
- == LICENSE:
23
-
24
- (The MIT License)
25
-
26
- Copyright (c) 2008 Ben Marini
27
-
28
- Permission is hereby granted, free of charge, to any person obtaining
29
- a copy of this software and associated documentation files (the
30
- 'Software'), to deal in the Software without restriction, including
31
- without limitation the rights to use, copy, modify, merge, publish,
32
- distribute, sublicense, and/or sell copies of the Software, and to
33
- permit persons to whom the Software is furnished to do so, subject to
34
- the following conditions:
35
-
36
- The above copyright notice and this permission notice shall be
37
- included in all copies or substantial portions of the Software.
38
-
39
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
40
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
43
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
44
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ <pre>
23
+ cap serv1 [some task to perform on serv1]
24
+ cap serv1 serv2 [some task to perform on servers 1 and 2]
25
+ </pre>
@@ -0,0 +1,20 @@
1
+ require 'capistrano'
2
+ unless Capistrano::Configuration.respond_to?(:instance)
3
+ abort "cap-hacks/plugins/multiserver requires Capistrano 2"
4
+ end
5
+
6
+ module MultiServer
7
+ def define(name, host, options={})
8
+ options = {:roles => [:app, :web]}.merge(options)
9
+
10
+ desc "Add #{name} to servers to perform subsequent tasks on"
11
+ task(name) do
12
+ options.delete(:roles).each do |r|
13
+ role(r, host, options)
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+
20
+ Capistrano.plugin :servers, MultiServer
@@ -0,0 +1,30 @@
1
+ Capistrano::Configuration.instance.load do
2
+ namespace :caphacks do
3
+ namespace :apache do
4
+
5
+ desc "Retrieve some general info"
6
+ task :info do
7
+ apachectl_path = capture 'which apachectl'
8
+ apache_info = capture 'apachectl -V'
9
+
10
+ apache = {}
11
+ apache[:version] = /Server version: ([^\n]+)/.match(apache_info)[1]
12
+ apache[:root] = /HTTPD_ROOT="(.*)"/.match(apache_info)[1]
13
+ apache[:config] = /SERVER_CONFIG_FILE="(.*)"/.match(apache_info)[1]
14
+
15
+ puts "apachectl location: #{apachectl_path}"
16
+ puts "Version: #{apache[:version]}"
17
+ puts "Config: #{apache[:root]}/#{apache[:config]}"
18
+ end
19
+ end
20
+
21
+ namespace :php do
22
+ desc "Locate the config file"
23
+ task :locate_config do
24
+ result = capture "php --info | grep php.ini"
25
+ puts "PHP Config File: " + /Configuration File .* Path => ([^\n]+)/.match(result)[1]
26
+ end
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module CapHacks #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 2
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/cap-hacks.rb CHANGED
@@ -1,3 +1,7 @@
1
- class CapHacks
2
- VERSION = '0.0.1'
1
+ $:.unshift File.dirname(__FILE__)
2
+ require 'cap-hacks/plugins/multiserver'
3
+ require 'cap-hacks/recipes/caphacks'
4
+
5
+ module CapHacks
6
+
3
7
  end
data/test/Capfile ADDED
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + '/../lib/cap-hacks'
2
+ load 'cap_servers.rb'
3
+ Dir['recipes/*.rb'].each { |plugin| load(plugin) } if FileTest.exist?('recipes')
@@ -0,0 +1,4 @@
1
+ # label ssh host and username role - optional
2
+ servers.define :serv1, 'ben@serv1.example.com'
3
+ servers.define :serv2, 'ben@serv2.example.com'
4
+ servers.define :serv3, 'ben@serv3.example.com'
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestCapHacks < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/cap-hacks'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-hacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Marini
@@ -9,47 +9,44 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-26 00:00:00 -08:00
12
+ date: 2008-01-27 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: capistrano >= 2.1.0
16
+ name: capistrano
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: "0"
22
+ version: 2.1.0
23
23
  version:
24
- - !ruby/object:Gem::Dependency
25
- name: hoe
26
- version_requirement:
27
- version_requirements: !ruby/object:Gem::Requirement
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- version: 1.4.0
32
- version:
33
- description: This is a collection of sysadmin related tasks and extensions for capistrano. It is meant to ease the burden of sysadmin chores on multiple servers by allowing you to define a list of servers and execute common tasks arbitrarily on them.
24
+ description: A collection of sysadmin related plugins and recipes for capistrano
34
25
  email: bmarini@gmail.com
35
- executables:
36
- - cap-hacks
26
+ executables: []
27
+
37
28
  extensions: []
38
29
 
39
30
  extra_rdoc_files:
40
31
  - History.txt
32
+ - License.txt
41
33
  - Manifest.txt
42
34
  - README.txt
43
35
  files:
44
36
  - History.txt
37
+ - License.txt
45
38
  - Manifest.txt
46
39
  - README.txt
47
- - Rakefile
48
- - bin/cap-hacks
49
40
  - lib/cap-hacks.rb
41
+ - lib/cap-hacks/plugins/multiserver.rb
42
+ - lib/cap-hacks/recipes/caphacks.rb
43
+ - lib/cap-hacks/version.rb
44
+ - test/Capfile
45
+ - test/cap_servers.example.rb
50
46
  - test/test_cap-hacks.rb
47
+ - test/test_helper.rb
51
48
  has_rdoc: true
52
- homepage: http://www.zenspider.com/ZSS/Products/cap-hacks/
49
+ homepage: http://cap-hacks.rubyforge.org
53
50
  post_install_message:
54
51
  rdoc_options:
55
52
  - --main
@@ -74,6 +71,7 @@ rubyforge_project: cap-hacks
74
71
  rubygems_version: 1.0.1
75
72
  signing_key:
76
73
  specification_version: 2
77
- summary: A collection of plugins and recipes for sysadmin related tasks
74
+ summary: A collection of sysadmin related plugins and recipes for capistrano
78
75
  test_files:
79
76
  - test/test_cap-hacks.rb
77
+ - test/test_helper.rb
data/Rakefile DELETED
@@ -1,22 +0,0 @@
1
- # -*- ruby -*-
2
-
3
- require 'rubygems'
4
- require 'hoe'
5
- require './lib/cap-hacks.rb'
6
-
7
- Hoe.new('cap-hacks', CapHacks::VERSION) do |p|
8
- p.rubyforge_name = 'cap-hacks'
9
- p.author = 'Ben Marini'
10
- p.email = 'bmarini@gmail.com'
11
- p.summary = 'A collection of plugins and recipes for sysadmin related tasks'
12
- p.description = <<-EOF
13
- This is a collection of sysadmin related tasks and extensions for capistrano.
14
- It is meant to ease the burden of sysadmin chores on multiple servers by allowing
15
- you to define a list of servers and execute common tasks arbitrarily on them.
16
- EOF
17
- p.extra_deps = ['capistrano >= 2.1.0']
18
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
19
- p.remote_rdoc_dir = '' # Release to root
20
- end
21
-
22
- # vim: syntax=Ruby
data/bin/cap-hacks DELETED
File without changes