crafterm-sprinkle 0.1.6 → 0.1.7
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/CREDITS +14 -12
- data/Manifest.txt +18 -0
- data/README.txt +3 -3
- data/examples/packages/build_essential.rb +9 -0
- data/examples/packages/databases/mysql.rb +13 -0
- data/examples/packages/databases/sqlite3.rb +16 -0
- data/examples/packages/phusion.rb +55 -0
- data/examples/packages/ruby/rails.rb +9 -0
- data/examples/packages/ruby/ruby.rb +17 -0
- data/examples/packages/ruby/rubygems.rb +17 -0
- data/examples/packages/scm/git.rb +11 -0
- data/examples/packages/scm/subversion.rb +4 -0
- data/examples/packages/servers/apache.rb +15 -0
- data/examples/rails/packages/essential.rb +4 -1
- data/examples/rails/packages/scm.rb +11 -0
- data/lib/sprinkle/actors/local.rb +26 -0
- data/lib/sprinkle/actors/ssh.rb +81 -0
- data/lib/sprinkle/installers/deb.rb +32 -0
- data/lib/sprinkle/installers/yum.rb +37 -0
- data/lib/sprinkle/package.rb +2 -0
- data/lib/sprinkle/version.rb +1 -1
- data/lib/sprinkle.rb +3 -3
- data/spec/sprinkle/actors/local_spec.rb +29 -0
- data/spec/sprinkle/installers/yum_spec.rb +49 -0
- data/sprinkle.gemspec +6 -6
- metadata +20 -3
data/CREDITS
CHANGED
@@ -3,15 +3,17 @@
|
|
3
3
|
Many thanks to the following people who have submitted ideas, patches, helped with testing
|
4
4
|
and/or generally provided support to Sprinke, I really appreciate your help:
|
5
5
|
|
6
|
-
Kristin Baumann
|
7
|
-
Ben Schwarz
|
8
|
-
Jim Freeze
|
9
|
-
Matthew Tanase
|
10
|
-
Jared Kuolt
|
11
|
-
Jamis Buck
|
12
|
-
Matt Allen
|
13
|
-
Eric Hodel
|
14
|
-
Pete Yandell
|
15
|
-
Adam Meehan
|
16
|
-
Mitchell Hashimoto
|
17
|
-
Ari Lerner
|
6
|
+
Kristin Baumann (http://crafterm.net/kristin/blog/)
|
7
|
+
Ben Schwarz (http://germanforblack.com/)
|
8
|
+
Jim Freeze (http://www.artima.com/rubycs/articles/ruby_as_dslP.html)
|
9
|
+
Matthew Tanase (http://www.slicehost.com)
|
10
|
+
Jared Kuolt (http://www.slicehost.com)
|
11
|
+
Jamis Buck (http://www.capify.org)
|
12
|
+
Matt Allen (http://blog.allen.com.au)
|
13
|
+
Eric Hodel (http://blog.segment7.net)
|
14
|
+
Pete Yandell (http://notahat.com)
|
15
|
+
Adam Meehan (http://duckpunching.com)
|
16
|
+
Mitchell Hashimoto (http://mitchellhashimoto.com)
|
17
|
+
Ari Lerner (http://www.citrusbyte.com)
|
18
|
+
Jorgen Orehøj Erichsen (http://blog.erichsen.net)
|
19
|
+
Joshua Sierles (http://diluvia.net)
|
data/Manifest.txt
CHANGED
@@ -7,11 +7,22 @@ Rakefile
|
|
7
7
|
bin/sprinkle
|
8
8
|
config/hoe.rb
|
9
9
|
config/requirements.rb
|
10
|
+
examples/packages/build_essential.rb
|
11
|
+
examples/packages/databases/mysql.rb
|
12
|
+
examples/packages/databases/sqlite3.rb
|
13
|
+
examples/packages/phusion.rb
|
14
|
+
examples/packages/ruby/rails.rb
|
15
|
+
examples/packages/ruby/ruby.rb
|
16
|
+
examples/packages/ruby/rubygems.rb
|
17
|
+
examples/packages/scm/git.rb
|
18
|
+
examples/packages/scm/subversion.rb
|
19
|
+
examples/packages/servers/apache.rb
|
10
20
|
examples/rails/README
|
11
21
|
examples/rails/deploy.rb
|
12
22
|
examples/rails/packages/database.rb
|
13
23
|
examples/rails/packages/essential.rb
|
14
24
|
examples/rails/packages/rails.rb
|
25
|
+
examples/rails/packages/scm.rb
|
15
26
|
examples/rails/packages/search.rb
|
16
27
|
examples/rails/packages/server.rb
|
17
28
|
examples/rails/rails.rb
|
@@ -19,6 +30,8 @@ examples/sprinkle/sprinkle.rb
|
|
19
30
|
lib/sprinkle.rb
|
20
31
|
lib/sprinkle/actors/actors.rb
|
21
32
|
lib/sprinkle/actors/capistrano.rb
|
33
|
+
lib/sprinkle/actors/local.rb
|
34
|
+
lib/sprinkle/actors/ssh.rb
|
22
35
|
lib/sprinkle/actors/vlad.rb
|
23
36
|
lib/sprinkle/configurable.rb
|
24
37
|
lib/sprinkle/deployment.rb
|
@@ -29,11 +42,13 @@ lib/sprinkle/extensions/dsl_accessor.rb
|
|
29
42
|
lib/sprinkle/extensions/string.rb
|
30
43
|
lib/sprinkle/extensions/symbol.rb
|
31
44
|
lib/sprinkle/installers/apt.rb
|
45
|
+
lib/sprinkle/installers/deb.rb
|
32
46
|
lib/sprinkle/installers/gem.rb
|
33
47
|
lib/sprinkle/installers/installer.rb
|
34
48
|
lib/sprinkle/installers/rake.rb
|
35
49
|
lib/sprinkle/installers/rpm.rb
|
36
50
|
lib/sprinkle/installers/source.rb
|
51
|
+
lib/sprinkle/installers/yum.rb
|
37
52
|
lib/sprinkle/package.rb
|
38
53
|
lib/sprinkle/policy.rb
|
39
54
|
lib/sprinkle/script.rb
|
@@ -50,6 +65,8 @@ script/generate
|
|
50
65
|
spec/spec.opts
|
51
66
|
spec/spec_helper.rb
|
52
67
|
spec/sprinkle/actors/capistrano_spec.rb
|
68
|
+
spec/sprinkle/actors/local_spec.rb
|
69
|
+
spec/sprinkle/configurable_spec.rb
|
53
70
|
spec/sprinkle/deployment_spec.rb
|
54
71
|
spec/sprinkle/extensions/array_spec.rb
|
55
72
|
spec/sprinkle/extensions/string_spec.rb
|
@@ -57,6 +74,7 @@ spec/sprinkle/installers/apt_spec.rb
|
|
57
74
|
spec/sprinkle/installers/gem_spec.rb
|
58
75
|
spec/sprinkle/installers/installer_spec.rb
|
59
76
|
spec/sprinkle/installers/rpm_spec.rb
|
77
|
+
spec/sprinkle/installers/yum_spec.rb
|
60
78
|
spec/sprinkle/installers/source_spec.rb
|
61
79
|
spec/sprinkle/package_spec.rb
|
62
80
|
spec/sprinkle/policy_spec.rb
|
data/README.txt
CHANGED
@@ -62,9 +62,9 @@ appserver, database and webserver can be virtual packages, where the user will b
|
|
62
62
|
multiple choices for the virtual package exist.
|
63
63
|
|
64
64
|
Sprinkle is architected to be extendable in many ways, one of those areas is in its deployment of commands to
|
65
|
-
remote hosts. Currently Sprinkle supports the use of Capistrano
|
66
|
-
but could also be extended to use any other command transport mechanism
|
67
|
-
commands
|
65
|
+
remote hosts. Currently Sprinkle supports the use of Capistrano, Vlad, or a direct net/ssh connection to
|
66
|
+
issue commands on remote hosts via ssh, but could also be extended to use any other command transport mechanism
|
67
|
+
desired. Sprinkle can also be configured to simply issue installation commands to provision the local system.
|
68
68
|
|
69
69
|
An full example Sprinkle deployment script for deploying Rails (via gems), MySQL (via APT), Apache (via source)
|
70
70
|
and Git (via source with dependencies from APT):
|
@@ -0,0 +1,9 @@
|
|
1
|
+
## Special package, anything that defines a 'source' package means build-essential should be installed for Ubuntu
|
2
|
+
|
3
|
+
package :build_essential do
|
4
|
+
description 'Build tools'
|
5
|
+
apt 'build-essential' do
|
6
|
+
# Update the sources and upgrade the lists before we build essentials
|
7
|
+
pre :install, ['aptitude update', 'aptitude safe-upgrade', 'aptitude full-upgrade']
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
package :mysql, :provides => :database do
|
2
|
+
description 'MySQL Database'
|
3
|
+
apt %w( mysql-server mysql-client libmysqlclient15-dev )
|
4
|
+
end
|
5
|
+
|
6
|
+
package :mysql_ruby_driver do
|
7
|
+
description 'Ruby MySQL database driver'
|
8
|
+
gem 'mysql'
|
9
|
+
|
10
|
+
verify do
|
11
|
+
ruby_can_load 'mysql'
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Packages to install sqlite3 and the sqlite3 ruby driver.
|
2
|
+
package :sqlite3, :provides => :database do
|
3
|
+
description 'SQLite3 database'
|
4
|
+
apt 'sqlite3'
|
5
|
+
end
|
6
|
+
|
7
|
+
package :sqlite3_ruby_driver do
|
8
|
+
description 'Ruby SQLite3 library.'
|
9
|
+
apt 'libsqlite3-dev libsqlite3-ruby1.8'
|
10
|
+
|
11
|
+
requires :rubygems
|
12
|
+
|
13
|
+
verify do
|
14
|
+
ruby_can_load 'sqlite3'
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Contains software created by Phusion.nl which is Ruby Enterprise Edition
|
2
|
+
# and mod_rails
|
3
|
+
|
4
|
+
package :ruby_enterprise do
|
5
|
+
description 'Ruby Enterprise Edition'
|
6
|
+
version '1.8.6-20080810'
|
7
|
+
source 'http://rubyforge.org/frs/download.php/41040/ruby-enterprise-1.8.6-20080810.tar.gz' do
|
8
|
+
custom_install 'echo -en "\n\n\n\n" | ./installer'
|
9
|
+
|
10
|
+
# Modify the passenger conf file to point to REE
|
11
|
+
post :install, 'sed -i "s|^PassengerRuby [/a-zA-Z0-9.]*$|PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby|" /etc/apache2/extras/passenger.conf'
|
12
|
+
|
13
|
+
# Restart apache
|
14
|
+
post :install, '/etc/init.d/apache2 restart'
|
15
|
+
end
|
16
|
+
|
17
|
+
verify do
|
18
|
+
has_directory '/opt/ruby-enterprise-1.8.6-20080810'
|
19
|
+
has_executable '/opt/ruby-enterprise-1.8.6-20080810/bin/ruby'
|
20
|
+
end
|
21
|
+
|
22
|
+
requires :apache
|
23
|
+
requires :passenger
|
24
|
+
end
|
25
|
+
|
26
|
+
package :passenger, :provides => :appserver do
|
27
|
+
description 'Phusion Passenger (mod_rails)'
|
28
|
+
gem 'passenger' do
|
29
|
+
post :install, 'echo -en "\n\n\n\n" | passenger-install-apache2-module'
|
30
|
+
|
31
|
+
# Create the passenger conf file
|
32
|
+
post :install, 'mkdir /etc/apache2/extras'
|
33
|
+
post :install, 'touch /etc/apache2/extras/passenger.conf'
|
34
|
+
post :install, "echo 'Include /etc/apache2/extras/passenger.conf' >> /etc/apache2/apache2.conf"
|
35
|
+
|
36
|
+
[%q(LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so),
|
37
|
+
%q(PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3),
|
38
|
+
%q(PassengerRuby /usr/bin/ruby1.8),
|
39
|
+
%q(RailsEnv development)].each do |line|
|
40
|
+
post :install, "echo '#{line}' >> /etc/apache2/extras/passenger.conf"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Restart apache to note changes
|
44
|
+
post :install, '/etc/init.d/apache2 restart'
|
45
|
+
end
|
46
|
+
|
47
|
+
verify do
|
48
|
+
has_file '/etc/apache2/extras/passenger.conf'
|
49
|
+
has_file '/usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so'
|
50
|
+
has_directory '/usr/lib/ruby/gems/1.8/gems/passenger-2.0.3'
|
51
|
+
end
|
52
|
+
|
53
|
+
requires :apache
|
54
|
+
requires :apache2_prefork_dev
|
55
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
package :ruby do
|
2
|
+
description 'Ruby Virtual Machine'
|
3
|
+
version '1.8.6'
|
4
|
+
apt %q(ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby) do
|
5
|
+
post :install, [%q(ln -s /usr/bin/ruby1.8 /usr/bin/ruby),
|
6
|
+
%q(ln -s /usr/bin/ri1.8 /usr/bin/ri),
|
7
|
+
%q(ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc),
|
8
|
+
%q(ln -s /usr/bin/irb1.8 /usr/bin/irb)]
|
9
|
+
end
|
10
|
+
|
11
|
+
verify 'binaries' do
|
12
|
+
has_file '/usr/bin/ruby1.8'
|
13
|
+
has_file '/usr/bin/ri1.8'
|
14
|
+
has_file '/usr/bin/rdoc1.8'
|
15
|
+
has_file '/usr/bin/irb1.8'
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
package :rubygems do
|
2
|
+
description 'Ruby Gems Package Management System'
|
3
|
+
version '1.2.0'
|
4
|
+
source "http://rubyforge.org/frs/download.php/38646/rubygems-#{version}.tgz" do
|
5
|
+
custom_install 'ruby setup.rb'
|
6
|
+
post :install, 'ln -s /usr/bin/gem1.8 /usr/bin/gem'
|
7
|
+
post :install, 'gem update'
|
8
|
+
post :install, 'gem update --system'
|
9
|
+
end
|
10
|
+
|
11
|
+
verify 'binary' do
|
12
|
+
has_file '/usr/bin/gem1.8'
|
13
|
+
has_symlink '/usr/bin/gem', '/usr/bin/gem1.8'
|
14
|
+
end
|
15
|
+
|
16
|
+
requires :ruby
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
package :git, :provides => :scm do
|
2
|
+
description 'Git Distributed Version Control'
|
3
|
+
version '1.5.6.3'
|
4
|
+
source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
5
|
+
requires :git_dependencies
|
6
|
+
end
|
7
|
+
|
8
|
+
package :git_dependencies do
|
9
|
+
description 'Git Build Dependencies'
|
10
|
+
apt 'git', :dependencies_only => true
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
package :apache, :provides => :webserver do
|
2
|
+
description 'Apache2 web server.'
|
3
|
+
apt 'apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert' do
|
4
|
+
post :install, 'a2enmod rewrite'
|
5
|
+
end
|
6
|
+
|
7
|
+
verify do
|
8
|
+
has_process 'apache2'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
package :apache2_prefork_dev do
|
13
|
+
description 'A dependency required by some packages.'
|
14
|
+
apt 'apache2-prefork-dev'
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
package :git, :provides => :scm do
|
2
|
+
description 'Git Distributed Version Control'
|
3
|
+
version '1.5.6.3'
|
4
|
+
source "http://kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
|
5
|
+
requires :git_dependencies
|
6
|
+
end
|
7
|
+
|
8
|
+
package :git_dependencies do
|
9
|
+
description 'Git Build Dependencies'
|
10
|
+
apt 'git', :dependencies_only => true
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Actors
|
3
|
+
# = Local Delivery Method
|
4
|
+
#
|
5
|
+
# This actor implementation performs any given commands on your local system, as
|
6
|
+
# opposed to other implementations that generally run commands on a remote system
|
7
|
+
# via the network.
|
8
|
+
#
|
9
|
+
# This is useful if you'd like to use Sprinkle to provision your local machine.
|
10
|
+
# To enable this actor, in your Sprinkle script specify the :local delivery mechanism.
|
11
|
+
#
|
12
|
+
# deployment do
|
13
|
+
# delivery :local
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Note, your local machine will be assumed to be a member of all roles when applying policies
|
17
|
+
#
|
18
|
+
class Local
|
19
|
+
|
20
|
+
def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc:
|
21
|
+
commands.each { |command| system command }
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'net/ssh/gateway'
|
2
|
+
|
3
|
+
module Sprinkle
|
4
|
+
module Actors
|
5
|
+
class Ssh
|
6
|
+
attr_accessor :options
|
7
|
+
|
8
|
+
def initialize(options = {}, &block) #:nodoc:
|
9
|
+
@options = options.update(:user => 'root')
|
10
|
+
self.instance_eval &block if block
|
11
|
+
end
|
12
|
+
|
13
|
+
def roles(roles)
|
14
|
+
@options[:roles] = roles
|
15
|
+
end
|
16
|
+
|
17
|
+
def gateway(gateway)
|
18
|
+
@options[:gateway] = gateway
|
19
|
+
end
|
20
|
+
|
21
|
+
def user(user)
|
22
|
+
@options[:user] = user
|
23
|
+
end
|
24
|
+
|
25
|
+
def process(name, commands, roles, suppress_and_return_failures = false)
|
26
|
+
return process_with_gateway(name, commands, roles) if gateway_defined?
|
27
|
+
process_direct(name, commands, roles)
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def process_with_gateway(name, commands, roles)
|
33
|
+
on_gateway do |gateway|
|
34
|
+
Array(roles).each { |role| execute_on_role(commands, role, gateway) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def process_direct(name, commands, roles)
|
39
|
+
Array(roles).each { |role| execute_on_role(commands, role) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def execute_on_role(commands, role, gateway = nil)
|
43
|
+
hosts = @options[:roles][role]
|
44
|
+
Array(hosts).each { |host| execute_on_host(commands, host, gateway) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def execute_on_host(commands, host, gateway = nil)
|
48
|
+
if gateway # SSH connection via gateway
|
49
|
+
gateway.ssh(host, @options[:user]) do |ssh|
|
50
|
+
execute_on_connection(commands, ssh)
|
51
|
+
end
|
52
|
+
else # direct SSH connection
|
53
|
+
Net::SSH.start(host, @options[:user]) do |ssh|
|
54
|
+
execute_on_connection(commands, ssh)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def execute_on_connection(commands, connection)
|
60
|
+
Array(commands).each do |command|
|
61
|
+
connection.exec! command do |ch, stream, data|
|
62
|
+
logger.send((stream == :stderr ? 'error' : 'debug'), data)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def gateway_defined?
|
70
|
+
!! @options[:gateway]
|
71
|
+
end
|
72
|
+
|
73
|
+
def on_gateway(&block)
|
74
|
+
gateway = Net::SSH::Gateway.new(@options[:gateway], @options[:user])
|
75
|
+
block.call gateway
|
76
|
+
ensure
|
77
|
+
gateway.shutdown!
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = Deb Package Installer
|
4
|
+
#
|
5
|
+
# The Deb installer installs deb packages sourced from a remote URL
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# Installing the magic_beans deb.
|
10
|
+
#
|
11
|
+
# package :magic_beans do
|
12
|
+
# deb 'http://debs.example.com/magic_beans.deb'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
class Deb < Installer
|
16
|
+
attr_accessor :packages #:nodoc:
|
17
|
+
|
18
|
+
def initialize(parent, packages, &block) #:nodoc:
|
19
|
+
super parent, &block
|
20
|
+
packages = [packages] unless packages.is_a? Array
|
21
|
+
@packages = packages
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def install_commands #:nodoc:
|
27
|
+
"wget -cq --directory-prefix=/tmp #{@packages.join(' ')}; dpkg -i #{@packages.collect{|p| "/tmp/#{p}"}.join(" ")}"
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = Yum Package Installer
|
4
|
+
#
|
5
|
+
# The Yum package installer installs RPM packages.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# Installing the magic_beans RPM via Yum. Its all the craze these days.
|
10
|
+
#
|
11
|
+
# package :magic_beans do
|
12
|
+
# yum 'magic_beans'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# You may also specify multiple rpms as an array:
|
16
|
+
#
|
17
|
+
# package :magic_beans do
|
18
|
+
# yum %w(magic_beans magic_sauce)
|
19
|
+
# end
|
20
|
+
class Yum < Installer
|
21
|
+
attr_accessor :packages #:nodoc:
|
22
|
+
|
23
|
+
def initialize(parent, packages, &block) #:nodoc:
|
24
|
+
super parent, &block
|
25
|
+
packages = [packages] unless packages.is_a? Array
|
26
|
+
@packages = packages
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def install_commands #:nodoc:
|
32
|
+
"yum #{@packages.join(' ')} -y"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/sprinkle/package.rb
CHANGED
data/lib/sprinkle/version.rb
CHANGED
data/lib/sprinkle.rb
CHANGED
@@ -2,11 +2,11 @@ require 'rubygems'
|
|
2
2
|
require 'active_support'
|
3
3
|
|
4
4
|
# Use active supports auto load mechanism
|
5
|
-
Dependencies.load_paths << File.dirname(__FILE__)
|
5
|
+
ActiveSupport::Dependencies.load_paths << File.dirname(__FILE__)
|
6
6
|
|
7
7
|
# Configure active support to log auto-loading of dependencies
|
8
|
-
#Dependencies::RAILS_DEFAULT_LOGGER = Logger.new($stdout)
|
9
|
-
#Dependencies.log_activity = true
|
8
|
+
#ActiveSupport::Dependencies::RAILS_DEFAULT_LOGGER = Logger.new($stdout)
|
9
|
+
#ActiveSupport::Dependencies.log_activity = true
|
10
10
|
|
11
11
|
# Load up extensions to existing classes
|
12
12
|
Dir[File.dirname(__FILE__) + '/sprinkle/extensions/*.rb'].each { |e| require e }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Sprinkle::Actors::Local do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@local = Sprinkle::Actors::Local.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'when processing commands' do
|
10
|
+
|
11
|
+
before do
|
12
|
+
@commands = %w( op1 op2 )
|
13
|
+
@roles = %w( app )
|
14
|
+
@name = 'name'
|
15
|
+
|
16
|
+
@local.stub!(:system).and_return
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should run the commands on the local system' do
|
20
|
+
@local.should_receive(:system).twice.and_return
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
@local.process @name, @commands, @roles
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Sprinkle::Installers::Yum do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_rpm(rpms, &block)
|
10
|
+
Sprinkle::Installers::Yum.new(@package, rpms, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'when created' do
|
14
|
+
|
15
|
+
it 'should accept a single package to install' do
|
16
|
+
@installer = create_rpm 'ruby'
|
17
|
+
@installer.packages.should == [ 'ruby' ]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should accept an array of packages to install' do
|
21
|
+
@installer = create_rpm %w( gcc gdb g++ )
|
22
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'during installation' do
|
28
|
+
|
29
|
+
before do
|
30
|
+
@installer = create_rpm 'ruby' do
|
31
|
+
pre :install, 'op1'
|
32
|
+
post :install, 'op2'
|
33
|
+
end
|
34
|
+
@install_commands = @installer.send :install_commands
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should invoke the rpm installer for all specified packages' do
|
38
|
+
@install_commands.should =~ /yum ruby -y/
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
42
|
+
@installer.send(:install_sequence).should == [ 'op1', 'yum ruby -y', 'op2' ]
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should install a specific version if defined'
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/sprinkle.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{sprinkle}
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.7"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Marcus Crafter", "Mitchell Hashimoto"]
|
7
|
-
s.date = %q{2008-
|
7
|
+
s.date = %q{2008-11-04}
|
8
8
|
s.default_executable = %q{sprinkle}
|
9
9
|
s.description = %q{Ruby DSL based software provisioning tool}
|
10
10
|
s.email = ["crafterm@redartisan.com", "mitchell.hashimoto@citrusbyte.com"]
|
11
11
|
s.executables = ["sprinkle"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
13
|
-
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "bin/sprinkle", "config/hoe.rb", "config/requirements.rb", "examples/rails/README", "examples/rails/deploy.rb", "examples/rails/packages/database.rb", "examples/rails/packages/essential.rb", "examples/rails/packages/rails.rb", "examples/rails/packages/search.rb", "examples/rails/packages/server.rb", "examples/rails/rails.rb", "examples/sprinkle/sprinkle.rb", "lib/sprinkle.rb", "lib/sprinkle/actors/actors.rb", "lib/sprinkle/actors/capistrano.rb", "lib/sprinkle/actors/vlad.rb", "lib/sprinkle/configurable.rb", "lib/sprinkle/deployment.rb", "lib/sprinkle/extensions/arbitrary_options.rb", "lib/sprinkle/extensions/array.rb", "lib/sprinkle/extensions/blank_slate.rb", "lib/sprinkle/extensions/dsl_accessor.rb", "lib/sprinkle/extensions/string.rb", "lib/sprinkle/extensions/symbol.rb", "lib/sprinkle/installers/apt.rb", "lib/sprinkle/installers/gem.rb", "lib/sprinkle/installers/installer.rb", "lib/sprinkle/installers/rake.rb", "lib/sprinkle/installers/rpm.rb", "lib/sprinkle/installers/source.rb", "lib/sprinkle/package.rb", "lib/sprinkle/policy.rb", "lib/sprinkle/script.rb", "lib/sprinkle/verifiers/directory.rb", "lib/sprinkle/verifiers/executable.rb", "lib/sprinkle/verifiers/file.rb", "lib/sprinkle/verifiers/process.rb", "lib/sprinkle/verifiers/ruby.rb", "lib/sprinkle/verifiers/symlink.rb", "lib/sprinkle/verify.rb", "lib/sprinkle/version.rb", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/sprinkle/actors/capistrano_spec.rb", "spec/sprinkle/configurable_spec.rb", "spec/sprinkle/deployment_spec.rb", "spec/sprinkle/extensions/array_spec.rb", "spec/sprinkle/extensions/string_spec.rb", "spec/sprinkle/installers/apt_spec.rb", "spec/sprinkle/installers/gem_spec.rb", "spec/sprinkle/installers/installer_spec.rb", "spec/sprinkle/installers/rpm_spec.rb", "spec/sprinkle/installers/source_spec.rb", "spec/sprinkle/package_spec.rb", "spec/sprinkle/policy_spec.rb", "spec/sprinkle/script_spec.rb", "spec/sprinkle/sprinkle_spec.rb", "spec/sprinkle/verify_spec.rb", "sprinkle.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
|
13
|
+
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "bin/sprinkle", "config/hoe.rb", "config/requirements.rb", "examples/packages/build_essential.rb", "examples/packages/databases/mysql.rb", "examples/packages/databases/sqlite3.rb", "examples/packages/phusion.rb", "examples/packages/ruby/rails.rb", "examples/packages/ruby/ruby.rb", "examples/packages/ruby/rubygems.rb", "examples/packages/scm/git.rb", "examples/packages/scm/subversion.rb", "examples/packages/servers/apache.rb", "examples/rails/README", "examples/rails/deploy.rb", "examples/rails/packages/database.rb", "examples/rails/packages/essential.rb", "examples/rails/packages/rails.rb", "examples/rails/packages/scm.rb", "examples/rails/packages/search.rb", "examples/rails/packages/server.rb", "examples/rails/rails.rb", "examples/sprinkle/sprinkle.rb", "lib/sprinkle.rb", "lib/sprinkle/actors/actors.rb", "lib/sprinkle/actors/capistrano.rb", "lib/sprinkle/actors/local.rb", "lib/sprinkle/actors/ssh.rb", "lib/sprinkle/actors/vlad.rb", "lib/sprinkle/configurable.rb", "lib/sprinkle/deployment.rb", "lib/sprinkle/extensions/arbitrary_options.rb", "lib/sprinkle/extensions/array.rb", "lib/sprinkle/extensions/blank_slate.rb", "lib/sprinkle/extensions/dsl_accessor.rb", "lib/sprinkle/extensions/string.rb", "lib/sprinkle/extensions/symbol.rb", "lib/sprinkle/installers/apt.rb", "lib/sprinkle/installers/deb.rb", "lib/sprinkle/installers/gem.rb", "lib/sprinkle/installers/installer.rb", "lib/sprinkle/installers/rake.rb", "lib/sprinkle/installers/rpm.rb", "lib/sprinkle/installers/source.rb", "lib/sprinkle/installers/yum.rb", "lib/sprinkle/package.rb", "lib/sprinkle/policy.rb", "lib/sprinkle/script.rb", "lib/sprinkle/verifiers/directory.rb", "lib/sprinkle/verifiers/executable.rb", "lib/sprinkle/verifiers/file.rb", "lib/sprinkle/verifiers/process.rb", "lib/sprinkle/verifiers/ruby.rb", "lib/sprinkle/verifiers/symlink.rb", "lib/sprinkle/verify.rb", "lib/sprinkle/version.rb", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/sprinkle/actors/capistrano_spec.rb", "spec/sprinkle/actors/local_spec.rb", "spec/sprinkle/configurable_spec.rb", "spec/sprinkle/deployment_spec.rb", "spec/sprinkle/extensions/array_spec.rb", "spec/sprinkle/extensions/string_spec.rb", "spec/sprinkle/installers/apt_spec.rb", "spec/sprinkle/installers/gem_spec.rb", "spec/sprinkle/installers/installer_spec.rb", "spec/sprinkle/installers/rpm_spec.rb", "spec/sprinkle/installers/yum_spec.rb", "spec/sprinkle/installers/source_spec.rb", "spec/sprinkle/package_spec.rb", "spec/sprinkle/policy_spec.rb", "spec/sprinkle/script_spec.rb", "spec/sprinkle/sprinkle_spec.rb", "spec/sprinkle/verify_spec.rb", "sprinkle.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://sprinkle.rubyforge.org}
|
16
16
|
s.rdoc_options = ["--main", "README.txt"]
|
@@ -27,17 +27,17 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
|
28
28
|
s.add_runtime_dependency(%q<highline>, [">= 1.4.0"])
|
29
29
|
s.add_runtime_dependency(%q<capistrano>, [">= 2.2.0"])
|
30
|
-
s.add_development_dependency(%q<hoe>, [">= 1.
|
30
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
31
31
|
else
|
32
32
|
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
33
33
|
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
34
34
|
s.add_dependency(%q<capistrano>, [">= 2.2.0"])
|
35
|
-
s.add_dependency(%q<hoe>, [">= 1.
|
35
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
36
36
|
end
|
37
37
|
else
|
38
38
|
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
39
39
|
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
40
40
|
s.add_dependency(%q<capistrano>, [">= 2.2.0"])
|
41
|
-
s.add_dependency(%q<hoe>, [">= 1.
|
41
|
+
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
42
42
|
end
|
43
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crafterm-sprinkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Crafter
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-
|
13
|
+
date: 2008-11-04 00:00:00 -08:00
|
14
14
|
default_executable: sprinkle
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 1.
|
50
|
+
version: 1.8.2
|
51
51
|
version:
|
52
52
|
description: Ruby DSL based software provisioning tool
|
53
53
|
email:
|
@@ -71,11 +71,22 @@ files:
|
|
71
71
|
- bin/sprinkle
|
72
72
|
- config/hoe.rb
|
73
73
|
- config/requirements.rb
|
74
|
+
- examples/packages/build_essential.rb
|
75
|
+
- examples/packages/databases/mysql.rb
|
76
|
+
- examples/packages/databases/sqlite3.rb
|
77
|
+
- examples/packages/phusion.rb
|
78
|
+
- examples/packages/ruby/rails.rb
|
79
|
+
- examples/packages/ruby/ruby.rb
|
80
|
+
- examples/packages/ruby/rubygems.rb
|
81
|
+
- examples/packages/scm/git.rb
|
82
|
+
- examples/packages/scm/subversion.rb
|
83
|
+
- examples/packages/servers/apache.rb
|
74
84
|
- examples/rails/README
|
75
85
|
- examples/rails/deploy.rb
|
76
86
|
- examples/rails/packages/database.rb
|
77
87
|
- examples/rails/packages/essential.rb
|
78
88
|
- examples/rails/packages/rails.rb
|
89
|
+
- examples/rails/packages/scm.rb
|
79
90
|
- examples/rails/packages/search.rb
|
80
91
|
- examples/rails/packages/server.rb
|
81
92
|
- examples/rails/rails.rb
|
@@ -83,6 +94,8 @@ files:
|
|
83
94
|
- lib/sprinkle.rb
|
84
95
|
- lib/sprinkle/actors/actors.rb
|
85
96
|
- lib/sprinkle/actors/capistrano.rb
|
97
|
+
- lib/sprinkle/actors/local.rb
|
98
|
+
- lib/sprinkle/actors/ssh.rb
|
86
99
|
- lib/sprinkle/actors/vlad.rb
|
87
100
|
- lib/sprinkle/configurable.rb
|
88
101
|
- lib/sprinkle/deployment.rb
|
@@ -93,11 +106,13 @@ files:
|
|
93
106
|
- lib/sprinkle/extensions/string.rb
|
94
107
|
- lib/sprinkle/extensions/symbol.rb
|
95
108
|
- lib/sprinkle/installers/apt.rb
|
109
|
+
- lib/sprinkle/installers/deb.rb
|
96
110
|
- lib/sprinkle/installers/gem.rb
|
97
111
|
- lib/sprinkle/installers/installer.rb
|
98
112
|
- lib/sprinkle/installers/rake.rb
|
99
113
|
- lib/sprinkle/installers/rpm.rb
|
100
114
|
- lib/sprinkle/installers/source.rb
|
115
|
+
- lib/sprinkle/installers/yum.rb
|
101
116
|
- lib/sprinkle/package.rb
|
102
117
|
- lib/sprinkle/policy.rb
|
103
118
|
- lib/sprinkle/script.rb
|
@@ -114,6 +129,7 @@ files:
|
|
114
129
|
- spec/spec.opts
|
115
130
|
- spec/spec_helper.rb
|
116
131
|
- spec/sprinkle/actors/capistrano_spec.rb
|
132
|
+
- spec/sprinkle/actors/local_spec.rb
|
117
133
|
- spec/sprinkle/configurable_spec.rb
|
118
134
|
- spec/sprinkle/deployment_spec.rb
|
119
135
|
- spec/sprinkle/extensions/array_spec.rb
|
@@ -122,6 +138,7 @@ files:
|
|
122
138
|
- spec/sprinkle/installers/gem_spec.rb
|
123
139
|
- spec/sprinkle/installers/installer_spec.rb
|
124
140
|
- spec/sprinkle/installers/rpm_spec.rb
|
141
|
+
- spec/sprinkle/installers/yum_spec.rb
|
125
142
|
- spec/sprinkle/installers/source_spec.rb
|
126
143
|
- spec/sprinkle/package_spec.rb
|
127
144
|
- spec/sprinkle/policy_spec.rb
|