bahuvrihi-data_explorer 0.0.1 → 0.0.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.
@@ -12,11 +12,17 @@ module DataExplorer
12
12
  # DatToAscii is based on the getdeascii.pl script.
13
13
  class DatToAscii < Tap::FileTask
14
14
  include DataExplorer
15
-
16
- def process(output_dir, *input_files)
15
+
16
+ config :output_dir, nil, &c.string_or_nil
17
+
18
+ def process(*input_files)
17
19
  @updated_files = []
18
20
  input_files.collect do |input_file|
19
- output_file = File.join(output_dir, basename(input_file, ".txt"))
21
+ output_file = if output_dir
22
+ File.join(output_dir, basename(input_file, ".txt"))
23
+ else
24
+ input_file.chomp(File.extname(input_file)) + ".txt"
25
+ end
20
26
 
21
27
  if uptodate?(output_file, input_file)
22
28
  log_basename(:skip, input_file)
@@ -55,7 +61,7 @@ module DataExplorer
55
61
  # Ensure de has time to close, then make sure all the output files are dated later than the inputs
56
62
  # This rigmarole is necessary because the output file is created while the input file is open in
57
63
  # DataExplorer, and apparently DataExplorer doesn't release the file until it completely exits.
58
- sleep 1 unless updated_files.empty?
64
+ sleep 1 unless @updated_files.empty?
59
65
  @updated_files.each {|file| FileUtils.touch(file) }
60
66
  @updated_files = nil
61
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bahuvrihi-data_explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Chiang