Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4465299
commit 2713e90
Showing
98 changed files
with
76,362 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
exclude_paths: | ||
- 'spec/**/*.rb' | ||
- 'sorbet/**/*' | ||
- 'exec/**/*' | ||
- 'data/**/*' | ||
- 'bin/**/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--format documentation | ||
--color | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
ruby_version: 3.3 | ||
ruby_version: 3.3 | ||
|
||
ignore: # default: [] | ||
- 'data/**/*' | ||
# Testing by hand | ||
- 'outside_*.rb' | ||
- 'test/**/*' | ||
# Auto generated files | ||
- 'lib/sc2ai/protocol/*.rb' | ||
- 'lib/sc2ai/api/ability_id.rb' | ||
- 'lib/sc2ai/api/buff_id.rb' | ||
- 'lib/sc2ai/api/effect_id.rb' | ||
- 'lib/sc2ai/api/tech_tree.rb' | ||
- 'lib/sc2ai/api/tech_tree_data.rb' | ||
- 'lib/sc2ai/api/unit_type_id.rb' | ||
- 'lib/sc2ai/api/upgrade_id.rb' | ||
|
||
plugins: # default: [] | ||
- standard-custom | ||
- standard-performance | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
require "standard/rake" | ||
|
||
task default: :standard | ||
task default: %w[spec standard:fix] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# This was used to download updated techtree data. In reality we generate our own now. | ||
|
||
# Thanks Burny <3 | ||
# https://github.com/BurnySc2/sc2-techtree/blob/develop/data/data.json | ||
|
||
require "net/http" | ||
File.write("data/data.json", Net::HTTP.get(URI.parse("https://raw.githubusercontent.com/dysonreturns/sc2-techtree/develop/data/data.json"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# This command is used to update lib/../protocol/*_pb.rb files, which shouldn't ever happen again. | ||
|
||
require "fileutils" | ||
|
||
output_path = "lib/" | ||
proto_base_path = "data/" | ||
proto_relative_path = "sc2ai/protocol/" | ||
|
||
# Create output dir | ||
FileUtils.mkdir_p output_path | ||
|
||
# Fix .proto file paths which result in: require "sc2clientprotocol/" | ||
# Do this by replacing the weird import path prefix "sc2clientprotocol/" | ||
proto_files = Dir.glob("#{proto_base_path}#{proto_relative_path}*.proto") | ||
|
||
proto_files.each do |proto_file| | ||
text = File.read(proto_file) | ||
text = text.gsub('import "s2clientprotocol/', "import \"#{proto_relative_path}") | ||
text = text.gsub("package SC2APIProtocol", "package Api") | ||
File.open(proto_file, "w") { |file| file.puts text } | ||
end | ||
|
||
puts "extracting ruby..." | ||
cmd = "protoc --proto_path=#{proto_base_path} --ruby_out=#{output_path} #{proto_files.map do |f| | ||
f.partition(proto_base_path).last | ||
end.join(" ")}" | ||
puts cmd | ||
Kernel.exec(cmd) | ||
|
||
# puts "extracting rbi..." | ||
# cmd = "protoc --proto_path=#{proto_base_path} --rbi_out=grpc:false:sorbet/rbi #{proto_files.map do |f| | ||
# f.partition(proto_base_path).last | ||
# end.join(" ")}" | ||
# puts cmd | ||
Kernel.exec(cmd) |
Oops, something went wrong.