Icarus-Mod-Tools 1.8.2.1 → 1.9.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
  SHA256:
3
- metadata.gz: f5300a7aec66d731f9bea8dfec09626928ff51e0e611b3a6173f9c2ed5c4ebd8
4
- data.tar.gz: c5bd016ddf8c8d4dd6631ae57c8202bed96ae4da587c8ab3999bbc5d656ed14d
3
+ metadata.gz: 9fba522a3f41d8d1c77402e95f59684594bb7be97a8227966e4b647777152f05
4
+ data.tar.gz: 933ee795c5f13f964e1a866c0ce06549912c6e99c06c78fd687e5c25886bf148
5
5
  SHA512:
6
- metadata.gz: 4a7f0fce56f5ce4471763c001895af4308deaeb7bee335c08d9bc350d79daaf2c3c23accc546213472f0047b3e45c3deab5fd6d15a338084ff0df3378bc9a0e7
7
- data.tar.gz: 4536666a6b5bbfd6ed61f0d3f97a6f05a33e377a5d7e211a4394e413c1721c6c0f312c774e04d926cb07075bfc5dbca7546f824c101568d343080fb6a266f8b6
6
+ metadata.gz: 0cd6a08a77be86801059b2b63a81fb662583ca404391afa2fd9544dbda8549e0652ce4c7db9a5ff64edb04afd07b50b742e1473861639ea190eddd22dda70f03
7
+ data.tar.gz: 1f28bff449d31ea47fa9166586dd10b996c466ed898ff53449a2cfd84fff98a5454418214fa479fa9976c0700ca88b12724c8b1f166b059093658d32862ee938
data/CHANGES.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## History (reverse chronological order)
6
6
 
7
+ ### v1.9 - 2023-01-28
8
+
9
+ - Renamed `Progs` to `Tools`
10
+
7
11
  ### v1.8 - 2023-01-27
8
12
 
9
13
  - Added support for `proginfo.json` files
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Icarus-Mod-Tools (1.8.2.1)
4
+ Icarus-Mod-Tools (1.9.0)
5
5
  google-cloud-firestore (~> 2.7)
6
6
  octokit (~> 6.0)
7
7
  paint (~> 2.3)
@@ -51,6 +51,7 @@ GEM
51
51
  gapic-common (>= 0.16.0, < 2.a)
52
52
  google-cloud-errors (~> 1.0)
53
53
  google-protobuf (3.21.12-x86_64-darwin)
54
+ google-protobuf (3.21.12-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)
@@ -67,6 +68,9 @@ GEM
67
68
  grpc (1.51.0-x86_64-darwin)
68
69
  google-protobuf (~> 3.21)
69
70
  googleapis-common-protos-types (~> 1.0)
71
+ grpc (1.51.0-x86_64-linux)
72
+ google-protobuf (~> 3.21)
73
+ googleapis-common-protos-types (~> 1.0)
70
74
  guard (2.18.0)
71
75
  formatador (>= 0.2.4)
72
76
  listen (>= 2.7, < 4.0)
data/README.md CHANGED
@@ -71,7 +71,7 @@ Options:
71
71
  Commands:
72
72
  imt add help [COMMAND] # Describe subcommands or one specific subcommand
73
73
  imt add modinfo # Adds an entry to 'meta/modinfo/list'
74
- imt add proginfo # Adds an entry to 'meta/proginfo/list'
74
+ imt add toolinfo # Adds an entry to 'meta/toolinfo/list'
75
75
  imt add repos # Adds an entry to 'meta/repos/list'
76
76
 
77
77
  Options:
@@ -89,8 +89,8 @@ Commands:
89
89
  imt list help [COMMAND] # Describe subcommands or one specific subcommand
90
90
  imt list modinfo # Displays data from 'meta/modinfo/list'
91
91
  imt list mods # Displays data from 'mods'
92
- imt list proginfo # Displays data from 'meta/proginfo/list'
93
- imt list progs # Displays data from 'progs'
92
+ imt list toolinfo # Displays data from 'meta/toolinfo/list'
93
+ imt list tools # Displays data from 'tools'
94
94
  imt list repos # Displays data from 'meta/repos/list'
95
95
 
96
96
  Options:
@@ -109,8 +109,8 @@ Commands:
109
109
  imt sync help [COMMAND] # Describe subcommands or one specific subcommand
110
110
  imt sync modinfo # Reads from 'meta/repos/list' and Syncs any modinfo files we find (github only for now)
111
111
  imt sync mods # Reads from 'meta/modinfo/list' and updates the 'mods' database accordingly
112
- imt sync proginfo # Reads from 'meta/repos/list' and Syncs any proginfo files we find (github only for now)
113
- imt sync progs # Reads from 'meta/proginfo/list' and updates the 'progs' database accordingly
112
+ imt sync toolinfo # Reads from 'meta/repos/list' and Syncs any toolinfo files we find (github only for now)
113
+ imt sync tools # Reads from 'meta/toolinfo/list' and updates the 'tools' database accordingly
114
114
 
115
115
  Options:
116
116
  -C, [--config=CONFIG] # Path to the config file
@@ -14,10 +14,10 @@
14
14
  },
15
15
  "collections": {
16
16
  "modinfo": "meta/modinfo",
17
- "proginfo": "meta/proginfo",
17
+ "toolinfo": "meta/toolinfo",
18
18
  "repositories": "meta/repos",
19
19
  "mods": "mods",
20
- "progs": "progs"
20
+ "tools": "tools"
21
21
  }
22
22
  },
23
23
  "github": {
@@ -15,12 +15,12 @@ module Icarus
15
15
  puts firestore.update(:modinfo, payload, merge: true) ? "Success" : "Failure"
16
16
  end
17
17
 
18
- desc "proginfo", "Adds an entry to 'meta/proginfo/list'"
19
- def proginfo(item)
18
+ desc "toolinfo", "Adds an entry to 'meta/toolinfo/list'"
19
+ def toolinfo(item)
20
20
  firestore = Firestore.new
21
- payload = [firestore.list(:proginfo), item].flatten.compact
21
+ payload = [firestore.list(:toolinfo), item].flatten.compact
22
22
 
23
- puts firestore.update(:proginfo, payload, merge: true) ? "Success" : "Failure"
23
+ puts firestore.update(:toolinfo, payload, merge: true) ? "Success" : "Failure"
24
24
  end
25
25
 
26
26
  desc "repos", "Adds an entry to 'meta/repos/list'"
@@ -15,11 +15,11 @@ module Icarus
15
15
  puts "Total: #{modinfo_array.count}" if verbose > 1
16
16
  end
17
17
 
18
- desc "proginfo", "Displays data from 'meta/proginfo/list'"
19
- def proginfo
20
- proginfo_array = Firestore.new.list(:proginfo)
21
- puts proginfo_array
22
- puts "Total: #{proginfo_array.count}" if verbose > 1
18
+ desc "toolinfo", "Displays data from 'meta/toolinfo/list'"
19
+ def toolinfo
20
+ toolinfo_array = Firestore.new.list(:toolinfo)
21
+ puts toolinfo_array
22
+ puts "Total: #{toolinfo_array.count}" if verbose > 1
23
23
  end
24
24
 
25
25
  desc "repos", "Displays data from 'meta/repos/list'"
@@ -36,16 +36,16 @@ module Icarus
36
36
  list_for_type(:mods)
37
37
  end
38
38
 
39
- desc "progs", "Displays data from 'progs'"
39
+ desc "tools", "Displays data from 'tools'"
40
40
  method_option :sort, type: :string, default: "name", desc: "Sort by field (name, author, etc.)"
41
41
  method_option :filter, type: :array, default: [], desc: "Filter by field (name, author, etc.)"
42
- def progs
43
- list_for_type(:progs)
42
+ def tools
43
+ list_for_type(:tools)
44
44
  end
45
45
 
46
46
  no_commands do
47
47
  def list_for_type(type)
48
- klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Proginfo
48
+ klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
49
49
  valid_keys = klass::HASHKEYS + [:updated_at]
50
50
  sort_field = options[:sort]&.to_sym
51
51
  filter = !options[:filter].empty?
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "tools/sync/modinfo"
4
- require "tools/sync/proginfo"
3
+ require "tools/sync/modinfo_list"
4
+ require "tools/sync/toolinfo_list"
5
5
  require "tools/sync/mods"
6
- require "tools/sync/progs"
6
+ require "tools/sync/tools"
7
7
 
8
8
  module Icarus
9
9
  module Mod
@@ -17,11 +17,11 @@ module Icarus
17
17
 
18
18
  desc "all", "Run all sync jobs"
19
19
  def all
20
- puts "Running Proginfo Sync..." if verbose?
21
- invoke :proginfo
20
+ puts "Running Toolinfo Sync..." if verbose?
21
+ invoke :toolinfo
22
22
 
23
- puts "Running Progs Sync..." if verbose?
24
- invoke :progs
23
+ puts "Running Tools Sync..." if verbose?
24
+ invoke :tools
25
25
 
26
26
  puts "Running Modinfo Sync..." if verbose?
27
27
  invoke :modinfo
@@ -35,9 +35,9 @@ module Icarus
35
35
  sync_info(:modinfo)
36
36
  end
37
37
 
38
- desc "proginfo", "Reads from 'meta/repos/list' and Syncs any proginfo files we find (github only for now)"
39
- def proginfo
40
- sync_info(:proginfo)
38
+ desc "toolinfo", "Reads from 'meta/repos/list' and Syncs any toolinfo files we find (github only for now)"
39
+ def toolinfo
40
+ sync_info(:toolinfo)
41
41
  end
42
42
 
43
43
  desc "mods", "Reads from 'meta/modinfo/list' and updates the 'mods' database accordingly"
@@ -46,10 +46,10 @@ module Icarus
46
46
  sync_list(:mods)
47
47
  end
48
48
 
49
- desc "progs", "Reads from 'meta/proginfo/list' and updates the 'progs' database accordingly"
50
- method_option :check, type: :boolean, default: false, desc: "Validate proginfo without applying changes"
51
- def progs
52
- sync_list(:progs)
49
+ desc "tools", "Reads from 'meta/toolinfo/list' and updates the 'tools' database accordingly"
50
+ method_option :check, type: :boolean, default: false, desc: "Validate toolinfo without applying changes"
51
+ def tools
52
+ sync_list(:tools)
53
53
  end
54
54
 
55
55
  no_commands do
@@ -58,7 +58,7 @@ module Icarus
58
58
  end
59
59
 
60
60
  def sync_info(type)
61
- sync = (type == :modinfo ? Icarus::Mod::Tools::Sync::Modinfo : Icarus::Mod::Tools::Sync::Proginfo).new(client: firestore)
61
+ sync = (type == :modinfo ? Icarus::Mod::Tools::Sync::ModinfoList : Icarus::Mod::Tools::Sync::ToolinfoList).new(client: firestore)
62
62
 
63
63
  puts "Retrieving repository Data..." if verbose?
64
64
  repositories = sync.repositories
@@ -83,7 +83,7 @@ module Icarus
83
83
  end
84
84
 
85
85
  def sync_list(type)
86
- sync = (type == :mods ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Progs).new(client: firestore)
86
+ sync = (type == :mods ? Icarus::Mod::Tools::Sync::Mods : Icarus::Mod::Tools::Sync::Tools).new(client: firestore)
87
87
 
88
88
  puts "Retrieving Info Data..." if verbose?
89
89
  info_array = sync.info_array
@@ -12,9 +12,9 @@ module Icarus
12
12
  validate(:modinfo)
13
13
  end
14
14
 
15
- desc "proginfo", "Reads proginfo data from 'meta/proginfo/list' and Validates syntax of progfiles"
16
- def proginfo
17
- validate(:proginfo)
15
+ desc "toolinfo", "Reads Toolinfo data from 'meta/toolinfo/list' and Validates syntax of toolfiles"
16
+ def toolinfo
17
+ validate(:toolinfo)
18
18
  end
19
19
 
20
20
  no_commands do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "google/cloud/firestore"
4
4
  require "tools/modinfo"
5
- require "tools/proginfo"
5
+ require "tools/toolinfo"
6
6
 
7
7
  module Icarus
8
8
  module Mod
@@ -23,16 +23,16 @@ module Icarus
23
23
  @modinfo ||= list(:modinfo)
24
24
  end
25
25
 
26
- def proginfo
27
- @proginfo ||= list(:proginfo)
26
+ def toolinfo
27
+ @toolinfo ||= list(:toolinfo)
28
28
  end
29
29
 
30
30
  def mods
31
31
  @mods ||= list(:mods)
32
32
  end
33
33
 
34
- def progs
35
- @progs ||= list(:progs)
34
+ def tools
35
+ @tools ||= list(:tools)
36
36
  end
37
37
 
38
38
  def find_by_type(type:, name:, author:)
@@ -47,11 +47,11 @@ module Icarus
47
47
 
48
48
  def list(type)
49
49
  case type.to_sym
50
- when :modinfo, :proginfo, :repositories
50
+ when :modinfo, :toolinfo, :repositories
51
51
  get_list(type)
52
- when :mods, :progs
52
+ when :mods, :tools
53
53
  @client.col(collections.send(type)).get.map do |doc|
54
- klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Proginfo
54
+ klass = type == :mods ? Icarus::Mod::Tools::Modinfo : Icarus::Mod::Tools::Toolinfo
55
55
  klass.new(doc.data, id: doc.document_id, created: doc.create_time, updated: doc.update_time)
56
56
  end
57
57
  else
@@ -71,12 +71,12 @@ module Icarus
71
71
  raise "You must specify a payload to update" if payload&.empty? || payload.nil?
72
72
 
73
73
  case type.to_sym
74
- when :modinfo, :proginfo
74
+ when :modinfo, :toolinfo
75
75
  update_array = (send(type) + [payload]).flatten.uniq
76
76
  response = @client.doc(collections.send(type)).set({ list: update_array }, merge:) if update_array.any?
77
77
  when :repositories
78
78
  response = @client.doc(collections.repositories).set({ list: payload }, merge:)
79
- when :mod, :prog
79
+ when :mod, :tool
80
80
  response = update_or_create(pluralize(type), payload, merge:)
81
81
  else
82
82
  raise "Invalid type: #{type}"
@@ -87,7 +87,7 @@ module Icarus
87
87
 
88
88
  def delete(type, payload)
89
89
  case type.to_sym
90
- when :mod, :prog
90
+ when :mod, :tool
91
91
  response = @client.doc("#{collections.send(pluralize(type))}/#{payload.id}").delete
92
92
  else
93
93
  raise "Invalid type: #{type}"
@@ -3,7 +3,7 @@
3
3
  module Icarus
4
4
  module Mod
5
5
  module Tools
6
- # Base class for Modinfo and Proginfo
6
+ # Base class for Modinfo and Toolinfo
7
7
  class Baseinfo
8
8
  attr_reader :data, :id, :created_at, :updated_at
9
9
 
@@ -13,6 +13,8 @@ module Icarus
13
13
  # Sync helper methods
14
14
  module Helpers
15
15
  def retrieve_from_url(url)
16
+ raise RequestFailed, "Invalid URI: '#{url}'" unless url && url =~ URI::DEFAULT_PARSER.make_regexp
17
+
16
18
  res = Net::HTTP.get_response(URI(url))
17
19
 
18
20
  raise RequestFailed, "HTTP Request failed for #{url} (#{res.code}): #{res.message}" unless res&.code == "200"
@@ -9,7 +9,7 @@ module Icarus
9
9
  module Tools
10
10
  module Sync
11
11
  # Sync methods
12
- class Modinfo
12
+ class ModinfoList
13
13
  include Helpers
14
14
 
15
15
  def initialize(client: nil)
@@ -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| 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] =~ /[a-z0-9]+/i }
25
25
  rescue Icarus::Mod::Tools::Sync::RequestFailed
26
26
  warn "Skipped; Failed to retrieve #{url}"
27
27
  next
@@ -9,7 +9,7 @@ module Icarus
9
9
  module Tools
10
10
  module Sync
11
11
  # Sync methods
12
- class Proginfo
12
+ class ToolinfoList
13
13
  include Helpers
14
14
 
15
15
  def initialize(client: nil)
@@ -22,11 +22,11 @@ module Icarus
22
22
  @firestore.repos
23
23
  end
24
24
 
25
- def update(proginfo_array)
26
- @firestore.update(:proginfo, proginfo_array)
25
+ def update(toolinfo_array)
26
+ @firestore.update(:toolinfo, toolinfo_array)
27
27
  end
28
28
 
29
- def proginfo(url)
29
+ def toolinfo(url)
30
30
  retrieve_from_url(url)
31
31
  end
32
32
 
@@ -37,15 +37,15 @@ module Icarus
37
37
  case repo
38
38
  when /github/
39
39
  @github.repository = repo
40
- proginfo_url = @github.find("proginfo.json")
40
+ toolinfo_url = @github.find("toolinfo.json")
41
41
 
42
- unless proginfo_url
43
- puts "Skipped...no proginfo.json" if verbose
42
+ unless toolinfo_url
43
+ puts "Skipped...no toolinfo.json" if verbose
44
44
  next
45
45
  end
46
46
 
47
47
  puts "Found!" if verbose
48
- proginfo_url
48
+ toolinfo_url
49
49
  else
50
50
  puts "Skipped...repository type not supported yet" if verbose
51
51
  end
@@ -8,20 +8,22 @@ module Icarus
8
8
  module Tools
9
9
  module Sync
10
10
  # Sync methods
11
- class Progs
11
+ class Tools
12
12
  include Helpers
13
13
 
14
14
  def initialize(client: nil)
15
15
  @firestore = client || Firestore.new
16
16
  end
17
17
 
18
- def progs
19
- @firestore.progs
18
+ def tools
19
+ @firestore.tools
20
20
  end
21
21
 
22
22
  def info_array
23
- @info_array ||= @firestore.proginfo.map do |url|
24
- retrieve_from_url(url)[:programs].map { |prog| Tools::Proginfo.new(prog) if prog[:name] =~ /[a-z0-9]+/i }
23
+ @info_array ||= @firestore.toolinfo.map do |url|
24
+ next unless url
25
+
26
+ retrieve_from_url(url)[:tools].map { |tool| Icarus::Mod::Tools::Toolinfo.new(tool) if tool[:name] =~ /[a-z0-9]+/i }
25
27
  rescue Icarus::Mod::Tools::Sync::RequestFailed
26
28
  warn "Skipped; Failed to retrieve #{url}"
27
29
  next
@@ -31,20 +33,20 @@ module Icarus
31
33
  end.flatten.compact
32
34
  end
33
35
 
34
- def find(proginfo)
35
- @firestore.find_by_type(type: "progs", name: proginfo.name, author: proginfo.author)&.id
36
+ def find(toolinfo)
37
+ @firestore.find_by_type(type: "tools", name: toolinfo.name, author: toolinfo.author)&.id
36
38
  end
37
39
 
38
- def find_info(proginfo)
39
- @info_array.find { |prog| prog.name == proginfo.name }
40
+ def find_info(toolinfo)
41
+ @info_array.find { |tool| tool.name == toolinfo.name }
40
42
  end
41
43
 
42
- def update(proginfo)
43
- @firestore.update(:prog, proginfo, merge: false)
44
+ def update(toolinfo)
45
+ @firestore.update(:tool, toolinfo, merge: false)
44
46
  end
45
47
 
46
- def delete(proginfo)
47
- @firestore.delete(:prog, proginfo)
48
+ def delete(toolinfo)
49
+ @firestore.delete(:tool, toolinfo)
48
50
  end
49
51
  end
50
52
  end
@@ -6,7 +6,7 @@ module Icarus
6
6
  module Mod
7
7
  module Tools
8
8
  # Sync methods
9
- class Proginfo < Baseinfo
9
+ class Toolinfo < Baseinfo
10
10
  # rubocop:disable Naming/MethodName
11
11
  def fileType
12
12
  @data[:fileType] || "zip"
@@ -11,8 +11,8 @@ module Icarus
11
11
  @array = case type
12
12
  when :modinfo
13
13
  Sync::Mods.new.info_array
14
- when :proginfo
15
- Sync::Progs.new.info_array
14
+ when :toolinfo
15
+ Sync::Tools.new.info_array
16
16
  else
17
17
  raise ArgumentError, "Invalid type: #{type}"
18
18
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Icarus
4
4
  module Mod
5
- VERSION = "1.8.2.1"
5
+ VERSION = "1.9.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Icarus-Mod-Tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donovan Young
@@ -99,12 +99,12 @@ files:
99
99
  - lib/icarus/mod/tools.rb
100
100
  - lib/icarus/mod/tools/baseinfo.rb
101
101
  - lib/icarus/mod/tools/modinfo.rb
102
- - lib/icarus/mod/tools/proginfo.rb
103
102
  - lib/icarus/mod/tools/sync/helpers.rb
104
- - lib/icarus/mod/tools/sync/modinfo.rb
103
+ - lib/icarus/mod/tools/sync/modinfo_list.rb
105
104
  - lib/icarus/mod/tools/sync/mods.rb
106
- - lib/icarus/mod/tools/sync/proginfo.rb
107
- - lib/icarus/mod/tools/sync/progs.rb
105
+ - lib/icarus/mod/tools/sync/toolinfo_list.rb
106
+ - lib/icarus/mod/tools/sync/tools.rb
107
+ - lib/icarus/mod/tools/toolinfo.rb
108
108
  - lib/icarus/mod/tools/validator.rb
109
109
  - lib/icarus/mod/version.rb
110
110
  - sig/database/sync/sync.rbs