watson-ruby 1.1.1 → 1.1.2

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: 37f247838098885b504b1c38a06b9776a240ab51
4
- data.tar.gz: 5d3a653d18d972768b6e172ccb4568f54338faf8
3
+ metadata.gz: 8a65947ab759c4844295dddd2d5c907ae7712ca8
4
+ data.tar.gz: e49e231ba4cf0cb5c98a7ce3e69af5000350119a
5
5
  SHA512:
6
- metadata.gz: fd8993cb5cfb517b785e5f018effbfd4b8a3aefb251259c54d30d14df0f9a2cd0fcd9c94ac11b0e1ce1fe2a6053816752c319a572c9d74279d8fb3da340066e1
7
- data.tar.gz: 7734757b7c3b2ba986be3f86c82dcc57d0da2fc0c43f43f20d43d85890de0f22e6390f14a99f0d563d596d0defc3ca469e4d11a186534cff8ac53ffcd2b9d39b
6
+ metadata.gz: a62c2fa1a530131b54fd43bb6893a33bfa3fdf3d57d3f09b8f1f600e9d888a8dd1739456573a052fbb01bf430a9923670cf20a92921fafbfbd24127eb3ddd025
7
+ data.tar.gz: c623d74ef56e48cf65e00de763c6efc82e13ed2a1cc780be9af90be0227f9eedcfb6b055d9f39a4455ece375b7a3ef76b51321973b8959dc90e06070a80dc6a3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- watson-ruby (1.1.1)
4
+ watson-ruby (1.1.2)
5
5
  json
6
6
 
7
7
  GEM
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
@@ -161,58 +161,54 @@ module Watson
161
161
  ###########################################################
162
162
  # Print help for watson
163
163
  def help
164
- # [todo] - Add bold and colored printing
164
+ # [todo] - Add bold and colored printing
165
165
 
166
166
  # Identify method entry
167
167
  debug_print "#{ self } : #{ __method__ }\n"
168
168
 
169
- print BOLD;
170
- print "Usage: watson [OPTION]...\n"
171
- print "Running watson with no arguments will parse with settings in RC file\n"
172
- print "If no RC file exists, default RC file will be created\n"
173
-
174
- print "\n"
175
- print " -c, --context-depth number of lines of context to provide with posted issue\n"
176
- print " -d, --dirs list of directories to search in\n"
177
- print " -f, --files list of files to search in\n"
178
- print " -h, --help print help\n"
179
- print " -i, --ignore list of files, directories, or types to ignore\n"
180
- print " -p, --parse-depth depth to recursively parse directories\n"
181
- print " -r, --remote list / create tokens for Bitbucket/GitHub\n"
182
- print " -s, --show whether to show [all, clean, dirty] files\n"
183
- print " -t, --tags list of tags to search for\n"
184
- print " -u, --update update remote repos with current issues\n"
185
- print " -v, --version print watson version and info\n"
186
- print "\n"
187
-
188
- print "Any number of files, tags, dirs, and ignores can be listed after flag\n"
189
- print "Ignored files should be space separated\n"
190
- print "To use *.filetype identifier, encapsulate in \"\" to avoid shell substitutions \n"
191
- print "\n"
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
- print "watson v1.0\n"
211
- print "Copyright (c) 2012-2013 goosecode labs\n"
212
- print "Licensed under MIT, see LICENSE for details\n"
213
- print "\n"
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 directory path
283
- _dir = _dir.match(/^((\w+)?\.?\/?)+/)[0].gsub(/(\/)+$/, "")
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
- print BOLD + "Incorrect arguments passed\n" + RESET
467
- print " Please specify either Github or Bitbucket to setup remote\n"
468
- print " Or pass without argument to see current remotes\n"
469
- print " See help (-h/--help) for more details\n"
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
- # If current depth is less than limit (set in config), parse directory and pass depth
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
- # Else, depth is greater than limit, ignore the directory
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
@@ -1,3 +1,3 @@
1
1
  module Watson
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watson-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nhmood