gamefic-sdk 2.0.0 → 2.1.0
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/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +146 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/gamefic +0 -10
- data/bin/setup +8 -0
- data/gamefic-sdk.gemspec +42 -0
- data/lib/gamefic-sdk/server.rb +1 -2
- data/lib/gamefic-sdk/version.rb +1 -1
- data/scaffolds/library/Gemfile +3 -0
- data/scaffolds/library/__name__.gemspec.gf.erb +14 -0
- data/scaffolds/library/lib/__name__.rb +5 -0
- data/scaffolds/project/.gitignore +2 -0
- data/scaffolds/project/Gemfile +12 -0
- data/scaffolds/project/Rakefile +6 -0
- data/scaffolds/project/main.rb.gf.erb +9 -0
- data/scaffolds/react/.babelrc +3 -0
- data/scaffolds/react/package.json.gf.erb +34 -0
- data/scaffolds/react/web/public/index.html.gf.erb +11 -0
- data/scaffolds/react/web/src/driver/development.js +4 -0
- data/scaffolds/react/web/src/driver/opal.rb +7 -0
- data/scaffolds/react/web/src/driver/production.js +5 -0
- data/scaffolds/react/web/src/index.js +28 -0
- data/scaffolds/react/web/src/scenes/ActivityScene.jsx +13 -0
- data/scaffolds/react/web/src/scenes/ConclusionScene.jsx +12 -0
- data/scaffolds/react/web/src/scenes/MultipleChoiceScene.jsx +37 -0
- data/scaffolds/react/web/src/scenes/PauseScene.jsx +13 -0
- data/scaffolds/react/web/src/scenes/index.js +11 -0
- data/scaffolds/react/web/src/style.css +3 -0
- data/scaffolds/react/webpack.config.js +69 -0
- metadata +49 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e191127d0c07f062207511ce1abb9b6b8237252a2c211751554673cc43a9572d
|
4
|
+
data.tar.gz: e68a2692143010304e89abe4ccaf5d99f3227a39f89ef10c1cb7d56df6ed0c25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b871b39cc1371113111d917ec0ff01180483daefefbe9725e95f1d486f9b72d708215b8ca8b483784b908d3682c7430b29ecb6fc13953b626c92b170555a315e
|
7
|
+
data.tar.gz: a3e31833934272af6363b821f76cb8b1af8427b1797ccc0b61dcaff023aa9dc6323b9b4de174387d659a9ee1307020be81ee111560b173dba2b2afb99e6874f9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
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
|
+
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
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/gamefic
CHANGED
@@ -4,13 +4,3 @@ require 'gamefic-sdk'
|
|
4
4
|
require 'gamefic-sdk/shell'
|
5
5
|
|
6
6
|
Gamefic::Sdk::Shell.start(ARGV)
|
7
|
-
|
8
|
-
#!/usr/bin/env ruby
|
9
|
-
|
10
|
-
#require 'gamefic'
|
11
|
-
#require 'gamefic-tty'
|
12
|
-
|
13
|
-
# Make play the default command if the first argument is an existing file
|
14
|
-
#args = %w(play help).include?(ARGV[0]) || ARGV.count.zero? || !File.exist?(ARGV[0]) ? ARGV : ARGV.dup.unshift('play')
|
15
|
-
|
16
|
-
#Gamefic::Tty::Shell.start(args)
|
data/bin/setup
ADDED
data/gamefic-sdk.gemspec
ADDED
@@ -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', '>= 2.0.2'
|
28
|
+
s.add_runtime_dependency 'gamefic-standard', '~> 2.0'
|
29
|
+
s.add_runtime_dependency 'gamefic-tty', '~> 2.0', '>= 2.0.1'
|
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', '~> 13.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
|
data/lib/gamefic-sdk/server.rb
CHANGED
@@ -32,7 +32,6 @@ module Gamefic
|
|
32
32
|
content_type :json
|
33
33
|
@@plot.update
|
34
34
|
@@plot.ready
|
35
|
-
# @@character.state.merge(input: params['command'], continued: @@character.queue.any?).to_json
|
36
35
|
@@character.output.to_json
|
37
36
|
end
|
38
37
|
|
@@ -45,7 +44,7 @@ module Gamefic
|
|
45
44
|
content_type :json
|
46
45
|
# The snapshot needs to be received as a JSON string because of issues
|
47
46
|
# with IndifferentHash malforming arrays.
|
48
|
-
snapshot = JSON.parse(params['snapshot']
|
47
|
+
snapshot = JSON.parse(params['snapshot'])
|
49
48
|
@@plot.restore snapshot
|
50
49
|
@@character.cue @@plot.default_scene
|
51
50
|
@@plot.update
|
data/lib/gamefic-sdk/version.rb
CHANGED
@@ -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,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.1",
|
30
|
+
"react": "^16.5.2",
|
31
|
+
"react-dom": "^16.5.2",
|
32
|
+
"react-gamefic": "^0.3.0"
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render } from 'react-dom';
|
3
|
+
import { Console, Terminal } from 'react-gamefic';
|
4
|
+
|
5
|
+
import { driver } from 'driver';
|
6
|
+
|
7
|
+
import { ActivityScene, PauseScene, MultipleChoiceScene, ConclusionScene } from './scenes';
|
8
|
+
import 'react-gamefic/styles/ebook';
|
9
|
+
import './style.css';
|
10
|
+
|
11
|
+
const sceneComponents = {
|
12
|
+
Activity: ActivityScene,
|
13
|
+
Pause: PauseScene,
|
14
|
+
MultipleChoice: MultipleChoiceScene,
|
15
|
+
YesOrNo: MultipleChoiceScene,
|
16
|
+
Conclusion: ConclusionScene
|
17
|
+
}
|
18
|
+
|
19
|
+
render(
|
20
|
+
<Console driver={driver}>
|
21
|
+
<Terminal sceneComponents={sceneComponents} autoScroll={true} />
|
22
|
+
</Console>,
|
23
|
+
document.getElementById('root')
|
24
|
+
);
|
25
|
+
|
26
|
+
driver.start().then((state) => {
|
27
|
+
driver.notify(state);
|
28
|
+
});
|
@@ -0,0 +1,13 @@
|
|
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
|
+
}
|
@@ -0,0 +1,37 @@
|
|
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
|
+
}
|
@@ -0,0 +1,13 @@
|
|
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
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { ActivityScene } from './ActivityScene.jsx';
|
2
|
+
import { PauseScene } from './PauseScene.jsx';
|
3
|
+
import { MultipleChoiceScene } from './MultipleChoiceScene.jsx';
|
4
|
+
import { ConclusionScene } from './ConclusionScene.jsx';
|
5
|
+
|
6
|
+
export {
|
7
|
+
ActivityScene,
|
8
|
+
PauseScene,
|
9
|
+
MultipleChoiceScene,
|
10
|
+
ConclusionScene
|
11
|
+
}
|
@@ -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,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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.2
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '2.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.2
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: gamefic-standard
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,6 +51,9 @@ dependencies:
|
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '2.0'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.0.1
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,6 +61,9 @@ dependencies:
|
|
52
61
|
- - "~>"
|
53
62
|
- !ruby/object:Gem::Version
|
54
63
|
version: '2.0'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.0.1
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: listen
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +168,14 @@ dependencies:
|
|
156
168
|
requirements:
|
157
169
|
- - "~>"
|
158
170
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
171
|
+
version: '13.0'
|
160
172
|
type: :development
|
161
173
|
prerelease: false
|
162
174
|
version_requirements: !ruby/object:Gem::Requirement
|
163
175
|
requirements:
|
164
176
|
- - "~>"
|
165
177
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
178
|
+
version: '13.0'
|
167
179
|
- !ruby/object:Gem::Dependency
|
168
180
|
name: rspec
|
169
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,7 +225,18 @@ executables:
|
|
213
225
|
extensions: []
|
214
226
|
extra_rdoc_files: []
|
215
227
|
files:
|
228
|
+
- ".gitignore"
|
229
|
+
- ".rspec"
|
230
|
+
- ".travis.yml"
|
231
|
+
- CHANGELOG.md
|
232
|
+
- Gemfile
|
233
|
+
- LICENSE.txt
|
234
|
+
- README.md
|
235
|
+
- Rakefile
|
236
|
+
- bin/console
|
216
237
|
- bin/gamefic
|
238
|
+
- bin/setup
|
239
|
+
- gamefic-sdk.gemspec
|
217
240
|
- lib/gamefic-sdk.rb
|
218
241
|
- lib/gamefic-sdk/diagram.rb
|
219
242
|
- lib/gamefic-sdk/scaffold.rb
|
@@ -224,6 +247,27 @@ files:
|
|
224
247
|
- lib/gamefic-sdk/tasks/ruby.rb
|
225
248
|
- lib/gamefic-sdk/tasks/web.rb
|
226
249
|
- lib/gamefic-sdk/version.rb
|
250
|
+
- scaffolds/library/Gemfile
|
251
|
+
- scaffolds/library/__name__.gemspec.gf.erb
|
252
|
+
- scaffolds/library/lib/__name__.rb
|
253
|
+
- scaffolds/project/.gitignore
|
254
|
+
- scaffolds/project/Gemfile
|
255
|
+
- scaffolds/project/Rakefile
|
256
|
+
- scaffolds/project/main.rb.gf.erb
|
257
|
+
- scaffolds/react/.babelrc
|
258
|
+
- scaffolds/react/package.json.gf.erb
|
259
|
+
- scaffolds/react/web/public/index.html.gf.erb
|
260
|
+
- scaffolds/react/web/src/driver/development.js
|
261
|
+
- scaffolds/react/web/src/driver/opal.rb
|
262
|
+
- scaffolds/react/web/src/driver/production.js
|
263
|
+
- scaffolds/react/web/src/index.js
|
264
|
+
- scaffolds/react/web/src/scenes/ActivityScene.jsx
|
265
|
+
- scaffolds/react/web/src/scenes/ConclusionScene.jsx
|
266
|
+
- scaffolds/react/web/src/scenes/MultipleChoiceScene.jsx
|
267
|
+
- scaffolds/react/web/src/scenes/PauseScene.jsx
|
268
|
+
- scaffolds/react/web/src/scenes/index.js
|
269
|
+
- scaffolds/react/web/src/style.css
|
270
|
+
- scaffolds/react/webpack.config.js
|
227
271
|
homepage: http://gamefic.com
|
228
272
|
licenses:
|
229
273
|
- MIT
|
@@ -243,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
287
|
- !ruby/object:Gem::Version
|
244
288
|
version: '0'
|
245
289
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.1.2
|
247
291
|
signing_key:
|
248
292
|
specification_version: 4
|
249
293
|
summary: Gamefic SDK
|