boatman 0.1.1 → 0.1.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -14,6 +14,8 @@ class Boatman
14
14
 
15
15
  Boatman.logger.info "Successfully copied #{source_path} to #{destination_path}"
16
16
  rescue Exception => e
17
+ # remove the possible incorrect destination file
18
+ FileUtils.rm_r "#{destination_path}"
17
19
  Boatman.logger.error "#{e.message} at #{e.backtrace[0]}"
18
20
  end
19
21
  end
data/spec/boatman_spec.rb CHANGED
@@ -87,6 +87,15 @@ describe "Moving new files from one location to another" do
87
87
  File.directory?(@working_directory + '/tmp/destination/bob').should be_true
88
88
  end
89
89
 
90
+ it "should not produce a file at the destination if the block passed to 'copy' raises an exception" do
91
+ FileUtils.touch(@working_directory + '/tmp/source/datafile.txt')
92
+
93
+ boatman = Boatman.load(["#{@working_directory}/copy_exception.yml", @working_directory])
94
+ run_boatman
95
+
96
+ File.exist?(@working_directory + '/tmp/destination/datafile.txt').should be_false
97
+ end
98
+
90
99
  after(:each) do
91
100
  FileUtils.rm_rf(@working_directory + '/tmp')
92
101
  end
@@ -0,0 +1,9 @@
1
+ source_folder.check_every 1.second do
2
+ age :greater_than => 0.minutes
3
+
4
+ files_ending_with "txt" do |file|
5
+ copy file, :to => destination_folder do |old_file_name, new_file_name|
6
+ raise "something went horribly wrong"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ tasks:
2
+ - copy_exception.rb
3
+ directories:
4
+ source_folder: tmp/source
5
+ destination_folder: tmp/destination
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boatman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruz Marzolf
@@ -9,8 +9,8 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-30 00:00:00 -08:00
13
- default_executable:
12
+ date: 2010-01-07 00:00:00 -08:00
13
+ default_executable: boatman
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -26,7 +26,6 @@ description: ""
26
26
  email: bmarzolf@systemsbiology.org
27
27
  executables:
28
28
  - boatman
29
- - boatman~
30
29
  extensions: []
31
30
 
32
31
  extra_rdoc_files:
@@ -48,6 +47,8 @@ files:
48
47
  - lib/boatman/monitored_directory.rb
49
48
  - lib/boatman/monitored_file.rb
50
49
  - spec/boatman_spec.rb
50
+ - spec/data/copy_exception.rb
51
+ - spec/data/copy_exception.yml
51
52
  - spec/data/filename_ending.rb
52
53
  - spec/data/filename_ending.yml
53
54
  - spec/data/filename_ending_regexp.rb
@@ -95,10 +96,11 @@ summary: Ruby DSL for ferrying around and manipulating files
95
96
  test_files:
96
97
  - spec/spec_helper.rb
97
98
  - spec/boatman_spec.rb
98
- - spec/data/folder.rb
99
- - spec/data/modify.rb
100
- - spec/data/no_destination_folder.rb
101
- - spec/data/filename_ending_regexp.rb
102
- - spec/data/filename_ending.rb
103
99
  - spec/data/rename.rb
100
+ - spec/data/filename_ending.rb
101
+ - spec/data/no_destination_folder.rb
104
102
  - spec/data/filename_regexp.rb
103
+ - spec/data/modify.rb
104
+ - spec/data/filename_ending_regexp.rb
105
+ - spec/data/folder.rb
106
+ - spec/data/copy_exception.rb
data/bin/boatman~ DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- puts "Starting boatman"
4
-
5
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
6
-
7
- require 'rubygems'
8
- require 'boatman'
9
-
10
- puts "Logging to boatman.log"
11
- $logger = Logger.new("boatman.log")
12
- $logger.level = Logger::INFO
13
-
14
- Boatman.load(ARGV)
15
- Boatman.run