game_kit 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 210ccde0acd73db4ef9ba747b65949c705a2fd06fff3b1df7ffc811e2d6c3677
4
+ data.tar.gz: d7aa02b4455ef0c992e72094ac214f96fd2eff2dbdd9f5bc4eda9d574ecb8040
5
+ SHA512:
6
+ metadata.gz: 7acce30c78e3615194cabaf3a8327ba36e79e499d8692dc7db84472961e484417c0602a2e527134b10dd7c28c21bb645cbdb314edd3f58f19a78284900299bdb
7
+ data.tar.gz: e8f9cf351f7bf6d5cbab7bfe216d2ee5c716da6e700099c9ac180f0b222ef2ea386172431938fafc657b3425d413e395f3ad4c46c6ef2486c9fd60936db6bb9f
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ # These are some examples of commonly ignored file patterns.
2
+ # You should customize this list as applicable to your project.
3
+ # Learn more about .gitignore:
4
+ # https://www.atlassian.com/git/tutorials/saving-changes/gitignore
5
+
6
+ # Node artifact files
7
+ node_modules/
8
+ dist/
9
+
10
+ # Compiled Java class files
11
+ *.class
12
+
13
+ # Compiled Python bytecode
14
+ *.py[cod]
15
+
16
+ # Log files
17
+ *.log
18
+
19
+ # Package files
20
+ *.jar
21
+
22
+ # Maven
23
+ target/
24
+ dist/
25
+
26
+ # JetBrains IDE
27
+ .idea/
28
+
29
+ # Unit test reports
30
+ TEST*.xml
31
+
32
+ # Generated by MacOS
33
+ .DS_Store
34
+
35
+ # Generated by Windows
36
+ Thumbs.db
37
+
38
+ # Applications
39
+ *.app
40
+ *.exe
41
+ *.war
42
+
43
+ # Large media files
44
+ *.mp4
45
+ *.tiff
46
+ *.avi
47
+ *.flv
48
+ *.mov
49
+ *.wmv
50
+
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'http://gems.sd.laxino.com'
2
+ group :test do
3
+ gem 'simplecov', '0.12.0'
4
+ gem 'rspec'
5
+ gem 'faker'
6
+ gem 'as-duration'
7
+ gem 'factory_girl'
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,53 @@
1
+ GEM
2
+ remote: http://gems.sd.laxino.com/
3
+ specs:
4
+ activesupport (5.1.1)
5
+ concurrent-ruby (~> 1.0, >= 1.0.2)
6
+ i18n (~> 0.7)
7
+ minitest (~> 5.1)
8
+ tzinfo (~> 1.1)
9
+ as-duration (0.1.1)
10
+ concurrent-ruby (1.0.5)
11
+ diff-lcs (1.3)
12
+ docile (1.1.5)
13
+ factory_girl (4.8.0)
14
+ activesupport (>= 3.0.0)
15
+ faker (1.7.3)
16
+ i18n (~> 0.5)
17
+ i18n (0.8.4)
18
+ json (2.1.0)
19
+ minitest (5.10.2)
20
+ rspec (3.6.0)
21
+ rspec-core (~> 3.6.0)
22
+ rspec-expectations (~> 3.6.0)
23
+ rspec-mocks (~> 3.6.0)
24
+ rspec-core (3.6.0)
25
+ rspec-support (~> 3.6.0)
26
+ rspec-expectations (3.6.0)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.6.0)
29
+ rspec-mocks (3.6.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.6.0)
32
+ rspec-support (3.6.0)
33
+ simplecov (0.12.0)
34
+ docile (~> 1.1.0)
35
+ json (>= 1.8, < 3)
36
+ simplecov-html (~> 0.10.0)
37
+ simplecov-html (0.10.1)
38
+ thread_safe (0.3.6)
39
+ tzinfo (1.2.3)
40
+ thread_safe (~> 0.1)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ as-duration
47
+ factory_girl
48
+ faker
49
+ rspec
50
+ simplecov (= 0.12.0)
51
+
52
+ BUNDLED WITH
53
+ 1.15.1
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Game Kit(game_kit)
2
+
3
+ ## Introduction
4
+
5
+ Game Kit is a toolbox to provide some features relative to game endpoint, game management and control in gaming platform.
6
+
7
+ ## Features
8
+
9
+ ### Infrastructure
10
+
11
+ Infrastructure features in game_kit is to provide game endpoint management currently.
12
+
13
+ #### Endpoint
14
+
15
+ Game endpoint is composed by gateway host(default: http://localhost, game ID and IDC environment(default: int). Currently, you can specify gateway host and IDC environment in environment valuables GW_HOST and IDC_ENV. Here is the example of default return game endpoint, such as game id is 10000
16
+
17
+
18
+ http://localhost/int_game10000_app
19
+
20
+
21
+ If you specify GW_HOST is 'http://my_gateway', so you can get the game endpoint as:
22
+
23
+
24
+ http://my_gateway/int_game10000_app
25
+
26
+
27
+ Similarly, setting IDC_ENV to 'stg', the game endpoint can be:
28
+
29
+
30
+ http://localhost/stg_game10000_app
31
+
32
+
33
+ ## Usage
34
+
35
+ gem install game_kit
36
+
37
+ ```ruby
38
+ require 'game_kit/infra'
39
+
40
+ GameKit::Infra.endpoint_for(10000) # http://localhost/int_game10000_app
41
+
42
+ # Specify gateway host in API call
43
+
44
+ GameKit::Infra.endpoint_for(10000,'http://my_gateway') # http://my_gateway/int_game10000_app
45
+
46
+ # Specify gateway host and idc environment in API call
47
+
48
+ GameKit::Infra.endpoint_for(10000,'http://my_gateway', 'stg') # http://my_gateway/stg_game10000_app
49
+ ```
50
+
51
+ ## Contributors
52
+
53
+ Ben Wu <ben.wu@laxino.com>
data/game_kit.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'game_kit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "game_kit"
8
+ spec.version = GameKit::VERSION
9
+ spec.authors = ["Ben Wu"]
10
+ spec.email = ["ben.wu@laxino.com"]
11
+
12
+ spec.summary = %q{Write a short summary, because Rubygems requires one.}
13
+ spec.description = %q{Write a longer description or delete this line.}
14
+ spec.homepage = "http://github.com/cheokman"
15
+ spec.licenses = ['MIT', 'Ruby']
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+
30
+ spec.add_dependency "bundler", "~> 1.12"
31
+ end
@@ -0,0 +1,24 @@
1
+ module GameKit::Infra
2
+ module Endpoint
3
+ def self.included(descendant)
4
+ descendant.extend ClassMethods
5
+ descendant.include InstanceMethods
6
+ end
7
+
8
+ module ClassMethods
9
+ def endpoint_for(game_id, host=nil, idc_env=nil)
10
+ host = ENV['GW_HOST'] || host || 'http://localhost'
11
+ "#{host}/game#{game_id}_app"
12
+ end
13
+
14
+ def backend_url_for(service_name, subset: 'app', scheme: 'http')
15
+ host = "#{scheme}://#{service_name}-#{subset}"
16
+ host
17
+ end
18
+ end
19
+
20
+ module InstanceMethods
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ require 'game_kit'
2
+ require 'game_kit/infra/endpoint.rb'
3
+ module GameKit
4
+ module Infra
5
+ include Endpoint
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module GameKit
2
+ VERSION = '0.1.0'
3
+ end
data/lib/game_kit.rb ADDED
@@ -0,0 +1,2 @@
1
+ module GameKit
2
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: game_kit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Wu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ description: Write a longer description or delete this line.
42
+ email:
43
+ - ben.wu@laxino.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - README.md
52
+ - game_kit.gemspec
53
+ - lib/game_kit.rb
54
+ - lib/game_kit/infra.rb
55
+ - lib/game_kit/infra/endpoint.rb
56
+ - lib/game_kit/version.rb
57
+ homepage: http://github.com/cheokman
58
+ licenses:
59
+ - MIT
60
+ - Ruby
61
+ metadata:
62
+ allowed_push_host: https://rubygems.org
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubygems_version: 3.0.3.1
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Write a short summary, because Rubygems requires one.
82
+ test_files: []