watson-ruby 1.0.6 → 1.1.0

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: 44137e243624ca9f33b847d08d8a64789e89142d
4
- data.tar.gz: 75194b81af02f48dfcdda8dea4e4ae4a00e42d87
3
+ metadata.gz: ec33e9094845f5023da89a937a235da967c88d82
4
+ data.tar.gz: afd3ea9e2c2a491f7c3e81dd01634502563f3a4b
5
5
  SHA512:
6
- metadata.gz: c3bece662ec2a55e7f7b25a1970537144eb22b6eda44d1e9f964141c2c5106f6092aa4c22ef6891c01017b8e9f4216aa3b9c7638f6d57d7eecb08ee934b13f20
7
- data.tar.gz: be581a10fddb3dc38c23dfeb5063314c06dad67759a9fa928f5fba8af28f6d29fe2dc6d91d9e80242d1f5e8761c42751eff4375188c196eeaeadac8fc617ea47
6
+ metadata.gz: be68174eb42d076b5ed0c063cc972e9b5bf5574be6c22673ee6a432e6df1e2c88dd811965fe44e4f15bd0c9150c88372b0392cd9e838ab88225f0ea413c1bcdc
7
+ data.tar.gz: 94ffaf78d6a230ce4402944bbaab9a73ea562b61eae2cc2eb6bafef9051489569ae0e530bddf56e1b45244485ddbab648e1e38b7c9f0a223f62f322802993b02
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- watson-ruby (1.0.6)
4
+ watson-ruby (1.1.0)
5
5
  json
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -56,15 +56,16 @@ Usage: watson [OPTION]...
56
56
  Running watson with no arguments will parse with settings in RC file
57
57
  If no RC file exists, default RC file will be created
58
58
 
59
- -c, --context-lines number of lines of context to provide with posted issue
59
+ -c, --context-lines number of lines of context to provide with posted issue
60
60
  -d, --dirs list of directories to search in
61
61
  -f, --files list of files to search in
62
62
  -h, --help print help
63
63
  -i, --ignore list of files, directories, or types to ignore
64
64
  -p, --parse-depth depth to recursively parse directories
65
65
  -r, --remote list / create tokens for Bitbucket/Github
66
+ -s, --show whether to show [all, clean, dirty] files
66
67
  -t, --tags list of tags to search for
67
- -u, --update update remote repos with current issues
68
+ -u, --update update remote repos with current issues
68
69
  -v, --version print watson version and info
69
70
 
70
71
  Any number of files, tags, dirs, and ignores can be listed after flag
@@ -83,6 +84,7 @@ This parameter specifies how many lines of context watson should include when po
83
84
  When this parameter is set from the command line, the .watsonrc config file is written with the value; the command line option effectively sets the default value for this feature in the current directory.
84
85
  The default value is set to 15 (and can be found in the lib/watson/command.rb file).
85
86
 
87
+
86
88
  ### -d, --dirs [DIRS]
87
89
  This parameter specifies which directories watson should parse through.
88
90
  It should be followed by a space separated list of directories that should be parsed.
@@ -117,6 +119,14 @@ If passed without any options, the currently established remotes will be listed.
117
119
  If passed with a github or bitbucket argument, watson will proceed to ask some questions to set up the corresponding remote.
118
120
 
119
121
 
122
+ ### -s, --show [ALL, CLEAN, DIRTY]
123
+ This parameter is used to specify which types of files and entries are shown when watson is run.
124
+ If passed with the `clean` argument, only files that watson did *NOT* find issues in will be displayed.
125
+ If passed with the `dirty` argument, only files that watson *DID* find issues in will be displayed.
126
+ If passed with the `all` argument, watson will display all files, regardless of their issue status.
127
+ The default behavior of watson is the `all` option.
128
+
129
+
120
130
  ### -t, --tags [TAGS]
121
131
  This parameter is used to specify which tags watson should look for when parsing.
122
132
  The tag currently supports any regular character and number combination, no special (!@#$...) characters.
@@ -24,16 +24,17 @@ module Watson
24
24
 
25
25
  # List of possible flags, used later in parsing and for user reference
26
26
  _flag_list = ["-c", "--context-depth",
27
- "-d", "--dirs",
28
- "-f", "--files",
29
- "-h", "--help",
30
- "-i", "--ignore",
31
- "-p", "--parse-depth",
32
- "-r", "--remote",
33
- "-t", "--tags",
34
- "-u", "--update",
35
- "-v", "--version"
36
- ]
27
+ "-d", "--dirs",
28
+ "-f", "--files",
29
+ "-h", "--help",
30
+ "-i", "--ignore",
31
+ "-p", "--parse-depth",
32
+ "-r", "--remote",
33
+ "-s", "--show",
34
+ "-t", "--tags",
35
+ "-u", "--update",
36
+ "-v", "--version"
37
+ ]
37
38
 
38
39
 
39
40
  # If we get the version or help flag, ignore all other flags
@@ -132,6 +133,10 @@ module Watson
132
133
  # If setting up remote, exit afterwards
133
134
  exit true
134
135
 
136
+ when "-s", "--show"
137
+ debug_print "Found -s/--show argument\n"
138
+ set_show_type(_flag_args)
139
+
135
140
  when "-t", "--tags"
136
141
  debug_print "Found -t/--tags argument\n"
137
142
  set_tags(_flag_args)
@@ -163,33 +168,34 @@ module Watson
163
168
 
164
169
  print BOLD;
165
170
  print "Usage: watson [OPTION]...\n"
166
- print "Running watson with no arguments will parse with settings in RC file\n"
167
- print "If no RC file exists, default RC file will be created\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"
168
173
 
169
- print "\n"
174
+ print "\n"
170
175
  print " -c, --context-depth number of lines of context to provide with posted issue\n"
171
- print " -d, --dirs list of directories to search in\n"
172
- print " -f, --files list of files to search in\n"
173
- print " -h, --help print help\n"
174
- print " -i, --ignore list of files, directories, or types to ignore\n"
175
- print " -p, --parse-depth depth to recursively parse directories\n"
176
- print " -r, --remote list / create tokens for Bitbucket/GitHub\n"
177
- print " -t, --tags list of tags to search for\n"
178
- print " -u, --update update remote repos with current issues\n"
179
- print " -v, --version print watson version and info\n"
180
- print "\n"
181
-
182
- print "Any number of files, tags, dirs, and ignores can be listed after flag\n"
183
- print "Ignored files should be space separated\n"
184
- print "To use *.filetype identifier, encapsulate in \"\" to avoid shell substitutions \n"
185
- print "\n"
186
-
187
- print "Report bugs to: watson\@goosecode.com\n"
188
- print "watson home page: <http://goosecode.com/projects/watson>\n"
189
- print "[goosecode] labs | 2012-2013\n"
190
- print RESET;
191
-
192
- return true
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;
197
+
198
+ return true
193
199
 
194
200
  end
195
201
 
@@ -465,6 +471,42 @@ module Watson
465
471
  end
466
472
  end
467
473
 
474
+
475
+ ###########################################################
476
+ # set_show
477
+ # Set what files watson should show
478
+ def set_show_type(args)
479
+
480
+ # Identify method entry
481
+ debug_print "#{ self } : #{ __method__ }\n"
482
+
483
+ # This should be a single value, either all, clean, or dirty
484
+ # If they pass more, just take the last valid value
485
+ if args.length <= 0
486
+ debug_print "No args passed, exiting\n"
487
+ return false
488
+ end
489
+
490
+ args.each do | _show |
491
+ case _show.downcase
492
+ when 'clean'
493
+ debug_print "Setting config show to #{ _show }\n"
494
+ @config.show_type = 'clean'
495
+
496
+ when 'dirty'
497
+ debug_print "Setting config show to #{ _show }\n"
498
+ @config.show_type = 'dirty'
499
+
500
+ else
501
+ debug_print "Setting config show to #{ _show }\n"
502
+ @config.show_type = 'all'
503
+ end
504
+
505
+ end
506
+
507
+ debug_print "Updated show to: #{ @config.show_type }\n"
508
+ return true
509
+ end
468
510
  end
469
511
  end
470
512
  end
data/lib/watson/config.rb CHANGED
@@ -33,6 +33,9 @@ module Watson
33
33
  # Flag for command line setting of tag to parse for
34
34
  attr_accessor :cl_tag_set
35
35
 
36
+ # Entries that watson should show
37
+ attr_accessor :show_type
38
+
36
39
  # Flag for whether less is avaliable to print results
37
40
  attr_reader :use_less
38
41
  # Flag for where the temp file for printing is located
@@ -86,6 +89,8 @@ module Watson
86
89
  @cl_tag_set = false
87
90
  @cl_ignore_set = false
88
91
 
92
+ @show_type = 'all'
93
+
89
94
  # System flags
90
95
  # [todo] - Add option to save output to file also
91
96
  @use_less = false
@@ -5,17 +5,17 @@ module Watson
5
5
  # in the printer.rb file at least
6
6
 
7
7
  BOLD = "\e[01m"
8
- UNDERLINE = "\e[4m"
8
+ UNDERLINE = "\e[4m"
9
9
  RESET = "\e[00m"
10
10
 
11
- GRAY = "\e[38;5;0m"
12
- RED = "\e[38;5;1m"
13
- GREEN = "\e[38;5;2m"
14
- YELLOW = "\e[38;5;3m"
15
- BLUE = "\e[38;5;4m"
16
- MAGENTA = "\e[38;5;5m"
17
- CYAN = "\e[38;5;6m"
18
- WHITE = "\e[38;5;7m"
11
+ GRAY = "\e[38;5;0m"
12
+ RED = "\e[38;5;1m"
13
+ GREEN = "\e[38;5;2m"
14
+ YELLOW = "\e[38;5;3m"
15
+ BLUE = "\e[38;5;4m"
16
+ MAGENTA = "\e[38;5;5m"
17
+ CYAN = "\e[38;5;6m"
18
+ WHITE = "\e[38;5;7m"
19
19
 
20
20
 
21
21
  # Printer class that handles all formatting and printing of parsed dir/file structure
@@ -224,16 +224,22 @@ module Watson
224
224
 
225
225
  # If no issues for this file, print that and break
226
226
  # The filename print is repetative, but reduces another check later
227
- if entry[:has_issues] == false
228
- debug_print "No issues for #{ entry }\n"
229
- print_status "o", GREEN
230
- cprint BOLD + UNDERLINE + GREEN + "#{ entry[:relative_path] }" + RESET + "\n"
231
- return true
227
+ if !entry[:has_issues]
228
+ if @config.show_type != 'dirty'
229
+ debug_print "No issues for #{ entry }\n"
230
+ print_status "o", GREEN
231
+ cprint BOLD + UNDERLINE + GREEN + "#{ entry[:relative_path] }" + RESET + "\n"
232
+ return true
233
+ end
232
234
  else
233
- debug_print "Issues found for #{ entry }\n"
234
- cprint "\n"
235
- print_status "x", RED
236
- cprint BOLD + UNDERLINE + RED + "#{entry[:relative_path]}" + RESET + "\n"
235
+ if @config.show_type != 'clean'
236
+ debug_print "Issues found for #{ entry }\n"
237
+ cprint "\n"
238
+ print_status "x", RED
239
+ cprint BOLD + UNDERLINE + RED + "#{entry[:relative_path]}" + RESET + "\n"
240
+ else
241
+ return true
242
+ end
237
243
  end
238
244
 
239
245
 
@@ -246,7 +252,6 @@ module Watson
246
252
  # Maybe have individual has_issues for each one?
247
253
  if entry[_tag].size.zero?
248
254
  debug_print "#{ _tag } has no issues, skipping\n"
249
- cprint "\n"
250
255
  next
251
256
  end
252
257
 
@@ -1,3 +1,3 @@
1
1
  module Watson
2
- VERSION = "1.0.6"
2
+ VERSION = "1.1.0"
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.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nhmood