sprinkle 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sprinkle/installers/thor.rb +37 -0
- data/lib/sprinkle/package.rb +4 -0
- data/spec/sprinkle/installers/thor_spec.rb +29 -0
- data/sprinkle.gemspec +4 -2
- metadata +6 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = Thor Installer
|
4
|
+
#
|
5
|
+
# This installer runs a thor command.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# The following example runs the command "thor spec" on
|
10
|
+
# the remote server.
|
11
|
+
#
|
12
|
+
# package :spec do
|
13
|
+
# thor 'spec'
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Specify a Thorfile with the :thorfile option.
|
17
|
+
#
|
18
|
+
# package :spec, :thorfile => "/var/setup/Thorfile" do
|
19
|
+
# thor 'spec'
|
20
|
+
# end
|
21
|
+
|
22
|
+
class Thor < Installer
|
23
|
+
def initialize(parent, commands, options = {}, &block) #:nodoc:
|
24
|
+
super parent, options, &block
|
25
|
+
@commands = commands
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def install_commands #:nodoc:
|
31
|
+
file = @options[:thorfile] ? "-f #{@options[:thorfile]} " : ""
|
32
|
+
"thor #{file}#{@commands}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/sprinkle/package.rb
CHANGED
@@ -187,6 +187,10 @@ module Sprinkle
|
|
187
187
|
@installers << Sprinkle::Installers::Rake.new(self, name, options, &block)
|
188
188
|
end
|
189
189
|
|
190
|
+
def thor(name, options = {}, &block)
|
191
|
+
@installers << Sprinkle::Installers::Thor.new(self, name, options, &block)
|
192
|
+
end
|
193
|
+
|
190
194
|
def noop(&block)
|
191
195
|
@installers << Sprinkle::Installers::Noop.new(self, name, options, &block)
|
192
196
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Sprinkle::Installers::Thor do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'spec')
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_thor(names, options = {}, &block)
|
10
|
+
Sprinkle::Installers::Thor.new(@package, names, options, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'during installation' do
|
14
|
+
|
15
|
+
it 'should invoke the thor executer for all specified tasks' do
|
16
|
+
@installer = create_thor 'spec'
|
17
|
+
@install_commands = @installer.send :install_commands
|
18
|
+
@install_commands.should =~ /thor spec/
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should invoke the thor executer for all specified tasks' do
|
22
|
+
@installer = create_thor 'spec', :thorfile => '/some/Thorfile'
|
23
|
+
@install_commands = @installer.send :install_commands
|
24
|
+
@install_commands.should == "thor -f /some/Thorfile spec"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/sprinkle.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "sprinkle"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.6"
|
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-
|
12
|
+
s.date = "2011-09-10"
|
13
13
|
s.description = "Ruby DSL based software provisioning tool"
|
14
14
|
s.email = "crafterm@redartisan.com"
|
15
15
|
s.executables = ["sprinkle"]
|
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
|
|
79
79
|
"lib/sprinkle/installers/runner.rb",
|
80
80
|
"lib/sprinkle/installers/smart.rb",
|
81
81
|
"lib/sprinkle/installers/source.rb",
|
82
|
+
"lib/sprinkle/installers/thor.rb",
|
82
83
|
"lib/sprinkle/installers/transfer.rb",
|
83
84
|
"lib/sprinkle/installers/user.rb",
|
84
85
|
"lib/sprinkle/installers/yum.rb",
|
@@ -125,6 +126,7 @@ Gem::Specification.new do |s|
|
|
125
126
|
"spec/sprinkle/installers/rpm_spec.rb",
|
126
127
|
"spec/sprinkle/installers/runner_spec.rb",
|
127
128
|
"spec/sprinkle/installers/source_spec.rb",
|
129
|
+
"spec/sprinkle/installers/thor_spec.rb",
|
128
130
|
"spec/sprinkle/installers/transfer_spec.rb",
|
129
131
|
"spec/sprinkle/installers/yum_spec.rb",
|
130
132
|
"spec/sprinkle/installers/zypper_spec.rb",
|
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:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 6
|
10
|
+
version: 0.3.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcus Crafter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/sprinkle/installers/runner.rb
|
152
152
|
- lib/sprinkle/installers/smart.rb
|
153
153
|
- lib/sprinkle/installers/source.rb
|
154
|
+
- lib/sprinkle/installers/thor.rb
|
154
155
|
- lib/sprinkle/installers/transfer.rb
|
155
156
|
- lib/sprinkle/installers/user.rb
|
156
157
|
- lib/sprinkle/installers/yum.rb
|
@@ -197,6 +198,7 @@ files:
|
|
197
198
|
- spec/sprinkle/installers/rpm_spec.rb
|
198
199
|
- spec/sprinkle/installers/runner_spec.rb
|
199
200
|
- spec/sprinkle/installers/source_spec.rb
|
201
|
+
- spec/sprinkle/installers/thor_spec.rb
|
200
202
|
- spec/sprinkle/installers/transfer_spec.rb
|
201
203
|
- spec/sprinkle/installers/yum_spec.rb
|
202
204
|
- spec/sprinkle/installers/zypper_spec.rb
|