srs_game 0.Alexis → 0.1.Alexis
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.
- data/lib/srs_game/version.rb +5 -1
- metadata +29 -28
- data/.gitignore +0 -8
- data/.rspec +0 -1
- data/.travis.yml +0 -3
- data/.yardopts +0 -2
- data/Gemfile +0 -6
- data/LICENSE +0 -12
- data/README.md +0 -57
- data/Rakefile.rb +0 -42
- data/examples/pokemon_clone.rb +0 -68
- data/spec/game_spec.rb +0 -33
- data/spec/helpers_spec.rb +0 -62
- data/spec/location_spec.rb +0 -70
- data/spec/spec_helper.rb +0 -10
- data/spec/srserver_spec.rb +0 -18
- data/srs_game.gemspec +0 -21
data/lib/srs_game/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: srs_game
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.Alexis
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.Alexis
|
5
|
+
prerelease: 4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jackson Willis
|
@@ -10,7 +10,29 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-03-31 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: term-ansicolor
|
16
|
+
requirement: &15055320 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.7
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *15055320
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &15053700 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.2.2
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *15053700
|
14
36
|
description: A framework and collection of text-based games
|
15
37
|
email:
|
16
38
|
- jcwillis.school@gmail.com
|
@@ -18,26 +40,11 @@ executables: []
|
|
18
40
|
extensions: []
|
19
41
|
extra_rdoc_files: []
|
20
42
|
files:
|
21
|
-
- .gitignore
|
22
|
-
- .rspec
|
23
|
-
- .travis.yml
|
24
|
-
- .yardopts
|
25
|
-
- Gemfile
|
26
|
-
- LICENSE
|
27
|
-
- README.md
|
28
|
-
- Rakefile.rb
|
29
|
-
- examples/pokemon_clone.rb
|
30
|
-
- lib/srs_game.rb
|
31
|
-
- lib/srs_game/basic.rb
|
32
|
-
- lib/srs_game/tamera.rb
|
33
43
|
- lib/srs_game/tia.rb
|
44
|
+
- lib/srs_game/tamera.rb
|
34
45
|
- lib/srs_game/version.rb
|
35
|
-
-
|
36
|
-
-
|
37
|
-
- spec/location_spec.rb
|
38
|
-
- spec/spec_helper.rb
|
39
|
-
- spec/srserver_spec.rb
|
40
|
-
- srs_game.gemspec
|
46
|
+
- lib/srs_game/basic.rb
|
47
|
+
- lib/srs_game.rb
|
41
48
|
homepage: http://github.com/jacksonwillis/srs_game
|
42
49
|
licenses: []
|
43
50
|
post_install_message:
|
@@ -62,10 +69,4 @@ rubygems_version: 1.8.10
|
|
62
69
|
signing_key:
|
63
70
|
specification_version: 3
|
64
71
|
summary: A framework and collection of text-based games
|
65
|
-
test_files:
|
66
|
-
- spec/game_spec.rb
|
67
|
-
- spec/helpers_spec.rb
|
68
|
-
- spec/location_spec.rb
|
69
|
-
- spec/spec_helper.rb
|
70
|
-
- spec/srserver_spec.rb
|
71
|
-
has_rdoc:
|
72
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/.travis.yml
DELETED
data/.yardopts
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Jackson Willis
|
2
|
-
|
3
|
-
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
|
4
|
-
|
5
|
-
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
6
|
-
|
7
|
-
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
|
8
|
-
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
9
|
-
|
10
|
-
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
11
|
-
|
12
|
-
3. This notice may not be removed or altered from any source distribution.
|
data/README.md
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
SRS GAME
|
2
|
-
========
|
3
|
-
|
4
|
-
[](https://secure.travis-ci.org/jacksonwillis/srs_game)
|
5
|
-
[](https://gemnasium.com/jacksonwillis/srs_game)
|
6
|
-
|
7
|
-

|
8
|
-
|
9
|
-
Welcome
|
10
|
-
-------
|
11
|
-
|
12
|
-
SRS GAME is a framework and a collection of text-based games written in the [Ruby](http://www.ruby-lang.org/) 1.9 programming language.
|
13
|
-
|
14
|
-
If you find a bug, feel free to [create an issue](https://github.com/jacksonwillis/srs_game/issues/new).
|
15
|
-
|
16
|
-
Installation
|
17
|
-
------------
|
18
|
-
|
19
|
-
*Main article: [Installation](https://github.com/jacksonwillis/srs_game/wiki/Installation)*
|
20
|
-
|
21
|
-
Playing the game
|
22
|
-
----------------
|
23
|
-
|
24
|
-
$ rake play:tamera # Play as the goddess Tamera
|
25
|
-
$ rake play:tia # Play as a follower of the Cult of Tia
|
26
|
-
|
27
|
-
Running a server
|
28
|
-
----------------
|
29
|
-
|
30
|
-
$ rake server:tamera HOST=127.0.0.1 PORT=5446 MAX_CONNECTIONS=4
|
31
|
-
|
32
|
-
Testing
|
33
|
-
-------
|
34
|
-
|
35
|
-
To test, just run `rake`
|
36
|
-
or check out the [automated tests](https://secure.travis-ci.org/jacksonwillis/srs_game).
|
37
|
-
|
38
|
-
API
|
39
|
-
---
|
40
|
-
|
41
|
-
irb > require "srs_game/tamera"
|
42
|
-
=> true
|
43
|
-
irb > game = Game.new(Tamera, color: false)
|
44
|
-
=> #<SRSGame::Game:0x000000022f1337>
|
45
|
-
irb > game.send "look"
|
46
|
-
=> "You find yourself in the Main Room.\nItems here are an AM/FM Radio.\nExits are east and west."
|
47
|
-
irb > game.send "north"
|
48
|
-
=> "NOPE. Can't go that way."
|
49
|
-
irb > game.send "west"
|
50
|
-
=> ""
|
51
|
-
irb > game.room
|
52
|
-
=> #<SRSGame::Location "the West Room" @items=[] exits=["east", "west"]>
|
53
|
-
|
54
|
-
License
|
55
|
-
-------
|
56
|
-
|
57
|
-
SRS GAME is released under the zlib license. See [LICENSE](https://github.com/jacksonwillis/srs_game/blob/master/LICENSE)
|
data/Rakefile.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
6
|
-
require "srs_game"
|
7
|
-
require "rake"
|
8
|
-
|
9
|
-
require "bundler/gem_tasks"
|
10
|
-
|
11
|
-
namespace :play do
|
12
|
-
desc "Play as a follower of the Cult of Tia"
|
13
|
-
task :tia do
|
14
|
-
require "srs_game/tia"
|
15
|
-
Game.new(Tia, color: true).play
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "Play as the goddess Tamera"
|
19
|
-
task :tamera do
|
20
|
-
require "srs_game/tamera"
|
21
|
-
Game.new(Tamera, color: true).play
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
namespace :server do
|
26
|
-
desc "Telnet server for Tia"
|
27
|
-
task :tia do
|
28
|
-
require "srs_game/tia"
|
29
|
-
SRServer.play(Tia, ENV["PORT"], ENV["HOST"], ENV["MAX_CONNECTIONS"])
|
30
|
-
end
|
31
|
-
|
32
|
-
desc "Telnet server for Tamera"
|
33
|
-
task :tamera do
|
34
|
-
require "srs_game/tamera"
|
35
|
-
SRServer.play(Tamera, ENV["PORT"], ENV["HOST"], ENV["MAX_CONNECTIONS"])
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
require "rspec/core/rake_task"
|
40
|
-
RSpec::Core::RakeTask.new
|
41
|
-
|
42
|
-
task :default => :spec
|
data/examples/pokemon_clone.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
6
|
-
require "srs_game"
|
7
|
-
include SRSGame
|
8
|
-
|
9
|
-
module PokemonClone
|
10
|
-
class Computer < Item
|
11
|
-
interactable_as :computer
|
12
|
-
name "red's computer"
|
13
|
-
end
|
14
|
-
|
15
|
-
class Bed < Item
|
16
|
-
interactable_as :bed
|
17
|
-
name "YOUR BED"
|
18
|
-
end
|
19
|
-
|
20
|
-
def greeting
|
21
|
-
" /\"*-.\n" << \
|
22
|
-
" / `-.\n" << \
|
23
|
-
" / `-.\n" << \
|
24
|
-
" / `-.\n" << \
|
25
|
-
" `\"*-._ `-.\n" << \
|
26
|
-
" \"*-. .-'\n" << \
|
27
|
-
" .-' .-'\n" << \
|
28
|
-
" <' <'\n" << \
|
29
|
-
" `-. `-. .\n" << \
|
30
|
-
" .' .-' $\n" << \
|
31
|
-
" _ .' .-' bug :$;\n" << \
|
32
|
-
" T$bp.L.-*\"\"*-._ d$b\n" << \
|
33
|
-
" `TP `-. `-. : T$\n" << \
|
34
|
-
" .' `. `. `. ; ;\n" << \
|
35
|
-
" / `. \\ _. \\: :\n" << \
|
36
|
-
" / `..-\" ; |\n" << \
|
37
|
-
" : / ;\n" << \
|
38
|
-
" ; \\ / _ :\n" << \
|
39
|
-
" /`--'\\ .' $o$ |\n" << \
|
40
|
-
"/ / `./-, `\"' _ :\n" << \
|
41
|
-
"'-' : ; _ ' $o$ ;\n" << \
|
42
|
-
" ;Y\" |\"-. `\"' /\n" << \
|
43
|
-
" | `. L.' .-. /`*.\n" << \
|
44
|
-
" : `-. ; :' \\\n" << \
|
45
|
-
" ; :`*-._L.-'`-. :\n" << \
|
46
|
-
" : ; `-.*\n" << \
|
47
|
-
" \\ /\n" << \
|
48
|
-
" \"\" ~* PokemonClone.rb *~\n"
|
49
|
-
end
|
50
|
-
|
51
|
-
def main_room
|
52
|
-
house = L.new(:name => "outside your house")
|
53
|
-
house.in = L.new(:name => "in your living room")
|
54
|
-
house.in.up = L.new(:name => "at the top of your stairs")
|
55
|
-
|
56
|
-
room = house.in.up.north = L.new(:name => "at the threshold your room")
|
57
|
-
room.north = L.new(:name => "standing in the middle of your room", :items => [Bed.new])
|
58
|
-
room.north.west = L.new(:name => "at your computer", :items => [Computer.new])
|
59
|
-
|
60
|
-
house.south = L.new(:name => "at the Pallet Town plaza")
|
61
|
-
house
|
62
|
-
end
|
63
|
-
|
64
|
-
class Commands < SRSGame::Commands
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
SRSGame::Game.new(PokemonClone, color: true).play if __FILE__ == $0
|
data/spec/game_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../", __FILE__)
|
6
|
-
require "spec_helper"
|
7
|
-
|
8
|
-
describe SRSGame::Game do
|
9
|
-
it "has a room" do
|
10
|
-
Game.new.room.should be_instance_of Location
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#go!" do
|
14
|
-
it "travels" do
|
15
|
-
game = Game.new
|
16
|
-
|
17
|
-
kitchen = Location.new
|
18
|
-
basement = Location.new { |l| l.up = kitchen }
|
19
|
-
sidewalk = Location.new { |l| l.in = kitchen }
|
20
|
-
bus_stop = Location.new { |l| l.north = sidewalk }
|
21
|
-
|
22
|
-
game.room = basement
|
23
|
-
->{game.go! :up, :out, :south}.should change {game.room}.from(basement).to(bus_stop)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
describe "#_quit" do
|
29
|
-
it "quits" do
|
30
|
-
->{Game.new.send "quit"}.should raise_error DONE_WITH_SRS_GAME
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/spec/helpers_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../", __FILE__)
|
6
|
-
require "spec_helper"
|
7
|
-
|
8
|
-
describe "helpers" do
|
9
|
-
it "determines blankness" do
|
10
|
-
[].blank?.should be_true
|
11
|
-
"".blank?.should be_true
|
12
|
-
false.blank?.should be_true
|
13
|
-
true.blank?.should be_false
|
14
|
-
3.14.blank?.should be_false
|
15
|
-
nil.unblank?.should be_false
|
16
|
-
"foo".unblank?.should be_true
|
17
|
-
end
|
18
|
-
|
19
|
-
it "formats commands" do
|
20
|
-
"_baz".command_pp.should eq "baz"
|
21
|
-
:_Senate.command_pp.should eq "senate"
|
22
|
-
end
|
23
|
-
|
24
|
-
it "converts arrays to sentences" do
|
25
|
-
[1,2,3].to_sentence.should eq "1, 2, and 3"
|
26
|
-
["jack", "jill"].to_sentence.should eq "jack and jill"
|
27
|
-
["Something"].to_sentence.should eq "Something"
|
28
|
-
[].to_sentence.should eq ""
|
29
|
-
["Kinada", "Dwor", "apple", "green"].to_sentence(bold: true).should eq \
|
30
|
-
"\e[1mKinada\e[0m, \e[1mDwor\e[0m, \e[1mapple\e[0m, and \e[1mgreen\e[0m"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "converts string to booleans" do
|
34
|
-
"yes".to_bool.should be_true
|
35
|
-
"no".to_bool.should be_false
|
36
|
-
"f".to_bool.should be_false
|
37
|
-
"t".to_bool.should be_true
|
38
|
-
"true".to_bool.should be_true
|
39
|
-
"foo".to_bool.should be_nil
|
40
|
-
end
|
41
|
-
|
42
|
-
it "identifies if a string represents a boolean" do
|
43
|
-
"yes".boolean?.should be_true
|
44
|
-
"false".boolean?.should be_true
|
45
|
-
"foo".boolean?.should be_false
|
46
|
-
end
|
47
|
-
|
48
|
-
it "identifies if a string represents a numeric" do
|
49
|
-
"3.14".numeric?.should be_true
|
50
|
-
"42".numeric?.should be_true
|
51
|
-
"4.2e2".numeric?.should be_true
|
52
|
-
"foo".numeric?.should be_false
|
53
|
-
end
|
54
|
-
|
55
|
-
it "parses a string into arguments" do
|
56
|
-
"3.14 yes gaga false".args.should eq [3.14, true, "gaga", false]
|
57
|
-
"tia".args.should eq ["tia"]
|
58
|
-
"".args.should eq []
|
59
|
-
" ".args.should eq []
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/spec/location_spec.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../", __FILE__)
|
6
|
-
require "spec_helper"
|
7
|
-
|
8
|
-
describe SRSGame::Location do
|
9
|
-
it "instantiates rooms" do
|
10
|
-
name = "some room"
|
11
|
-
|
12
|
-
location = Location.new do |l|
|
13
|
-
l.name = name
|
14
|
-
end
|
15
|
-
|
16
|
-
location.name.should eq name
|
17
|
-
location.inspect.should be_an_instance_of(String)
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#do" do
|
21
|
-
it "only lets you occupy reality" do
|
22
|
-
location = Location.new # no exits
|
23
|
-
->{location.go("west")}.should raise_error SRSGame::DirectionError
|
24
|
-
->{location.go(:down)}.should raise_error SRSGame::DirectionError
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#info" do
|
29
|
-
it "describes a room" do
|
30
|
-
class SomeItem < Item
|
31
|
-
name "some item"
|
32
|
-
end
|
33
|
-
|
34
|
-
location = Location.new do |l|
|
35
|
-
l.name = "in a room"
|
36
|
-
l.description = "A picture hangs on the wall."
|
37
|
-
l.items = [SomeItem.new]
|
38
|
-
l.south = L.new
|
39
|
-
l.out = L.new
|
40
|
-
end
|
41
|
-
|
42
|
-
location.info.uncolored.should eq "You find yourself in a room. A picture hangs on the wall." <<
|
43
|
-
"\nItems here are some item.\nExits are south and out."
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it "looks for items" do
|
48
|
-
class FooItem < Item
|
49
|
-
interactable_as :foo
|
50
|
-
end
|
51
|
-
|
52
|
-
class BarItem < Item
|
53
|
-
interactable_as :bar
|
54
|
-
end
|
55
|
-
|
56
|
-
foo = FooItem.new
|
57
|
-
bar = BarItem.new
|
58
|
-
|
59
|
-
location = Location.new { |l| l.items = [foo, bar] }
|
60
|
-
|
61
|
-
location.item_grep("foo").should eq [foo]
|
62
|
-
location.item_grep("bar").should eq [bar]
|
63
|
-
location.item_grep("baz").should eq []
|
64
|
-
location.item_grep("").should eq []
|
65
|
-
end
|
66
|
-
|
67
|
-
it "has a prompt" do
|
68
|
-
Game.new.prompt.should eq "$ "
|
69
|
-
end
|
70
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/srserver_spec.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../", __FILE__)
|
6
|
-
require "spec_helper"
|
7
|
-
|
8
|
-
describe SRSGame::SRServer do
|
9
|
-
describe "::new" do
|
10
|
-
it "makes a default server" do
|
11
|
-
server = SRServer.new Basic
|
12
|
-
server.mod.should eq Basic
|
13
|
-
server.host.should eq SRServer::DEFAULT_HOST
|
14
|
-
server.port.should eq SRServer::DEFAULT_PORT
|
15
|
-
server.maxConnections.should eq SRServer::MAX_CONNECTIONS
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/srs_game.gemspec
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: UTF-8 -*-
|
3
|
-
# This file is part of SRS GAME <http://github.com/jacksonwillis/srs_game/>.
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift File.expand_path("../lib/", __FILE__)
|
6
|
-
require "srs_game/version"
|
7
|
-
|
8
|
-
Gem::Specification.new do |gem|
|
9
|
-
gem.authors = ["Jackson Willis"]
|
10
|
-
gem.email = ["jcwillis.school@gmail.com"]
|
11
|
-
gem.description = "A framework and collection of text-based games"
|
12
|
-
gem.summary = "A framework and collection of text-based games"
|
13
|
-
gem.homepage = "http://github.com/jacksonwillis/srs_game"
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($\)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.name = "srs_game"
|
19
|
-
gem.require_paths = ["lib"]
|
20
|
-
gem.version = SRSGame::VERSION
|
21
|
-
end
|