Icarus-Mod-Tools 2.1.2 → 2.1.3

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
  SHA256:
3
- metadata.gz: 6b11076691550f236dbbe8cffc43ab3f4e87d0d6bc3796a05249586884df9af7
4
- data.tar.gz: 7c0c0dbeee725796ebea01ea3b8f0d1fd11418fc92aaad54ceca055ef36c83f0
3
+ metadata.gz: c6d319cdda834c36f092c7e2ec601beccba56c07c982d515039566a0dfcde470
4
+ data.tar.gz: ab8646c60970f163bc749d2a42267a122454d6fe13f9e7cd2a717ff841f57182
5
5
  SHA512:
6
- metadata.gz: bb68f166b13d2d62e696d880a7ce63da51a0d941fd00211a6c63df28109808ee85f390090dcbf0c5bad35f5905b79d05b902a4be72b3366cc31a96ee908cc9d7
7
- data.tar.gz: 55e3a9b353561d231cc58f6081f06f98d0204b9229d1fe1f404b0516e2dbd8e37a82297bb0bd610a3e11afc6f5409020409f9d3aec524d26c44b90b3790abfc7
6
+ metadata.gz: 9f4ca058de03df31d7791de1a3e5ecbf77cbb43d0ad6f7c646e22c9ac4183ee2bd7081383c55f08cc555e5ff74267c4e910bacf5e9aaec37f462644ceb807288
7
+ data.tar.gz: 226221b51db91108f1bc4c41f2fe7f9f360f492b0bf4374eb38a6d9214952ef943f10ae6465c934376e894b6c5c1eacb6395f9ebe75ff5f34cb88e872f3d171a
data/Gemfile CHANGED
@@ -14,4 +14,5 @@ group :develop do
14
14
  gem "rspec", "~> 3.12"
15
15
  gem "rubocop", "~> 1.41"
16
16
  gem "rubocop-rspec", "~> 2.16", require: false
17
+ gem "standard"
17
18
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Icarus-Mod-Tools (2.1.2)
4
+ Icarus-Mod-Tools (2.1.3)
5
5
  google-cloud-firestore (~> 2.7)
6
6
  octokit (~> 6.0)
7
7
  paint (~> 2.3)
@@ -14,17 +14,17 @@ GEM
14
14
  public_suffix (>= 2.0.2, < 6.0)
15
15
  ast (2.4.2)
16
16
  coderay (1.1.3)
17
- concurrent-ruby (1.2.0)
17
+ concurrent-ruby (1.2.2)
18
18
  diff-lcs (1.5.0)
19
19
  faraday (2.7.4)
20
20
  faraday-net_http (>= 2.0, < 3.1)
21
21
  ruby2_keywords (>= 0.0.4)
22
22
  faraday-net_http (3.0.2)
23
- faraday-retry (2.0.0)
23
+ faraday-retry (2.1.0)
24
24
  faraday (~> 2.0)
25
25
  ffi (1.15.5)
26
26
  formatador (1.1.0)
27
- gapic-common (0.17.1)
27
+ gapic-common (0.18.0)
28
28
  faraday (>= 1.9, < 3.a)
29
29
  faraday-retry (>= 1.0, < 3.a)
30
30
  google-protobuf (~> 3.14)
@@ -37,34 +37,38 @@ GEM
37
37
  google-cloud-errors (~> 1.0)
38
38
  google-cloud-env (1.6.0)
39
39
  faraday (>= 0.17.3, < 3.0)
40
- google-cloud-errors (1.3.0)
41
- google-cloud-firestore (2.10.0)
40
+ google-cloud-errors (1.3.1)
41
+ google-cloud-firestore (2.11.0)
42
42
  concurrent-ruby (~> 1.0)
43
43
  google-cloud-core (~> 1.5)
44
- google-cloud-firestore-v1 (~> 0.0)
44
+ google-cloud-firestore-v1 (~> 0.10)
45
45
  rbtree (~> 0.4.2)
46
- google-cloud-firestore-v1 (0.8.0)
47
- gapic-common (>= 0.10, < 2.a)
46
+ google-cloud-firestore-v1 (0.10.0)
47
+ gapic-common (>= 0.17.1, < 2.a)
48
48
  google-cloud-errors (~> 1.0)
49
- google-cloud-location (>= 0.0, < 2.a)
50
- google-cloud-location (0.3.0)
51
- gapic-common (>= 0.16.0, < 2.a)
49
+ google-cloud-location (>= 0.4, < 2.a)
50
+ google-cloud-location (0.4.0)
51
+ gapic-common (>= 0.17.1, < 2.a)
52
52
  google-cloud-errors (~> 1.0)
53
- google-protobuf (3.21.12-x86_64-darwin)
53
+ google-protobuf (3.22.2-x86_64-darwin)
54
+ google-protobuf (3.22.2-x86_64-linux)
54
55
  googleapis-common-protos (1.4.0)
55
56
  google-protobuf (~> 3.14)
56
57
  googleapis-common-protos-types (~> 1.2)
57
58
  grpc (~> 1.27)
58
59
  googleapis-common-protos-types (1.5.0)
59
60
  google-protobuf (~> 3.14)
60
- googleauth (1.3.0)
61
+ googleauth (1.5.0)
61
62
  faraday (>= 0.17.3, < 3.a)
62
63
  jwt (>= 1.4, < 3.0)
63
64
  memoist (~> 0.16)
64
65
  multi_json (~> 1.11)
65
66
  os (>= 0.9, < 2.0)
66
67
  signet (>= 0.16, < 2.a)
67
- grpc (1.52.0-x86_64-darwin)
68
+ grpc (1.53.0-x86_64-darwin)
69
+ google-protobuf (~> 3.21)
70
+ googleapis-common-protos-types (~> 1.0)
71
+ grpc (1.53.0-x86_64-linux)
68
72
  google-protobuf (~> 3.21)
69
73
  googleapis-common-protos-types (~> 1.0)
70
74
  guard (2.18.0)
@@ -83,6 +87,7 @@ GEM
83
87
  rspec (>= 2.99.0, < 4.0)
84
88
  json (2.6.3)
85
89
  jwt (2.7.0)
90
+ language_server-protocol (3.17.0.3)
86
91
  listen (3.8.0)
87
92
  rb-fsevent (~> 0.10, >= 0.10.3)
88
93
  rb-inotify (~> 0.9, >= 0.9.10)
@@ -94,13 +99,13 @@ GEM
94
99
  notiffany (0.1.3)
95
100
  nenv (~> 0.1)
96
101
  shellany (~> 0.0)
97
- octokit (6.0.1)
102
+ octokit (6.1.0)
98
103
  faraday (>= 1, < 3)
99
104
  sawyer (~> 0.9)
100
105
  os (1.1.4)
101
106
  paint (2.3.0)
102
107
  parallel (1.22.1)
103
- parser (3.2.1.0)
108
+ parser (3.2.1.1)
104
109
  ast (~> 2.4.1)
105
110
  pry (0.14.2)
106
111
  coderay (~> 1.1)
@@ -123,28 +128,31 @@ GEM
123
128
  rspec-expectations (3.12.2)
124
129
  diff-lcs (>= 1.2.0, < 2.0)
125
130
  rspec-support (~> 3.12.0)
126
- rspec-mocks (3.12.3)
131
+ rspec-mocks (3.12.4)
127
132
  diff-lcs (>= 1.2.0, < 2.0)
128
133
  rspec-support (~> 3.12.0)
129
134
  rspec-support (3.12.0)
130
- rubocop (1.45.1)
135
+ rubocop (1.48.1)
131
136
  json (~> 2.3)
132
137
  parallel (~> 1.10)
133
138
  parser (>= 3.2.0.0)
134
139
  rainbow (>= 2.2.2, < 4.0)
135
140
  regexp_parser (>= 1.8, < 3.0)
136
141
  rexml (>= 3.2.5, < 4.0)
137
- rubocop-ast (>= 1.24.1, < 2.0)
142
+ rubocop-ast (>= 1.26.0, < 2.0)
138
143
  ruby-progressbar (~> 1.7)
139
144
  unicode-display_width (>= 2.4.0, < 3.0)
140
- rubocop-ast (1.26.0)
145
+ rubocop-ast (1.28.0)
141
146
  parser (>= 3.2.1.0)
142
- rubocop-capybara (2.17.0)
147
+ rubocop-capybara (2.17.1)
143
148
  rubocop (~> 1.41)
144
- rubocop-rspec (2.18.1)
149
+ rubocop-performance (1.16.0)
150
+ rubocop (>= 1.7.0, < 2.0)
151
+ rubocop-ast (>= 0.4.0)
152
+ rubocop-rspec (2.19.0)
145
153
  rubocop (~> 1.33)
146
154
  rubocop-capybara (~> 2.17)
147
- ruby-progressbar (1.11.0)
155
+ ruby-progressbar (1.13.0)
148
156
  ruby2_keywords (0.0.5)
149
157
  sawyer (0.9.2)
150
158
  addressable (>= 2.3.5)
@@ -155,6 +163,10 @@ GEM
155
163
  faraday (>= 0.17.5, < 3.a)
156
164
  jwt (>= 1.5, < 3.0)
157
165
  multi_json (~> 1.10)
166
+ standard (1.25.3)
167
+ language_server-protocol (~> 3.17.0.2)
168
+ rubocop (~> 1.48.1)
169
+ rubocop-performance (~> 1.16.0)
158
170
  thor (1.2.1)
159
171
  unicode-display_width (2.4.2)
160
172
 
@@ -171,6 +183,7 @@ DEPENDENCIES
171
183
  rspec (~> 3.12)
172
184
  rubocop (~> 1.41)
173
185
  rubocop-rspec (~> 2.16)
186
+ standard
174
187
 
175
188
  BUNDLED WITH
176
189
  2.3.26
@@ -57,8 +57,12 @@ module Icarus
57
57
  $firestore ||= Firestore.new
58
58
  end
59
59
 
60
+ def success_or_failure(status)
61
+ format("%<status>10s", status: status ? Paint["Success", :green] : Paint["Failure", :red])
62
+ end
63
+
60
64
  def sync_info(type)
61
- sync = (type == :modinfo ? Icarus::Mod::Tools::Sync::ModinfoList : Icarus::Mod::Tools::Sync::ToolinfoList).new(client: firestore)
65
+ sync = ((type == :modinfo) ? Icarus::Mod::Tools::Sync::ModinfoList : Icarus::Mod::Tools::Sync::ToolinfoList).new(client: firestore)
62
66
 
63
67
  puts "Retrieving repository Data..." if verbose?
64
68
  repositories = sync.repositories
@@ -71,19 +75,19 @@ module Icarus
71
75
  raise Icarus::Mod::Tools::Error, "no .json files found for #{type}" unless info_array&.any?
72
76
 
73
77
  if options[:dry_run]
74
- puts "Dry run; no changes will be made"
78
+ puts Paint["Dry run; no changes will be made", :orange, :bright]
75
79
  return
76
80
  end
77
81
 
78
- puts "Saving to Firestore..." if verbose?
82
+ puts Paint["Saving to Firestore...", :black] if verbose?
79
83
  response = sync.update(info_array)
80
- puts response ? "Success" : "Failure (may be no changes)" if verbose?
84
+ puts response ? Paint["Success", :green, :bright] : Paint["Failure (may be no changes)", :red, :bright] if verbose?
81
85
  rescue Icarus::Mod::Tools::Error => e
82
86
  warn e.message
83
87
  end
84
88
 
85
89
  def sync_list(type)
86
- sync = (type == :mods ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Tools).new(client: firestore)
90
+ sync = ((type == :mods) ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Tools).new(client: firestore)
87
91
 
88
92
  puts "Syncing #{type} to #{Config.firebase.collections.send(type)}" if verbose > 1
89
93
 
@@ -100,11 +104,18 @@ module Icarus
100
104
  verb = "Creating"
101
105
 
102
106
  puts "Validating Info Data for #{list.uniq_name}..." if verbose > 2
103
- warn "Skipping List #{list.uniq_name} due to validation errors" && next unless list.valid?
107
+ unless list.valid?
108
+ warn Paint["Skipping List #{list.uniq_name} due to validation errors", :yellow, :bright]
109
+ if verbose > 1
110
+ warn list.errors.map { |error| Paint[error, :red] }.join("\n")
111
+ end
112
+
113
+ next
114
+ end
104
115
 
105
116
  doc_id = sync.find(list)
106
117
  if doc_id
107
- puts "Found existing list #{list.name} at #{doc_id}" if verbose > 2
118
+ puts Paint["Found existing list #{list.name} at #{doc_id}", :black] if verbose > 2
108
119
  list.id = doc_id
109
120
  verb = "Updating"
110
121
  end
@@ -112,16 +123,16 @@ module Icarus
112
123
  print format("#{verb} %-<name>60s", name: "'#{list.author || "NoOne"}/#{list.name || "Unnamed"}'") if verbose > 1
113
124
 
114
125
  if options[:dry_run]
115
- puts "Dry run; no changes will be made" if verbose > 1
126
+ puts Paint["Dry run; no changes will be made", :yellow] if verbose > 1
116
127
  next
117
128
  end
118
129
 
119
130
  response = sync.update(list)
120
- puts format("%<status>10s", status: response ? "Success" : "Failure") if verbose > 1
131
+ puts success_or_failure(status: response) if verbose > 1
121
132
  end
122
133
 
123
134
  if options[:dry_run]
124
- puts "Dry run; no changes will be made" if verbose?
135
+ puts Paint["Dry run; no changes will be made", :white] if verbose?
125
136
  return
126
137
  end
127
138
 
@@ -135,7 +146,7 @@ module Icarus
135
146
  delete_array.each do |list|
136
147
  print format("Deleting %-<name>60s", name: "'#{list.author || "NoOne"}/#{list.name || "Unnamed'"}") if verbose > 1
137
148
  response = sync.delete(list)
138
- puts format("%<status>10s", status: response ? "Success" : "Failure") if verbose > 1
149
+ puts success_or_failure(status: response) if verbose > 1
139
150
  end
140
151
 
141
152
  puts "Deleted #{delete_array.count} outdated items" if verbose?
@@ -48,16 +48,16 @@ module Icarus
48
48
  raise "You must specify a payload to update" if payload&.empty? || payload.nil?
49
49
 
50
50
  response = case type.to_sym
51
- when :modinfo, :toolinfo
52
- update_array = (send(type) + [payload]).flatten.uniq
53
- @client.doc(collections.meta.send(type)).set({ list: update_array }, merge:) if update_array.any?
54
- when :repositories
55
- @client.doc(collections.meta.repositories).set({ list: payload }, merge:)
56
- when :mod, :tool
57
- create_or_update(pluralize(type), payload, merge:)
58
- else
59
- raise "Invalid type: #{type}"
60
- end
51
+ when :modinfo, :toolinfo
52
+ update_array = (send(type) + [payload]).flatten.uniq
53
+ @client.doc(collections.meta.send(type)).set({list: update_array}, merge:) if update_array.any?
54
+ when :repositories
55
+ @client.doc(collections.meta.repositories).set({list: payload}, merge:)
56
+ when :mod, :tool
57
+ create_or_update(pluralize(type), payload, merge:)
58
+ else
59
+ raise "Invalid type: #{type}"
60
+ end
61
61
 
62
62
  response.is_a?(Google::Cloud::Firestore::DocumentReference) || response.is_a?(Google::Cloud::Firestore::CommitResponse::WriteResult)
63
63
  end
@@ -81,7 +81,7 @@ module Icarus
81
81
  @client.doc(collections.meta.send(type)).get[:list]
82
82
  when :mods, :tools
83
83
  @client.col(collections.send(type)).get.map do |doc|
84
- klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
84
+ klass = (type == :mods) ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
85
85
  klass.new(doc.data, id: doc.document_id, created: doc.create_time, updated: doc.update_time)
86
86
  end
87
87
  else
@@ -21,7 +21,7 @@ module Icarus
21
21
 
22
22
  def info_array
23
23
  @info_array ||= @firestore.modinfo.map do |url|
24
- retrieve_from_url(url)[:mods].map { |mod| Icarus::Mod::Tools::Modinfo.new(mod) if mod[:name] =~ /[a-z0-9]+/i }
24
+ retrieve_from_url(url)[:mods].map { |mod| Icarus::Mod::Tools::Modinfo.new(mod) if mod[:name].match?(/[a-z0-9]+/i) }
25
25
  rescue Icarus::Mod::Tools::Sync::RequestFailed
26
26
  warn "Skipped; Failed to retrieve #{url}"
27
27
  next
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Icarus
4
4
  module Mod
5
- VERSION = "2.1.2"
5
+ VERSION = "2.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Icarus-Mod-Tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donovan Young
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-12 00:00:00.000000000 Z
11
+ date: 2023-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-firestore