sprinkle 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -0,0 +1,34 @@
1
+ module Sprinkle
2
+ module Installers
3
+ # = Homebrew Package Installer
4
+ #
5
+ # The Homebrew package installer uses the +brew+ command to install
6
+ # packages on OSX.
7
+ #
8
+ # == Example Usage
9
+ #
10
+ # package :magic_beans do
11
+ # description "Beans beans they're good for your heart..."
12
+ # brew 'magic_beans_package'
13
+ # end
14
+ #
15
+ class Brew < Installer
16
+ attr_accessor :formulas #:nodoc:
17
+
18
+ def initialize(parent, *formulas, &block) #:nodoc:
19
+ formulas.flatten!
20
+
21
+ super parent, &block
22
+
23
+ @formulas = formulas
24
+ end
25
+
26
+ protected
27
+
28
+ def install_commands #:nodoc:
29
+ "brew install #{@formulas.join(' ')}"
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -172,6 +172,10 @@ module Sprinkle
172
172
  def zypper(*names, &block)
173
173
  @installers << Sprinkle::Installers::Zypper.new(self, *names, &block)
174
174
  end
175
+
176
+ def brew(*names, &block)
177
+ @installers << Sprinkle::Installers::Brew.new(self, *names, &block)
178
+ end
175
179
 
176
180
  def gem(name, options = {}, &block)
177
181
  @recommends << :rubygems
@@ -0,0 +1,21 @@
1
+ module Sprinkle
2
+ module Verifiers
3
+ # = Brew package Verifier
4
+ #
5
+ # Contains a verifier to check the existance of a Homebrew formula.
6
+ #
7
+ # == Example Usage
8
+ #
9
+ # verify { has_brew 'ntp' }
10
+ #
11
+ module Brew
12
+ Sprinkle::Verify.register(Sprinkle::Verifiers::Brew)
13
+
14
+ # Checks to make sure the brew <tt>formula</tt> exists on the remote server.
15
+ def has_brew(package)
16
+ @commands << "brew list | grep #{package}"
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,66 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe Sprinkle::Installers::Brew do
4
+
5
+ before do
6
+ @formula = mock(Sprinkle::Package, :name => 'formula')
7
+ end
8
+
9
+ def create_brew(*formulas, &block)
10
+ Sprinkle::Installers::Brew.new(@formula, *formulas, &block)
11
+ end
12
+
13
+ describe 'when created' do
14
+
15
+ it 'should accept a single package to install' do
16
+ @installer = create_brew 'ruby'
17
+ @installer.formulas.should == [ 'ruby' ]
18
+ end
19
+
20
+ it 'should accept an array of packages to install' do
21
+ @installer = create_brew %w( gcc gdb g++ )
22
+ @installer.formulas.should == ['gcc', 'gdb', 'g++']
23
+ end
24
+
25
+ it 'should remove options from packages list' do
26
+ @installer = create_brew 'ruby'
27
+ @installer.formulas.should == [ 'ruby' ]
28
+ end
29
+
30
+ end
31
+
32
+ describe 'during installation' do
33
+
34
+ before do
35
+ @installer = create_brew 'ruby' do
36
+ pre :install, 'op1'
37
+ post :install, 'op2'
38
+ end
39
+ @install_commands = @installer.send :install_commands
40
+ end
41
+
42
+ it 'should invoke the apt installer for all specified packages' do
43
+ @install_commands.should =~ /brew install ruby/
44
+ end
45
+
46
+ it 'should automatically insert pre/post commands for the specified package' do
47
+ @installer.send(:install_sequence).should == [ 'op1', %(brew install ruby), 'op2' ]
48
+ end
49
+
50
+ it 'should install a specific version if defined'
51
+
52
+ end
53
+
54
+ # describe 'during dependencies only installation' do
55
+ #
56
+ # before do
57
+ # @installer = create_apt('ruby') { dependencies_only true }
58
+ # @install_commands = @installer.send :install_commands
59
+ # end
60
+ #
61
+ # it 'should invoke the apt installer with build-dep command for all specified packages' do
62
+ # @install_commands.should =~ /apt-get --force-yes -qyu build-dep ruby/
63
+ # end
64
+ #
65
+ # end
66
+ end
data/sprinkle.gemspec CHANGED
@@ -4,14 +4,15 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "sprinkle"
8
- s.version = "0.4.1"
7
+ s.name = %q{sprinkle}
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marcus Crafter"]
12
- s.date = "2011-09-18"
13
- s.description = "Ruby DSL based software provisioning tool"
14
- s.email = "crafterm@redartisan.com"
12
+ s.date = %q{2011-10-04}
13
+ s.default_executable = %q{sprinkle}
14
+ s.description = %q{Ruby DSL based software provisioning tool}
15
+ s.email = %q{crafterm@redartisan.com}
15
16
  s.executables = ["sprinkle"]
16
17
  s.extra_rdoc_files = [
17
18
  "README.markdown",
@@ -60,6 +61,7 @@ Gem::Specification.new do |s|
60
61
  "lib/sprinkle/extensions/symbol.rb",
61
62
  "lib/sprinkle/installers/apt.rb",
62
63
  "lib/sprinkle/installers/binary.rb",
64
+ "lib/sprinkle/installers/brew.rb",
63
65
  "lib/sprinkle/installers/bsd_port.rb",
64
66
  "lib/sprinkle/installers/deb.rb",
65
67
  "lib/sprinkle/installers/freebsd_pkg.rb",
@@ -88,6 +90,7 @@ Gem::Specification.new do |s|
88
90
  "lib/sprinkle/policy.rb",
89
91
  "lib/sprinkle/script.rb",
90
92
  "lib/sprinkle/verifiers/apt.rb",
93
+ "lib/sprinkle/verifiers/brew.rb",
91
94
  "lib/sprinkle/verifiers/directory.rb",
92
95
  "lib/sprinkle/verifiers/executable.rb",
93
96
  "lib/sprinkle/verifiers/file.rb",
@@ -111,6 +114,7 @@ Gem::Specification.new do |s|
111
114
  "spec/sprinkle/extensions/string_spec.rb",
112
115
  "spec/sprinkle/installers/apt_spec.rb",
113
116
  "spec/sprinkle/installers/binary_spec.rb",
117
+ "spec/sprinkle/installers/brew_spec.rb",
114
118
  "spec/sprinkle/installers/bsd_port_spec.rb",
115
119
  "spec/sprinkle/installers/freebsd_pkg_spec.rb",
116
120
  "spec/sprinkle/installers/freebsd_portinstall_spec.rb",
@@ -136,11 +140,11 @@ Gem::Specification.new do |s|
136
140
  "spec/sprinkle/verify_spec.rb",
137
141
  "sprinkle.gemspec"
138
142
  ]
139
- s.homepage = "http://github.com/crafterm/sprinkle"
143
+ s.homepage = %q{http://github.com/crafterm/sprinkle}
140
144
  s.require_paths = ["lib"]
141
- s.rubyforge_project = "sprinkle"
142
- s.rubygems_version = "1.8.10"
143
- s.summary = "Ruby DSL based software provisioning tool"
145
+ s.rubyforge_project = %q{sprinkle}
146
+ s.rubygems_version = %q{1.4.2}
147
+ s.summary = %q{Ruby DSL based software provisioning tool}
144
148
 
145
149
  if s.respond_to? :specification_version then
146
150
  s.specification_version = 3
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprinkle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcus Crafter
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-18 00:00:00 Z
18
+ date: 2011-10-04 00:00:00 +11:00
19
+ default_executable: sprinkle
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
@@ -132,6 +133,7 @@ files:
132
133
  - lib/sprinkle/extensions/symbol.rb
133
134
  - lib/sprinkle/installers/apt.rb
134
135
  - lib/sprinkle/installers/binary.rb
136
+ - lib/sprinkle/installers/brew.rb
135
137
  - lib/sprinkle/installers/bsd_port.rb
136
138
  - lib/sprinkle/installers/deb.rb
137
139
  - lib/sprinkle/installers/freebsd_pkg.rb
@@ -160,6 +162,7 @@ files:
160
162
  - lib/sprinkle/policy.rb
161
163
  - lib/sprinkle/script.rb
162
164
  - lib/sprinkle/verifiers/apt.rb
165
+ - lib/sprinkle/verifiers/brew.rb
163
166
  - lib/sprinkle/verifiers/directory.rb
164
167
  - lib/sprinkle/verifiers/executable.rb
165
168
  - lib/sprinkle/verifiers/file.rb
@@ -183,6 +186,7 @@ files:
183
186
  - spec/sprinkle/extensions/string_spec.rb
184
187
  - spec/sprinkle/installers/apt_spec.rb
185
188
  - spec/sprinkle/installers/binary_spec.rb
189
+ - spec/sprinkle/installers/brew_spec.rb
186
190
  - spec/sprinkle/installers/bsd_port_spec.rb
187
191
  - spec/sprinkle/installers/freebsd_pkg_spec.rb
188
192
  - spec/sprinkle/installers/freebsd_portinstall_spec.rb
@@ -208,6 +212,7 @@ files:
208
212
  - spec/sprinkle/verify_spec.rb
209
213
  - sprinkle.gemspec
210
214
  - TODO
215
+ has_rdoc: true
211
216
  homepage: http://github.com/crafterm/sprinkle
212
217
  licenses: []
213
218
 
@@ -237,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
242
  requirements: []
238
243
 
239
244
  rubyforge_project: sprinkle
240
- rubygems_version: 1.8.10
245
+ rubygems_version: 1.4.2
241
246
  signing_key:
242
247
  specification_version: 3
243
248
  summary: Ruby DSL based software provisioning tool