Indentinator 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.
Files changed (3) hide show
  1. data/bin/indentinator +7 -3
  2. data/lib/indentinator.rb +0 -3
  3. metadata +3 -3
data/bin/indentinator CHANGED
@@ -25,13 +25,15 @@ end
25
25
 
26
26
  @files.each do |path|
27
27
  begin
28
+ if File.directory?(path)
29
+ puts "#{path} is a directory."
30
+ next
31
+ end
28
32
  File.open(path) do |file|
29
33
  lines = file.read.split("\n")
30
34
  amount = indent_amount(lines)
31
35
  if @to_amount.nil?
32
- if amount.nil?
33
- puts "Failed for #{path}. Is it binary?"
34
- elsif amount == 0
36
+ if amount == 0
35
37
  puts "#{path} has no indentation."
36
38
  else
37
39
  puts "#{path} uses #{amount} spaces."
@@ -42,5 +44,7 @@ end
42
44
  end
43
45
  rescue Errno::ENOENT
44
46
  puts "Can't open #{path}"
47
+ rescue ArgumentError
48
+ puts "Failed for #{path}. Is it binary?"
45
49
  end
46
50
  end
data/lib/indentinator.rb CHANGED
@@ -24,9 +24,6 @@ def indent_amount(lines)
24
24
  else
25
25
  0
26
26
  end
27
- rescue ArgumentError
28
- # Probably a binary file
29
- nil
30
27
  end
31
28
 
32
29
  def convert_indentation(text, from, to)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Indentinator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Toby Ho