ndr_dev_support 2.0.2 → 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: c549695ca2f5c892b209d22a626df24f521590c3
4
- data.tar.gz: 626218f3403114a27c4307269e0fb5f09b95ea95
3
+ metadata.gz: ff79dd76561dbabac2a6f54db5b1dadc19439165
4
+ data.tar.gz: 1033b76bb6f51a15b9a2fe66a0e475d793102c40
5
5
  SHA512:
6
- metadata.gz: b7e023326ab81eb33042904a829837329ba0e1bdac2acfbc119a93bc37d8e7e3b016f8538cf2312eb16e06e0afd20f16891c56d74454c6162afb20a20605fe6e
7
- data.tar.gz: c3a4a394b4e82d5a22d00aa8dfd4a92602dd3ebc17b991759ea5924189020e7136a1ceaff38c8c276619e6d36d728a80d55ee1403fc2f6420cbcd0a78aa8e8fe
6
+ metadata.gz: 2d0228f1592a2ed805c9191d64de4d91abbcda9b9e180ae2e00ff50369171125e06d10daa37bd5be50803574597231c41af2afe5f4b5375b9afb3a831ebfd480
7
+ data.tar.gz: f3f5e3fe9406928742b403eff426e2283eb5117a4b80b1762a87a878b3ac6f1b29ac31b0085dd5d7cc8f4e615cf62b8175f3e6ac010a000fcd2f752189d18fda
data/.rubocop.yml CHANGED
@@ -10,6 +10,7 @@ AllCops:
10
10
  - 'bin/*'
11
11
  - 'db/**/*'
12
12
  - 'lib/generators/**/templates/*'
13
+ - 'tmp/**/*'
13
14
  - 'vendor/**/*'
14
15
 
15
16
  # Run the Rails cops by default (-R/--rails not required):
data/README.md CHANGED
@@ -23,6 +23,12 @@ Or install it yourself as:
23
23
 
24
24
  $ gem install ndr_dev_support
25
25
 
26
+ To add development support tasks (see below) to your project, add this line to your application's `Rakefile`:
27
+
28
+ ```ruby
29
+ require 'ndr_dev_support/tasks'
30
+ ```
31
+
26
32
  ## Usage
27
33
 
28
34
  ### Code Auditing Rake Tasks
@@ -77,12 +83,6 @@ $ rake rubocop:diff:unstaged
77
83
  $ find . -iregex .*\.rake$ | xargs rake rubocop:diff:file
78
84
  ```
79
85
 
80
- To add development support tasks to your project, add this line to your application's Rakefile:
81
-
82
- ```ruby
83
- require 'ndr_dev_support/tasks'
84
- ```
85
-
86
86
  ### Integration test environment
87
87
 
88
88
  ndr_dev_support bundles a configured Rails integration testing environment. It uses `capybara` and `poltergeist` to drive a PhantomJS headless browser, and includes some sensible configuration.
data/code_safety.yml CHANGED
@@ -6,8 +6,8 @@ file safety:
6
6
  safe_revision: c59a45986f8b6d087c8c21b1e889f31f7346da17
7
7
  ".rubocop.yml":
8
8
  comments:
9
- reviewed_by: josh.pencheon
10
- safe_revision: b37c9dc7871fad7c592945188b2e7307f1abedcd
9
+ reviewed_by: timgentry
10
+ safe_revision: 7256d6b694c7f3a62769b7d8ef56f32b93772ff9
11
11
  ".travis.yml":
12
12
  comments:
13
13
  reviewed_by: josh.pencheon
@@ -27,7 +27,7 @@ file safety:
27
27
  README.md:
28
28
  comments:
29
29
  reviewed_by: timgentry
30
- safe_revision: a5dda3d6e14d08ca21b1adbfb15c1c3f63804061
30
+ safe_revision: 04a0d70cc467dad5a380744a6c678693429e0213
31
31
  Rakefile:
32
32
  comments:
33
33
  reviewed_by: josh.pencheon
@@ -87,12 +87,12 @@ file safety:
87
87
  lib/ndr_dev_support/version.rb:
88
88
  comments:
89
89
  reviewed_by: timgentry
90
- safe_revision: e7f67cbe41eb7c64866b46ff78b49dd0991a1161
90
+ safe_revision: 32aea472f527924ab3dad90b5116cc1c5716c3e8
91
91
  lib/tasks/audit_code.rake:
92
92
  comments: Identical to the version reviewed by josh.pencheon when contained within
93
93
  ndr_support
94
94
  reviewed_by: timgentry
95
- safe_revision: 2cee09c32e63a5c339fc8acddd04c2f30dbbfa06
95
+ safe_revision: 063ba98f4ce8449cf586231dd9630a28aacc0743
96
96
  lib/tasks/rubocop.rake:
97
97
  comments:
98
98
  reviewed_by: josh.pencheon
@@ -100,7 +100,7 @@ file safety:
100
100
  ndr_dev_support.gemspec:
101
101
  comments:
102
102
  reviewed_by: timgentry
103
- safe_revision: 73f74aa9091f21a153a0e9ba140aedbc7b94da90
103
+ safe_revision: 6436fb4ccee84240eec27f56f6f59528a10442e7
104
104
  test/ndr_dev_support_test.rb:
105
105
  comments:
106
106
  reviewed_by: timgentry
@@ -2,5 +2,5 @@
2
2
  # This defines the NdrDevSupport version. If you change it, rebuild and commit the gem.
3
3
  # Use "rake build" to build the gem, see rake -T for all bundler rake tasks (and our own).
4
4
  module NdrDevSupport
5
- VERSION = '2.0.2'.freeze
5
+ VERSION = '2.1.1'.freeze
6
6
  end
@@ -71,6 +71,14 @@ def audit_code_safety(max_print = 20, ignore_new = false, show_diffs = false, sh
71
71
  puts "Number of files originally in #{SAFETY_FILE}: #{orig_count}"
72
72
  puts "Number of new files added: #{file_safety.size - orig_count}"
73
73
 
74
+ missing_files = file_safety.keys.reject { |path| File.file?(path) }
75
+
76
+ if missing_files.length > 0
77
+ puts "Number of files no longer in repository but in code_safety.yml: #{missing_files.length}"
78
+ puts " Please run rake audit:tidy_code_safety_file to remove redundant files"
79
+ missing_files.each { |path| puts " " + path }
80
+ end
81
+
74
82
  # Now generate statistics:
75
83
  unknown = file_safety.values.select { |x| x['safe_revision'].nil? }
76
84
  unsafe = file_safety.values.select do |x|
@@ -352,6 +360,7 @@ def print_repo_file_diffs(repolatest, repo, fname, user_name, safe_revision)
352
360
  if cmd
353
361
  puts(cmd.join(' '))
354
362
  stdout_and_err_str, status = Open3.capture2e(*cmd)
363
+ puts 'Invalid commit ID in code_safety.yml ' + safe_revision if stdout_and_err_str.start_with?('fatal: Invalid revision range ')
355
364
  puts(stdout_and_err_str)
356
365
  else
357
366
  puts 'Unknown repo'
@@ -396,6 +405,21 @@ def clean_working_copy?
396
405
  end
397
406
  end
398
407
 
408
+ def remove_non_existent_files_from_code_safety
409
+ safety_cfg = YAML.load_file(SAFETY_FILE)
410
+ file_safety = safety_cfg['file safety']
411
+ files_no_longer_in_repo = file_safety.keys.reject {|ff| File.file?(ff)}
412
+ files_no_longer_in_repo.each do |f|
413
+ puts 'No longer in repository ' + f
414
+ file_safety.delete f
415
+ end
416
+ File.open(SAFETY_FILE, 'w') do |file|
417
+ # Consistent file diffs, as ruby preserves Hash insertion order since v1.9
418
+ safety_cfg['file safety'] = Hash[file_safety.sort]
419
+ YAML.dump(safety_cfg, file) # Save changes before checking latest revisions
420
+ end
421
+ end
422
+
399
423
  namespace :audit do
400
424
  desc "Audit safety of source code.
401
425
  Usage: audit:code [max_print=n] [ignore_new=false|true] [show_diffs=false|true] [reviewed_by=usr]
@@ -448,6 +472,13 @@ Usage:
448
472
  flag_file_as_safe(release, ENV['reviewed_by'], ENV['comments'], ENV['file'])
449
473
  end
450
474
 
475
+ desc 'Deletes any files from code_safety.yml that are no longer in repository.'
476
+ task(:tidy_code_safety_file) do
477
+ puts 'Checking code safety for missing files...'
478
+
479
+ remove_non_existent_files_from_code_safety
480
+ end
481
+
451
482
  desc 'Wraps audit:code, and stops if any review is pending/stale.'
452
483
  task(:ensure_safe) do
453
484
  abort('You have local changes, cannot verify code safety!') unless clean_working_copy?
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 2.2'
22
22
 
23
+ spec.add_dependency 'pry'
24
+
23
25
  # Rubocop dependencies:
24
- spec.add_dependency 'rubocop', '0.44.0'
26
+ spec.add_dependency 'rubocop', '0.44.1'
25
27
  spec.add_dependency 'parser'
26
28
  spec.add_dependency 'rainbow'
27
29
 
@@ -32,6 +34,5 @@ Gem::Specification.new do |spec|
32
34
 
33
35
  spec.add_development_dependency 'bundler', '~> 1.7'
34
36
  spec.add_development_dependency 'rake', '~> 10.0'
35
- spec.add_development_dependency 'pry'
36
37
  spec.add_development_dependency "minitest", "~> 5.0"
37
38
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ndr_dev_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NCRS Development Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rubocop
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - '='
18
32
  - !ruby/object:Gem::Version
19
- version: 0.44.0
33
+ version: 0.44.1
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - '='
25
39
  - !ruby/object:Gem::Version
26
- version: 0.44.0
40
+ version: 0.44.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: parser
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +136,6 @@ dependencies:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: '10.0'
125
- - !ruby/object:Gem::Dependency
126
- name: pry
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: minitest
141
141
  requirement: !ruby/object:Gem::Requirement