gamefic-sdk 2.1.0 → 2.3.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/gamefic-sdk.gemspec +2 -2
- data/lib/gamefic-sdk/scaffold.rb +1 -1
- data/lib/gamefic-sdk/tasks/web.rb +0 -1
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scaffolds/library/README.md.gf.erb +19 -0
- data/scaffolds/project/README.md.gf.erb +49 -0
- data/scaffolds/react/.babelrc +1 -1
- data/scaffolds/react/package.json.gf.erb +13 -13
- data/scaffolds/react/web/src/index.js +6 -6
- data/scaffolds/react/web/src/scenes/Activity.jsx +13 -0
- data/scaffolds/react/web/src/scenes/Conclusion.jsx +12 -0
- data/scaffolds/react/web/src/scenes/MultipleChoice.jsx +13 -0
- data/scaffolds/react/web/src/scenes/Pause.jsx +13 -0
- data/scaffolds/react/web/src/scenes/index.js +8 -8
- data/scaffolds/react/webpack.config.js +34 -29
- metadata +16 -14
- data/scaffolds/react/web/src/scenes/ActivityScene.jsx +0 -13
- data/scaffolds/react/web/src/scenes/ConclusionScene.jsx +0 -12
- data/scaffolds/react/web/src/scenes/MultipleChoiceScene.jsx +0 -37
- data/scaffolds/react/web/src/scenes/PauseScene.jsx +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eae9343564055a00e7ca5cf1039ab349af0c67dfe75a17edf3d2f09506dbb65
|
4
|
+
data.tar.gz: 4bf5da93fd0d2b5dfd6d4b630c2bbdb0c7ee7e5eab592d62d3c6169d74ed082d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e0e4f96795702bb01071048284827944d23dcb75fb8de9b0aadc06eb48658db5554e27ad809ff925b17fee4b0a878ae7120569e7cd2b7cdd366f3a999c90e1
|
7
|
+
data.tar.gz: b8de100c44bd07dbfbc04423ba97a68ef275820d1d43f912016be4f633effd4fc9e9f29e968f99f714f5015dafd329b7deebf9015a1c5838289df292f1adf768
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## 2.3.3 - July 3, 2021
|
2
|
+
- Rename READMEs in scaffolds so they get rendered
|
3
|
+
- Update gamefic dependency
|
4
|
+
- Fix bundle install in scaffold build
|
5
|
+
|
6
|
+
## 2.3.2 - March 11, 2021
|
7
|
+
- Add READMEs to project scaffolds
|
8
|
+
- Disable css-loader esModule option in webpack config
|
9
|
+
|
10
|
+
## 2.3.1 - March 3, 2021
|
11
|
+
- Update opal dependency
|
12
|
+
|
13
|
+
## 2.3.0 - December 14, 2020
|
14
|
+
- Update package dependencies for web builds
|
15
|
+
|
16
|
+
## 2.2.0 - August 29, 2020
|
17
|
+
- Update to react-gamefic 0.4.0
|
18
|
+
|
1
19
|
## 2.1.0 - August 27, 2020
|
2
20
|
- Update web app with customizable scene components
|
3
21
|
|
data/gamefic-sdk.gemspec
CHANGED
@@ -24,11 +24,11 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
s.required_ruby_version = '>= 2.3.0'
|
26
26
|
|
27
|
-
s.add_runtime_dependency 'gamefic', '~> 2.0', '>= 2.
|
27
|
+
s.add_runtime_dependency 'gamefic', '~> 2.0', '>= 2.1.1'
|
28
28
|
s.add_runtime_dependency 'gamefic-standard', '~> 2.0'
|
29
29
|
s.add_runtime_dependency 'gamefic-tty', '~> 2.0', '>= 2.0.1'
|
30
30
|
s.add_runtime_dependency 'listen', '~> 3.0'
|
31
|
-
s.add_runtime_dependency 'opal', '~> 1.
|
31
|
+
s.add_runtime_dependency 'opal', '~> 1.1'
|
32
32
|
s.add_runtime_dependency 'sinatra', '~> 2'
|
33
33
|
s.add_runtime_dependency 'thor', '~> 1.0'
|
34
34
|
|
data/lib/gamefic-sdk/scaffold.rb
CHANGED
@@ -47,7 +47,7 @@ module Gamefic
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
map.each_pair { |src, dst| custom_copy src, dst, data }
|
50
|
-
system "
|
50
|
+
system "cd #{Shellwords.escape(destination)} && bundle install"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/lib/gamefic-sdk/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# <%= name %>
|
2
|
+
|
3
|
+
An extension library for Gamefic
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your Gamefic project's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem '<%= name %>'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# <%= name %>
|
2
|
+
|
3
|
+
A Gamefic game project
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ bundle install
|
8
|
+
|
9
|
+
## Running on the Command Line
|
10
|
+
|
11
|
+
$ rake ruby:run
|
12
|
+
|
13
|
+
## Building a CLI Game
|
14
|
+
|
15
|
+
$ rake ruby:build
|
16
|
+
|
17
|
+
The script will be saved in the `builds/ruby` directory.
|
18
|
+
|
19
|
+
## Web-Based Games
|
20
|
+
|
21
|
+
The Gamefic SDK also supports web-based versions of games. The project gets built into a single-page application with the Ruby game code compiled into JavaScript.
|
22
|
+
|
23
|
+
First you need to install the web project scaffold:
|
24
|
+
|
25
|
+
```
|
26
|
+
$ rake web:generate
|
27
|
+
```
|
28
|
+
|
29
|
+
## Running a Web Game
|
30
|
+
|
31
|
+
To run the app in debug mode:
|
32
|
+
|
33
|
+
```
|
34
|
+
$ rake web:run
|
35
|
+
```
|
36
|
+
|
37
|
+
Open http://localhost:4342 in a browser.
|
38
|
+
|
39
|
+
## Building a Web Game
|
40
|
+
|
41
|
+
```
|
42
|
+
$ rake web:build
|
43
|
+
```
|
44
|
+
|
45
|
+
The application will be saved in the `builds/web/production` directory.
|
46
|
+
|
47
|
+
## More Information
|
48
|
+
|
49
|
+
Go to https://gamefic.com for documentation.
|
data/scaffolds/react/.babelrc
CHANGED
@@ -8,27 +8,27 @@
|
|
8
8
|
"private": true,
|
9
9
|
"scripts": {
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
11
|
-
"build": "webpack --
|
12
|
-
"develop": "webpack --
|
11
|
+
"build": "webpack --mode production",
|
12
|
+
"develop": "webpack --mode development"
|
13
13
|
},
|
14
14
|
"devDependencies": {
|
15
|
-
"babel
|
16
|
-
"babel-loader": "^
|
17
|
-
"babel
|
18
|
-
"babel
|
19
|
-
"copy-webpack-plugin": "^
|
20
|
-
"css-loader": "^
|
21
|
-
"file-loader": "^
|
15
|
+
"@babel/core": "^7.12.0",
|
16
|
+
"babel-loader": "^8.2.2",
|
17
|
+
"@babel/preset-env": "^7.12.10",
|
18
|
+
"@babel/preset-react": "^7.12.10",
|
19
|
+
"copy-webpack-plugin": "^7.0.0",
|
20
|
+
"css-loader": "^5.0.1",
|
21
|
+
"file-loader": "^6.2.0",
|
22
22
|
"opal-webpack-bundler": "^0.0.1",
|
23
23
|
"style-loader": "^0.23.1",
|
24
|
-
"url-loader": "^1.1
|
25
|
-
"webpack": "^
|
26
|
-
"webpack-cli": "^
|
24
|
+
"url-loader": "^4.1.1",
|
25
|
+
"webpack": "^5.10.1",
|
26
|
+
"webpack-cli": "^4.2.0"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
29
|
"gamefic-driver": "^0.2.1",
|
30
30
|
"react": "^16.5.2",
|
31
31
|
"react-dom": "^16.5.2",
|
32
|
-
"react-gamefic": "^0.
|
32
|
+
"react-gamefic": "^0.5.0"
|
33
33
|
}
|
34
34
|
}
|
@@ -4,16 +4,16 @@ import { Console, Terminal } from 'react-gamefic';
|
|
4
4
|
|
5
5
|
import { driver } from 'driver';
|
6
6
|
|
7
|
-
import {
|
7
|
+
import { Activity, Pause, MultipleChoice, Conclusion } from './scenes';
|
8
8
|
import 'react-gamefic/styles/ebook';
|
9
9
|
import './style.css';
|
10
10
|
|
11
11
|
const sceneComponents = {
|
12
|
-
Activity:
|
13
|
-
Pause:
|
14
|
-
MultipleChoice:
|
15
|
-
YesOrNo:
|
16
|
-
Conclusion:
|
12
|
+
Activity: Activity,
|
13
|
+
Pause: Pause,
|
14
|
+
MultipleChoice: MultipleChoice,
|
15
|
+
YesOrNo: MultipleChoice,
|
16
|
+
Conclusion: Conclusion
|
17
17
|
}
|
18
18
|
|
19
19
|
render(
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ActivityScene, Output, CommandForm } from 'react-gamefic';
|
3
|
+
|
4
|
+
export class Activity extends React.Component {
|
5
|
+
render() {
|
6
|
+
return (
|
7
|
+
<ActivityScene>
|
8
|
+
<Output {...this.props} transcribe={true} />
|
9
|
+
<CommandForm prompt={this.props.state.prompt} />
|
10
|
+
</ActivityScene>
|
11
|
+
);
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ConclusionScene, Output } from 'react-gamefic';
|
3
|
+
|
4
|
+
export class Conclusion extends React.Component {
|
5
|
+
render() {
|
6
|
+
return (
|
7
|
+
<ConclusionScene>
|
8
|
+
<Output {...this.props} transcribe={true} />
|
9
|
+
</ConclusionScene>
|
10
|
+
);
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { MultipleChoiceScene, ChoiceList } from 'react-gamefic';
|
3
|
+
|
4
|
+
export class MultipleChoice extends React.Component {
|
5
|
+
render() {
|
6
|
+
return (
|
7
|
+
<MultipleChoiceScene>
|
8
|
+
<Output {...this.props} transcribe={true} />,
|
9
|
+
<ChoiceList options={this.props.state.options} prompt={this.props.state.prompt} />
|
10
|
+
</MultipleChoiceScene>
|
11
|
+
);
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { PauseScene, Output, CommandLink } from 'react-gamefic';
|
3
|
+
|
4
|
+
export class Pause extends React.Component {
|
5
|
+
render() {
|
6
|
+
return (
|
7
|
+
<PauseScene>
|
8
|
+
<Output {...this.props} transcribe={true} />
|
9
|
+
<CommandLink command="">Continue</CommandLink>
|
10
|
+
</PauseScene>
|
11
|
+
);
|
12
|
+
}
|
13
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
1
|
+
import { Activity } from './Activity.jsx';
|
2
|
+
import { Pause } from './Pause.jsx';
|
3
|
+
import { MultipleChoice } from './MultipleChoice.jsx';
|
4
|
+
import { Conclusion } from './Conclusion.jsx';
|
5
5
|
|
6
6
|
export {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
Activity,
|
8
|
+
Pause,
|
9
|
+
MultipleChoice,
|
10
|
+
Conclusion
|
11
11
|
}
|
@@ -1,51 +1,56 @@
|
|
1
1
|
const path = require('path');
|
2
2
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
3
3
|
|
4
|
-
module.exports = (
|
4
|
+
module.exports = (_env, argv) => {
|
5
5
|
var config = {
|
6
6
|
entry: path.resolve(__dirname, 'web', 'src', 'index.js'),
|
7
7
|
output: {
|
8
8
|
filename: 'bundle.js',
|
9
|
-
path: path.resolve(__dirname, "builds", "web",
|
9
|
+
path: path.resolve(__dirname, "builds", "web", argv.mode)
|
10
10
|
},
|
11
11
|
resolve: {
|
12
12
|
alias: {
|
13
|
-
driver: path.join(__dirname, 'web', 'src', 'driver',
|
13
|
+
driver: path.join(__dirname, 'web', 'src', 'driver', argv.mode)
|
14
14
|
}
|
15
15
|
},
|
16
16
|
plugins: [
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
new CopyWebpackPlugin({
|
18
|
+
patterns: [
|
19
|
+
{
|
20
|
+
from: path.resolve(__dirname, 'web', 'public')
|
21
|
+
}
|
22
|
+
]
|
23
|
+
})
|
22
24
|
],
|
23
25
|
module: {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
{
|
40
|
-
test: /\.jsx?/,
|
41
|
-
include: path.resolve(__dirname, 'web'),
|
42
|
-
use: 'babel-loader'
|
26
|
+
rules: [
|
27
|
+
{
|
28
|
+
test: /\.css$/,
|
29
|
+
use: [
|
30
|
+
'style-loader',
|
31
|
+
{ loader: 'css-loader', options: { esModule: false } }
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
test: /\.(png|jp(e*)g|svg)$/,
|
36
|
+
use: [{
|
37
|
+
loader: 'url-loader',
|
38
|
+
options: {
|
39
|
+
limit: 8000, // Convert images < 8kb to base64 strings
|
40
|
+
name: 'images/[hash]-[name].[ext]'
|
43
41
|
}
|
44
|
-
|
42
|
+
}]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
test: /\.jsx?/,
|
46
|
+
include: path.resolve(__dirname, 'web'),
|
47
|
+
use: 'babel-loader'
|
48
|
+
}
|
49
|
+
]
|
45
50
|
}
|
46
51
|
}
|
47
52
|
|
48
|
-
if (
|
53
|
+
if (argv.mode == 'production') {
|
49
54
|
config.module.rules.push(
|
50
55
|
{
|
51
56
|
// opal-webpack-bundler will compile and include ruby files in the pack
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '2.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.
|
22
|
+
version: 2.1.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '2.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
32
|
+
version: 2.1.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: gamefic-standard
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,14 +84,14 @@ dependencies:
|
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '1.
|
87
|
+
version: '1.1'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '1.
|
94
|
+
version: '1.1'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: sinatra
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,10 +248,12 @@ files:
|
|
248
248
|
- lib/gamefic-sdk/tasks/web.rb
|
249
249
|
- lib/gamefic-sdk/version.rb
|
250
250
|
- scaffolds/library/Gemfile
|
251
|
+
- scaffolds/library/README.md.gf.erb
|
251
252
|
- scaffolds/library/__name__.gemspec.gf.erb
|
252
253
|
- scaffolds/library/lib/__name__.rb
|
253
254
|
- scaffolds/project/.gitignore
|
254
255
|
- scaffolds/project/Gemfile
|
256
|
+
- scaffolds/project/README.md.gf.erb
|
255
257
|
- scaffolds/project/Rakefile
|
256
258
|
- scaffolds/project/main.rb.gf.erb
|
257
259
|
- scaffolds/react/.babelrc
|
@@ -261,10 +263,10 @@ files:
|
|
261
263
|
- scaffolds/react/web/src/driver/opal.rb
|
262
264
|
- scaffolds/react/web/src/driver/production.js
|
263
265
|
- scaffolds/react/web/src/index.js
|
264
|
-
- scaffolds/react/web/src/scenes/
|
265
|
-
- scaffolds/react/web/src/scenes/
|
266
|
-
- scaffolds/react/web/src/scenes/
|
267
|
-
- scaffolds/react/web/src/scenes/
|
266
|
+
- scaffolds/react/web/src/scenes/Activity.jsx
|
267
|
+
- scaffolds/react/web/src/scenes/Conclusion.jsx
|
268
|
+
- scaffolds/react/web/src/scenes/MultipleChoice.jsx
|
269
|
+
- scaffolds/react/web/src/scenes/Pause.jsx
|
268
270
|
- scaffolds/react/web/src/scenes/index.js
|
269
271
|
- scaffolds/react/web/src/style.css
|
270
272
|
- scaffolds/react/webpack.config.js
|
@@ -272,7 +274,7 @@ homepage: http://gamefic.com
|
|
272
274
|
licenses:
|
273
275
|
- MIT
|
274
276
|
metadata: {}
|
275
|
-
post_install_message:
|
277
|
+
post_install_message:
|
276
278
|
rdoc_options: []
|
277
279
|
require_paths:
|
278
280
|
- lib
|
@@ -287,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
289
|
- !ruby/object:Gem::Version
|
288
290
|
version: '0'
|
289
291
|
requirements: []
|
290
|
-
rubygems_version: 3.1.
|
291
|
-
signing_key:
|
292
|
+
rubygems_version: 3.1.6
|
293
|
+
signing_key:
|
292
294
|
specification_version: 4
|
293
295
|
summary: Gamefic SDK
|
294
296
|
test_files: []
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { Output, CommandForm } from 'react-gamefic';
|
3
|
-
|
4
|
-
export class ActivityScene extends React.Component {
|
5
|
-
render() {
|
6
|
-
return (
|
7
|
-
<div className="ActivityScene">
|
8
|
-
<Output {...this.props} />
|
9
|
-
<CommandForm prompt={this.props.state.prompt} />
|
10
|
-
</div>
|
11
|
-
);
|
12
|
-
}
|
13
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { Output } from 'react-gamefic';
|
3
|
-
import { CommandLink } from 'react-gamefic';
|
4
|
-
|
5
|
-
export class MultipleChoiceScene extends React.Component {
|
6
|
-
renderChoices() {
|
7
|
-
if (this.props.state.options) {
|
8
|
-
const listItems = this.props.state.options.map((opt, index) => {
|
9
|
-
return (
|
10
|
-
<li key={index}>
|
11
|
-
<CommandLink command={opt}>{opt}</CommandLink>
|
12
|
-
</li>
|
13
|
-
);
|
14
|
-
});
|
15
|
-
return (
|
16
|
-
<nav>
|
17
|
-
<ol>
|
18
|
-
{listItems}
|
19
|
-
</ol>
|
20
|
-
</nav>
|
21
|
-
);
|
22
|
-
} else {
|
23
|
-
console.warn("Error: Multiple choice scene does not have any options");
|
24
|
-
return '';
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
render() {
|
29
|
-
return (
|
30
|
-
<div className="MultipleChoiceScene">
|
31
|
-
<Output {...this.props} />
|
32
|
-
<label>{this.props.state.prompt}</label>
|
33
|
-
{this.renderChoices()}
|
34
|
-
</div>
|
35
|
-
);
|
36
|
-
}
|
37
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { Output, CommandLink, CommandForm } from 'react-gamefic';
|
3
|
-
|
4
|
-
export class PauseScene extends React.Component {
|
5
|
-
render() {
|
6
|
-
return (
|
7
|
-
<div className="PauseScene">
|
8
|
-
<Output {...this.props} />
|
9
|
-
<CommandLink command="">Continue</CommandLink>
|
10
|
-
</div>
|
11
|
-
);
|
12
|
-
}
|
13
|
-
}
|