gamefic-sdk 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce08abec9929267cbcd41b95da9a7bd313e3449ce3160277b26160aadd8437bf
4
- data.tar.gz: 1e7c8e9827b24816addfec88ff81f1c9d9e8112f9e5422f045a2ef07471375b1
3
+ metadata.gz: ab948f913c148992dc91b0ec1b4c5b8a605661b4f542bb17b7eee91648d17fd2
4
+ data.tar.gz: 2bc3d80372c32eaaa9106f4aa1dc57aacf211745d7f902c660d58ab9ffed69b8
5
5
  SHA512:
6
- metadata.gz: 1dc60435ac2e35ed97f76de2d2ba8494c5dad6a54b6aeb943b4767159c866cdd799e21763f29ed1b9360e117a8b2912934ad607b6b343d986cac9c4769d004bd
7
- data.tar.gz: 76c10bcf57491365f4b61b78f2f076d3bdd9bab43b0d46a6ed838b612c2a7c82026cb6d2ef5d94bc7f0fa817fe364ff3325b1550e8de7bfc49b5e95e47a4d910
6
+ metadata.gz: af98a3ceedfed1d026b848950eb4eeadd17ab84d5c0f61675e5500d2a6cf36e69e2f7bf38a5e435c831b828b7fc0f5dc2ab048661373c7751b38f4ec49229358
7
+ data.tar.gz: ba3a8485e4a5f240d63238fa8498cab2e8495f5fd92d16b7394a249708b6b57f5d32df7e48fcdbe757048f149c808826e13576a8ec4cbe33b3073c3738368c06
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /guides/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.3
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Fred Snyder
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,146 @@
1
+ # Gamefic SDK
2
+
3
+ **A Ruby Interactive Fiction Framework**
4
+
5
+ The Gamefic SDK provides development tools for writing games and interactive fiction with Gamefic.
6
+
7
+ ## Installation
8
+
9
+ Install the gem:
10
+
11
+ $ gem install gamefic-sdk
12
+
13
+ ## Usage
14
+
15
+ This section provides a fast and simple introduction to using the SDK. Go to
16
+ the [Gamefic website](https://gamefic.com) for in-depth guides and
17
+ documentation.
18
+
19
+ ### Creating a New Project
20
+
21
+ Create a new project and go to its directory:
22
+
23
+ $ gamefic init my_game
24
+ $ cd my_game
25
+
26
+ Test the project by running the game on the command line:
27
+
28
+ $ rake ruby:run
29
+
30
+ The Ruby game works like a traditional text adventure:
31
+
32
+ Hello, world!
33
+ >
34
+
35
+ You can enter commands at the `>` prompt, but you haven't written any content,
36
+ so there's not much to do yet. Enter `QUIT` to exit the game.
37
+
38
+ ### The Script Code
39
+
40
+ The main script for your narrative is `main.rb` in your project's root
41
+ directory. It should look something like this:
42
+
43
+ ```ruby
44
+ GAMEFIC_UUID = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
45
+ require 'gamefic-standard'
46
+
47
+ Gamefic.script do
48
+ introduction do |actor|
49
+ actor.tell "Hello, world!"
50
+ end
51
+ end
52
+ ```
53
+
54
+ `GAMEFIC_UUID` is a globally unique identifier. It can be useful if you want to
55
+ add your game to online catalogs, such as the [Interactive Fiction Database](https://ifdb.tads.org/),
56
+ but it's safe to delete if you don't need it.
57
+
58
+ ['gamefic-standard'](https://github.com/castwide/gamefic-standard) is a collection
59
+ of baseline features that are frequently useful for interactive fiction. [Inform](http://inform7.com/)
60
+ developers should find it similar to Inform's Standard Rules. It defines common
61
+ components like Rooms and Characters, along with in-game commands like `GO`,
62
+ `GET`, and `DROP` to enable basic interactivity.
63
+
64
+ `Gamefic.script` is where you write the story itself. In the starter project,
65
+ the only thing in the script is an introductory message.
66
+
67
+ ### Modifying the Script
68
+
69
+ Replace the contents of `main.rb` with the following:
70
+
71
+ ```ruby
72
+ require 'gamefic-standard'
73
+
74
+ Gamefic.script do
75
+ @living_room = make Room, name: 'living room', description: 'This is your living room.'
76
+ @bedroom = make Room, name: 'bedroom', description: 'This is your bedroom.'
77
+ @living_room.connect @bedroom, 'north'
78
+ @backpack = make Room, name: 'backpack', description: 'Your trusty backpack.', parent: @bedroom
79
+ @book = make Room, name: 'book', description: 'Your favorite novel.', parent: @living_room
80
+
81
+ introduction do |actor|
82
+ actor.parent = @living_room
83
+ actor.tell "You're in your house."
84
+ end
85
+ end
86
+ ```
87
+
88
+ Enter `rake ruby:run` to test the game. Now that it has rooms and objects, you
89
+ can perform in-game commands like `LOOK AROUND`, `GO NORTH`, and `TAKE THE BACKPACK`.
90
+
91
+ ### Making Games for the Web
92
+
93
+ The default game project includes tasks for building "web" apps using HTML,
94
+ CSS, and JavaScript. Generate the code for a web build with the following
95
+ command:
96
+
97
+ ```
98
+ $ rake web:generate
99
+ ```
100
+
101
+ Test the game in a browser by starting a server:
102
+
103
+ ```
104
+ $ rake web:run
105
+ ```
106
+
107
+ Open `http://localhost:4342` to run the game in debug mode.
108
+
109
+ Build a standalone web game:
110
+
111
+ ```
112
+ $ rake web:build
113
+ ```
114
+
115
+ The game's HTML file and related assets will be generated in the
116
+ `builds/web/production` directory. The SDK uses
117
+ [opal](https://github.com/opal/opal) to compile Ruby code to JavaScript, so the
118
+ web build does not require a Ruby interpreter. Open `index.html` in a browser
119
+ to play the game.
120
+
121
+ Note: building the web app requires [Node.js](https://nodejs.org).
122
+
123
+ ### Example Projects
124
+
125
+ The gamefic-sdk repo includes several example projects that provide more
126
+ more complete demonstrations of Gamefic's features. To run an example, copy
127
+ its `main.rb` file to your own project.
128
+
129
+ ### Learning More
130
+
131
+ Go to the [Gamefic website](https://gamefic.com) for more information about
132
+ developing and building apps with Gamefic.
133
+
134
+ ## Development
135
+
136
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
137
+
138
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
139
+
140
+ ## Contributing
141
+
142
+ Bug reports and pull requests are welcome on GitHub at https://github.com/castwide/gamefic-sdk.
143
+
144
+ ## License
145
+
146
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gamefic/sdk"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'gamefic-sdk/version'
4
+ require 'date'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'gamefic-sdk'
8
+ s.version = Gamefic::Sdk::VERSION
9
+ s.date = Date.today.strftime("%Y-%m-%d")
10
+ s.summary = "Gamefic SDK"
11
+ s.description = "Development and command-line tools for Gamefic"
12
+ s.authors = ["Fred Snyder"]
13
+ s.email = 'fsnyder@gamefic.com'
14
+ s.homepage = 'http://gamefic.com'
15
+ s.license = 'MIT'
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|examples|guides)/}) }
21
+ end
22
+ s.executables = ['gamefic']
23
+ s.require_paths = ['lib']
24
+
25
+ s.required_ruby_version = '>= 2.3.0'
26
+
27
+ s.add_runtime_dependency 'gamefic', '~> 2.0'
28
+ s.add_runtime_dependency 'gamefic-standard', '~> 2.0'
29
+ s.add_runtime_dependency 'gamefic-tty', '~> 2.0'
30
+ s.add_runtime_dependency 'listen', '~> 3.0'
31
+ s.add_runtime_dependency 'opal', '~> 1.0'
32
+ s.add_runtime_dependency 'sinatra', '~> 2'
33
+ s.add_runtime_dependency 'thor', '~> 1.0'
34
+
35
+ s.add_development_dependency "bundler", "~> 2.0"
36
+ s.add_development_dependency 'capybara', '~> 3.3'
37
+ s.add_development_dependency 'puma', '~> 3'
38
+ s.add_development_dependency 'rake', '~> 10.0'
39
+ s.add_development_dependency "rspec", "~> 3.0"
40
+ s.add_development_dependency 'selenium-webdriver', '~> 3.13'
41
+ s.add_development_dependency 'simplecov', '~> 0.14'
42
+ end
@@ -1,5 +1,5 @@
1
1
  module Gamefic
2
2
  module Sdk
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,14 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = '<%= name %>'
3
+ spec.version = '1.0.0'
4
+ spec.summary = 'A Gamefic library'
5
+ spec.authors = ['Anomynous']
6
+ spec.license = 'MIT'
7
+ spec.files = Dir['lib/**/*.rb']
8
+
9
+ spec.add_runtime_dependency 'gamefic', '~> 2.0'
10
+ spec.add_runtime_dependency 'gamefic-standard', '~> 2.0'
11
+
12
+ spec.add_development_dependency 'gamefic-sdk', '~> 2.0'
13
+ spec.add_development_dependency 'rake', '~> 12.3'
14
+ end
@@ -0,0 +1,5 @@
1
+ require 'gamefic-standard'
2
+
3
+ Gamefic.script do
4
+ # Game code goes here
5
+ end
@@ -0,0 +1,2 @@
1
+ builds
2
+ node_modules
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem 'gamefic'
6
+ gem 'gamefic-standard'
7
+
8
+ group :development do
9
+ gem 'gamefic-sdk'
10
+ gem 'gamefic-tty'
11
+ gem 'rake'
12
+ end
@@ -0,0 +1,6 @@
1
+ require 'bundler/setup'
2
+ require 'gamefic-sdk'
3
+
4
+ # Add the default Gamefic tasks for building and running games
5
+ # Run `rake --tasks` for a list of commands and descriptions
6
+ Gamefic::Sdk::Tasks.define_all
@@ -0,0 +1,9 @@
1
+ GAMEFIC_UUID = '<%= SecureRandom.uuid %>'
2
+ require 'gamefic'
3
+ require 'gamefic-standard'
4
+
5
+ Gamefic.script do
6
+ introduction do |actor|
7
+ actor.tell "Hello, world!"
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets" : ["env", "react"]
3
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "<%= name %>",
3
+ "version": "1.0.0",
4
+ "description": "A Gamefic web app",
5
+ "keywords": [],
6
+ "author": "Anonymous",
7
+ "license": "UNLICENSED",
8
+ "private": true,
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "build": "webpack --env=production -p",
12
+ "develop": "webpack --env=development -d"
13
+ },
14
+ "devDependencies": {
15
+ "babel-core": "^6.26.3",
16
+ "babel-loader": "^7.1.5",
17
+ "babel-preset-env": "^1.7.0",
18
+ "babel-preset-react": "^6.24.1",
19
+ "copy-webpack-plugin": "^4.5.3",
20
+ "css-loader": "^1.0.0",
21
+ "file-loader": "^3.0.1",
22
+ "opal-webpack-bundler": "^0.0.1",
23
+ "style-loader": "^0.23.1",
24
+ "url-loader": "^1.1.2",
25
+ "webpack": "^4.20.2",
26
+ "webpack-cli": "^3.1.2"
27
+ },
28
+ "dependencies": {
29
+ "gamefic-driver": "^0.2.0",
30
+ "react": "^16.5.2",
31
+ "react-dom": "^16.5.2",
32
+ "react-gamefic": "^0.2.0"
33
+ }
34
+ }
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= name %></title>
6
+ </head>
7
+ <body>
8
+ <div id="root" />
9
+ <script src="bundle.js" type="text/javascript"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,4 @@
1
+ import { WebDriver } from 'gamefic-driver';
2
+
3
+ const driver = new WebDriver('http://localhost:4342');
4
+ export { driver };
@@ -0,0 +1,7 @@
1
+ require 'opal'
2
+ require 'gamefic'
3
+ require 'main'
4
+
5
+ $plot = Gamefic::Plot.new
6
+ $character = $plot.get_player_character
7
+ $plot.introduce $character
@@ -0,0 +1,5 @@
1
+ import './opal.rb';
2
+ import { OpalDriver } from 'gamefic-driver';
3
+
4
+ const driver = new OpalDriver(Opal);
5
+ export { driver };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { render } from 'react-dom';
3
+ import { Console, Terminal } from 'react-gamefic';
4
+ import { driver } from 'driver';
5
+ import 'react-gamefic/styles/ebook';
6
+ import './style.css';
7
+
8
+ render(
9
+ <Console driver={driver}>
10
+ <Terminal />
11
+ </Console>,
12
+ document.getElementById('root')
13
+ );
14
+
15
+ driver.start().then((state) => {
16
+ driver.notify(state);
17
+ });
@@ -0,0 +1,3 @@
1
+ html {
2
+ background-color: #EFEFEF;
3
+ }
@@ -0,0 +1,69 @@
1
+ const path = require('path');
2
+ const CopyWebpackPlugin = require('copy-webpack-plugin');
3
+
4
+ module.exports = (env) => {
5
+ var config = {
6
+ entry: path.resolve(__dirname, 'web', 'src', 'index.js'),
7
+ output: {
8
+ filename: 'bundle.js',
9
+ path: path.resolve(__dirname, "builds", "web", env)
10
+ },
11
+ resolve: {
12
+ alias: {
13
+ driver: path.join(__dirname, 'web', 'src', 'driver', env)
14
+ }
15
+ },
16
+ plugins: [
17
+ new CopyWebpackPlugin([
18
+ {
19
+ from: path.resolve(__dirname, 'web', 'public')
20
+ },
21
+ ])
22
+ ],
23
+ module: {
24
+ rules: [
25
+ {
26
+ test: /\.css$/,
27
+ use: ['style-loader', 'css-loader']
28
+ },
29
+ {
30
+ test: /\.(png|jp(e*)g|svg)$/,
31
+ use: [{
32
+ loader: 'url-loader',
33
+ options: {
34
+ limit: 8000, // Convert images < 8kb to base64 strings
35
+ name: 'images/[hash]-[name].[ext]'
36
+ }
37
+ }]
38
+ },
39
+ {
40
+ test: /\.jsx?/,
41
+ include: path.resolve(__dirname, 'web'),
42
+ use: 'babel-loader'
43
+ }
44
+ ]
45
+ }
46
+ }
47
+
48
+ if (env == 'production') {
49
+ config.module.rules.push(
50
+ {
51
+ // opal-webpack-bundler will compile and include ruby files in the pack
52
+ test: /\.rb$/,
53
+ use: [
54
+ {
55
+ loader: 'opal-webpack-bundler',
56
+ options: {
57
+ useBundler: true,
58
+ paths: [path.resolve(__dirname), path.resolve(__dirname, 'lib')],
59
+ sourceMap: false,
60
+ root: path.resolve(__dirname)
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ );
66
+ }
67
+
68
+ return config;
69
+ };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
@@ -213,7 +213,17 @@ executables:
213
213
  extensions: []
214
214
  extra_rdoc_files: []
215
215
  files:
216
+ - ".gitignore"
217
+ - ".rspec"
218
+ - ".travis.yml"
219
+ - Gemfile
220
+ - LICENSE.txt
221
+ - README.md
222
+ - Rakefile
223
+ - bin/console
216
224
  - bin/gamefic
225
+ - bin/setup
226
+ - gamefic-sdk.gemspec
217
227
  - lib/gamefic-sdk.rb
218
228
  - lib/gamefic-sdk/diagram.rb
219
229
  - lib/gamefic-sdk/scaffold.rb
@@ -224,6 +234,22 @@ files:
224
234
  - lib/gamefic-sdk/tasks/ruby.rb
225
235
  - lib/gamefic-sdk/tasks/web.rb
226
236
  - lib/gamefic-sdk/version.rb
237
+ - scaffolds/library/Gemfile
238
+ - scaffolds/library/__name__.gemspec.gf.erb
239
+ - scaffolds/library/lib/__name__.rb
240
+ - scaffolds/project/.gitignore
241
+ - scaffolds/project/Gemfile
242
+ - scaffolds/project/Rakefile
243
+ - scaffolds/project/main.rb.gf.erb
244
+ - scaffolds/react/.babelrc
245
+ - scaffolds/react/package.json.gf.erb
246
+ - scaffolds/react/web/public/index.html.gf.erb
247
+ - scaffolds/react/web/src/driver/development.js
248
+ - scaffolds/react/web/src/driver/opal.rb
249
+ - scaffolds/react/web/src/driver/production.js
250
+ - scaffolds/react/web/src/index.js
251
+ - scaffolds/react/web/src/style.css
252
+ - scaffolds/react/webpack.config.js
227
253
  homepage: http://gamefic.com
228
254
  licenses:
229
255
  - MIT