sprinkle 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CREDITS +2 -1
  2. data/Rakefile +5 -10
  3. data/VERSION +1 -1
  4. data/lib/sprinkle/configurable.rb +1 -1
  5. data/lib/sprinkle/extensions/blank_slate.rb +2 -2
  6. data/lib/sprinkle/installers/binary.rb +4 -4
  7. data/lib/sprinkle/installers/rake.rb +2 -2
  8. data/lib/sprinkle/installers/source.rb +11 -11
  9. data/spec/spec_helper.rb +0 -8
  10. data/spec/sprinkle/actors/capistrano_spec.rb +1 -1
  11. data/spec/sprinkle/actors/local_spec.rb +1 -1
  12. data/spec/sprinkle/configurable_spec.rb +2 -2
  13. data/spec/sprinkle/deployment_spec.rb +1 -1
  14. data/spec/sprinkle/extensions/array_spec.rb +1 -1
  15. data/spec/sprinkle/extensions/string_spec.rb +1 -1
  16. data/spec/sprinkle/installers/apt_spec.rb +5 -2
  17. data/spec/sprinkle/installers/binary_spec.rb +64 -0
  18. data/spec/sprinkle/installers/bsd_port_spec.rb +1 -1
  19. data/spec/sprinkle/installers/freebsd_pkg_spec.rb +4 -2
  20. data/spec/sprinkle/installers/freebsd_portinstall_spec.rb +1 -1
  21. data/spec/sprinkle/installers/gem_spec.rb +1 -1
  22. data/spec/sprinkle/installers/installer_spec.rb +3 -3
  23. data/spec/sprinkle/installers/mac_port_spec.rb +1 -1
  24. data/spec/sprinkle/installers/noop_spec.rb +1 -1
  25. data/spec/sprinkle/installers/openbsd_pkg_spec.rb +4 -2
  26. data/spec/sprinkle/installers/opensolaris_pkg_spec.rb +4 -2
  27. data/spec/sprinkle/installers/push_text_spec.rb +1 -1
  28. data/spec/sprinkle/installers/rake_spec.rb +1 -1
  29. data/spec/sprinkle/installers/replace_text_spec.rb +1 -1
  30. data/spec/sprinkle/installers/rpm_spec.rb +7 -3
  31. data/spec/sprinkle/installers/runner_spec.rb +1 -1
  32. data/spec/sprinkle/installers/source_spec.rb +70 -44
  33. data/spec/sprinkle/installers/transfer_spec.rb +1 -1
  34. data/spec/sprinkle/installers/yum_spec.rb +4 -2
  35. data/spec/sprinkle/installers/zypper_spec.rb +1 -1
  36. data/spec/sprinkle/package_spec.rb +1 -1
  37. data/spec/sprinkle/policy_spec.rb +10 -4
  38. data/spec/sprinkle/script_spec.rb +1 -1
  39. data/spec/sprinkle/sprinkle_spec.rb +1 -1
  40. data/spec/sprinkle/verify_spec.rb +1 -1
  41. metadata +14 -66
  42. data/.gitignore +0 -6
  43. data/spec/sprinkle/sequence_spec.rb +0 -44
data/CREDITS CHANGED
@@ -29,5 +29,6 @@ Chris Gaffney (http://github.com/gaffneyc)
29
29
  Maxmpz (http://github.com/maxmpz)
30
30
  Geoff Garside (http://geoffgarside.co.uk/)
31
31
  Oliver Kiessler (http://inceedo.com)
32
+ Nick Plante (http://blog.zerosum.org)
32
33
 
33
- The transfer installer contains a piece of exception reporting code copied from the Chef library (http://wiki.opscode.com/display/chef/Home)
34
+ The transfer installer contains a piece of exception reporting code copied from the Chef library (http://wiki.opscode.com/display/chef/Home)
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.rubyforge_project = 'sprinkle'
12
12
  gem.homepage = "http://github.com/crafterm/sprinkle"
13
13
  gem.authors = ["Marcus Crafter"]
14
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ gem.add_development_dependency("rspec", ">= 2.5")
15
15
  gem.add_dependency('activesupport', '>= 2.0.2')
16
16
  gem.add_dependency('highline', '>= 1.4.0')
17
17
  gem.add_dependency('capistrano', '>= 2.5.5')
@@ -27,16 +27,11 @@ task "inst"=>[:clobber, :build] do
27
27
  puts `gem install pkg/sprinkle-*.gem`
28
28
  end
29
29
 
30
- require 'spec/rake/spectask'
31
- Spec::Rake::SpecTask.new(:spec) do |spec|
32
- spec.libs << 'lib' << 'spec'
33
- spec.spec_files = FileList['spec/**/*_spec.rb']
34
- end
35
-
36
- Spec::Rake::SpecTask.new(:rcov) do |spec|
37
- spec.libs << 'lib' << 'spec'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
38
32
  spec.pattern = 'spec/**/*_spec.rb'
39
- spec.rcov = true
33
+ spec.rspec_opts = ['--backtrace']
34
+ # spec.rcov = true
40
35
  end
41
36
 
42
37
  task :spec => :check_dependencies
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -18,7 +18,7 @@ module Sprinkle
18
18
  def method_missing(sym, *args, &block)
19
19
  unless args.empty? # mutate if not set
20
20
  @options ||= {}
21
- @options[sym] = *args unless @options[sym]
21
+ @options[sym] = args unless @options[sym]
22
22
  end
23
23
 
24
24
  @options[sym] || @package.send(sym, *args, &block) # try the parents options if unknown
@@ -1,5 +1,5 @@
1
1
  class BlankSlate #:nodoc:
2
- instance_methods.each do |m|
3
- undef_method(m) unless %w( __send__ __id__ send class inspect instance_eval instance_variables ).include?(m)
2
+ instance_methods.each do |m|
3
+ undef_method(m) unless %w( __send__ __id__ send class inspect instance_eval instance_variables object_id ).include?(m.to_s)
4
4
  end
5
5
  end
@@ -18,13 +18,13 @@ module Sprinkle
18
18
  raise 'No installation area defined' unless @options[:prefix]
19
19
  raise 'No archive download area defined' unless @options[:archives]
20
20
 
21
- [ "mkdir -p #{@options[:prefix]}",
22
- "mkdir -p #{@options[:archives]}" ]
21
+ [ "mkdir -p #{@options[:prefix].first}",
22
+ "mkdir -p #{@options[:archives].first}" ]
23
23
  end
24
24
 
25
25
  def install_commands #:nodoc:
26
- commands = [ "bash -c 'wget -cq --directory-prefix=#{@options[:archives]} #{@binary_archive}'" ]
27
- commands << "bash -c 'cd #{@options[:prefix]} && #{extract_command} #{@options[:archives]}/#{@binary_archive.split("/").last}'"
26
+ commands = [ "bash -c 'wget -cq --directory-prefix=#{@options[:archives].first} #{@binary_archive}'" ]
27
+ commands << "bash -c 'cd #{@options[:prefix].first} && #{extract_command} #{@options[:archives].first}/#{@binary_archive.split("/").last}'"
28
28
  end
29
29
 
30
30
  def extract_command(archive_name = @binary_archive.split("/").last)
@@ -22,14 +22,14 @@ module Sprinkle
22
22
  class Rake < Installer
23
23
  def initialize(parent, commands, options = {}, &block) #:nodoc:
24
24
  super parent, options, &block
25
- @commands = commands.to_a
25
+ @commands = commands
26
26
  end
27
27
 
28
28
  protected
29
29
 
30
30
  def install_commands #:nodoc:
31
31
  file = @options[:rakefile] ? "-f #{@options[:rakefile]} " : ""
32
- "rake #{file}#{@commands.join(' ')}"
32
+ "rake #{file}#{@commands}"
33
33
  end
34
34
 
35
35
  end
@@ -91,27 +91,27 @@ module Sprinkle
91
91
  raise 'No build area defined' unless @options[:builds]
92
92
  raise 'No source download area defined' unless @options[:archives]
93
93
 
94
- [ "mkdir -p #{@options[:prefix]}",
95
- "mkdir -p #{@options[:builds]}",
96
- "mkdir -p #{@options[:archives]}" ]
94
+ [ "mkdir -p #{@options[:prefix].first}",
95
+ "mkdir -p #{@options[:builds].first}",
96
+ "mkdir -p #{@options[:archives].first}" ]
97
97
  end
98
98
 
99
99
  def download_commands #:nodoc:
100
100
  if File.exist? @source
101
- [ "cp #{@source} #{@options[:archives]}/#{archive_name}" ]
101
+ [ "cp #{@source} #{@options[:archives].first}/#{archive_name}" ]
102
102
  else
103
- [ "wget -cq --directory-prefix='#{@options[:archives]}' #{@source}" ]
103
+ [ "wget -cq --directory-prefix='#{@options[:archives].first}' #{@source}" ]
104
104
  end
105
105
  end
106
106
 
107
107
  def extract_commands #:nodoc:
108
- [ "bash -c 'cd #{@options[:builds]} && #{extract_command} #{@options[:archives]}/#{archive_name}'" ]
108
+ [ "bash -c 'cd #{@options[:builds].first} && #{extract_command} #{@options[:archives].first}/#{archive_name}'" ]
109
109
  end
110
110
 
111
111
  def configure_commands #:nodoc:
112
112
  return [] if custom_install?
113
113
 
114
- command = "bash -c 'cd #{build_dir} && ./configure --prefix=#{@options[:prefix]} "
114
+ command = "bash -c 'cd #{build_dir} && ./configure --prefix=#{@options[:prefix].first} "
115
115
 
116
116
  extras = {
117
117
  :enable => '--enable', :disable => '--disable',
@@ -119,8 +119,8 @@ module Sprinkle
119
119
  :option => '-',
120
120
  }
121
121
 
122
- extras.inject(command) { |m, (k, v)| m << create_options(k, v) if options[k]; m }
123
-
122
+ extras.inject(command) { |m, (k, v)| m << create_options(k, v) if options[k]; m }
123
+
124
124
  [ command << " > #{@package.name}-configure.log 2>&1'" ]
125
125
  end
126
126
 
@@ -154,7 +154,7 @@ module Sprinkle
154
154
  private
155
155
 
156
156
  def create_options(key, prefix) #:nodoc:
157
- @options[key].inject(' ') { |m, option| m << "#{prefix}-#{option} "; m }
157
+ @options[key].first.inject('') { |m, option| m << "#{prefix}-#{option} "; m }
158
158
  end
159
159
 
160
160
  def extract_command #:nodoc:
@@ -179,7 +179,7 @@ module Sprinkle
179
179
  end
180
180
 
181
181
  def build_dir #:nodoc:
182
- "#{@options[:builds]}/#{options[:custom_dir] || base_dir}"
182
+ "#{@options[:builds].first}/#{options[:custom_dir] || base_dir}"
183
183
  end
184
184
 
185
185
  def base_dir #:nodoc:
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,3 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- gem 'rspec'
6
- require 'spec'
7
- end
8
-
9
1
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
2
  require 'sprinkle'
11
3
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Actors::Capistrano do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Actors::Local do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Configurable do
4
4
  module MyPrefix
@@ -32,7 +32,7 @@ describe Sprinkle::Configurable do
32
32
  @configurable.instance_eval do
33
33
  hsv 'gts'
34
34
  end
35
- @configurable.hsv.should == 'gts'
35
+ @configurable.hsv.first.should == 'gts'
36
36
  end
37
37
 
38
38
  it 'should allow the delivery instance variable to be accessed' do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Deployment do
4
4
  include Sprinkle::Deployment
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Array, 'task name conversions' do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe String, 'task name conversions' do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Apt do
4
4
 
@@ -51,7 +51,9 @@ describe Sprinkle::Installers::Apt do
51
51
  @installer.send(:install_sequence).should == [ 'op1', %(env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qyu install ruby), 'op2' ]
52
52
  end
53
53
 
54
- it 'should install a specific version if defined'
54
+ it 'should install a specific version if defined' do
55
+ pending
56
+ end
55
57
 
56
58
  end
57
59
 
@@ -67,4 +69,5 @@ describe Sprinkle::Installers::Apt do
67
69
  end
68
70
 
69
71
  end
72
+
70
73
  end
@@ -0,0 +1,64 @@
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
+
3
+ describe Sprinkle::Installers::Binary do
4
+ include Sprinkle::Deployment
5
+
6
+ def create_context
7
+ binary = 'http://www.example.com/archive.tar.gz'
8
+
9
+ deployment = deployment do
10
+ delivery :capistrano
11
+ binary "http://www.example.com/archive.tar.gz" do
12
+ prefix '/prefix/directory'
13
+ archives '/archives/directory'
14
+ end
15
+ end
16
+
17
+ installer = create_binary binary do
18
+ prefix '/prefix/directory'
19
+ archives '/archives/directory'
20
+ end
21
+
22
+ installer.defaults(@deployment)
23
+
24
+ [binary, deployment, installer]
25
+ end
26
+
27
+ def create_binary(binary, version = nil, &block)
28
+ @package = mock(Sprinkle::Package, :name => 'package', :version => version)
29
+ Sprinkle::Installers::Binary.new(@package, binary, &block)
30
+ end
31
+
32
+ describe "binary#prepare_commands" do
33
+ before do
34
+ @binary, @deployment, @installer = create_context
35
+ end
36
+
37
+ it "should return mkdir command to create the prefix directory" do
38
+ @installer.send(:prepare_commands)[0].should == 'mkdir -p /prefix/directory'
39
+ end
40
+ it "should return mkdir command to create the archives directory" do
41
+ @installer.send(:prepare_commands)[1].should == 'mkdir -p /archives/directory'
42
+ end
43
+ end
44
+
45
+
46
+ describe "binary#install_commands" do
47
+ before do
48
+ @binary, @deployment, @installer = create_context
49
+ end
50
+
51
+ it "should return a commands to place the binary in the correct archive directory" do
52
+ @installer.send(:install_commands)[0].should =~ /--directory-prefix=\/archives\/directory/
53
+ end
54
+
55
+ it "should return a command to extract to the correct prefix folder" do
56
+ @installer.send(:install_commands)[1].should =~ /cd \/prefix\/directory/
57
+ end
58
+
59
+ it "should return a command to extract the right file in the right directory" do
60
+ @installer.send(:install_commands)[1].should =~ / \/archives\/directory\/archive.tar.gz/
61
+ end
62
+ end
63
+
64
+ end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::BsdPort do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::FreebsdPkg do
4
4
 
@@ -42,7 +42,9 @@ describe Sprinkle::Installers::FreebsdPkg do
42
42
  @installer.send(:install_sequence).should == [ 'op1', 'pkg_add -r ruby', 'op2' ]
43
43
  end
44
44
 
45
- it 'should install a specific version if defined'
45
+ it 'should install a specific version if defined' do
46
+ pending
47
+ end
46
48
 
47
49
  end
48
50
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::FreebsdPortinstall do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Gem do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Installer do
4
4
  include Sprinkle::Deployment
@@ -41,13 +41,13 @@ describe Sprinkle::Installers::Installer do
41
41
 
42
42
  it 'should accept an optional block to customize installers defaults' do
43
43
  @installer = create_installer do; prefix '/usr/local'; end
44
- @installer.prefix.should == '/usr/local'
44
+ @installer.prefix.first.should == '/usr/local'
45
45
  end
46
46
 
47
47
  it 'should override any deployment level defaults' do
48
48
  @installer = create_installer do; prefix '/usr/local'; end
49
49
  @installer.defaults(@deployment)
50
- @installer.prefix.should == '/usr/local'
50
+ @installer.prefix.first.should == '/usr/local'
51
51
  end
52
52
  end
53
53
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::MacPort do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Noop do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::OpenbsdPkg do
4
4
 
@@ -42,7 +42,9 @@ describe Sprinkle::Installers::OpenbsdPkg do
42
42
  @installer.send(:install_sequence).should == [ 'op1', 'pkg_add ruby', 'op2' ]
43
43
  end
44
44
 
45
- it 'should install a specific version if defined'
45
+ it 'should install a specific version if defined' do
46
+ pending
47
+ end
46
48
 
47
49
  end
48
50
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::OpensolarisPkg do
4
4
 
@@ -42,7 +42,9 @@ describe Sprinkle::Installers::OpensolarisPkg do
42
42
  @installer.send(:install_sequence).should == [ 'op1', 'pkg install ruby', 'op2' ]
43
43
  end
44
44
 
45
- it 'should install a specific version if defined'
45
+ it 'should install a specific version if defined' do
46
+ pending
47
+ end
46
48
 
47
49
  end
48
50
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::PushText do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Rake do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::ReplaceText do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Rpm do
4
4
 
@@ -42,8 +42,12 @@ describe Sprinkle::Installers::Rpm do
42
42
  @installer.send(:install_sequence).should == [ 'op1', 'rpm -Uvh ruby', 'op2' ]
43
43
  end
44
44
 
45
- it 'should specify a non interactive mode to the apt installer'
46
- it 'should install a specific version if defined'
45
+ it 'should specify a non interactive mode to the apt installer' do
46
+ pending
47
+ end
48
+ it 'should install a specific version if defined' do
49
+ pending
50
+ end
47
51
 
48
52
  end
49
53
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Runner do
4
4
 
@@ -1,10 +1,12 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Source do
4
4
  include Sprinkle::Deployment
5
5
 
6
6
  before do
7
- @source = 'ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz'
7
+ @filename = "ruby-1.8.6-p111"
8
+ @tarball = "#{@filename}.tar.gz"
9
+ @source = "ftp://ftp.ruby-lang.org/pub/ruby/1.8/#{@tarball}"
8
10
 
9
11
  @deployment = deployment do
10
12
  delivery :capistrano
@@ -24,7 +26,7 @@ describe Sprinkle::Installers::Source do
24
26
  disable %w( cache proxy rewrite )
25
27
 
26
28
  with %w( debug extras )
27
- without %w( fancyisms )
29
+ without %w( fancyisms pandas )
28
30
 
29
31
  option %w( foo bar baz )
30
32
  end
@@ -34,6 +36,7 @@ describe Sprinkle::Installers::Source do
34
36
 
35
37
  def create_source(source, version = nil, &block)
36
38
  @package = mock(Sprinkle::Package, :name => 'package', :version => version)
39
+
37
40
  Sprinkle::Installers::Source.new(@package, source, &block)
38
41
  end
39
42
 
@@ -70,101 +73,124 @@ describe Sprinkle::Installers::Source do
70
73
 
71
74
  end
72
75
 
73
- describe 'customized configuration' do
76
+ describe 'customized configuration' do
74
77
 
75
78
  it 'should support specification of "enable" options' do
76
- @installer.enable.should == %w( headers ssl deflate so )
79
+ @installer.enable.first.should == %w( headers ssl deflate so )
77
80
  end
78
81
 
79
82
  it 'should support specification of "disable" options' do
80
- @installer.disable.should == %w( cache proxy rewrite )
83
+ @installer.disable.first.should == %w( cache proxy rewrite )
81
84
  end
82
85
 
83
86
  it 'should support specification of "with" options' do
84
- @installer.with.should == %w( debug extras )
87
+ @installer.with.first.should == %w( debug extras )
85
88
  end
86
89
 
87
90
  it 'should support specification of "without" options' do
88
- @installer.without.should == %w( fancyisms )
91
+ @installer.without.first.should == %w( fancyisms pandas )
89
92
  end
90
93
 
91
94
  it 'should support specification of "option" options' do
92
- @installer.option.should == %w( foo bar baz )
95
+ @installer.option.first.should == %w( foo bar baz )
93
96
  end
94
97
 
95
98
  it 'should support customized build area' do
96
- @installer.prefix.should == '/usr/local'
99
+ @installer.prefix.first.should == '/usr/local'
97
100
  end
98
101
 
99
102
  it 'should support customized source area' do
100
- @installer.archives.should == '/usr/local/archives'
103
+ @installer.archives.first.should == '/usr/local/archives'
101
104
  end
102
105
 
103
106
  it 'should support customized install area' do
104
- @installer.builds.should == '/usr/local/builds'
107
+ @installer.builds.first.should == '/usr/local/builds'
105
108
  end
106
-
107
109
  end
108
110
 
109
111
  describe 'during gnu source archive style installation' do
110
112
 
111
113
  it 'should prepare the build, installation and source archives area' do
112
- @installer.should_receive(:prepare).and_return(
113
- [
114
+ @installer.should_receive(:prepare).and_return []
115
+ end
116
+
117
+ it "should prepare the build, installation and source archives area with correct paths" do
118
+ @installer.send(:prepare).should ==
119
+ [
114
120
  'mkdir -p /usr/local',
115
121
  'mkdir -p /usr/local/builds',
116
- 'mkdir -p /usr/local/archives'
117
- ]
118
- )
119
-
122
+ 'mkdir -p /usr/local/archives'
123
+ ]
120
124
  end
121
-
125
+
122
126
  it 'should download the source archive' do
123
- @installer.should_receive(:download).and_return(
127
+ @installer.should_receive(:download).and_return []
128
+ end
129
+
130
+ it 'should download the source archive to the correct path' do
131
+ @installer.send(:download).should ==
124
132
  [
125
133
  "wget -cq --directory-prefix='/usr/local/archives' #{@source}"
126
134
  ]
127
- )
128
135
  end
129
-
136
+
130
137
  it 'should extract the source archive' do
131
- @installer.should_receive(:extract).and_return(
138
+ @installer.should_receive(:extract).and_return []
139
+ end
140
+
141
+ it 'should extract the source to the correct path' do
142
+ @installer.send(:extract).should ==
132
143
  [
133
- "bash -c 'cd /usr/local/builds && tar xzf /usr/local/archives/ruby-1.8.6-p111.tar.gz"
144
+ "bash -c 'cd /usr/local/builds && tar xzf /usr/local/archives/ruby-1.8.6-p111.tar.gz'"
134
145
  ]
135
- )
136
146
  end
137
147
 
138
148
  it 'should configure the source' do
149
+ @installer.should_receive(:configure).and_return []
150
+ end
151
+
152
+ it 'should configure the source in the correct path and with the correct prefix and options' do
139
153
  enable = %w( headers ssl deflate so ).inject([]) { |m, value| m << "--enable-#{value}"; m }
140
154
  disable = %w( cache proxy rewrite ).inject([]) { |m, value| m << "--disable-#{value}"; m }
141
155
 
142
156
  with = %w( debug extras ).inject([]) { |m, value| m << "--with-#{value}"; m }
143
- without = %w( fancyisms ).inject([]) { |m, value| m << "--without-#{value}"; m }
144
-
145
- options = "#{enable.join(' ')} #{disable.join(' ')} #{with.join(' ')} #{without.join(' ')}"
146
-
147
- @installer.should_receive(:build).and_return(
148
- [
149
- "bash -c 'cd /usr/local/builds && ./configure --prefix=/usr/local #{options} > #{@package.name}-configure.log 2>&1'"
150
- ]
151
- )
152
- end
153
-
157
+ without = %w( fancyisms pandas ).inject([]) { |m, value| m << "--without-#{value}"; m }
158
+
159
+ option = %w( foo bar baz ).inject([]) { |m, value| m << "--#{value}"; m }
160
+
161
+ configure_command = @installer.send(:configure).first
162
+
163
+ configure_command.should =~ %r{^bash -c 'cd /usr/local/builds/#{@filename} && ./configure --prefix=/usr/local}
164
+ configure_command.should =~ %r{ > #{@package.name}-configure.log 2>&1'$}
165
+
166
+ # order of options is arbitrary in ruby 1.8 !
167
+ configure_command.should =~ /#{enable.join(' ')}/
168
+ configure_command.should =~ /#{disable.join(' ')}/
169
+ configure_command.should =~ /#{with.join(' ')}/
170
+ configure_command.should =~ /#{without.join(' ')}/
171
+ configure_command.should =~ /#{option.join(' ')}/
172
+ end
173
+
154
174
  it 'should build the source' do
155
- @installer.should_receive(:build).and_return(
175
+ @installer.should_receive(:build).and_return []
176
+ end
177
+
178
+ it 'should build the source in the correct build path' do
179
+ @installer.send(:build).should ==
156
180
  [
157
- "bash -c 'cd /usr/local/builds && make > #{@package.name}-build.log 2>&1'"
181
+ "bash -c 'cd /usr/local/builds/#{@filename} && make > #{@package.name}-build.log 2>&1'"
158
182
  ]
159
- )
160
183
  end
161
184
 
162
185
  it 'should install the source' do
163
- @installer.should_receive(:install).and_return(
186
+ @installer.should_receive(:install).and_return []
187
+ end
188
+
189
+ it 'should install the source from the correct build path' do
190
+ @installer.send(:install).should ==
164
191
  [
165
- "bash -c 'cd /usr/local/builds && make install > #{@package.name}-install.log 2>&1'"
192
+ "bash -c 'cd /usr/local/builds/#{@filename} && make install > #{@package.name}-install.log 2>&1'"
166
193
  ]
167
- )
168
194
  end
169
195
 
170
196
  describe 'with a custom archive definition' do
@@ -192,7 +218,7 @@ describe Sprinkle::Installers::Source do
192
218
  end
193
219
 
194
220
  it 'should store the custom install commands' do
195
- @installer.options[:custom_install].should == 'ruby setup.rb'
221
+ @installer.options[:custom_install].first.should == 'ruby setup.rb'
196
222
  end
197
223
 
198
224
  it 'should identify as having a custom install command' do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
  require 'tempfile'
3
3
 
4
4
  describe Sprinkle::Installers::Transfer do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Yum do
4
4
 
@@ -42,7 +42,9 @@ describe Sprinkle::Installers::Yum do
42
42
  @installer.send(:install_sequence).should == [ 'op1', 'yum install ruby -y', 'op2' ]
43
43
  end
44
44
 
45
- it 'should install a specific version if defined'
45
+ it 'should install a specific version if defined' do
46
+ pending
47
+ end
46
48
 
47
49
  end
48
50
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
1
+ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Installers::Zypper do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Package do
4
4
  include Sprinkle::Package
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Policy do
4
4
  include Sprinkle::Policy
@@ -81,9 +81,15 @@ describe Sprinkle::Policy do
81
81
 
82
82
  describe 'containing package dependencies with versions' do
83
83
 
84
- it 'should be invalid if the specified package does not exist'
85
- it 'should ignore any packages of the same name that have other versions'
86
- it 'should select the correct package version when applying'
84
+ it 'should be invalid if the specified package does not exist' do
85
+ pending
86
+ end
87
+ it 'should ignore any packages of the same name that have other versions' do
88
+ pending
89
+ end
90
+ it 'should select the correct package version when applying' do
91
+ pending
92
+ end
87
93
 
88
94
  end
89
95
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Script, 'class' do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe Sprinkle::Verify do
4
4
  before do
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: 21
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
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: 2010-12-12 00:00:00 +11:00
18
+ date: 2011-05-10 00:00:00 +10:00
19
19
  default_executable: sprinkle
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,11 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 13
29
+ hash: 9
30
30
  segments:
31
- - 1
32
31
  - 2
33
- - 9
34
- version: 1.2.9
32
+ - 5
33
+ version: "2.5"
35
34
  type: :development
36
35
  version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
@@ -92,7 +91,6 @@ extra_rdoc_files:
92
91
  - README.markdown
93
92
  - TODO
94
93
  files:
95
- - .gitignore
96
94
  - CREDITS
97
95
  - MIT-LICENSE
98
96
  - README.markdown
@@ -182,6 +180,7 @@ files:
182
180
  - spec/sprinkle/extensions/array_spec.rb
183
181
  - spec/sprinkle/extensions/string_spec.rb
184
182
  - spec/sprinkle/installers/apt_spec.rb
183
+ - spec/sprinkle/installers/binary_spec.rb
185
184
  - spec/sprinkle/installers/bsd_port_spec.rb
186
185
  - spec/sprinkle/installers/freebsd_pkg_spec.rb
187
186
  - spec/sprinkle/installers/freebsd_portinstall_spec.rb
@@ -206,14 +205,13 @@ files:
206
205
  - spec/sprinkle/sprinkle_spec.rb
207
206
  - spec/sprinkle/verify_spec.rb
208
207
  - TODO
209
- - spec/sprinkle/sequence_spec.rb
210
208
  has_rdoc: true
211
209
  homepage: http://github.com/crafterm/sprinkle
212
210
  licenses: []
213
211
 
214
212
  post_install_message:
215
- rdoc_options:
216
- - --charset=UTF-8
213
+ rdoc_options: []
214
+
217
215
  require_paths:
218
216
  - lib
219
217
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -237,59 +235,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
235
  requirements: []
238
236
 
239
237
  rubyforge_project: sprinkle
240
- rubygems_version: 1.3.7
238
+ rubygems_version: 1.5.2
241
239
  signing_key:
242
240
  specification_version: 3
243
241
  summary: Ruby DSL based software provisioning tool
244
- test_files:
245
- - spec/spec_helper.rb
246
- - spec/sprinkle/actors/capistrano_spec.rb
247
- - spec/sprinkle/actors/local_spec.rb
248
- - spec/sprinkle/configurable_spec.rb
249
- - spec/sprinkle/deployment_spec.rb
250
- - spec/sprinkle/extensions/array_spec.rb
251
- - spec/sprinkle/extensions/string_spec.rb
252
- - spec/sprinkle/installers/apt_spec.rb
253
- - spec/sprinkle/installers/bsd_port_spec.rb
254
- - spec/sprinkle/installers/freebsd_pkg_spec.rb
255
- - spec/sprinkle/installers/freebsd_portinstall_spec.rb
256
- - spec/sprinkle/installers/gem_spec.rb
257
- - spec/sprinkle/installers/installer_spec.rb
258
- - spec/sprinkle/installers/mac_port_spec.rb
259
- - spec/sprinkle/installers/noop_spec.rb
260
- - spec/sprinkle/installers/openbsd_pkg_spec.rb
261
- - spec/sprinkle/installers/opensolaris_pkg_spec.rb
262
- - spec/sprinkle/installers/push_text_spec.rb
263
- - spec/sprinkle/installers/rake_spec.rb
264
- - spec/sprinkle/installers/replace_text_spec.rb
265
- - spec/sprinkle/installers/rpm_spec.rb
266
- - spec/sprinkle/installers/runner_spec.rb
267
- - spec/sprinkle/installers/source_spec.rb
268
- - spec/sprinkle/installers/transfer_spec.rb
269
- - spec/sprinkle/installers/yum_spec.rb
270
- - spec/sprinkle/installers/zypper_spec.rb
271
- - spec/sprinkle/package_spec.rb
272
- - spec/sprinkle/policy_spec.rb
273
- - spec/sprinkle/script_spec.rb
274
- - spec/sprinkle/sequence_spec.rb
275
- - spec/sprinkle/sprinkle_spec.rb
276
- - spec/sprinkle/verify_spec.rb
277
- - examples/packages/build_essential.rb
278
- - examples/packages/databases/mysql.rb
279
- - examples/packages/databases/sqlite3.rb
280
- - examples/packages/phusion.rb
281
- - examples/packages/ruby/rails.rb
282
- - examples/packages/ruby/ruby.rb
283
- - examples/packages/ruby/rubygems.rb
284
- - examples/packages/scm/git.rb
285
- - examples/packages/scm/subversion.rb
286
- - examples/packages/servers/apache.rb
287
- - examples/rails/deploy.rb
288
- - examples/rails/packages/database.rb
289
- - examples/rails/packages/essential.rb
290
- - examples/rails/packages/rails.rb
291
- - examples/rails/packages/scm.rb
292
- - examples/rails/packages/search.rb
293
- - examples/rails/packages/server.rb
294
- - examples/rails/rails.rb
295
- - examples/sprinkle/sprinkle.rb
242
+ test_files: []
243
+
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *.gem
2
- pkg
3
- .DS_Store
4
- .idea
5
- .*.swp
6
- sprinkle.gemspec
@@ -1,44 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Sprinkle::Sequence do
4
-
5
- before do
6
- @sequence = Sprinkle::Sequence.new do
7
- section1 do
8
- 'command1'
9
- end
10
-
11
- section2 do
12
- 'command2'
13
- end
14
- end
15
- end
16
-
17
- describe 'during initialization' do
18
-
19
- it 'should yield the block, storing all section definitions provided' do
20
- @sequence.stages.size.should == 2
21
- end
22
-
23
- end
24
-
25
- describe 'during iteration' do
26
-
27
- before do
28
- @stages = { }
29
- @sequence.each do |stage, commands|
30
- @stages[stage] = commands
31
- end
32
- end
33
-
34
- it 'should yield to a given block with the stage and commands for that stage' do
35
- @stages.size.should == 2
36
- @stages.keys.should include(:section1)
37
- @stages[:section1].should == 'command1'
38
- @stages.keys.should include(:section2)
39
- @stages[:section2].should == 'command2'
40
- end
41
-
42
- end
43
-
44
- end