snooper 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35bd66062da4d8e2f2ee037335468a1364209c70
4
- data.tar.gz: eb1bd60ec064498b8d94341c8c1782a2594c91ab
3
+ metadata.gz: 3911c398b1c83b549e996a605f65e79211e2ee4a
4
+ data.tar.gz: a91ca9f1ff1b114c70e9d9872fa695975b98c752
5
5
  SHA512:
6
- metadata.gz: 074f9ad4672586cf8674ec2cf7080664a41ab19c572e4045994f2e96e8fd6d8f33686d76b481864d404321370bab03b77e6142c808d92c303b58c446ff213384
7
- data.tar.gz: c5c2b33e21c15744bdd670f5b6505c44136bdce46cc636bf5f818f7434573d7012726a38db67bf07d7c4f860c298b0638d708fd053b7a8b7b28eddfeacca4bfd
6
+ metadata.gz: 5bc6a4a0e02acbfee57efe128efb893dc3e8ee40e848b312e257adf07b42ba552c5c775d5d40eb43ecf5f35b7a961e0889331e2913b158208c8f43ee7e962265
7
+ data.tar.gz: aaadd056771a21fcd7bc14d40baee028da7f87222d12fbafc0227ec2c94b5df50d534f801bc6eec587a0d4a9da316435880b9877d80979d13eca556d80ce68db
@@ -154,7 +154,21 @@ module Snooper
154
154
  opts[key.to_sym] = value
155
155
  end
156
156
 
157
- @file_path = (file_path.is_a?(String) && file_path) || file_path.path
157
+ case file_path
158
+ when String
159
+ @file_path = file_path
160
+ when Pathname
161
+ @file_path = file_path.to_s
162
+ else
163
+ @file_path = file_path.path
164
+ end
165
+
166
+ # Expand out the base path relative to the file, not the PWD
167
+ if base_path
168
+ base_path = File.expand_path base_path, File.dirname(@file_path)
169
+ else
170
+ base_path = File.dirname(@file_path)
171
+ end
158
172
 
159
173
  initialize base_path, command, options
160
174
  end
@@ -32,7 +32,7 @@ For more information see snooper(1).
32
32
  END
33
33
 
34
34
  options = ParsedOptions.new
35
- options.config_path = '.snooper.yaml'
35
+ options.config_path = nil
36
36
 
37
37
  parser = OptionParser.new do |parser|
38
38
  parser.banner =
@@ -67,8 +67,28 @@ END
67
67
  exit 1
68
68
  end
69
69
 
70
+ options.config_path = find_config unless options.config_path
71
+
70
72
  options.command = arguments.join " " if not arguments.empty?
71
73
  options
72
74
  end
75
+
76
+ private
77
+
78
+ ##
79
+ # Internal : Find a config file to use
80
+ #
81
+ # Returns the path to the config, or nil if none can be found
82
+ def self.find_config
83
+ file_name = '.snooper.yaml'
84
+
85
+ Pathname.pwd.ascend do |subpath|
86
+ location = subpath + file_name
87
+ return location if location.exist?
88
+ end
89
+
90
+ nil
91
+ end
92
+
73
93
  end
74
94
  end
data/lib/snooper/snoop.rb CHANGED
@@ -146,7 +146,10 @@ module Snooper
146
146
  def run
147
147
  if @config.file_path
148
148
  dir = File.dirname @config.file_path
149
- Listen.to dir, filter: %r{^#{@config.file_path}$} do |*args|
149
+ filter = %r{#{File.basename @config.file_path}$}
150
+ Listen.to dir, relative_paths: false, filter: filter do |*args|
151
+ next unless args.reduce(&:+).include? @config.file_path
152
+ puts statusbar "Re-loading Config File...", &:yellow
150
153
  @listener.stop if @listener
151
154
  end
152
155
  end
@@ -10,5 +10,5 @@ module Snooper
10
10
  #
11
11
  # This should conform to SemVer. If this is changed it should be the only
12
12
  # thing that changes in the comit.
13
- VERSION = '2.1.0'
13
+ VERSION = '2.1.1'
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snooper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Speak
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 2.0.2
118
+ rubygems_version: 2.0.6
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Spying on Tests