effigy_wire 0.0.2 → 0.0.3

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +13 -6
  5. data/bin/bundler +17 -0
  6. data/bin/import +47 -0
  7. data/bin/protoc-gen-ruby +17 -0
  8. data/bin/rake +17 -0
  9. data/bin/repath +6 -0
  10. data/bin/rpc_server +17 -0
  11. data/bin/support/00-nuke_everything +35 -0
  12. data/bin/support/10-clarity_protobuf_copy +68 -0
  13. data/bin/support/20-clean_clarity_protobuf +46 -0
  14. data/bin/{effigy/package → support/30-package_proto} +10 -8
  15. data/bin/support/40-tweak_proto +24 -0
  16. data/bin/support/50-compile_proto +100 -0
  17. data/bin/support/60-tweak_rb +23 -0
  18. data/bin/{effigy/mk-require-turds → support/70-make_require_turds} +10 -6
  19. data/bin/support/80-delete_stragglers +7 -0
  20. data/bin/thor +17 -0
  21. data/effigy_wire.gemspec +1 -2
  22. data/lib/effigy/wire.rb +0 -6
  23. data/lib/effigy/wire/demo.pb.rb +22 -21
  24. data/lib/effigy/wire/dota_commonmessages.pb.rb +87 -86
  25. data/lib/effigy/wire/dota_modifiers.pb.rb +2 -1
  26. data/lib/effigy/wire/dota_usermessages.pb.rb +50 -49
  27. data/lib/effigy/wire/netmessages.pb.rb +2 -1
  28. data/lib/effigy/wire/networkbasetypes.pb.rb +15 -14
  29. data/lib/effigy/wire/s1/s1_dota_usermessages.pb.rb +81 -80
  30. data/lib/effigy/wire/s1/s1_netmessages.pb.rb +29 -28
  31. data/lib/effigy/wire/s1/s1_usermessages.pb.rb +33 -32
  32. data/lib/effigy/wire/s2/s2_base_gcmessages.pb.rb +2 -1
  33. data/lib/effigy/wire/s2/s2_dota_gcmessages_common.pb.rb +3 -2
  34. data/lib/effigy/wire/s2/s2_dota_match_metadata.pb.rb +3 -2
  35. data/lib/effigy/wire/s2/s2_dota_usermessages.pb.rb +96 -95
  36. data/lib/effigy/wire/s2/s2_gameevents.pb.rb +15 -14
  37. data/lib/effigy/wire/s2/s2_netmessages.pb.rb +26 -25
  38. data/lib/effigy/wire/s2/s2_te.pb.rb +29 -28
  39. data/lib/effigy/wire/s2/s2_usermessages.pb.rb +48 -47
  40. data/proto/dota_commonmessages.proto +91 -91
  41. data/proto/dota_usermessages.proto +48 -48
  42. data/proto/networkbasetypes.proto +14 -14
  43. data/proto/s1/s1_netmessages.proto +27 -27
  44. data/proto/s2/s2_dota_gcmessages_common.proto +1 -1
  45. data/proto/s2/s2_dota_match_metadata.proto +1 -1
  46. data/proto/s2/s2_netmessages.proto +24 -24
  47. metadata +19 -10
  48. data/BIN_README.txt +0 -18
  49. data/bin/clarity-protobuf/clean +0 -36
  50. data/bin/clarity-protobuf/copy +0 -75
  51. data/bin/effigy/compile-proto +0 -81
  52. data/bin/effigy/tweak-proto +0 -30
  53. data/bin/effigy/tweak-rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af2d81261224d5ec6dedf674b2358086bfa60a03
4
- data.tar.gz: 300aad4dc0f1246fe8c4d7d1334c7eb2b0b9620c
3
+ metadata.gz: 6c49aa9c25c929fcaf22e5f0cda7ddb2dfd367eb
4
+ data.tar.gz: 60120e3e639be3f87095934cac3ac15da4044f42
5
5
  SHA512:
6
- metadata.gz: fef6e3a8703b242b39f1cd5105beb37d3e2d804369263bd1fbfcc8d993eb5e5f35634996f89d31a716e9607d231feec8b059348ff086288a4b6ad48d8709a8c9
7
- data.tar.gz: 94c42144911f82724a18b431a113677f2bfd033466ef91d3d2ee5920995297477b2c27770c29740defe493a4f070f718780d1797c6527dfbf23a1ab2aaae6979
6
+ metadata.gz: a2944bf1204bf189b7fddf6c2ef7ef49d438b6fdecbe276c252d2ea29ccfa60d44281820743f1d3117990d8c11287cbb0b13ee6a8926e6089d2d9db93256b83d
7
+ data.tar.gz: d3e49cb2af2386255f7bcb5ea94d115e7b5d135e861b7deb96d1703d97c44438a71acba7cb2e2261043645500b3c17917510347209fc85cb4d25da221e326eb8
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  .DS_Store
2
+ .bundle
2
3
  .ruby-version
3
4
  *.swp
4
5
  *.gem
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'protobuf', github: 'ruby-protobuf/protobuf', branch: 'master'
@@ -1,7 +1,18 @@
1
+ GIT
2
+ remote: git://github.com/ruby-protobuf/protobuf.git
3
+ revision: 24a339f4beb328cb5d1e953a9883cb98b4d3af0b
4
+ branch: master
5
+ specs:
6
+ protobuf (3.6.9)
7
+ activesupport (>= 3.2)
8
+ middleware
9
+ thor
10
+ thread_safe
11
+
1
12
  PATH
2
13
  remote: .
3
14
  specs:
4
- effigy_wire (0.0.2)
15
+ effigy_wire (0.0.3)
5
16
  protobuf (~> 3.6.9, >= 3.6.9)
6
17
 
7
18
  GEM
@@ -17,11 +28,6 @@ GEM
17
28
  json (1.8.3)
18
29
  middleware (0.1.0)
19
30
  minitest (5.9.0)
20
- protobuf (3.6.9)
21
- activesupport (>= 3.2)
22
- middleware
23
- thor
24
- thread_safe
25
31
  rake (10.4.2)
26
32
  thor (0.19.1)
27
33
  thread_safe (0.3.5)
@@ -34,6 +40,7 @@ PLATFORMS
34
40
  DEPENDENCIES
35
41
  bundler (~> 1.7)
36
42
  effigy_wire!
43
+ protobuf!
37
44
  rake (~> 10.0)
38
45
 
39
46
  BUNDLED WITH
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'bundler' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("bundler", "bundler")
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ EFF_WIRE_ROOT = File.join(__dir__, '..')
4
+
5
+ EFF_RUBY_VERSION =
6
+ begin
7
+ ENV.fetch('EFF_RUBY_VERSION')
8
+ rescue KeyError
9
+ File.read(File.join(EFF_WIRE_ROOT, '.ruby-version'))
10
+ end
11
+
12
+ script_paths = Dir.glob(File.join(__dir__, 'support', '*')).to_a.sort
13
+ script_paths.each do |script_path|
14
+ puts <<-EOV
15
+
16
+
17
+
18
+ ********************************************************************************
19
+ Running '#{File.basename(script_path)}'
20
+ ********************************************************************************
21
+ EOV
22
+
23
+ status =
24
+ system(
25
+ {
26
+ 'RBENV_VERSION' => EFF_RUBY_VERSION,
27
+ 'EFF_SKIP_CONFIRM' => 'true',
28
+ 'EFF_CLARITY_PROTO_ROOT' => ENV['EFF_CLARITY_PROTO_ROOT'],
29
+ 'EFF_CLARITY_PROTO_BIN_ROOT' => ENV['EFF_CLARITY_PROTO_BIN_ROOT'],
30
+ 'EFF_CLARITY_PROTO_COMMON_ROOT' => ENV['EFF_CLARITY_PROTO_COMMON_ROOT'],
31
+ 'EFF_PROTO_ROOT' => ENV['EFF_PROTO_ROOT'],
32
+ 'EFF_LIB_ROOT' => ENV['EFF_LIB_ROOT'],
33
+ 'EFF_RUBY_OUT_ROOT' => ENV['EFF_RUBY_OUT_ROOT'],
34
+ },
35
+ "ruby #{script_path}"
36
+ )
37
+
38
+ raise "Something went wrong with #{script_path}" unless !!status
39
+ end
40
+
41
+ puts <<-EOV
42
+
43
+
44
+ All done! Don't forget to manually fix require_relatives and bump VERSION!
45
+
46
+ EOV
47
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'protoc-gen-ruby' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("protobuf", "protoc-gen-ruby")
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rake", "rake")
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+ #
3
+ # run this to add binstubs to local executables in project root
4
+ echo "$PWD/bin"
5
+ export PATH="$PWD/bin:$PATH"
6
+ hash -r 2>/dev/null || true
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rpc_server' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("protobuf", "rpc_server")
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ EFF_WIRE_ROOT = File.join(__dir__, '..', '..')
6
+
7
+ EFF_PROTO_ROOT =
8
+ begin
9
+ ENV.fetch('EFF_PROTO_ROOT')
10
+ rescue KeyError
11
+ File.join(EFF_WIRE_ROOT, 'proto')
12
+ end
13
+
14
+ EFF_LIB_ROOT =
15
+ begin
16
+ ENV.fetch('EFF_LIB_ROOT')
17
+ rescue KeyError
18
+ File.join(EFF_WIRE_ROOT, 'lib')
19
+ end
20
+
21
+
22
+ puts "> Deleting and recreating '#{EFF_LIB_ROOT}'"
23
+ begin
24
+ FileUtils.rm_rf(EFF_LIB_ROOT)
25
+ rescue Errno::ENOENT
26
+ end
27
+ FileUtils.mkdir(EFF_LIB_ROOT)
28
+
29
+
30
+ puts "> Deleting and recreating '#{EFF_PROTO_ROOT}'"
31
+ begin
32
+ FileUtils.rm_rf(EFF_PROTO_ROOT)
33
+ rescue Errno::ENOENT
34
+ end
35
+ FileUtils.mkdir(EFF_PROTO_ROOT)
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'logger'
5
+
6
+ err_log = Logger.new(STDERR)
7
+
8
+ EFF_WIRE_ROOT = File.join(__dir__, '..', '..')
9
+
10
+ EFF_CLARITY_PROTO_ROOT =
11
+ begin
12
+ ENV.fetch('EFF_CLARITY_PROTO_ROOT')
13
+ rescue KeyError
14
+ File.join(
15
+ EFF_WIRE_ROOT,
16
+ '..',
17
+ 'clarity-protobuf',
18
+ 'src', 'main', 'proto'
19
+ )
20
+ end
21
+
22
+ EFF_CLARITY_PROTO_BIN_ROOT =
23
+ begin
24
+ ENV.fetch('EFF_CLARITY_PROTO_BIN_ROOT')
25
+ rescue KeyError
26
+ File.join(EFF_CLARITY_PROTO_ROOT, 'bin')
27
+ end
28
+
29
+ EFF_CLARITY_PROTO_COMMON_ROOT =
30
+ begin
31
+ ENV.fetch('EFF_CLARITY_PROTO_COMMON_ROOT')
32
+ rescue KeyError
33
+ File.join(EFF_CLARITY_PROTO_ROOT, 'common')
34
+ end
35
+
36
+ EFF_PROTO_ROOT =
37
+ begin
38
+ ENV.fetch('EFF_PROTO_ROOT')
39
+ rescue KeyError
40
+ File.join(EFF_WIRE_ROOT, 'proto')
41
+ end
42
+
43
+ src_package_paths =
44
+ Dir.glob("#{EFF_CLARITY_PROTO_ROOT}/*").select do |package_path|
45
+ next(false) if package_path.include?(EFF_CLARITY_PROTO_BIN_ROOT)
46
+ next(false) if package_path.include?(EFF_CLARITY_PROTO_COMMON_ROOT)
47
+ true
48
+ end
49
+
50
+ if src_package_paths.empty?
51
+ raise <<-EOV
52
+
53
+
54
+ Provided clarity-protobuf proto root is apparently empty. Exiting.
55
+
56
+ EOV
57
+ end
58
+
59
+ src_package_paths.each do |src_package_path|
60
+ puts "> Copying '#{src_package_path}'"
61
+ FileUtils.cp_r(src_package_path, EFF_PROTO_ROOT)
62
+ end
63
+
64
+ puts "> Copying '#{EFF_CLARITY_PROTO_COMMON_ROOT}'"
65
+ FileUtils.cp(
66
+ Dir.glob(File.join(EFF_CLARITY_PROTO_COMMON_ROOT, '*.proto')),
67
+ EFF_PROTO_ROOT
68
+ )
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ EFF_WIRE_ROOT = File.join(__dir__, '..', '..')
6
+
7
+ EFF_PROTO_ROOT =
8
+ begin
9
+ ENV.fetch('EFF_PROTO_ROOT')
10
+ rescue KeyError
11
+ File.join(EFF_WIRE_ROOT, 'proto')
12
+ end
13
+
14
+ EFF_SKIP_CONFIRM =
15
+ begin
16
+ !!ENV.fetch('EFF_SKIP_CONFIRM')
17
+ rescue KeyError
18
+ false
19
+ end
20
+
21
+ unless EFF_SKIP_CONFIRM
22
+ print "Remove non-proto files in '#{EFF_PROTO_ROOT}'? [yN] > "
23
+ answer = gets.strip
24
+
25
+ unless answer == 'y'
26
+ puts 'OK, aborting.'
27
+ exit(0)
28
+ end
29
+ end
30
+
31
+ begin
32
+ bindir_path = File.join(EFF_PROTO_ROOT, 'bin')
33
+ puts "> Removing #{bindir_path}"
34
+ FileUtils.rm_rf(bindir_path)
35
+ rescue Errno::ENOENT
36
+ end
37
+
38
+ proto_paths = Dir.glob("#{EFF_PROTO_ROOT}/**/*")
39
+
40
+ proto_paths.each do |proto_path|
41
+ next if File.directory?(proto_path)
42
+ next if File.extname(proto_path) == '.proto' # keep these
43
+
44
+ puts "> Removing #{proto_path}"
45
+ File.delete(proto_path)
46
+ end
@@ -4,14 +4,16 @@ require 'logger'
4
4
 
5
5
  err_log = Logger.new(STDERR)
6
6
 
7
- PROTO_ROOT =
7
+ EFF_WIRE_ROOT = File.join(__dir__, '..', '..')
8
+
9
+ EFF_PROTO_ROOT =
8
10
  begin
9
- ENV.fetch('PROTO_ROOT')
11
+ ENV.fetch('EFF_PROTO_ROOT')
10
12
  rescue KeyError
11
- File.join(Dir.pwd, 'proto')
13
+ File.join(EFF_WIRE_ROOT, 'proto')
12
14
  end
13
15
 
14
- proto_paths = Dir.glob("#{PROTO_ROOT}/**/*").select do |proto_path|
16
+ proto_paths = Dir.glob("#{EFF_PROTO_ROOT}/**/*").select do |proto_path|
15
17
  next(false) if File.directory?(proto_path)
16
18
  true
17
19
  end
@@ -20,11 +22,11 @@ if proto_paths.empty?
20
22
  raise <<-EOV
21
23
 
22
24
 
23
- No definitions found in #{PROTO_ROOT}!
25
+ No definitions found in #{EFF_PROTO_ROOT}!
24
26
 
25
27
  Either:
26
28
  1. Run ./bin/bootstrap in the project root directory, or
27
- 2. Set PROTO_ROOT to the location of your proto definitions
29
+ 2. Set EFF_PROTO_ROOT to the location of your proto definitions
28
30
 
29
31
  EOV
30
32
  end
@@ -37,9 +39,9 @@ proto_paths.each do |proto_path|
37
39
  end
38
40
 
39
41
  exclusion_index =
40
- proto_path.split('/').length - 1 == PROTO_ROOT.split('/').length ? -3
42
+ proto_path.split('/').length - 1 == EFF_PROTO_ROOT.split('/').length ? -3
41
43
  : -2
42
- rel_path = proto_path[PROTO_ROOT.length+1..-1]
44
+ rel_path = proto_path[EFF_PROTO_ROOT.length+1..-1]
43
45
  package_components =
44
46
  [
45
47
  'effigy',
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ EFF_WIRE_ROOT = File.join(__dir__, '..', '..')
4
+
5
+ EFF_PROTO_ROOT =
6
+ begin
7
+ ENV.fetch('EFF_PROTO_ROOT')
8
+ rescue KeyError
9
+ File.join(EFF_WIRE_ROOT, 'proto')
10
+ end
11
+
12
+ Dir.glob(File.join(EFF_PROTO_ROOT, '**/*')).each do |proto_path|
13
+ next if File.directory?(proto_path)
14
+
15
+ puts "> Tweaking #{File.basename(proto_path)}"
16
+ cmd = <<-EOV
17
+ sed -i \
18
+ -e '/optional/ s/optional \\./optional /' \
19
+ -e '/repeated/ s/repeated \\./repeated /' \
20
+ #{proto_path}
21
+ EOV
22
+ status = system(cmd)
23
+ exit(-1) unless !!status
24
+ end
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ require 'logger'
4
+
5
+ err_log = Logger.new(STDERR)
6
+
7
+ EFF_WIRE_ROOT = File.join(__dir__, '..', '..')
8
+
9
+ EFF_PROTO_ROOT =
10
+ begin
11
+ ENV.fetch('EFF_PROTO_ROOT')
12
+ rescue KeyError
13
+ File.join(EFF_WIRE_ROOT, 'proto')
14
+ end
15
+
16
+ EFF_LIB_ROOT =
17
+ begin
18
+ ENV.fetch('EFF_LIB_ROOT')
19
+ rescue KeyError
20
+ File.join(EFF_WIRE_ROOT, 'lib')
21
+ end
22
+
23
+ EFF_RUBY_OUT_ROOT =
24
+ begin
25
+ ENV.fetch('EFF_RUBY_OUT_ROOT')
26
+ rescue KeyError
27
+ File.join(EFF_LIB_ROOT, 'effigy', 'wire')
28
+ end
29
+
30
+ EFF_SKIP_CONFIRM =
31
+ begin
32
+ !!ENV.fetch('EFF_SKIP_CONFIRM')
33
+ rescue KeyError
34
+ false
35
+ end
36
+
37
+ unless EFF_SKIP_CONFIRM
38
+ print "Have you cleaned, packaged, and tweak-proto'ed? [yN] > "
39
+ answer = gets.strip
40
+
41
+ unless answer == 'y'
42
+ print 'OK, go take care of that.'
43
+ exit(0)
44
+ end
45
+ end
46
+
47
+ puts "> Ensuring output directory exists"
48
+ FileUtils.mkdir_p(EFF_RUBY_OUT_ROOT)
49
+
50
+ package_paths = []
51
+ proto_paths = []
52
+
53
+ Dir.glob("#{EFF_PROTO_ROOT}/*").select do |path|
54
+ if File.directory?(path)
55
+ package_paths << path
56
+ else
57
+ proto_paths << path
58
+ end
59
+ end
60
+
61
+ proto_paths.each do |proto_path|
62
+ puts "> Compiling '#{File.basename(proto_path)}'"
63
+ cmd = <<-EOV
64
+ protoc \
65
+ --proto_path=#{File.join(EFF_PROTO_ROOT)} \
66
+ --ruby_out=#{EFF_RUBY_OUT_ROOT} \
67
+ #{proto_path}
68
+ EOV
69
+ status = system(
70
+ {
71
+ 'PB_UPCASE_ENUMS' => 'true',
72
+ 'PB_NO_TAG_WARNINGS' => 'true'
73
+ },
74
+ cmd
75
+ )
76
+ exit(-1) unless !!status
77
+ end
78
+
79
+ package_paths.each do |package_path|
80
+ puts "> Package '#{File.basename(package_path)}'"
81
+
82
+ Dir.glob(File.join(package_path, '*.proto')).each do |proto_path|
83
+ puts " > #{File.basename(proto_path)}"
84
+ cmd = <<-EOV
85
+ protoc \
86
+ --proto_path=#{File.join(EFF_PROTO_ROOT)} \
87
+ --proto_path=#{package_path} \
88
+ --ruby_out=#{EFF_RUBY_OUT_ROOT} \
89
+ #{proto_path}
90
+ EOV
91
+ status = system(
92
+ {
93
+ 'PB_UPCASE_ENUMS' => 'true',
94
+ 'PB_NO_TAG_WARNINGS' => 'true'
95
+ },
96
+ cmd
97
+ )
98
+ exit(-1) unless !!status
99
+ end
100
+ end