capistrano-cm 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Justin S. Leitgeb
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.md ADDED
@@ -0,0 +1,13 @@
1
+ = capistrano-cm
2
+
3
+ Lightweight extensions to Capistrano which help with updating the remote server to a particular state.
4
+
5
+ The methods defined in cm.rb will be made available in deployment tasks when the following is added to your recipe:
6
+
7
+ require 'capistrano/jsl/cm'
8
+
9
+ See cm.rb for the methods that will be added to your deployment recipes.
10
+
11
+ == About
12
+
13
+ Thanks to Hoodiny Entertainment (http://hoodiny.com) for supporting the development of these extensions!
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{capistrano-cm}
3
+ s.version = "0.0.1"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Justin S. Leitgeb"]
7
+ s.date = %q{2009-11-04}
8
+ s.description = %q{Lightweight cap extensions to assist in server configuration management}
9
+ s.email = %q{justin@phq.org}
10
+
11
+ s.extra_rdoc_files = [
12
+ "README.md"
13
+ ]
14
+
15
+ s.files = [
16
+ ".gitignore",
17
+ "MIT-LICENSE",
18
+ "README.md",
19
+ "capistrano-cm.gemspec",
20
+ "lib/capistrano/jsl/cm.rb"
21
+ ]
22
+ s.homepage = %q{http://github.com/jsl/capistrano-cm}
23
+ s.require_paths = ["lib"]
24
+ s.summary = %q{Cap extensions to help with server configuration management}
25
+
26
+ s.add_dependency('capistrano')
27
+ end
@@ -0,0 +1,39 @@
1
+ unless Capistrano::Configuration.respond_to?(:instance)
2
+ abort "capistrano/jsl/configuration_management requires Capistrano 2"
3
+ end
4
+
5
+ require 'digest/md5'
6
+
7
+ Capistrano::Configuration.instance.load do
8
+
9
+ # Returns Boolean indicating the result of +filetest+ on +full_path+ on the server, evaluated by shell on
10
+ # the server (usually bash or something roughly compatible).
11
+ def remote_filetest_passes?(filetest, full_path)
12
+ 'true' == capture("if [ #{filetest} #{full_path} ]; then echo 'true'; fi").strip
13
+ end
14
+
15
+ # Checks if a symlink exists on the remote machine.
16
+ def symlink_exists?(full_path)
17
+ remote_filetest_passes?('-L', full_path)
18
+ end
19
+
20
+ # Returns Boolean value indicating whether file exists on server
21
+ def remote_file_exists?(full_path)
22
+ remote_filetest_passes?('-e', full_path)
23
+ end
24
+
25
+ # Returns Boolean value indicating whether the file at +full_path+ matches +content+. Checks if file
26
+ # is equivalent to content by checking whether or not the MD5 of the remote content is the same as the
27
+ # MD5 of the String in +content+.
28
+ def remote_file_content_same_as?(full_path, content)
29
+ Digest::MD5.hexdigest(content) == capture("md5sum #{full_path} | awk '{ print $1 }'").strip
30
+ end
31
+
32
+ # Returns Boolean indicating whether the remote file is present and has the same contents as
33
+ # the String in +content+.
34
+ def remote_file_differs?(full_path, content)
35
+ !remote_file_exists?(full_path) || remote_file_exists?(full_path) && !remote_file_content_same_as?(full_path, content)
36
+ end
37
+
38
+ end
39
+
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-cm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin S. Leitgeb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-04 00:00:00 -05:00
13
+ default_executable:
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: "0"
24
+ version:
25
+ description: Lightweight cap extensions to assist in server configuration management
26
+ email: justin@phq.org
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.md
33
+ files:
34
+ - .gitignore
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - capistrano-cm.gemspec
38
+ - lib/capistrano/jsl/cm.rb
39
+ has_rdoc: true
40
+ homepage: http://github.com/jsl/capistrano-cm
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.5
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Cap extensions to help with server configuration management
67
+ test_files: []
68
+