Konker? I just met 'er!
Features: http://sprint.ly/product/41137/dashboard/?statuses=backlog,current,complete&order=priority
Game Database: https://docs.google.com/spreadsheets/d/1LY9Iklc3N7RkdJKkiuVNsMJ07TFsBi973VmIqgnLO6c/
-
[/] make sure client behaves OK with maintenance mode on (503 (Service Unavailable))
- some client calls still need to be hardened
-
optimization - look at Scout for slow requests
-
reexamine FitBit API to see if there's a more efficient call to fetch a bunch of days at once
-
round up remainder steps
-
return # of coins received in claim response (coins and gems alike)
-
validate max. one capture per game
-
player stats across all seasons in GET player endpoint
-
set session token inside WebGL HTML; skip login in client
-
expire session token after X days
-
redo dump tests
-
look into memory usage errors
-
heroku addons
- New Relic
- Scout
- Papertrail
- Honeybadger or Airbrake
- CircleCI
-
rename attack_mvp to top_attacker and defense_mvp to top_defender
-
seed_players should use avatar.csv to determine gear asset
-
remove/unify json path files -> paths.csv
-
remove
current
db field -
create prod env
- heroku
- fitbit
- game client selector UI
-
fixture factories
-
merge Piece into Player in API and DB
-
make a Procfile https://devcenter.heroku.com/articles/ruby-default-web-server
-
Alex learns Unity (gratis)
-
switch from RAML to Swagger? http://swagger.io/
To update the gear database,
- go to https://docs.google.com/spreadsheets/d/1LY9Iklc3N7RkdJKkiuVNsMJ07TFsBi973VmIqgnLO6c/
- select the "Gear" worksheet
- select "File > Download As > CSV (current sheet)"
- save as
db/gear.csv
- verify everything locally (
rake spec
,open http://localhost:3000
, etc.) git add db; git push; ./deploy.sh
Name
must be unique and remain consistent. NEVER remove or change the short name ("Name") of an item that already exists inside a player's inventory or was used in a game that has ever been played.
(We may want to add a "disabled" flag to the spreadsheet for that scenario in order to retire gear.)
For paths, similar to above but
- use the "Paths" sheet
- save as
db/paths.csv
git add db; git push; ./deploy.sh
to deploy
This should be obsolete soon, but I wrote a little script to convert Matt's path json into tab-delimited format for easy pasting into the gdoc. Put the various json files in db
e.g. db/bluePaths.json
and then...
- run
rails r "Path.print_rows('blue', 'defense')" | pbcopy
- switch to the gdoc, click on a cell and hit Cmd-V to paste
Reference doc: campconquer.raml
-
Install https://atom.io/
-
Install http://apiworkbench.com/ with
apm install api-workbench
- or open
Settings/Preferences -> Install
and search forapi-workbench
- or open
-
Activate autosave:
autosave: enabled: true
First, install raml2html
cd ..
git clone git@github.com:raml2html/raml2html.git
cd raml2html
chmod a+x ./bin/raml2html
npm install
Then go back to this project dir and run:
./doc.sh -o
and when the server is running later on you can access
http://localhost:3000/campconquer-api.html or http://campconquer-staging.herokuapp.com/campconquer-api.html
We are using ActiveAdmin for some non-API UI
http://activeadmin.info/docs/documentation.html
-
install Homebrew, XCode Command-Line Tools, RVM, Bundler, Rails, etc.; see http://installfest.railsbridge.org/ for more info
rvm get master rvm install ruby-2.3.3 gem install bundler
-
git clone git@github.com:mattbrand/campconquer.git
-
cd campconquer
-
bundle install
-
edit
.env
(see below) -
rake db:setup
Problems with Nokogiri? Check here: http://stackoverflow.com/questions/40038953/installing-nokogiri-on-mac-os-sierra-10-12
Optional setup:
Alex recommends JSON Viewer for nicely viewing JSON output in Chrome
and Postman for exploring APIs
git pull
bundle install
rake db:migrate
rake db:seed
(ifseeds.rb
or its data files have changed)rake spec
rails server
orheroku local
open http://localhost:3000
Open the campconquer-unity
directory as a project dir in Unity
- click "Build Settings" (cmd-shift-B)
- make sure platform is "WebGL" (select it and click "Switch Platform" if it's not)
- click "Player Settings" button and make sure memory is 2032
- click "Build" button
- click on "public" and Save As "CampConquer" -- if it doesn't say "Are you sure?" then you clicked wrong
-
Sign in and get a token (use your actual name and password)
http://localhost:3000/api/sessions?name=mod&password=xyzzy =>
{ "status": "ok", "token": "c1478346db1f93b79030d3d8a7753716ac4c634247af16bd48ab31fa371aee27", "player_id": 1024 }
-
Pass that token in to every subsequent call
{ "status": "ok", "players": [ { "id": 1024, "name": "mod", "team_name": "red", ...
-
Use POSTMAN, it's good
command | description |
---|---|
rake state_machine:draw CLASS=Game |
update the state diagram in Game_state.png |
rake db:seed_players |
create 50 random players with random roles / positions / paths / etc. (and erases all previous players and games) |
rake db:seed_game |
create 1 random game |
command | description |
---|---|
rails console |
enter the console |
Game.current.destroy! |
destroy the current game and all related pieces/setup |
g = Game.current |
get the current game, creating it if necessary |
g.lock_game! |
lock the game and copy pieces from the players |
g.finish_game! winner: 'red' |
force a completion (this may break soon) |
g.unlock_game! |
unlock the game and delete the copied pieces |
reload! |
load changed source code (ignores initializers) |
reload!; Game.current.destroy!; Game.current.lock_game! |
quick game restart |
p = Player.find(123) |
load a player by their id |
p = Player.find_by_name('fred') |
load a player by their name |
p.buy_gear! 'hat9' |
buy gear for a player |
p.equip_gear! 'hat9' |
equip gear for a player |
p.drop_gear! 'hat9' |
throw away (un-own and un-equip) gear for a player |
p.update!(password: '123456') |
sets player's password |
####More complicated Rails Console examples:
show all player names and their owned gear
Player.all.map{|p| [p.name, p.gear_owned]}
=> [["Thatcher", ["hat1", "hat2", "hat3", "shirt0", "shirt1", "shirt2", "shirt3", "shoes0", "hat0"]],
["Megan", ["hat1", "hat2", "hat3", "shirt0", "shirt1", "shirt2", "shirt3", "shoes0", "hat0"]], ...
buy (but don't re-buy) the default gear for all players
Player.all.each {|p| Gear.where(owned_by_default: true).each {|g| p.buy_gear! g.name unless p.gear_owned.include?(g.name)}}
set a random path on a player p
path = path: Path.where(team_name: 'red', role: 'offense').sample
player.piece.update!(path.points)
-
Create an app for yourself at https://dev.fitbit.com/apps named e.g. "Matt's Local CampConquer"
- Callback URL must be
http://localhost:3000/players/auth-callback
- Callback URL must be
-
Put values inside
.env
in the project dir, e.g.:FITBIT_CLIENT_ID=123XXX FITBIT_CLIENT_SECRET=abc123abc123abc123abc123abc123abc123 FITBIT_CALLBACK_URL=http://localhost:3000/players/auth-callback
Note that FITBIT_CALLBACK_URL must correspond with the Callback URL on https://dev.fitbit.com/apps/edit/xxxxx
- https://ngrok.com/ may be useful if you want to demo a locally-running app to someone on the wider Internet
git remote add prod https://git.heroku.com/campconquer-prod.git
git remote add staging https://git.heroku.com/campconquer-staging.git
command | description |
---|---|
./deploy.sh staging |
deploy local master branch to staging |
heroku console -r staging |
open Rails console on staging |
heroku config -r staging |
display config vars for staging |
--- | --- |
./deploy.sh production |
deploy local master branch to production |
heroku whatever -r prod |
do whatever on production |
- sign in to https://heroku.com
- visit https://dashboard.heroku.com/apps/campconquer-staging/resources
- or https://dashboard.heroku.com/apps/campconquer-prod/resources
- and click on "Papertrail"
We use Heroku Scheduler to run rake pull_activity
from lib/tasks/scheduler.rake
every night at 5:30 UTC (12:30 or 1:30 Eastern)
see https://devcenter.heroku.com/articles/scheduler
- Create a player: https://campconquer-staging.herokuapp.com/admin/players/new
- Click "Auth" and follow the Fitbit auth flow
Want to see what other Fitbit info is available? Check out https://dev.fitbit.com/docs/activity/ for docs
BestHTTP: https://docs.google.com/document/d/181l8SggPrVF1qRoPMEwobN_1Fn7NXOu-VtfjE6wvokg/edit#
Xamarin Studio Community Edition: https://www.xamarin.com/download