hmcgowan-roo-tools 0.1.1 → 0.2.0

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.
Files changed (3) hide show
  1. data/lib/roo-tools.rb +3 -0
  2. data/lib/roo-tools/grep.rb +15 -9
  3. metadata +4 -4
@@ -37,6 +37,9 @@ module RooTools
37
37
  builder.add_choice(:cells, :type=>:boolean, :default=>true) do | command_line |
38
38
  command_line.uses_switch("--cells", "Show/hide cells in results")
39
39
  end
40
+ builder.add_choice(:recurse, :type=>:boolean, :default=>false) do | command_line |
41
+ command_line.uses_switch("-r", "--recurse", "Search in subdirectories")
42
+ end
40
43
  builder.add_choice(:files) { |command_line |
41
44
  command_line.uses_arglist
42
45
  }
@@ -21,8 +21,10 @@ module RooTools
21
21
  def process_files
22
22
  @options[:files].each do |file|
23
23
  if File.directory?(file)
24
- Dir.glob(File.join(file.gsub('\\','/'),"**","*.xls")).each do |file|
25
- execute(file)
24
+ if @options[:recurse]
25
+ Dir.glob(File.join(file.gsub('\\','/'),"**","*.{xls, xlsx, ods}")).each { |file| execute(file)}
26
+ else
27
+ Dir.glob(File.join(file.gsub('\\','/'),"*.{xls, xlsx, ods}")).each { |file| execute(file)}
26
28
  end
27
29
  else
28
30
  execute(file)
@@ -31,13 +33,17 @@ module RooTools
31
33
  end
32
34
 
33
35
  def execute(file)
34
- @file = file
35
- @oo = open_spreadsheet(@file)
36
- @oo.sheets.each do |sheet|
37
- @oo.default_sheet = sheet
38
- check_sheet_name
39
- check_sheet_contents
40
- return if @options[:list_only] && @seen[@file]
36
+ begin
37
+ @file = file
38
+ @oo = open_spreadsheet(@file)
39
+ @oo.sheets.each do |sheet|
40
+ @oo.default_sheet = sheet
41
+ check_sheet_name
42
+ check_sheet_contents
43
+ return if @options[:list_only] && @seen[@file]
44
+ end
45
+ rescue Exception =>e
46
+ puts "Unable to open file: #{file}"
41
47
  end
42
48
  end
43
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hmcgowan-roo-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugh McGowan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-12 00:00:00 -07:00
12
+ date: 2009-07-21 00:00:00 -07:00
13
13
  default_executable: oogrep
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -46,7 +46,7 @@ files:
46
46
  - lib/roo-tools.rb
47
47
  - bin/oogrep
48
48
  - README
49
- has_rdoc: true
49
+ has_rdoc: false
50
50
  homepage: ""
51
51
  post_install_message:
52
52
  rdoc_options:
@@ -73,7 +73,7 @@ requirements: []
73
73
  rubyforge_project: roo-tools
74
74
  rubygems_version: 1.2.0
75
75
  signing_key:
76
- specification_version: 2
76
+ specification_version: 3
77
77
  summary: roo-tools
78
78
  test_files: []
79
79