pawnee 0.1.3 → 0.1.4

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.
@@ -10,14 +10,14 @@ module Pawnee
10
10
  data, config = args.shift, args.shift
11
11
  end
12
12
 
13
- if config[:once]
14
- if destination_files.binread(destination)[data]
15
- # Don't run again, the text is already in place
16
- return
17
- end
13
+ if destination_files.binread(destination)[data]
14
+ say_status :identical, destination
15
+ # Don't run again, the text is already in place
16
+ return
18
17
  end
19
18
 
20
- action InjectIntoFile.new(self, destination, data, config)
19
+ action Thor::Actions::InjectIntoFile.new(self, destination, data, config)
21
20
  end
21
+ alias_method :inject_into_file, :insert_into_file
22
22
  end
23
23
  end
@@ -1,6 +1,7 @@
1
1
  require 'pawnee/actions/package'
2
2
  require 'pawnee/actions/compile'
3
3
  require 'pawnee/actions/user'
4
+ require 'pawnee/actions/inject_into_file'
4
5
 
5
6
  module Pawnee
6
7
  # The pawnee gem provides the Pawnee::Base class which includes Thor::Actions,
@@ -1,3 +1,3 @@
1
1
  module Pawnee
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -10,6 +10,9 @@ describe "compile actions" do
10
10
  end
11
11
 
12
12
  it 'should install a package' do
13
+ @base.as_root do
14
+ @base.remove_file("/usr/local/bin/redis-server")
15
+ end
13
16
  @base.exec('which redis-server').should == ''
14
17
 
15
18
  @base.compile('http://redis.googlecode.com/files/redis-2.4.15.tar.gz', '/home/vagrant/redis-server/', {:skip_configure => true, :bin_file => 'redis-server'})
@@ -9,8 +9,22 @@ describe "inject into file" do
9
9
  @base.destination_connection = VagrantManager.connect
10
10
  end
11
11
 
12
- it "should only inject once if the once option is specified" do
13
-
12
+ it "should only inject once" do
13
+ @base.destination_files.binwrite('/home/vagrant/test.txt', "line1\nline2\n")
14
+ @base.append_to_file('/home/vagrant/test.txt', "line3")
15
+ @base.destination_files.binread('/home/vagrant/test.txt').scan("line3").size.should == 1
16
+ @base.append_to_file('/home/vagrant/test.txt', "line3")
17
+ @base.destination_files.binread('/home/vagrant/test.txt').scan("line3").size.should == 1
18
+ end
19
+
20
+ it "should say identical the 2nd time around" do
21
+ @base.shell.should_receive(:say_status).with(:append, "/home/vagrant/test.txt", true).once
22
+ @base.should_receive(:say_status).with(:identical, '/home/vagrant/test.txt').once
23
+ @base.destination_files.binwrite('/home/vagrant/test.txt', "line1\nline2\n")
24
+ @base.append_to_file('/home/vagrant/test.txt', "line3")
25
+ @base.destination_files.binread('/home/vagrant/test.txt').scan("line3").size.should == 1
26
+ @base.append_to_file('/home/vagrant/test.txt', "line3")
27
+ @base.destination_files.binread('/home/vagrant/test.txt').scan("line3").size.should == 1
14
28
  end
15
29
 
16
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pawnee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -310,7 +310,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
310
310
  version: '0'
311
311
  segments:
312
312
  - 0
313
- hash: 2154589448393807289
313
+ hash: 4043066546838291018
314
314
  required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  none: false
316
316
  requirements:
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  version: '0'
320
320
  segments:
321
321
  - 0
322
- hash: 2154589448393807289
322
+ hash: 4043066546838291018
323
323
  requirements: []
324
324
  rubyforge_project:
325
325
  rubygems_version: 1.8.22