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
class Game | |
include DataMapper::Resource | |
# | |
# Properties | |
# | |
property :id, Serial | |
# | |
# Associations |
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
class Game | |
include DataMapper::Resource | |
# | |
# Properties | |
# | |
property :id, Serial | |
# | |
# Associations |
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
#!/usr/bin/env ruby -Ku | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-sweatshop' | |
require 'bacon' | |
require 'dm-types' | |
require 'set' | |
#DataMapper::Logger.new($stdout, :debug) | |
DataMapper.setup(:default, 'sqlite3::memory:') |
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
#!/usr/bin/env ruby -Ku | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-sweatshop' | |
require 'bacon' | |
require 'dm-types' | |
require 'set' | |
#DataMapper::Logger.new($stdout, :debug) | |
DataMapper.setup(:default, 'sqlite3::memory:') |
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
require 'rango/mixins/rendering' | |
class Application < Merb::Controller | |
include Rango::ExplicitRendering | |
def scope | |
super.extend(ResourceHelper) | |
end | |
def context | |
@context ||= super.merge(params: self.request.params) |
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
require 'rango/mixins/rendering' | |
class Application < Merb::Controller | |
include Rango::ExplicitRendering | |
def scope | |
super.tap do |scope| | |
scope.extend ResourceHelper | |
scope.instance_variable_set("@params", self.request.params) | |
scope.extend Merb::Helpers | |
scope.extend Merb::AssetsMixin |
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
setup :method, "#member" do | |
@method = :member | |
end | |
setup :method, "#collection" do | |
@method = :collection | |
end | |
setup :stem, "stem" do | |
@stem = Stem.allocate |
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
module Presenters | |
class Game | |
include Presenter | |
def initialize(game) | |
@game = game | |
self | |
end | |
def prepare | |
generate_messages |
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
Jede URL, die der Bot aufruft, fängt immer mit "/api/<key>/<user key>/<user name>" an. Nachher kann dieselbe URL wie immer im Webinterface benutzt werden. Die grundlegenden wären: | |
* PUT /leave (leavt das aktuelle game) | |
* PUT /games/<id>/join (joint das gewählte game) | |
* POST /league/new_game [type, default Random] | |
CaptainGame: nur challenger wenn anonymous challenge | |
noch challenged wenn direkte challenge | |
* PUT /accept_challenge (um eine challenge zu akzeptieren) | |
* PUT /deny_challenge (sehe oben) | |
* PUT /vote (wobei vote abort, sentinel_wins, scourge_wins sein kann) |
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
$LOAD_PATH.unshift(File.expand_path("#{__FILE__}/../../lib")) # Add PROJECT/lib to $LOAD_PATH | |
require 'stylist' |
OlderNewer