gamefic-sdk 1.7.0 → 2.0.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 +5 -5
- data/bin/gamefic +16 -0
- data/lib/gamefic-sdk.rb +4 -24
- data/lib/gamefic-sdk/diagram.rb +205 -0
- data/lib/gamefic-sdk/scaffold.rb +54 -0
- data/lib/gamefic-sdk/server.rb +81 -65
- data/lib/gamefic-sdk/shell.rb +22 -129
- data/lib/gamefic-sdk/tasks.rb +40 -0
- data/lib/gamefic-sdk/tasks/common.rb +21 -0
- data/lib/gamefic-sdk/tasks/ruby.rb +99 -0
- data/lib/gamefic-sdk/tasks/web.rb +82 -0
- data/lib/gamefic-sdk/version.rb +5 -5
- metadata +123 -139
- data/bin/gfk +0 -6
- data/html/core/engine.js +0 -114
- data/html/core/jquery.js +0 -5
- data/html/core/jquery.modal.css +0 -44
- data/html/core/jquery.modal.js +0 -225
- data/html/core/js.cookie.js +0 -137
- data/html/sinatra/engine.js +0 -65
- data/html/skins/hypertext/compass.png +0 -0
- data/html/skins/hypertext/index.html +0 -149
- data/html/skins/hypertext/style.css +0 -74
- data/html/skins/minimal/index.html.erb +0 -22
- data/html/skins/minimal/index.rb +0 -4
- data/html/skins/minimal/play.js +0 -36
- data/html/skins/minimal/style.css +0 -8
- data/html/skins/multimedia/close.png +0 -0
- data/html/skins/multimedia/index.html +0 -179
- data/html/skins/multimedia/mobile.css +0 -10
- data/html/skins/multimedia/spinner.gif +0 -0
- data/html/skins/multimedia/style.css +0 -186
- data/html/skins/standard/index.html.erb +0 -22
- data/html/skins/standard/index.rb +0 -4
- data/html/skins/standard/play.js +0 -18
- data/html/skins/standard/style.css +0 -73
- data/lib/gamefic-sdk/build.rb +0 -30
- data/lib/gamefic-sdk/config.rb +0 -126
- data/lib/gamefic-sdk/debug.rb +0 -4
- data/lib/gamefic-sdk/debug/action.rb +0 -30
- data/lib/gamefic-sdk/debug/plot.rb +0 -23
- data/lib/gamefic-sdk/platform.rb +0 -22
- data/lib/gamefic-sdk/platform/base.rb +0 -68
- data/lib/gamefic-sdk/platform/gfic.rb +0 -27
- data/lib/gamefic-sdk/platform/sinatra.rb +0 -98
- data/lib/gamefic-sdk/platform/web.rb +0 -176
- data/lib/gamefic-sdk/platform/web/app_config.rb +0 -81
- data/lib/gamefic-sdk/platform/web/engine.rb +0 -44
- data/lib/gamefic-sdk/platform/web/user.rb +0 -19
- data/lib/gamefic-sdk/shell/init.rb +0 -83
- data/lib/gamefic-sdk/shell/test.rb +0 -32
- data/scripts/save-restore-undo.plot.rb +0 -25
- data/scripts/snapshots.plot.rb +0 -16
- data/scripts/standard.plot.rb +0 -10
- data/scripts/standard/actions.plot.rb +0 -13
- data/scripts/standard/actions/drop.plot.rb +0 -19
- data/scripts/standard/actions/enter.plot.rb +0 -19
- data/scripts/standard/actions/go.plot.rb +0 -48
- data/scripts/standard/actions/insert.plot.rb +0 -37
- data/scripts/standard/actions/inventory.plot.rb +0 -9
- data/scripts/standard/actions/leave.plot.rb +0 -30
- data/scripts/standard/actions/look.plot.rb +0 -108
- data/scripts/standard/actions/nil.plot.rb +0 -36
- data/scripts/standard/actions/place.plot.rb +0 -41
- data/scripts/standard/actions/quit.plot.rb +0 -11
- data/scripts/standard/actions/take.plot.rb +0 -31
- data/scripts/standard/actions/talk.plot.rb +0 -27
- data/scripts/standard/actions/wait.plot.rb +0 -3
- data/scripts/standard/clothing.plot.rb +0 -4
- data/scripts/standard/clothing/actions.plot.rb +0 -4
- data/scripts/standard/clothing/actions/doff.plot.rb +0 -12
- data/scripts/standard/clothing/actions/drop.plot.rb +0 -8
- data/scripts/standard/clothing/actions/inventory.plot.rb +0 -14
- data/scripts/standard/clothing/actions/wear.plot.rb +0 -20
- data/scripts/standard/clothing/entities.plot.rb +0 -7
- data/scripts/standard/clothing/entities/clothing.plot.rb +0 -5
- data/scripts/standard/clothing/entities/coat.plot.rb +0 -3
- data/scripts/standard/clothing/entities/gloves.plot.rb +0 -3
- data/scripts/standard/clothing/entities/hat.plot.rb +0 -3
- data/scripts/standard/clothing/entities/pants.plot.rb +0 -3
- data/scripts/standard/clothing/entities/shirt.plot.rb +0 -3
- data/scripts/standard/clothing/entities/shoes.plot.rb +0 -3
- data/scripts/standard/container.plot.rb +0 -28
- data/scripts/standard/container/actions.plot.rb +0 -0
- data/scripts/standard/container/entities.plot.rb +0 -5
- data/scripts/standard/direction.plot.rb +0 -55
- data/scripts/standard/edible.plot.rb +0 -21
- data/scripts/standard/entities.plot.rb +0 -12
- data/scripts/standard/entities/character.plot.rb +0 -10
- data/scripts/standard/entities/fixture.plot.rb +0 -3
- data/scripts/standard/entities/item.plot.rb +0 -3
- data/scripts/standard/entities/portal.plot.rb +0 -44
- data/scripts/standard/entities/receptacle.plot.rb +0 -3
- data/scripts/standard/entities/room.plot.rb +0 -57
- data/scripts/standard/entities/rubble.plot.rb +0 -11
- data/scripts/standard/entities/scenery.plot.rb +0 -3
- data/scripts/standard/entities/supporter.plot.rb +0 -7
- data/scripts/standard/entities/thing.plot.rb +0 -7
- data/scripts/standard/give.plot.rb +0 -27
- data/scripts/standard/lockable.plot.rb +0 -79
- data/scripts/standard/modules.plot.rb +0 -9
- data/scripts/standard/modules/attachable.plot.rb +0 -12
- data/scripts/standard/modules/auto_takes.plot.rb +0 -50
- data/scripts/standard/modules/enterable.plot.rb +0 -15
- data/scripts/standard/modules/explicit_exits.plot.rb +0 -15
- data/scripts/standard/modules/itemizable.plot.rb +0 -18
- data/scripts/standard/modules/locale_description.plot.rb +0 -20
- data/scripts/standard/modules/parent-room.plot.rb +0 -9
- data/scripts/standard/modules/portable.plot.rb +0 -11
- data/scripts/standard/modules/use.plot.rb +0 -51
- data/scripts/standard/openable.plot.rb +0 -43
- data/scripts/standard/pathfinder.plot.rb +0 -65
- data/scripts/standard/queries.plot.rb +0 -21
- data/scripts/standard/test.plot.rb +0 -10
- data/scripts/undo.plot.rb +0 -13
|
Binary file
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
html {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
font-family: Arial, sans-serif;
|
|
5
|
-
font-size: 12pt;
|
|
6
|
-
}
|
|
7
|
-
body {
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
background-color: #E3E7EA;
|
|
11
|
-
}
|
|
12
|
-
body.loading {
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
|
-
background-image: url('loading-large.gif');
|
|
16
|
-
background-position: center center;
|
|
17
|
-
background-repeat: no-repeat;
|
|
18
|
-
}
|
|
19
|
-
#gamefic_console {
|
|
20
|
-
width: 80%;
|
|
21
|
-
min-width: 600px;
|
|
22
|
-
max-width: 1024px;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
margin: 0 auto;
|
|
25
|
-
background-color: #FFFFFF;
|
|
26
|
-
-webkit-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
|
|
27
|
-
-moz-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
|
|
28
|
-
box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
|
|
29
|
-
}
|
|
30
|
-
#titlebar {
|
|
31
|
-
margin: 0 auto;
|
|
32
|
-
padding: 1px;
|
|
33
|
-
height: 20px;
|
|
34
|
-
background-color: #0D1046;
|
|
35
|
-
color: #FFFFFF;
|
|
36
|
-
}
|
|
37
|
-
#titlebar h1 {
|
|
38
|
-
margin: 0 0 0 10px;
|
|
39
|
-
height: 20px;
|
|
40
|
-
font-size: 14px;
|
|
41
|
-
font-weight: normal
|
|
42
|
-
}
|
|
43
|
-
#image-container {
|
|
44
|
-
margin: 0 auto;
|
|
45
|
-
padding: 0;
|
|
46
|
-
background-color: #FFFFFF;
|
|
47
|
-
border: 1px solid #A0A0A0;
|
|
48
|
-
display: none;
|
|
49
|
-
}
|
|
50
|
-
#image {
|
|
51
|
-
max-width: 100%;
|
|
52
|
-
max-height: 100%;
|
|
53
|
-
margin: 0 auto;
|
|
54
|
-
padding: 0;
|
|
55
|
-
background-repeat: no-repeat;
|
|
56
|
-
background-position: top center;
|
|
57
|
-
background-size: 100% 100%;
|
|
58
|
-
display: none;
|
|
59
|
-
}
|
|
60
|
-
#image-container.loading {
|
|
61
|
-
background-image: url('loading-circle.gif');
|
|
62
|
-
background-position: center center;
|
|
63
|
-
background-repeat: no-repeat;
|
|
64
|
-
background-size: auto auto;
|
|
65
|
-
}
|
|
66
|
-
#image-container.loading image {
|
|
67
|
-
visibility: hidden;
|
|
68
|
-
}
|
|
69
|
-
#text-container {
|
|
70
|
-
border-top: 1px solid #A0A0A0
|
|
71
|
-
background-color: #FFFFFF;
|
|
72
|
-
overflow: auto;
|
|
73
|
-
}
|
|
74
|
-
#text {
|
|
75
|
-
margin: 1em;
|
|
76
|
-
}
|
|
77
|
-
#text kbd {
|
|
78
|
-
font-family: Courier, Monospace;
|
|
79
|
-
font-weight: bold;
|
|
80
|
-
color: green;
|
|
81
|
-
}
|
|
82
|
-
#text kbd.logged {
|
|
83
|
-
color: gray;
|
|
84
|
-
}
|
|
85
|
-
#text blockquote {
|
|
86
|
-
margin: 1em 1em 1em 0;
|
|
87
|
-
padding: 0 0 0 1em;
|
|
88
|
-
border-left: 2px solid #E0E0E0;
|
|
89
|
-
color: #303030;
|
|
90
|
-
}
|
|
91
|
-
#controls {
|
|
92
|
-
border-top: 1px solid #A0A0A0;
|
|
93
|
-
background-color: #FFFFFF;
|
|
94
|
-
}
|
|
95
|
-
#prompt, #concluded {
|
|
96
|
-
margin: 4px 0 4px 0;
|
|
97
|
-
padding: 6px 0 0 10px;
|
|
98
|
-
background-color: #FFFFFF;
|
|
99
|
-
background-position: 10px 8px;
|
|
100
|
-
background-repeat: no-repeat;
|
|
101
|
-
font-size: 10pt;
|
|
102
|
-
height: 14pt;
|
|
103
|
-
font-weight: bold;
|
|
104
|
-
}
|
|
105
|
-
#commandform, #dialogform {
|
|
106
|
-
position: relative;
|
|
107
|
-
background-color: #FFFFFF;
|
|
108
|
-
padding: 0 0 10px 0;
|
|
109
|
-
}
|
|
110
|
-
#commandline-container, #dialogline-container {
|
|
111
|
-
margin-left: 10px;
|
|
112
|
-
margin-right: 80px;
|
|
113
|
-
height: 2em;
|
|
114
|
-
}
|
|
115
|
-
#gamefic_command, #dialogline {
|
|
116
|
-
width: 100%;
|
|
117
|
-
margin: 0;
|
|
118
|
-
padding: 0;
|
|
119
|
-
font-size: 14pt;
|
|
120
|
-
border: 1px solid #909090;
|
|
121
|
-
}
|
|
122
|
-
#commandenter, #dialogenter {
|
|
123
|
-
position: absolute;
|
|
124
|
-
font-size: 12pt;
|
|
125
|
-
right: 10px;
|
|
126
|
-
top: 0;
|
|
127
|
-
margin: 0;
|
|
128
|
-
padding: 0;
|
|
129
|
-
border: 1px solid black;
|
|
130
|
-
width: 60px;
|
|
131
|
-
}
|
|
132
|
-
.hidden {
|
|
133
|
-
display: none;
|
|
134
|
-
}
|
|
135
|
-
a.disabled {
|
|
136
|
-
color: gray;
|
|
137
|
-
text-decoration: none;
|
|
138
|
-
}
|
|
139
|
-
.error {
|
|
140
|
-
color: red;
|
|
141
|
-
}
|
|
142
|
-
.hint {
|
|
143
|
-
font-style: italic;
|
|
144
|
-
}
|
|
145
|
-
#prompt.hint {
|
|
146
|
-
color: red;
|
|
147
|
-
font-weight: bold;
|
|
148
|
-
}
|
|
149
|
-
kbd a {
|
|
150
|
-
color: green;
|
|
151
|
-
}
|
|
152
|
-
noscript p {
|
|
153
|
-
font-weight: bold;
|
|
154
|
-
text-align: center;
|
|
155
|
-
}
|
|
156
|
-
#image_cacher {
|
|
157
|
-
position: absolute;
|
|
158
|
-
top: 10000;
|
|
159
|
-
}
|
|
160
|
-
#dialog {
|
|
161
|
-
display: none;
|
|
162
|
-
}
|
|
163
|
-
#dialog nav p {
|
|
164
|
-
text-align: center;
|
|
165
|
-
}
|
|
166
|
-
#dialog nav p a {
|
|
167
|
-
margin: 0 1em 0 1em;
|
|
168
|
-
}
|
|
169
|
-
ol.multiple-choice {
|
|
170
|
-
list-style: none;
|
|
171
|
-
margin: 1em 0 1em 0.5em;
|
|
172
|
-
padding: 0;
|
|
173
|
-
}
|
|
174
|
-
ol.multiple-choice li {
|
|
175
|
-
margin: 0.5em 0 0.5em 0;
|
|
176
|
-
padding: 0;
|
|
177
|
-
list-style-type: decimal;
|
|
178
|
-
}
|
|
179
|
-
#dialog.loading * {
|
|
180
|
-
visibility: hidden;
|
|
181
|
-
}
|
|
182
|
-
#dialog.loading {
|
|
183
|
-
background-image: url('loading.gif');
|
|
184
|
-
background-position: center center;
|
|
185
|
-
background-repeat: no-repeat;
|
|
186
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<title><%= title %> by <%= author %></title>
|
|
6
|
-
<%= stylesheet_tags %>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<div id="gamefic_console">
|
|
10
|
-
<div id="gamefic_output">
|
|
11
|
-
</div>
|
|
12
|
-
<div id="gamefic_controls" class="working">
|
|
13
|
-
<form action="">
|
|
14
|
-
<span id="gamefic_prompt"></span>
|
|
15
|
-
<input type="text" name="command" id="gamefic_command" autocomplete="off" />
|
|
16
|
-
<button type="submit" id="gamefic_submit">Enter</button>
|
|
17
|
-
</form>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
<%= javascript_tags %>
|
|
21
|
-
</body>
|
|
22
|
-
</html>
|
data/html/skins/standard/play.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
$(function() {
|
|
2
|
-
console.log('starting play');
|
|
3
|
-
$('#gamefic_controls form').submit(function(event) {
|
|
4
|
-
$('#gamefic_controls').addClass('working');
|
|
5
|
-
event.preventDefault();
|
|
6
|
-
Gamefic.receive($('#gamefic_command').val());
|
|
7
|
-
$('#gamefic_command').val('');
|
|
8
|
-
$('#gamefic_controls').removeClass('working');
|
|
9
|
-
});
|
|
10
|
-
Gamefic.onUpdate((state) => {
|
|
11
|
-
$('#gamefic_output').append(state['output']);
|
|
12
|
-
if (state.scene == 'Conclusion') {
|
|
13
|
-
$('#gamefic_console').addClass('concluded');
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Gamefic.start();
|
|
17
|
-
$('#gamefic_controls').removeClass('working');
|
|
18
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
html {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
font-family: Arial, sans-serif;
|
|
5
|
-
font-size: 12pt;
|
|
6
|
-
}
|
|
7
|
-
body {
|
|
8
|
-
margin: 0;
|
|
9
|
-
padding: 0;
|
|
10
|
-
background-color: #E3E7EA;
|
|
11
|
-
}
|
|
12
|
-
#gamefic_console {
|
|
13
|
-
width: 80%;
|
|
14
|
-
min-width: 600px;
|
|
15
|
-
max-width: 1024px;
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
margin: 0 auto;
|
|
18
|
-
background-color: #FFFFFF;
|
|
19
|
-
-webkit-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
|
|
20
|
-
-moz-box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
|
|
21
|
-
box-shadow: 4px 4px 4px 0px rgba(0,0,0,0.75);
|
|
22
|
-
}
|
|
23
|
-
#gamefic_command {
|
|
24
|
-
width: calc(100% - 80px);
|
|
25
|
-
margin: 0;
|
|
26
|
-
padding: 0;
|
|
27
|
-
font-size: 14pt;
|
|
28
|
-
border: 1px solid #909090;
|
|
29
|
-
}
|
|
30
|
-
#gamefic_output {
|
|
31
|
-
min-height: 600px;
|
|
32
|
-
max-height: 80vh;
|
|
33
|
-
overflow: auto;
|
|
34
|
-
padding: 1em;
|
|
35
|
-
}
|
|
36
|
-
#gamefic_output figure {
|
|
37
|
-
margin: 0;
|
|
38
|
-
padding: 0;
|
|
39
|
-
}
|
|
40
|
-
#gamefic_output img {
|
|
41
|
-
max-width: 100%;
|
|
42
|
-
display: block;
|
|
43
|
-
margin: 0 auto;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
}
|
|
46
|
-
#gamefic_controls {
|
|
47
|
-
border-top: 1px solid #909090;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
padding: 1em;
|
|
50
|
-
}
|
|
51
|
-
#gamefic_prompt {
|
|
52
|
-
font-size: 10pt;
|
|
53
|
-
}
|
|
54
|
-
#gamefic_controls input {
|
|
55
|
-
font-size: 14pt;
|
|
56
|
-
height: 24px;
|
|
57
|
-
border: 1px solid #303030;
|
|
58
|
-
}
|
|
59
|
-
#gamefic_controls button {
|
|
60
|
-
display: inline-block;
|
|
61
|
-
font-size: 14pt;
|
|
62
|
-
line-height: normal !important;
|
|
63
|
-
height: 26px;
|
|
64
|
-
width: 72px;
|
|
65
|
-
border: 1px solid #303030;
|
|
66
|
-
margin: 0;
|
|
67
|
-
padding: 0;
|
|
68
|
-
color: #303030;
|
|
69
|
-
vertical-align: top;
|
|
70
|
-
}
|
|
71
|
-
#gamefic_controls.working {
|
|
72
|
-
display: none;
|
|
73
|
-
}
|
data/lib/gamefic-sdk/build.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require 'yaml'
|
|
2
|
-
|
|
3
|
-
module Gamefic::Sdk
|
|
4
|
-
|
|
5
|
-
module Build
|
|
6
|
-
def self.release directory, quiet = false
|
|
7
|
-
config = Gamefic::Sdk::Config.load(directory)
|
|
8
|
-
if config.auto_import?
|
|
9
|
-
puts "Importing scripts..."
|
|
10
|
-
Shell.start ['import', directory, '--quiet']
|
|
11
|
-
end
|
|
12
|
-
config.targets.each_pair { |k, v|
|
|
13
|
-
puts "Building #{k}..." unless quiet
|
|
14
|
-
plat = Gamefic::Sdk::Platform.load(config, k)
|
|
15
|
-
plat.build
|
|
16
|
-
}
|
|
17
|
-
puts "Build#{config.targets.length > 1 ? 's' : ''} complete." unless quiet
|
|
18
|
-
end
|
|
19
|
-
def self.clean directory
|
|
20
|
-
config = Gamefic::Sdk::Config.load(directory)
|
|
21
|
-
config.targets.each_pair { |k, v|
|
|
22
|
-
puts "Cleaning #{k}..."
|
|
23
|
-
plat = Gamefic::Sdk::Platform.load(config, k)
|
|
24
|
-
plat.clean
|
|
25
|
-
}
|
|
26
|
-
puts "Done."
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
data/lib/gamefic-sdk/config.rb
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
require 'yaml'
|
|
2
|
-
require 'pathname'
|
|
3
|
-
|
|
4
|
-
module Gamefic
|
|
5
|
-
module Sdk
|
|
6
|
-
class Config
|
|
7
|
-
attr_reader :source_dir
|
|
8
|
-
attr_reader :data
|
|
9
|
-
|
|
10
|
-
def initialize directory, data = {}
|
|
11
|
-
@source_dir = directory
|
|
12
|
-
@data = data
|
|
13
|
-
|
|
14
|
-
@source_dir.freeze
|
|
15
|
-
@data.freeze
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# The game's title.
|
|
19
|
-
#
|
|
20
|
-
# @return [String]
|
|
21
|
-
def title
|
|
22
|
-
@title ||= (data['title'] || 'Untitled')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# The game's author.
|
|
26
|
-
#
|
|
27
|
-
# @return [String]
|
|
28
|
-
def author
|
|
29
|
-
@author ||= (data['author'] || 'Anonymous')
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# The absolute path to the project's script directory.
|
|
33
|
-
#
|
|
34
|
-
# @return [String]
|
|
35
|
-
def script_path
|
|
36
|
-
@script_paths ||= Pathname.new(source_dir).join(data['script_path'] || './scripts').to_s
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# The absolute path to the project's import directory.
|
|
40
|
-
#
|
|
41
|
-
# @return [String]
|
|
42
|
-
def import_path
|
|
43
|
-
@import_paths ||= Pathname.new(source_dir).join(data['import_path'] || './imports').to_s
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# The absolute path to the project's media directory.
|
|
47
|
-
#
|
|
48
|
-
# @return [String]
|
|
49
|
-
def media_path
|
|
50
|
-
@media_path ||= Pathname.new(source_dir).join(data['media_path'] || './media').to_s
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# The absolute path to the project's build directory.
|
|
54
|
-
#
|
|
55
|
-
# @return [String]
|
|
56
|
-
def build_path
|
|
57
|
-
@build_path ||= Pathname.new(source_dir).join(data['build_path'] || './build').to_s
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# The absolute path to the project's release directory.
|
|
61
|
-
#
|
|
62
|
-
# @return [String]
|
|
63
|
-
def release_path
|
|
64
|
-
@release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def auto_import?
|
|
68
|
-
@auto_import ||= (data['auto_import'] || true)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# A hash of each target's name and its configuration options.
|
|
72
|
-
#
|
|
73
|
-
# @return [Hash]
|
|
74
|
-
def targets
|
|
75
|
-
@targets ||= (data['targets'] || {})
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
# A universal unique identifier for the project.
|
|
79
|
-
#
|
|
80
|
-
# @return [String]
|
|
81
|
-
def uuid
|
|
82
|
-
if @uuid.nil?
|
|
83
|
-
if File.file?(File.join source_dir, '.uuid')
|
|
84
|
-
@@uuid = File.read(File.join source_dir, '.uuid').strip
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
@uuid
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# @return [Gamefic::Sdk::Config]
|
|
91
|
-
def self.load directory
|
|
92
|
-
config = {}
|
|
93
|
-
['config.yml', 'config.yaml'].each do |cy|
|
|
94
|
-
config_file = File.join(directory, cy)
|
|
95
|
-
if File.exist?(config_file)
|
|
96
|
-
config = YAML.load(File.read(config_file))
|
|
97
|
-
break
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
Config.new(directory, config)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def self.generate author = 'Anonymous', title = 'Untitled'
|
|
104
|
-
<<-EOS
|
|
105
|
-
title: #{title}
|
|
106
|
-
author: #{author}
|
|
107
|
-
|
|
108
|
-
script_path: ./scripts
|
|
109
|
-
import_path: ./imports
|
|
110
|
-
media_path: ./media
|
|
111
|
-
|
|
112
|
-
build_path: ./build
|
|
113
|
-
release_path: ./release
|
|
114
|
-
|
|
115
|
-
targets:
|
|
116
|
-
web:
|
|
117
|
-
platform: Web
|
|
118
|
-
html: ./html
|
|
119
|
-
gfic:
|
|
120
|
-
platform: Gfic
|
|
121
|
-
filename: game.gfic
|
|
122
|
-
EOS
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|