sprinkle 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bin/sprinkle +1 -1
- data/lib/sprinkle/actors/ssh.rb +8 -2
- data/lib/sprinkle/installers/deb.rb +6 -6
- data/lib/sprinkle/installers/file.rb +5 -5
- data/lib/sprinkle/installers/npm.rb +16 -16
- data/lib/sprinkle/installers/pear.rb +33 -34
- data/lib/sprinkle/installers/rpm.rb +2 -2
- data/lib/sprinkle/installers/source.rb +2 -6
- data/lib/sprinkle/package.rb +3 -3
- data/lib/sprinkle/version.rb +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/bin/sprinkle
CHANGED
@@ -28,7 +28,7 @@ parser = OptionParser.new do |opts|
|
|
28
28
|
Sprinkle
|
29
29
|
========
|
30
30
|
|
31
|
-
http://github.com/
|
31
|
+
http://github.com/sprinkle-tool/sprinkle
|
32
32
|
|
33
33
|
Sprinkle is a software provisioning tool you can use to build remote servers with. eg. to
|
34
34
|
install a Rails or Merb stack on a brand new slice directly after its been created. It uses
|
data/lib/sprinkle/actors/ssh.rb
CHANGED
@@ -11,6 +11,7 @@ module Sprinkle
|
|
11
11
|
# delivery :ssh do
|
12
12
|
# user "rails"
|
13
13
|
# password "leetz"
|
14
|
+
# port 2222
|
14
15
|
#
|
15
16
|
# role :app, "app.myserver.com"
|
16
17
|
# end
|
@@ -46,7 +47,7 @@ module Sprinkle
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def initialize(options = {}, &block) #:nodoc:
|
49
|
-
@options = options.update(:user => 'root')
|
50
|
+
@options = options.update(:user => 'root', :port => 22)
|
50
51
|
@roles = {}
|
51
52
|
self.instance_eval &block if block
|
52
53
|
raise "You must define at least a single role." if @roles.empty?
|
@@ -90,6 +91,11 @@ module Sprinkle
|
|
90
91
|
@options[:password] = password
|
91
92
|
end
|
92
93
|
|
94
|
+
# Set the SSH port
|
95
|
+
def port(port)
|
96
|
+
@options[:port] = port
|
97
|
+
end
|
98
|
+
|
93
99
|
def keys(keys)
|
94
100
|
@options[:keys] = keys
|
95
101
|
end
|
@@ -231,7 +237,7 @@ module Sprinkle
|
|
231
237
|
end
|
232
238
|
|
233
239
|
def ssh_session(host) #:nodoc:
|
234
|
-
connections.start(host, @options[:user], @options.slice(:password, :keys))
|
240
|
+
connections.start(host, @options[:user], @options.slice(:password, :keys, :port))
|
235
241
|
end
|
236
242
|
|
237
243
|
def reconnect(host) #:nodoc:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sprinkle
|
2
2
|
module Installers
|
3
3
|
# The Deb installer installs deb packages sourced from a remote URL
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# == Example Usage
|
6
6
|
#
|
7
7
|
# Installing the magic_beans deb.
|
@@ -22,13 +22,13 @@ module Sprinkle
|
|
22
22
|
|
23
23
|
def install_commands #:nodoc:
|
24
24
|
[
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
"wget -cq --directory-prefix=/tmp #{@packages.join(' ')}",
|
26
|
+
"dpkg -i #{@packages.collect{|p| "/tmp/#{package_name(p)}"}.join(" ")}"
|
27
|
+
]
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
private
|
31
|
-
|
31
|
+
|
32
32
|
def package_name(url)
|
33
33
|
url.split('/').last
|
34
34
|
end
|
@@ -87,12 +87,12 @@ module Sprinkle
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def setup_source
|
90
|
-
file=Tempfile.new(@package.name.to_s)
|
91
|
-
file.print(@contents)
|
92
|
-
file.close
|
93
|
-
@sourcepath = file.path
|
90
|
+
@file=Tempfile.new(@package.name.to_s)
|
91
|
+
@file.print(@contents)
|
92
|
+
@file.close
|
93
|
+
@sourcepath = @file.path
|
94
94
|
end
|
95
95
|
|
96
96
|
end
|
97
97
|
end
|
98
|
-
end
|
98
|
+
end
|
@@ -3,7 +3,7 @@ module Sprinkle
|
|
3
3
|
# = Npm package Installed
|
4
4
|
#
|
5
5
|
# Installs an npm module
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# == Example Usage
|
8
8
|
#
|
9
9
|
# package :magic_beans do
|
@@ -11,32 +11,32 @@ module Sprinkle
|
|
11
11
|
# end
|
12
12
|
#
|
13
13
|
# verify { has_npm 'grunt' }
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
class Npm < Installer
|
15
|
+
|
16
|
+
attr_accessor :package_name
|
17
|
+
|
18
18
|
api do
|
19
19
|
def npm(package, &block)
|
20
20
|
install Npm.new(self, package, &block)
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
verify_api do
|
25
25
|
def has_npm(package)
|
26
26
|
@commands << "npm --global list | grep \"#{package}@\""
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
def initialize(parent, package_name, &block) #:nodoc:
|
31
|
+
super parent, &block
|
32
|
+
@package_name = package_name
|
33
|
+
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
protected
|
36
|
+
def install_commands #:nodoc:
|
37
|
+
"npm install --global #{@package_name}"
|
38
|
+
end
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
end
|
41
|
+
end
|
42
42
|
end
|
@@ -1,40 +1,39 @@
|
|
1
1
|
module Sprinkle
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
verify_api do
|
23
|
-
def has_pear(package)
|
24
|
-
@commands << "pear list | grep \"#{package}\" | grep \"stable\""
|
25
|
-
end
|
2
|
+
module Installers
|
3
|
+
# = Pear package installed
|
4
|
+
#
|
5
|
+
# Installs the specified pear package
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# package :php_stuff do
|
10
|
+
# pear 'PHP_Compat'
|
11
|
+
# verify { has_pear 'PHP_Compat' }
|
12
|
+
# end
|
13
|
+
class Pear < Installer
|
14
|
+
attr_accessor :package_name
|
15
|
+
|
16
|
+
api do
|
17
|
+
def pear(package, &block)
|
18
|
+
install Pear.new(self, package, &block)
|
26
19
|
end
|
20
|
+
end
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
verify_api do
|
23
|
+
def has_pear(package)
|
24
|
+
@commands << "pear list | grep \"#{package}\" | grep \"stable\""
|
25
|
+
end
|
26
|
+
end
|
32
27
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
def initialize(parent, package_name, &block) #:nodoc:
|
29
|
+
super parent, &block
|
30
|
+
@package_name = package_name
|
31
|
+
end
|
37
32
|
|
38
|
-
|
39
|
-
|
33
|
+
protected
|
34
|
+
def install_commands #:nodoc:
|
35
|
+
"pear install --alldeps #{@package_name}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
40
39
|
end
|
@@ -3,7 +3,7 @@ module Sprinkle
|
|
3
3
|
# = RPM Package Installer
|
4
4
|
#
|
5
5
|
# The RPM package installer installs RPM packages.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# == Example Usage
|
8
8
|
#
|
9
9
|
# Installing the magic_beans RPM. Its all the craze these days.
|
@@ -26,7 +26,7 @@ module Sprinkle
|
|
26
26
|
# :call-seq:
|
27
27
|
# rpm(*packages)
|
28
28
|
auto_api
|
29
|
-
|
29
|
+
|
30
30
|
verify_api do
|
31
31
|
def has_rpm(package)
|
32
32
|
@commands << "rpm -qa | grep #{package}"
|
@@ -103,7 +103,7 @@ module Sprinkle
|
|
103
103
|
|
104
104
|
multi_attributes :enable, :disable, :with, :without, :option,
|
105
105
|
:custom_install
|
106
|
-
attributes :configure_command, :build_command, :install_command
|
106
|
+
attributes :configure_command, :build_command, :install_command, :custom_archive
|
107
107
|
|
108
108
|
def install_sequence #:nodoc:
|
109
109
|
prepare + download + extract + configure + build + install
|
@@ -220,11 +220,7 @@ module Sprinkle
|
|
220
220
|
end
|
221
221
|
|
222
222
|
def archive_name #:nodoc:
|
223
|
-
name = @source.split('/').last
|
224
|
-
if options[:custom_archive]
|
225
|
-
name = options[:custom_archive]
|
226
|
-
name = name.join if name.is_a? Array
|
227
|
-
end
|
223
|
+
name = options[:custom_archive] || @source.split('/').last
|
228
224
|
raise "Unable to determine archive name for source: #{source}, please update code knowledge" unless name
|
229
225
|
name
|
230
226
|
end
|
data/lib/sprinkle/package.rb
CHANGED
@@ -118,7 +118,7 @@ module Sprinkle
|
|
118
118
|
|
119
119
|
class Package #:nodoc:
|
120
120
|
attr_accessor :name, :provides, :installers, :verifications
|
121
|
-
|
121
|
+
attr_internal :args, :opts
|
122
122
|
cattr_reader :installer_methods
|
123
123
|
@@installer_methods = []
|
124
124
|
|
@@ -177,11 +177,11 @@ module Sprinkle
|
|
177
177
|
end
|
178
178
|
|
179
179
|
def args
|
180
|
-
@
|
180
|
+
@_args ||= []
|
181
181
|
end
|
182
182
|
|
183
183
|
def opts
|
184
|
-
@
|
184
|
+
@_opts ||= defaults.clone
|
185
185
|
end
|
186
186
|
|
187
187
|
class ContextError < StandardError #:nodoc:
|
data/lib/sprinkle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprinkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-07-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|