watson-ruby 1.1.1 → 1.1.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/watson.rb +1 -0
- data/lib/watson/command.rb +41 -42
- data/lib/watson/parser.rb +19 -2
- data/lib/watson/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a65947ab759c4844295dddd2d5c907ae7712ca8
|
4
|
+
data.tar.gz: e49e231ba4cf0cb5c98a7ce3e69af5000350119a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a62c2fa1a530131b54fd43bb6893a33bfa3fdf3d57d3f09b8f1f600e9d888a8dd1739456573a052fbb01bf430a9923670cf20a92921fafbfbd24127eb3ddd025
|
7
|
+
data.tar.gz: c623d74ef56e48cf65e00de763c6efc82e13ed2a1cc780be9af90be0227f9eedcfb6b055d9f39a4455ece375b7a3ef76b51321973b8959dc90e06070a80dc6a3
|
data/Gemfile.lock
CHANGED
data/lib/watson.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative 'watson/printer'
|
|
6
6
|
require_relative 'watson/remote'
|
7
7
|
require_relative 'watson/github'
|
8
8
|
require_relative 'watson/bitbucket'
|
9
|
+
require_relative 'watson/version'
|
9
10
|
|
10
11
|
module Watson
|
11
12
|
# [todo] - Replace all regex parentheses() with brackets[] if not matching
|
data/lib/watson/command.rb
CHANGED
@@ -161,58 +161,54 @@ module Watson
|
|
161
161
|
###########################################################
|
162
162
|
# Print help for watson
|
163
163
|
def help
|
164
|
-
|
164
|
+
# [todo] - Add bold and colored printing
|
165
165
|
|
166
166
|
# Identify method entry
|
167
167
|
debug_print "#{ self } : #{ __method__ }\n"
|
168
168
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
print "Report bugs to: watson\@goosecode.com\n"
|
194
|
-
print "watson home page: <http://goosecode.com/projects/watson>\n"
|
195
|
-
print "[goosecode] labs | 2012-2013\n"
|
196
|
-
print RESET;
|
169
|
+
puts <<-HELP.gsub(/^ {,6}/, '')
|
170
|
+
#{BOLD}Usage: watson [OPTION]...
|
171
|
+
Running watson with no arguments will parse with settings in RC file
|
172
|
+
If no RC file exists, default RC file will be created
|
173
|
+
|
174
|
+
-c, --context-depth number of lines of context to provide with posted issue
|
175
|
+
-d, --dirs list of directories to search in
|
176
|
+
-f, --files list of files to search in
|
177
|
+
-h, --help print help
|
178
|
+
-i, --ignore list of files, directories, or types to ignore
|
179
|
+
-p, --parse-depth depth to recursively parse directories
|
180
|
+
-r, --remote list / create tokens for Bitbucket/GitHub
|
181
|
+
-t, --tags list of tags to search for
|
182
|
+
-u, --update update remote repos with current issues
|
183
|
+
-v, --version print watson version and info
|
184
|
+
|
185
|
+
Any number of files, tags, dirs, and ignores can be listed after flag
|
186
|
+
Ignored files should be space separated
|
187
|
+
To use *.filetype identifier, encapsulate in \"\" to avoid shell substitutions
|
188
|
+
|
189
|
+
Report bugs to: watson\@goosecode.com
|
190
|
+
watson home page: <http://goosecode.com/projects/watson>
|
191
|
+
[goosecode] labs | 2012-2013#{RESET}
|
192
|
+
HELP
|
197
193
|
|
198
194
|
return true
|
199
|
-
|
200
195
|
end
|
201
196
|
|
202
197
|
|
203
198
|
###########################################################
|
204
199
|
# Print version information about watson
|
205
200
|
def version
|
206
|
-
|
207
201
|
# Identify method entry
|
208
202
|
debug_print "#{ self } : #{ __method__ }\n"
|
209
203
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
204
|
+
puts <<-VERSION.gsub(/^ {,6}/, '')
|
205
|
+
watson v#{::Watson::VERSION}
|
206
|
+
Copyright (c) 2012-2013 goosecode labs
|
207
|
+
Licensed under MIT, see LICENSE for details
|
208
|
+
|
209
|
+
Written by nhmood, see <http://goosecode.com/projects/watson>
|
210
|
+
VERSION
|
214
211
|
|
215
|
-
print "Written by nhmood, see <http://goosecode.com/projects/watson>\n"
|
216
212
|
return true
|
217
213
|
end
|
218
214
|
|
@@ -279,8 +275,8 @@ module Watson
|
|
279
275
|
if !Watson::FS.check_dir(_dir)
|
280
276
|
print "Unable to open #{ _dir }\n"
|
281
277
|
else
|
282
|
-
# Clean up
|
283
|
-
_dir = _dir.
|
278
|
+
# Clean up path, remove trailing forward slashes
|
279
|
+
_dir = _dir.gsub(/(\/)+$/, "")
|
284
280
|
if !_dir.empty?
|
285
281
|
debug_print "Adding #{ _dir } to config dir_list\n"
|
286
282
|
@config.dir_list.push(_dir)
|
@@ -463,10 +459,13 @@ module Watson
|
|
463
459
|
end
|
464
460
|
elsif args.length > 1
|
465
461
|
Printer.print_status "x", RED
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
462
|
+
puts <<-SUMMERY.gsub(/^ {,8}/, '')
|
463
|
+
#{BOLD}Incorrect arguments passed#{RESET}
|
464
|
+
Please specify either Github or Bitbucket to setup remote
|
465
|
+
Or pass without argument to see current remotes
|
466
|
+
See help (-h/--help) for more details
|
467
|
+
SUMMERY
|
468
|
+
|
470
469
|
return false
|
471
470
|
end
|
472
471
|
end
|
data/lib/watson/parser.rb
CHANGED
@@ -135,6 +135,21 @@ module Watson
|
|
135
135
|
Dir.glob("#{ _glob_dir }{*, .*}").select { |_fn| File.directory?(_fn) }.sort.each do |_entry|
|
136
136
|
debug_print "Entry: #{ _entry } is a dir\n"
|
137
137
|
|
138
|
+
# Check if entry is in ignore list
|
139
|
+
_skip = false
|
140
|
+
@config.ignore_list.each do |_ignore|
|
141
|
+
if _entry == _ignore || File.absolute_path(_entry) == _ignore
|
142
|
+
debug_print "#{ _entry } is on the ignore list, setting to \"\"\n"
|
143
|
+
_skip = true
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# If directory is on the ignore list then skip
|
148
|
+
if _skip == true
|
149
|
+
_completed_dirs = []
|
150
|
+
_completed_files = []
|
151
|
+
next
|
152
|
+
end
|
138
153
|
|
139
154
|
## Depth limit logic
|
140
155
|
# Current depth is depth of previous parse_dir (passed in as second param) + 1
|
@@ -145,11 +160,13 @@ module Watson
|
|
145
160
|
if @config.parse_depth == 0
|
146
161
|
debug_print "No max depth, parsing directory\n"
|
147
162
|
_completed_dirs.push(parse_dir("#{ _entry }/", _cur_depth))
|
148
|
-
|
163
|
+
|
164
|
+
# If current depth is less than limit (set in config), parse directory and pass depth
|
149
165
|
elsif _cur_depth < @config.parse_depth.to_i + 1
|
150
166
|
debug_print "Depth less than max dept (from config), parsing directory\n"
|
151
167
|
_completed_dirs.push(parse_dir("#{ _entry }/", _cur_depth))
|
152
|
-
|
168
|
+
|
169
|
+
# Else, depth is greater than limit, ignore the directory
|
153
170
|
else
|
154
171
|
debug_print "Depth greater than max depth, ignoring\n"
|
155
172
|
end
|
data/lib/watson/version.rb
CHANGED