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 +4 -4
- data/lib/snooper/config.rb +15 -1
- data/lib/snooper/options.rb +21 -1
- data/lib/snooper/snoop.rb +4 -1
- data/lib/snooper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3911c398b1c83b549e996a605f65e79211e2ee4a
|
4
|
+
data.tar.gz: a91ca9f1ff1b114c70e9d9872fa695975b98c752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bc6a4a0e02acbfee57efe128efb893dc3e8ee40e848b312e257adf07b42ba552c5c775d5d40eb43ecf5f35b7a961e0889331e2913b158208c8f43ee7e962265
|
7
|
+
data.tar.gz: aaadd056771a21fcd7bc14d40baee028da7f87222d12fbafc0227ec2c94b5df50d534f801bc6eec587a0d4a9da316435880b9877d80979d13eca556d80ce68db
|
data/lib/snooper/config.rb
CHANGED
@@ -154,7 +154,21 @@ module Snooper
|
|
154
154
|
opts[key.to_sym] = value
|
155
155
|
end
|
156
156
|
|
157
|
-
|
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
|
data/lib/snooper/options.rb
CHANGED
@@ -32,7 +32,7 @@ For more information see snooper(1).
|
|
32
32
|
END
|
33
33
|
|
34
34
|
options = ParsedOptions.new
|
35
|
-
options.config_path =
|
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
|
-
|
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
|
data/lib/snooper/version.rb
CHANGED
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.
|
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.
|
118
|
+
rubygems_version: 2.0.6
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Spying on Tests
|