skull_island 2.0.3 → 2.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eff79cef47f9764701711c87bef82cded9cc3b7e58b4a21bc245042dbb77600f
4
- data.tar.gz: 6f433b14ac328bd48fba2c7eadfdeff256b5f1c97c3f298665c2f25fc1a14327
3
+ metadata.gz: b70ddd0dfb6534cdcbf0c362ac9a8329123bff76de67497e107f968b1679cc28
4
+ data.tar.gz: 1d03c93f9fe6cdee72449e30febe26b59932011e8c55e68807ea9c5937a96729
5
5
  SHA512:
6
- metadata.gz: f2422ea1ebd93c4b3f62c8b9229ca8bb8277abef46c036a79ac2a35fa7cd29e4c829a5eaea3df5917c74f1758ed73310f39580c7ce91617574e2127bd118c82e
7
- data.tar.gz: 9b6026082b5d2811617cda731a4887eb1d54a89935f3c78a06ecce61a399b9b20d432613510428edab0e99372bcc5b4f359842f2ea4ccbc18fee7615bbb825e8
6
+ metadata.gz: e3c0fddd3e23b2e7d0f6577900cb2865212712d7d2b3774c465a7562279a96416a0e142180281306fe93689ee600a8700b9bb85a5fadfb2cfab0ed9ef750fd89
7
+ data.tar.gz: 81fc8486b6afcdd90d3641eb63ef64992b87dd57fd726e414a3359b8437df4d7e7d1597aa1484387fa3473c7bd4e9c1ba952b57f60566ee467649aa8f61a9918
@@ -4,9 +4,21 @@ AllCops:
4
4
  Metrics/MethodLength:
5
5
  Max: 50
6
6
 
7
+ Layout/EmptyLinesAroundAttributeAccessor:
8
+ Enabled: true
9
+
7
10
  Layout/LineLength:
8
11
  Max: 100
9
12
 
13
+ Layout/SpaceAroundMethodCallOperator:
14
+ Enabled: true
15
+
16
+ Lint/RaiseException:
17
+ Enabled: true
18
+
19
+ Lint/StructNewOverride:
20
+ Enabled: true
21
+
10
22
  Metrics/ClassLength:
11
23
  Max: 190
12
24
 
@@ -18,6 +30,9 @@ Metrics/ModuleLength:
18
30
  Metrics/CyclomaticComplexity:
19
31
  Max: 7
20
32
 
33
+ Metrics/ParameterLists:
34
+ Max: 6
35
+
21
36
  Metrics/PerceivedComplexity:
22
37
  Exclude:
23
38
  - 'lib/skull_island/cli.rb'
@@ -40,6 +55,21 @@ Security/Eval:
40
55
  Exclude:
41
56
  - 'lib/skull_island/cli.rb'
42
57
 
58
+ Style/ExponentialNotation:
59
+ Enabled: true
60
+
61
+ Style/HashEachMethods:
62
+ Enabled: true
63
+
64
+ Style/HashTransformKeys:
65
+ Enabled: true
66
+
67
+ Style/HashTransformValues:
68
+ Enabled: false
69
+
43
70
  Style/NumericLiterals:
44
71
  Exclude:
45
72
  - 'spec/**/*_spec.rb'
73
+
74
+ Style/SlicingWithRange:
75
+ Enabled: true
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- skull_island (2.0.3)
4
+ skull_island (2.0.4)
5
5
  deepsort (~> 0.4)
6
6
  erubi (~> 1.8)
7
7
  json (~> 2.1)
@@ -13,16 +13,22 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- addressable (2.4.0)
16
+ activesupport (5.2.4.3)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ addressable (2.7.0)
22
+ public_suffix (>= 2.0.2, < 5.0)
17
23
  ast (2.4.0)
18
- backports (3.16.1)
24
+ concurrent-ruby (1.1.6)
19
25
  coveralls (0.7.1)
20
26
  multi_json (~> 1.3)
21
27
  rest-client
22
28
  simplecov (>= 0.7)
23
29
  term-ansicolor
24
30
  thor
25
- deepsort (0.4.3)
31
+ deepsort (0.4.5)
26
32
  diff-lcs (1.3)
27
33
  docile (1.3.2)
28
34
  domain_name (0.5.20190701)
@@ -30,45 +36,49 @@ GEM
30
36
  erubi (1.9.0)
31
37
  ethon (0.12.0)
32
38
  ffi (>= 1.3.0)
33
- faraday (0.17.3)
39
+ faraday (1.0.1)
34
40
  multipart-post (>= 1.2, < 3)
35
- faraday_middleware (0.14.0)
36
- faraday (>= 0.7.4, < 1.0)
41
+ faraday_middleware (1.0.0)
42
+ faraday (~> 1.0)
37
43
  ffi (1.12.2)
38
- gh (0.15.1)
39
- addressable (~> 2.4.0)
40
- backports
41
- faraday (~> 0.8)
44
+ gh (0.17.0)
45
+ activesupport (~> 5.0)
46
+ addressable (~> 2.4)
47
+ faraday (~> 1.0)
48
+ faraday_middleware (~> 1.0)
42
49
  multi_json (~> 1.0)
43
50
  net-http-persistent (~> 2.9)
44
51
  net-http-pipeline
45
- highline (1.7.10)
52
+ highline (2.0.3)
46
53
  http-accept (1.7.0)
47
54
  http-cookie (1.0.3)
48
55
  domain_name (~> 0.5)
49
- jaro_winkler (1.5.4)
56
+ i18n (1.8.2)
57
+ concurrent-ruby (~> 1.0)
50
58
  json (2.3.0)
51
59
  launchy (2.4.3)
52
60
  addressable (~> 2.3)
53
61
  linguistics (2.1.0)
54
62
  loggability (~> 0.11)
55
- loggability (0.15.1)
63
+ loggability (0.17.0)
56
64
  mime-types (3.3.1)
57
65
  mime-types-data (~> 3.2015)
58
- mime-types-data (3.2019.1009)
66
+ mime-types-data (3.2020.0512)
67
+ minitest (5.14.1)
59
68
  multi_json (1.14.1)
60
69
  multipart-post (2.1.1)
61
70
  net-http-persistent (2.9.4)
62
71
  net-http-pipeline (1.0.1)
63
72
  netrc (0.11.0)
64
73
  parallel (1.19.1)
65
- parser (2.7.0.3)
74
+ parser (2.7.1.2)
66
75
  ast (~> 2.4.0)
76
+ public_suffix (4.0.5)
67
77
  pusher-client (0.6.2)
68
78
  json
69
79
  websocket (~> 1.0)
70
80
  rainbow (3.0.0)
71
- rake (12.3.3)
81
+ rake (13.0.1)
72
82
  rest-client (2.1.0)
73
83
  http-accept (>= 1.7.0, < 2.0)
74
84
  http-cookie (>= 1.0.2, < 2.0)
@@ -79,52 +89,54 @@ GEM
79
89
  rspec-core (~> 3.9.0)
80
90
  rspec-expectations (~> 3.9.0)
81
91
  rspec-mocks (~> 3.9.0)
82
- rspec-core (3.9.1)
83
- rspec-support (~> 3.9.1)
84
- rspec-expectations (3.9.0)
92
+ rspec-core (3.9.2)
93
+ rspec-support (~> 3.9.3)
94
+ rspec-expectations (3.9.2)
85
95
  diff-lcs (>= 1.2.0, < 2.0)
86
96
  rspec-support (~> 3.9.0)
87
97
  rspec-mocks (3.9.1)
88
98
  diff-lcs (>= 1.2.0, < 2.0)
89
99
  rspec-support (~> 3.9.0)
90
- rspec-support (3.9.2)
91
- rubocop (0.80.1)
92
- jaro_winkler (~> 1.5.1)
100
+ rspec-support (3.9.3)
101
+ rubocop (0.83.0)
93
102
  parallel (~> 1.10)
94
103
  parser (>= 2.7.0.1)
95
104
  rainbow (>= 2.2.2, < 4.0)
96
105
  rexml
97
106
  ruby-progressbar (~> 1.7)
98
- unicode-display_width (>= 1.4.0, < 1.7)
107
+ unicode-display_width (>= 1.4.0, < 2.0)
99
108
  ruby-progressbar (1.10.1)
100
109
  simplecov (0.18.5)
101
110
  docile (~> 1.1)
102
111
  simplecov-html (~> 0.11)
103
- simplecov-html (0.12.1)
112
+ simplecov-html (0.12.2)
104
113
  sync (0.5.0)
105
114
  term-ansicolor (1.7.1)
106
115
  tins (~> 1.0)
107
116
  thor (0.20.3)
108
- tins (1.24.1)
117
+ thread_safe (0.3.6)
118
+ tins (1.25.0)
109
119
  sync
110
- travis (1.8.10)
111
- backports
112
- faraday (~> 0.9)
113
- faraday_middleware (~> 0.9, >= 0.9.1)
120
+ travis (1.9.1)
121
+ faraday (~> 1.0)
122
+ faraday_middleware (~> 1.0)
114
123
  gh (~> 0.13)
115
- highline (~> 1.6)
116
- launchy (~> 2.1)
124
+ highline (~> 2.0)
125
+ json (~> 2.3)
126
+ launchy (~> 2.1, < 2.5.0)
117
127
  pusher-client (~> 0.4)
118
128
  typhoeus (~> 0.6, >= 0.6.8)
119
129
  typhoeus (0.8.0)
120
130
  ethon (>= 0.8.0)
131
+ tzinfo (1.2.7)
132
+ thread_safe (~> 0.1)
121
133
  unf (0.1.4)
122
134
  unf_ext
123
- unf_ext (0.0.7.6)
124
- unicode-display_width (1.6.1)
135
+ unf_ext (0.0.7.7)
136
+ unicode-display_width (1.7.0)
125
137
  websocket (1.2.8)
126
138
  will_paginate (3.3.0)
127
- yard (0.9.24)
139
+ yard (0.9.25)
128
140
 
129
141
  PLATFORMS
130
142
  ruby
@@ -132,7 +144,7 @@ PLATFORMS
132
144
  DEPENDENCIES
133
145
  bundler (~> 2.0)
134
146
  coveralls (~> 0.7)
135
- rake (~> 12.0)
147
+ rake (~> 13.0)
136
148
  rspec (~> 3.0)
137
149
  rubocop (~> 0.50)
138
150
  simplecov (~> 0.17)
@@ -141,4 +153,4 @@ DEPENDENCIES
141
153
  yard (~> 0.9.20)
142
154
 
143
155
  BUNDLED WITH
144
- 2.0.1
156
+ 2.1.4
@@ -179,8 +179,10 @@ module SkullIsland
179
179
  )
180
180
  end
181
181
 
182
- def self.cleanup_except(project, keep_these)
183
- where(:project, project).reject { |res| keep_these.include?(res.id) }.map do |res|
182
+ def self.cleanup_except(project, keep_these, from_these = nil)
183
+ old_resources = from_these || where(:project, project)
184
+
185
+ old_resources.reject { |res| keep_these.include?(res.id) }.map do |res|
184
186
  puts "[WARN] ! Removing #{name} (#{res.id})"
185
187
  res.destroy
186
188
  end
@@ -29,6 +29,8 @@ module SkullIsland
29
29
  end
30
30
 
31
31
  cleanup_except(project, known_ids) if project
32
+
33
+ known_ids
32
34
  end
33
35
 
34
36
  def export(options = {})
@@ -35,6 +35,8 @@ module SkullIsland
35
35
  end
36
36
 
37
37
  cleanup_except(project, known_ids) if project
38
+
39
+ known_ids
38
40
  end
39
41
  # rubocop:enable Metrics/CyclomaticComplexity
40
42
  # rubocop:enable Metrics/PerceivedComplexity
@@ -95,6 +95,8 @@ module SkullIsland
95
95
  # rubocop:enable Metrics/BlockLength
96
96
 
97
97
  cleanup_except(project, known_ids) if project
98
+
99
+ known_ids
98
100
  end
99
101
  # rubocop:enable Metrics/MethodLength
100
102
 
@@ -43,6 +43,8 @@ module SkullIsland
43
43
  end
44
44
 
45
45
  cleanup_except(project, known_ids) if project
46
+
47
+ known_ids
46
48
  end
47
49
  # rubocop:enable Metrics/CyclomaticComplexity
48
50
  # rubocop:enable Metrics/PerceivedComplexity
@@ -31,7 +31,8 @@ module SkullIsland
31
31
  # rubocop:disable Metrics/CyclomaticComplexity
32
32
  # rubocop:disable Metrics/PerceivedComplexity
33
33
  # rubocop:disable Metrics/AbcSize
34
- def self.batch_import(data, verbose: false, test: false, project: nil, time: nil)
34
+ # rubocop:disable Layout/LineLength
35
+ def self.batch_import(data, verbose: false, test: false, project: nil, time: nil, cleanup: true)
35
36
  raise(Exceptions::InvalidArguments) unless data.is_a?(Array)
36
37
 
37
38
  known_ids = []
@@ -59,11 +60,14 @@ module SkullIsland
59
60
  known_ids << resource.id
60
61
  end
61
62
 
62
- cleanup_except(project, known_ids) if project
63
+ cleanup_except(project, known_ids) if project && cleanup
64
+
65
+ known_ids
63
66
  end
64
67
  # rubocop:enable Metrics/CyclomaticComplexity
65
68
  # rubocop:enable Metrics/PerceivedComplexity
66
69
  # rubocop:enable Metrics/AbcSize
70
+ # rubocop:enable Layout/LineLength
67
71
 
68
72
  # Provides a collection of related {Plugin} instances
69
73
  def plugins
@@ -49,16 +49,23 @@ module SkullIsland
49
49
  resource.import_update_or_skip(index: index, verbose: verbose, test: test)
50
50
  known_ids << resource.id
51
51
 
52
- Route.batch_import(
52
+ previous_routes = resource.routes.dup
53
+
54
+ added_routes = Route.batch_import(
53
55
  (rdata['routes'] || []).map { |r| r.merge('service' => { 'id' => resource.id }) },
54
56
  verbose: verbose,
55
57
  test: test,
56
58
  project: project,
57
- time: time
59
+ time: time,
60
+ cleanup: false
58
61
  )
62
+
63
+ Route.cleanup_except(project, added_routes, previous_routes)
59
64
  end
60
65
 
61
66
  cleanup_except(project, known_ids) if project
67
+
68
+ known_ids
62
69
  end
63
70
  # rubocop:enable Metrics/CyclomaticComplexity
64
71
  # rubocop:enable Metrics/PerceivedComplexity
@@ -116,7 +123,7 @@ module SkullIsland
116
123
  def modified_existing?
117
124
  return false unless new?
118
125
 
119
- # Find routes of the same name
126
+ # Find services of the same name
120
127
  same_name = self.class.where(:name, name)
121
128
 
122
129
  existing = same_name.size == 1 ? same_name.first : nil
@@ -65,6 +65,8 @@ module SkullIsland
65
65
  end
66
66
 
67
67
  cleanup_except(project, known_ids) if project
68
+
69
+ known_ids
68
70
  end
69
71
  # rubocop:enable Metrics/CyclomaticComplexity
70
72
  # rubocop:enable Metrics/PerceivedComplexity
@@ -38,6 +38,8 @@ module SkullIsland
38
38
  end
39
39
 
40
40
  cleanup_except(project, known_ids) if project
41
+
42
+ known_ids
41
43
  end
42
44
  # rubocop:enable Metrics/CyclomaticComplexity
43
45
  # rubocop:enable Metrics/PerceivedComplexity
@@ -4,6 +4,6 @@ module SkullIsland
4
4
  VERSION = [
5
5
  2, # Major
6
6
  0, # Minor
7
- 3 # Patch
7
+ 4 # Patch
8
8
  ].join('.')
9
9
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_development_dependency 'bundler', '~> 2.0'
38
38
  spec.add_development_dependency 'coveralls', '~> 0.7'
39
- spec.add_development_dependency 'rake', '~> 12.0'
39
+ spec.add_development_dependency 'rake', '~> 13.0'
40
40
  spec.add_development_dependency 'rspec', '~> 3.0'
41
41
  spec.add_development_dependency 'rubocop', '~> 0.50'
42
42
  spec.add_development_dependency 'simplecov', '~> 0.17'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skull_island
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2020-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deepsort
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '12.0'
145
+ version: '13.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '12.0'
152
+ version: '13.0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rspec
155
155
  requirement: !ruby/object:Gem::Requirement