stowaway 0.1.8 → 0.1.9

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.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 8
4
+ :patch: 9
5
5
  :build:
@@ -7,4 +7,4 @@ module FSHelpyHelp
7
7
  end
8
8
  false
9
9
  end
10
- end
10
+ end
@@ -41,15 +41,17 @@ module Stowaway
41
41
  return false if @line !~ expression
42
42
  params = $3.gsub(/[\s|"|']/, "").split(",")
43
43
  params.each do |f|
44
- return true if "/public/#{directory}/#{f}" == @file.root_path ||
45
- "/public/#{directory}/#{f}.#{extension}" == @file.root_path
44
+ path = @file.root_path
45
+ return true if "/public/#{directory}/#{f}" == path ||
46
+ "/public/#{directory}/#{f}.#{extension}" == path
46
47
  end
47
48
  false
48
49
  end
49
50
 
50
51
  def direct_or_public_dir_match?(expression)
51
- @line =~ Regexp.new(expression.to_s % @file.root_path) ||
52
- @line =~ Regexp.new(expression.to_s % trim_public)
52
+ expression = expression.to_s
53
+ @line =~ Regexp.new(expression % @file.root_path) ||
54
+ @line =~ Regexp.new(expression % trim_public)
53
55
  end
54
56
 
55
57
  def trim_public
@@ -13,6 +13,7 @@ module Stowaway
13
13
  end
14
14
 
15
15
  private
16
+
16
17
  def parse(argv)
17
18
  OptionParser.new do |opts|
18
19
  opts.banner = "Usage: stowaway [ options ] path/to/site"
@@ -23,20 +23,40 @@ module Stowaway
23
23
  private
24
24
 
25
25
  def respond(result)
26
- if result.files.empty?
27
- print "Zero stowaways found. You run a tight ship.\n\n"
28
- else
29
- print "\nYou have #{result.files.length} stowaway(s) ... shameful\n\n"
26
+ files = result.files
27
+ name_only_matches = result.name_only_matches
30
28
 
31
- unless result.name_only_matches.empty?
32
- p "Warning: #{result.name_only_matches.length} file(s) partially matched on name only"
33
- end
29
+ if files.empty?
30
+ print "Zero stowaways found. "
31
+ end
34
32
 
35
- 60.times { print "-" }
36
- print "\n\n"
37
- result.files.each_with_index { |f, i| print "#{i+1}: #{f.root_path}\n" }
38
- print "\n"
33
+ if files.empty? and name_only_matches.empty?
34
+ print "You run a tight ship."
35
+ blank_lines
36
+ return
39
37
  end
38
+
39
+ damage(result)
40
+ end
41
+
42
+ def damage(result)
43
+ files = result.files
44
+ name_only_matches = result.name_only_matches
45
+
46
+ print "\nYou have #{files.length} stowaway(s) ... scurvy dogs!\n"
47
+ warn name_only_matches
48
+ 60.times { print "-" }
49
+ blank_lines
50
+ files.each_with_index { |f, i| print "#{i+1}: #{f.root_path}\n" }
51
+ end
52
+
53
+ def warn name_only_matches
54
+ return if name_only_matches.empty?
55
+ print "WARNING: #{name_only_matches.length} file(s) partially matched on name only\n"
56
+ end
57
+
58
+ def blank_lines
59
+ print "\n\n"
40
60
  end
41
61
  end
42
62
  end
data/stowaway.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{stowaway}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Emilio Cavazos"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stowaway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emilio Cavazos