amygdala 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +81 -0
- data/LICENSE.txt +21 -0
- data/README.md +27 -0
- data/Rakefile +8 -0
- data/lefthook.yml +5 -0
- data/lib/amygdala/server.rb +28 -0
- data/lib/amygdala/version.rb +3 -0
- data/lib/amygdala.rb +37 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a960323911e63a35b9ab6d339cf368c00cd8971e7c95cd6dbb1c10f9b5396fa1
|
4
|
+
data.tar.gz: 36c269f8cb24733005c7cb2dc38e4af7bd5de81490a52d7490d1755bc852585a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 613f0fc4da4ccb66b71ea8c4b7e5bdc1b0043ad66d32861d980d2b6db3480c2586c54a48b51d5392b60eff7754921acd192d9faf7ebe79575d08552e41e6a31c
|
7
|
+
data.tar.gz: 07c064113aec0e9636a89b0ec8b7223136f591f3a3d2e247066f94092a423c29f3aef01dc8e15c5049052ca29556ea562afd5b3682d04c17a87c702ea57b6392
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
amygdala (0.1.0)
|
5
|
+
sinatra (~> 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
json (2.6.2)
|
13
|
+
lefthook (1.1.4)
|
14
|
+
mustermann (3.0.0)
|
15
|
+
ruby2_keywords (~> 0.0.1)
|
16
|
+
parallel (1.22.1)
|
17
|
+
parser (3.1.2.1)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
rack (2.2.4)
|
20
|
+
rack-protection (3.0.2)
|
21
|
+
rack
|
22
|
+
rack-test (2.0.2)
|
23
|
+
rack (>= 1.3)
|
24
|
+
rainbow (3.1.1)
|
25
|
+
rake (13.0.6)
|
26
|
+
regexp_parser (2.6.0)
|
27
|
+
rexml (3.2.5)
|
28
|
+
rspec (3.12.0)
|
29
|
+
rspec-core (~> 3.12.0)
|
30
|
+
rspec-expectations (~> 3.12.0)
|
31
|
+
rspec-mocks (~> 3.12.0)
|
32
|
+
rspec-core (3.12.0)
|
33
|
+
rspec-support (~> 3.12.0)
|
34
|
+
rspec-expectations (3.12.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.12.0)
|
37
|
+
rspec-mocks (3.12.0)
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
+
rspec-support (~> 3.12.0)
|
40
|
+
rspec-support (3.12.0)
|
41
|
+
rubocop (1.35.1)
|
42
|
+
json (~> 2.3)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 3.1.2.1)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8, < 3.0)
|
47
|
+
rexml (>= 3.2.5, < 4.0)
|
48
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
51
|
+
rubocop-ast (1.23.0)
|
52
|
+
parser (>= 3.1.1.0)
|
53
|
+
rubocop-performance (1.14.3)
|
54
|
+
rubocop (>= 1.7.0, < 2.0)
|
55
|
+
rubocop-ast (>= 0.4.0)
|
56
|
+
ruby-progressbar (1.11.0)
|
57
|
+
ruby2_keywords (0.0.5)
|
58
|
+
sinatra (3.0.2)
|
59
|
+
mustermann (~> 3.0)
|
60
|
+
rack (~> 2.2, >= 2.2.4)
|
61
|
+
rack-protection (= 3.0.2)
|
62
|
+
tilt (~> 2.0)
|
63
|
+
standard (1.16.1)
|
64
|
+
rubocop (= 1.35.1)
|
65
|
+
rubocop-performance (= 1.14.3)
|
66
|
+
tilt (2.0.11)
|
67
|
+
unicode-display_width (2.3.0)
|
68
|
+
|
69
|
+
PLATFORMS
|
70
|
+
x86_64-darwin-21
|
71
|
+
|
72
|
+
DEPENDENCIES
|
73
|
+
amygdala!
|
74
|
+
lefthook (~> 1.1)
|
75
|
+
rack-test (~> 2.0)
|
76
|
+
rake (~> 13.0)
|
77
|
+
rspec (~> 3.0)
|
78
|
+
standard (~> 1.3)
|
79
|
+
|
80
|
+
BUNDLED WITH
|
81
|
+
2.3.7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Jeremiah A. Bohling
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Amygdala
|
2
|
+
|
3
|
+
A "Lizard Brain" for your Battlesnake
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'amygdala'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install amygdala
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/allknowingfrog/amygdala.
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lefthook.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "sinatra/base"
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
module Amygdala
|
5
|
+
class Server < Sinatra::Base
|
6
|
+
set :default_content_type, :json
|
7
|
+
|
8
|
+
get "/" do
|
9
|
+
Amygdala.configs.to_json
|
10
|
+
end
|
11
|
+
|
12
|
+
post "/start" do
|
13
|
+
{}.to_json
|
14
|
+
end
|
15
|
+
|
16
|
+
post "/move" do
|
17
|
+
data = JSON.parse(request.body.read)
|
18
|
+
|
19
|
+
{
|
20
|
+
move: Amygdala.move(data)
|
21
|
+
}.to_json
|
22
|
+
end
|
23
|
+
|
24
|
+
post "/end" do
|
25
|
+
{}.to_json
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/amygdala.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative "amygdala/version"
|
2
|
+
require_relative "amygdala/server"
|
3
|
+
|
4
|
+
module Amygdala
|
5
|
+
class Error < StandardError; end
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def configs
|
9
|
+
{
|
10
|
+
"apiversion" => "1",
|
11
|
+
"author" => "amygdala",
|
12
|
+
"color" => "0x000000",
|
13
|
+
"head" => "default",
|
14
|
+
"tail" => "default",
|
15
|
+
"version" => "0.1"
|
16
|
+
}.merge(@configs || {})
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_configs(configs)
|
20
|
+
@configs = configs
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_move_handler(handler)
|
24
|
+
@move_handler = handler
|
25
|
+
end
|
26
|
+
|
27
|
+
def move(data)
|
28
|
+
move_handler.call(data)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def move_handler
|
34
|
+
@move_handler || proc { "up" }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: amygdala
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeremiah A. Bohling
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sinatra
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
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: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: lefthook
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
description: A simple framework for developing a Battlesnake API
|
98
|
+
email:
|
99
|
+
- jeremiah.bohling@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".rspec"
|
105
|
+
- ".standard.yml"
|
106
|
+
- CHANGELOG.md
|
107
|
+
- Gemfile
|
108
|
+
- Gemfile.lock
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- lefthook.yml
|
113
|
+
- lib/amygdala.rb
|
114
|
+
- lib/amygdala/server.rb
|
115
|
+
- lib/amygdala/version.rb
|
116
|
+
homepage: https://github.com/allknowingfrog/amygdala
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
metadata:
|
120
|
+
allowed_push_host: https://rubygems.org
|
121
|
+
homepage_uri: https://github.com/allknowingfrog/amygdala
|
122
|
+
source_code_uri: https://github.com/allknowingfrog/amygdala
|
123
|
+
changelog_uri: https://github.com/allknowingfrog/amygdala/CHANGELOG.md
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 2.6.0
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubygems_version: 3.3.7
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: A "Lizard Brain" for your Battlesnake
|
143
|
+
test_files: []
|