gamefic-sdk 0.3.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gfk +10 -1
- data/html/skins/minimal/{config.rb → index.rb} +0 -0
- data/html/skins/standard/{config.rb → index.rb} +0 -0
- data/lib/gamefic-sdk.rb +4 -3
- data/lib/gamefic-sdk/build.rb +13 -9
- data/lib/gamefic-sdk/debug.rb +0 -1
- data/lib/gamefic-sdk/platform/base.rb +20 -2
- data/lib/gamefic-sdk/platform/gfic.rb +11 -8
- data/lib/gamefic-sdk/platform/web.rb +77 -37
- data/lib/gamefic-sdk/platform/web/app_config.rb +50 -47
- data/lib/gamefic-sdk/platform/web/gamefic_opal.rb +7 -3
- data/lib/gamefic-sdk/plot_config.rb +6 -6
- data/lib/gamefic-sdk/shell.rb +5 -0
- data/lib/gamefic-sdk/shell/command.rb +8 -0
- data/lib/gamefic-sdk/shell/command/build.rb +12 -0
- data/lib/gamefic-sdk/shell/command/clean.rb +12 -0
- data/lib/gamefic-sdk/shell/command/init.rb +100 -0
- data/lib/gamefic-sdk/shell/command/test.rb +35 -0
- data/lib/gamefic-sdk/version.rb +1 -1
- metadata +53 -21
- data/lib/gamefic-sdk/gfk.rb +0 -243
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6950dc7d900b70606eb21d87497e78d18a38eea8
|
4
|
+
data.tar.gz: 4a3be87b77c9192303fcc68b41c758522c4ebff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50059ed23b431c675ddbc0c8871ad5f08230bf34c6a88da6273323bbcea08120bd605b24a60b69843c2aa26bc0862afa2d58a2634c3c1560c25bfa134edf73d9
|
7
|
+
data.tar.gz: 846fc454de1f3f9cb795fa66b6f609f48f34f231718f6a13111e8a0fed3709b7e1f3d94ae4d4f0a04935ed3ae212a608902262ae8ca7858b4c338dabaaa963f9
|
data/bin/gfk
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'gamefic'
|
4
|
+
require 'gamefic/shell'
|
4
5
|
require 'gamefic-sdk'
|
6
|
+
require 'gamefic-sdk/shell'
|
7
|
+
|
8
|
+
shell = Gamefic::Shell.new
|
9
|
+
|
10
|
+
shell.register "init", Gamefic::Sdk::Shell::Command::Init
|
11
|
+
shell.register "create", Gamefic::Sdk::Shell::Command::Init
|
12
|
+
shell.register "build", Gamefic::Sdk::Shell::Command::Build
|
13
|
+
shell.register "clean", Gamefic::Sdk::Shell::Command::Clean
|
14
|
+
shell.register "test", Gamefic::Sdk::Shell::Command::Test
|
5
15
|
|
6
|
-
shell = Gamefic::Sdk::Gfk.new
|
7
16
|
shell.execute
|
File without changes
|
File without changes
|
data/lib/gamefic-sdk.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'gamefic'
|
2
|
-
require 'gamefic-sdk/gfk'
|
3
2
|
require 'gamefic-sdk/platform'
|
4
3
|
require 'gamefic-sdk/plot_config'
|
4
|
+
require 'gamefic-sdk/debug'
|
5
|
+
require 'gamefic-sdk/version'
|
5
6
|
|
6
7
|
module Gamefic::Sdk
|
7
|
-
HTML_TEMPLATE_PATH = File.dirname(__FILE__) + "/../html/"
|
8
|
-
GLOBAL_SCRIPT_PATH = File.dirname(__FILE__) + "/../scripts/"
|
8
|
+
HTML_TEMPLATE_PATH = File.realpath(File.dirname(__FILE__) + "/../html/")
|
9
|
+
GLOBAL_SCRIPT_PATH = File.realpath(File.dirname(__FILE__) + "/../scripts/")
|
9
10
|
# @deprecated
|
10
11
|
GLOBAL_IMPORT_PATH = GLOBAL_SCRIPT_PATH
|
11
12
|
LIB_PATH = File.dirname(__FILE__)
|
data/lib/gamefic-sdk/build.rb
CHANGED
@@ -3,27 +3,31 @@ require 'yaml'
|
|
3
3
|
module Gamefic::Sdk
|
4
4
|
|
5
5
|
module Build
|
6
|
-
def self.release directory
|
7
|
-
config = YAML.load(File.read(
|
8
|
-
|
9
|
-
|
6
|
+
def self.release directory, quiet = false
|
7
|
+
config = YAML.load(File.read(File.join(directory, 'config.yaml')))
|
8
|
+
uuid_file = File.join(directory, '.uuid')
|
9
|
+
if File.file?(uuid_file)
|
10
|
+
config['uuid'] = File.read(uuid_file).strip
|
10
11
|
end
|
11
|
-
|
12
|
+
build_file = File.join(directory, 'build.yaml')
|
13
|
+
platforms = YAML.load(File.read(build_file))
|
12
14
|
platforms.each_pair { |k, v|
|
13
15
|
v['name'] = k
|
14
16
|
cls = Gamefic::Sdk::Platform.const_get(v['platform'])
|
15
17
|
plat = cls.new(directory, v)
|
16
|
-
puts "Building #{k}..."
|
18
|
+
puts "Building #{k}..." unless quiet
|
17
19
|
plat.build
|
18
20
|
}
|
19
|
-
puts "Build#{platforms.length > 1 ? 's' : ''} complete."
|
21
|
+
puts "Build#{platforms.length > 1 ? 's' : ''} complete." unless quiet
|
20
22
|
end
|
21
|
-
def self.clean directory
|
23
|
+
def self.clean directory
|
24
|
+
build_file = File.join(directory, 'build.yaml')
|
25
|
+
config = YAML.load(File.read(build_file))
|
22
26
|
config.each_pair { |k, v|
|
23
27
|
v['name'] = k
|
24
28
|
puts "Cleaning #{k}..."
|
25
29
|
build_dir = "#{directory}/build/#{k}"
|
26
|
-
platform_dir =
|
30
|
+
platform_dir = File.join(directory, release, k)
|
27
31
|
cls = Gamefic::Sdk::Platform.const_get(v['platform'])
|
28
32
|
plat = cls.new(directory, v)
|
29
33
|
plat.clean
|
data/lib/gamefic-sdk/debug.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'gamefic-sdk'
|
2
2
|
require 'gamefic-sdk/debug/plot'
|
3
|
+
require 'gamefic-sdk/plot_config'
|
3
4
|
|
4
5
|
module Gamefic::Sdk
|
5
6
|
class Platform::Base
|
@@ -19,10 +20,14 @@ module Gamefic::Sdk
|
|
19
20
|
@config['build_dir'] = File.absolute_path(@config['build_dir'], source_dir)
|
20
21
|
end
|
21
22
|
|
23
|
+
# @return [PlotConfig]
|
24
|
+
def plot_config
|
25
|
+
@plot_config ||= PlotConfig.new("#{source_dir}/config.yaml")
|
26
|
+
end
|
27
|
+
|
22
28
|
def plot
|
23
29
|
if @plot.nil?
|
24
|
-
|
25
|
-
paths = config.script_paths + [Gamefic::Sdk::GLOBAL_SCRIPT_PATH]
|
30
|
+
paths = plot_config.script_paths + [Gamefic::Sdk::GLOBAL_SCRIPT_PATH]
|
26
31
|
@plot = Gamefic::Sdk::Debug::Plot.new(Gamefic::Source::File.new(*paths))
|
27
32
|
@plot.script 'main'
|
28
33
|
end
|
@@ -44,5 +49,18 @@ module Gamefic::Sdk
|
|
44
49
|
def clean
|
45
50
|
puts "Nothing to do for this platform."
|
46
51
|
end
|
52
|
+
|
53
|
+
# Get a string of build metadata, represented as a hash.
|
54
|
+
#
|
55
|
+
# @return [Hash]
|
56
|
+
def metadata
|
57
|
+
hash = {}
|
58
|
+
uuid = File.exist?(source_dir + '/.uuid') ? File.read(source_dir + '/.uuid').strip : ''
|
59
|
+
hash[:uuid] = "#{uuid}"
|
60
|
+
hash[:gamefic_version] = "#{Gamefic::VERSION}"
|
61
|
+
hash[:sdk_version] = "#{Gamefic::Sdk::VERSION}"
|
62
|
+
hash[:build_data] = "#{DateTime.now}"
|
63
|
+
hash
|
64
|
+
end
|
47
65
|
end
|
48
66
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'zip'
|
2
|
-
|
2
|
+
require 'tempfile'
|
3
|
+
require 'yaml'
|
4
|
+
|
3
5
|
module Gamefic::Sdk
|
4
6
|
|
5
7
|
class Platform::Gfic < Platform::Base
|
@@ -13,18 +15,19 @@ module Gamefic::Sdk
|
|
13
15
|
def build
|
14
16
|
target_dir = config['target_dir']
|
15
17
|
if config['filename'].to_s == ''
|
16
|
-
filename = target_dir
|
18
|
+
filename = File.join(target_dir, source_dir.split('/').delete_if{|i| i.to_s == ''}.last + '.gfic')
|
17
19
|
else
|
18
|
-
filename =
|
20
|
+
filename = File.join(target_dir, config['filename'])
|
19
21
|
end
|
20
|
-
stream = StringIO.new("")
|
21
22
|
FileUtils.rm filename if File.file?(filename)
|
22
23
|
FileUtils.mkdir_p target_dir
|
23
24
|
Zip::File.open(filename, Zip::File::CREATE) do |zipfile|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
plot.imported_scripts.each { |script|
|
26
|
+
zipfile.add File.join('scripts', "#{script.path}.plot.rb"), script.absolute_path
|
27
|
+
}
|
28
|
+
Tempfile.open('metadata.yaml') do |file|
|
29
|
+
file.puts metadata.to_yaml
|
30
|
+
zipfile.add "metadata.yaml", file.path
|
28
31
|
end
|
29
32
|
end
|
30
33
|
end
|
@@ -14,26 +14,60 @@ module Gamefic::Sdk
|
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
|
+
def app_config
|
18
|
+
@app_config ||= AppConfig.new source_dir, config
|
19
|
+
end
|
20
|
+
|
17
21
|
def build
|
18
22
|
target_dir = config['target_dir']
|
19
23
|
build_dir = config['build_dir']
|
20
|
-
app_config = AppConfig.new source_dir, config
|
21
24
|
html_dir = app_config.html_dir
|
22
|
-
|
23
25
|
|
24
26
|
FileUtils.mkdir_p target_dir
|
27
|
+
copy_html_files target_dir
|
28
|
+
build_opal_js build_dir
|
29
|
+
build_gamefic_js build_dir
|
30
|
+
build_static_js build_dir
|
31
|
+
build_scripts_js build_dir
|
32
|
+
render_index target_dir
|
33
|
+
copy_assets build_dir, target_dir
|
34
|
+
copy_media source_dir, target_dir
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def clean
|
39
|
+
FileUtils.remove_entry_secure config['build_dir'] if File.exist?(config['build_dir'])
|
40
|
+
FileUtils.mkdir_p config['build_dir']
|
41
|
+
puts "#{config['build_dir']} cleaned."
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def resolve filename, paths
|
47
|
+
absolute = nil
|
48
|
+
paths.each { |path|
|
49
|
+
if File.file?("#{path}/#{filename}")
|
50
|
+
absolute = File.join(path, filename)
|
51
|
+
break
|
52
|
+
end
|
53
|
+
}
|
54
|
+
raise "#{filename} not found" if absolute.nil?
|
55
|
+
absolute
|
56
|
+
end
|
25
57
|
|
26
|
-
|
27
|
-
|
28
|
-
|
58
|
+
# Copy everything in source except config and template
|
59
|
+
def copy_html_files target_dir
|
60
|
+
Dir.entries(app_config.html_dir).each { |entry|
|
61
|
+
if entry != 'index.rb' and entry != 'index.html.erb' and entry != '.' and entry != '..'
|
29
62
|
FileUtils.mkdir_p target_dir + '/' + File.dirname(entry)
|
30
|
-
FileUtils.cp_r "#{html_dir}/#{entry}", "#{target_dir}/#{entry}"
|
63
|
+
FileUtils.cp_r "#{app_config.html_dir}/#{entry}", "#{target_dir}/#{entry}"
|
31
64
|
end
|
32
65
|
}
|
66
|
+
end
|
33
67
|
|
34
|
-
|
68
|
+
def build_opal_js build_dir
|
69
|
+
# Make sure core exists in build directory
|
35
70
|
FileUtils.mkdir_p build_dir + "/core"
|
36
|
-
|
37
71
|
# Opal core
|
38
72
|
if !File.exist?(build_dir + "/core/opal.js")
|
39
73
|
File.open(build_dir + "/core/opal.js", "w") do |file|
|
@@ -42,7 +76,9 @@ module Gamefic::Sdk
|
|
42
76
|
file << Opal::Builder.build('native')
|
43
77
|
end
|
44
78
|
end
|
45
|
-
|
79
|
+
end
|
80
|
+
|
81
|
+
def build_gamefic_js build_dir
|
46
82
|
# Gamefic core
|
47
83
|
Opal.append_path Gamefic::Sdk::LIB_PATH
|
48
84
|
if !File.exist?(build_dir + "/core/gamefic.js")
|
@@ -50,14 +86,18 @@ module Gamefic::Sdk
|
|
50
86
|
file << Opal::Builder.build('gamefic').to_s
|
51
87
|
end
|
52
88
|
end
|
53
|
-
|
89
|
+
end
|
90
|
+
|
91
|
+
def build_static_js build_dir
|
54
92
|
# GameficOpal
|
55
93
|
if !File.exist?(build_dir + "/core/static.js")
|
56
|
-
|
57
|
-
|
58
|
-
|
94
|
+
File.open(build_dir + "/core/static.js", "w") do |file|
|
95
|
+
file << Opal::Builder.build('gamefic-sdk/platform/web/gamefic_opal')
|
96
|
+
end
|
59
97
|
end
|
60
|
-
|
98
|
+
end
|
99
|
+
|
100
|
+
def build_scripts_js build_dir
|
61
101
|
# Plot scripts
|
62
102
|
File.open("#{build_dir}/scripts.rb", 'w') do |file|
|
63
103
|
file << "def GameficOpal.load_scripts\n"
|
@@ -67,51 +107,51 @@ module Gamefic::Sdk
|
|
67
107
|
file << "\nend\n"
|
68
108
|
}
|
69
109
|
file << "end\n"
|
110
|
+
#file << metadata
|
70
111
|
end
|
71
112
|
Opal.append_path build_dir
|
72
113
|
File.open(build_dir + "/core/scripts.js", 'w') do |file|
|
73
114
|
file << Opal::Builder.build('scripts')
|
74
115
|
end
|
75
|
-
|
116
|
+
end
|
117
|
+
|
118
|
+
def render_index target_dir
|
76
119
|
# Render index
|
77
120
|
File.open(target_dir + "/index.html", "w") do |file|
|
78
121
|
file << app_config.render
|
79
122
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
123
|
+
end
|
124
|
+
|
125
|
+
def copy_assets build_dir, target_dir
|
126
|
+
paths = app_config.resource_paths
|
127
|
+
paths.push build_dir
|
83
128
|
app_config.javascripts.each { |js|
|
84
|
-
absolute = resolve(js,
|
129
|
+
absolute = resolve(js, paths)
|
85
130
|
FileUtils.mkdir_p target_dir + "/" + File.dirname(js)
|
86
131
|
FileUtils.cp_r absolute, target_dir + "/" + js
|
87
132
|
}
|
88
133
|
app_config.stylesheets.each { |css|
|
89
|
-
absolute = resolve(css,
|
134
|
+
absolute = resolve(css, paths)
|
90
135
|
FileUtils.mkdir_p target_dir + "/" + File.dirname(css)
|
91
136
|
FileUtils.cp_r absolute, target_dir + "/" + css
|
92
137
|
}
|
93
138
|
end
|
94
|
-
|
95
|
-
def clean
|
96
|
-
FileUtils.remove_entry_secure config['build_dir'] if File.exist?(config['build_dir'])
|
97
|
-
FileUtils.mkdir_p config['build_dir']
|
98
|
-
puts "#{config['build_dir']} cleaned."
|
99
|
-
end
|
100
139
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
140
|
+
def copy_media source_dir, target_dir
|
141
|
+
# Copy media
|
142
|
+
pc = PlotConfig.new "#{source_dir}/config.yaml"
|
143
|
+
pc.media_paths.each { |path|
|
144
|
+
if File.directory?(path)
|
145
|
+
FileUtils.mkdir_p target_dir + "/media"
|
146
|
+
Dir.entries(path).each { |entry|
|
147
|
+
if entry != '.' and entry != '..'
|
148
|
+
FileUtils.mkdir_p target_dir + "/media/" + File.dirname(entry)
|
149
|
+
FileUtils.cp_r path + "/" + entry, target_dir + "/media/" + entry
|
150
|
+
end
|
151
|
+
}
|
109
152
|
end
|
110
153
|
}
|
111
|
-
raise "#{filename} not found" if absolute.nil?
|
112
|
-
absolute
|
113
154
|
end
|
114
|
-
|
115
155
|
end
|
116
156
|
|
117
157
|
end
|
@@ -1,54 +1,57 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'gamefic/stage'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
4
|
+
module Gamefic
|
5
|
+
module Sdk
|
6
|
+
class Gamefic::Sdk::Platform::Web::AppConfig
|
7
|
+
include Stage
|
8
|
+
attr_reader :javascripts, :stylesheets, :resource_paths, :source_dir, :config, :html_dir
|
9
|
+
expose :javascripts, :stylesheets, :resource_paths
|
10
|
+
|
11
|
+
# @param main_dir [String] The directory containing the resources (config file, HTML template, etc.) for this build
|
12
|
+
def initialize source_dir, config
|
13
|
+
@javascripts = []
|
14
|
+
@stylesheets = []
|
15
|
+
@source_dir = source_dir
|
16
|
+
@config = config
|
17
|
+
@html_dir = resolve_html_dir
|
18
|
+
@game_config = PlotConfig.new("#{source_dir}/config.yaml")
|
19
|
+
@resource_paths = ["#{html_dir}", Gamefic::Sdk::HTML_TEMPLATE_PATH]
|
20
|
+
config_file = "#{html_dir}/index.rb"
|
21
|
+
stage File.read(config_file), config_file
|
22
|
+
javascripts.push "core/opal.js", "core/gamefic.js", "core/static.js", "core/scripts.js", "core/engine.js"
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [BuildConfig::Data]
|
26
|
+
def data
|
27
|
+
Data.new @game_config, @javascripts, @stylesheets
|
28
|
+
end
|
29
|
+
|
30
|
+
# Render HTML using the build config data
|
31
|
+
#
|
32
|
+
# @return [String] The resulting HTML
|
33
|
+
def render
|
34
|
+
erb = ERB.new(File.read(html_dir + "/index.html.erb"))
|
35
|
+
erb.result data.get_binding
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def resolve_html_dir
|
41
|
+
dir = "#{source_dir}/html"
|
42
|
+
if !File.directory?(dir) and config['html_skin'].to_s != ''
|
43
|
+
dir = "#{Gamefic::Sdk::HTML_TEMPLATE_PATH}/skins/#{config['html_skin']}"
|
44
|
+
end
|
45
|
+
if !File.directory?(dir)
|
46
|
+
dir = "#{Gamefic::Sdk::HTML_TEMPLATE_PATH}/skins/minimal"
|
47
|
+
end
|
48
|
+
if !File.directory?(dir)
|
49
|
+
raise "Could not resolve HTML directory"
|
50
|
+
end
|
51
|
+
dir
|
52
|
+
end
|
53
|
+
end
|
21
54
|
end
|
22
|
-
|
23
|
-
# @return [BuildConfig::Data]
|
24
|
-
def data
|
25
|
-
Data.new @game_config, @javascripts, @stylesheets
|
26
|
-
end
|
27
|
-
|
28
|
-
# Render HTML using the build config data
|
29
|
-
#
|
30
|
-
# @return [String] The resulting HTML
|
31
|
-
def render
|
32
|
-
erb = ERB.new(File.read(html_dir + "/index.html.erb"))
|
33
|
-
erb.result data.get_binding
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def resolve_html_dir
|
39
|
-
dir = "#{source_dir}/html"
|
40
|
-
if !File.directory?(dir) and config['html_skin'].to_s != ''
|
41
|
-
dir = "#{Gamefic::Sdk::HTML_TEMPLATE_PATH}/skins/#{config['html_skin']}"
|
42
|
-
end
|
43
|
-
if !File.directory?(dir)
|
44
|
-
dir = "#{Gamefic::Sdk::HTML_TEMPLATE_PATH}/skins/minimal"
|
45
|
-
end
|
46
|
-
if !File.directory?(dir)
|
47
|
-
raise "Could not resolve HTML directory"
|
48
|
-
end
|
49
|
-
dir
|
50
|
-
end
|
51
|
-
|
52
55
|
end
|
53
56
|
|
54
57
|
class Gamefic::Sdk::Platform::Web::AppConfig::Data
|
@@ -2,12 +2,13 @@
|
|
2
2
|
require 'gamefic/query/expression'
|
3
3
|
require 'gamefic/query/matches'
|
4
4
|
require 'gamefic/grammar/verb_set'
|
5
|
+
require 'gamefic/scene/multiple_choice/input'
|
5
6
|
|
6
7
|
# HACK Opal doesn't recognizes classes and modules declared from scripts
|
7
8
|
def Object.const_missing sym
|
8
9
|
Gamefic.const_get sym
|
9
10
|
end
|
10
|
-
|
11
|
+
|
11
12
|
module GameficOpal
|
12
13
|
def self.static_plot
|
13
14
|
@@static_plot ||= WebPlot.new(Gamefic::Source::Text.new)
|
@@ -24,12 +25,15 @@ module GameficOpal
|
|
24
25
|
|
25
26
|
class WebUser < Gamefic::User
|
26
27
|
def save filename, data
|
27
|
-
`Gamefic.
|
28
|
+
`Gamefic.save(filename, data);`
|
28
29
|
end
|
29
30
|
def restore filename
|
30
|
-
data = `Gamefic.
|
31
|
+
data = `Gamefic.restore(filename);`
|
31
32
|
return data
|
32
33
|
end
|
34
|
+
def test_queue
|
35
|
+
character[:test_queue] || []
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
-
module Gamefic
|
3
|
+
module Gamefic::Sdk
|
4
4
|
|
5
5
|
class PlotConfig
|
6
|
-
attr_reader :author, :title, :script_paths, :
|
6
|
+
attr_reader :author, :title, :script_paths, :media_paths
|
7
7
|
def initialize filename = nil
|
8
8
|
@script_paths = []
|
9
|
-
@
|
9
|
+
@media_paths = []
|
10
10
|
if !filename.nil?
|
11
11
|
config = YAML.load_file filename
|
12
12
|
base_dir = File.dirname(filename)
|
@@ -15,9 +15,9 @@ module Gamefic
|
|
15
15
|
config['script_paths'].each { |p|
|
16
16
|
@script_paths.push File.absolute_path(p, base_dir)
|
17
17
|
} if !config['script_paths'].nil?
|
18
|
-
config['
|
19
|
-
@
|
20
|
-
} if !config['
|
18
|
+
config['media_paths'].map! { |p|
|
19
|
+
@media_paths.push File.absolute_path(p, base_dir)
|
20
|
+
} if !config['media_paths'].nil?
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'slop'
|
2
|
+
|
3
|
+
module Gamefic::Sdk::Shell::Command
|
4
|
+
autoload :Init, 'gamefic-sdk/shell/command/init'
|
5
|
+
autoload :Build, 'gamefic-sdk/shell/command/build'
|
6
|
+
autoload :Clean, 'gamefic-sdk/shell/command/clean'
|
7
|
+
autoload :Test, 'gamefic-sdk/shell/command/test'
|
8
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'gamefic-sdk/build'
|
2
|
+
|
3
|
+
class Gamefic::Sdk::Shell::Command::Build < Gamefic::Shell::Command::Base
|
4
|
+
def initialize
|
5
|
+
options.boolean '-q', '--quiet', 'suppress output', default: false
|
6
|
+
end
|
7
|
+
|
8
|
+
def run input
|
9
|
+
result = parse input
|
10
|
+
Gamefic::Sdk::Build.release result.arguments[1], result['--quiet']
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'gamefic-sdk/build'
|
2
|
+
|
3
|
+
class Gamefic::Sdk::Shell::Command::Clean < Gamefic::Shell::Command::Base
|
4
|
+
def initialize
|
5
|
+
#options.boolean '-q', '--quiet', 'suppress output', default: false
|
6
|
+
end
|
7
|
+
|
8
|
+
def run input
|
9
|
+
result = parse input
|
10
|
+
Gamefic::Sdk::Build.clean result.arguments[1]
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'getoptlong'
|
4
|
+
|
5
|
+
class Gamefic::Sdk::Shell::Command::Init < Gamefic::Shell::Command::Base
|
6
|
+
def initialize
|
7
|
+
@quiet = false
|
8
|
+
@html = 'standard'
|
9
|
+
@scripts = ['standard']
|
10
|
+
@platforms = ['Gfic', 'Web']
|
11
|
+
options.boolean '-q', '--quiet', 'suppress output', default: false
|
12
|
+
end
|
13
|
+
|
14
|
+
def run input
|
15
|
+
get_arguments input
|
16
|
+
make_game_directories
|
17
|
+
write_main_script
|
18
|
+
write_test_script
|
19
|
+
write_build_yaml
|
20
|
+
write_config_yaml
|
21
|
+
write_uuid_file
|
22
|
+
copy_html_skin
|
23
|
+
Dir.mkdir(File.join(@directory, 'media'))
|
24
|
+
puts "Game directory '#{@directory}' initialized." unless @quiet
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def get_arguments input
|
30
|
+
result = parse input
|
31
|
+
@quiet = result['--quiet']
|
32
|
+
@directory = result.arguments[1]
|
33
|
+
end
|
34
|
+
|
35
|
+
def make_game_directories
|
36
|
+
if @directory.to_s == ''
|
37
|
+
raise "No directory specified."
|
38
|
+
end
|
39
|
+
if File.exist?(@directory)
|
40
|
+
if File.file?(@directory)
|
41
|
+
raise "#{@directory} is a file."
|
42
|
+
else
|
43
|
+
if !Dir['your_directory/*'].empty?
|
44
|
+
raise "#{@directory} is not an empty directory."
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else
|
48
|
+
Dir.mkdir(@directory)
|
49
|
+
end
|
50
|
+
Dir.mkdir(@directory + '/scripts')
|
51
|
+
end
|
52
|
+
|
53
|
+
def write_main_script
|
54
|
+
main_file = File.join(@directory, 'scripts', 'main.plot.rb')
|
55
|
+
File.open(main_file, 'w') do |file|
|
56
|
+
@scripts.each { |script|
|
57
|
+
file.puts "script '#{script}'"
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def write_test_script
|
63
|
+
File.open("#{@directory}/scripts/test.plot.rb", 'w') do |file|
|
64
|
+
file.puts "script 'standard/test'"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def write_build_yaml
|
69
|
+
File.open("#{@directory}/build.yaml", 'w') do |file|
|
70
|
+
file.puts "web:",
|
71
|
+
" platform: Web",
|
72
|
+
"gfic:",
|
73
|
+
" platform: Gfic"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def write_config_yaml
|
78
|
+
File.open("#{@directory}/config.yaml", 'w') do |file|
|
79
|
+
file.puts "title: Untitled",
|
80
|
+
"author: Anonymous",
|
81
|
+
"",
|
82
|
+
"script_paths:",
|
83
|
+
" - ./scripts",
|
84
|
+
"media_paths:",
|
85
|
+
" - ./media"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def write_uuid_file
|
90
|
+
uuid = SecureRandom.uuid
|
91
|
+
File.open("#{@directory}/.uuid", "w") { |f| f.write uuid }
|
92
|
+
end
|
93
|
+
|
94
|
+
def copy_html_skin
|
95
|
+
Dir.mkdir("#{@directory}/html")
|
96
|
+
skin = 'standard'
|
97
|
+
FileUtils.cp_r(Dir[Gamefic::Sdk::HTML_TEMPLATE_PATH + "/skins/" + @html + "/*"], "#{@directory}/html")
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'gamefic/shell'
|
2
|
+
require 'gamefic-sdk/plot_config'
|
3
|
+
require 'gamefic/engine/tty'
|
4
|
+
|
5
|
+
module Gamefic
|
6
|
+
module Sdk
|
7
|
+
|
8
|
+
class Shell::Command::Test < Gamefic::Shell::Command::Base
|
9
|
+
def run input
|
10
|
+
result = parse input
|
11
|
+
puts "Loading..."
|
12
|
+
path = result.arguments[1]
|
13
|
+
if !File.exist?(path)
|
14
|
+
raise "Invalid path: #{path}"
|
15
|
+
end
|
16
|
+
build_file = nil
|
17
|
+
main_file = path
|
18
|
+
test_file = nil
|
19
|
+
if File.directory?(path)
|
20
|
+
config = PlotConfig.new File.join(path, 'config.yaml')
|
21
|
+
else
|
22
|
+
config = PlotConfig.new
|
23
|
+
end
|
24
|
+
paths = config.script_paths + [Gamefic::Sdk::GLOBAL_SCRIPT_PATH]
|
25
|
+
plot = Gamefic::Sdk::Debug::Plot.new Source::File.new(*paths)
|
26
|
+
plot.script 'main'
|
27
|
+
plot.script 'debug'
|
28
|
+
engine = Tty::Engine.new plot
|
29
|
+
puts "\n"
|
30
|
+
engine.run
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/lib/gamefic-sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamefic-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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: 2016-
|
11
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.7.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.7.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: slop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: poltergeist
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
46
74
|
- !ruby/object:Gem::Version
|
47
75
|
version: '0'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
|
-
- -
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '0'
|
55
83
|
description: Development tools for Gamefic
|
@@ -59,23 +87,28 @@ executables:
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
90
|
+
- bin/gfk
|
91
|
+
- html/skins/minimal/index.rb
|
92
|
+
- html/skins/standard/index.rb
|
62
93
|
- lib/gamefic-sdk.rb
|
94
|
+
- lib/gamefic-sdk/build.rb
|
95
|
+
- lib/gamefic-sdk/debug.rb
|
96
|
+
- lib/gamefic-sdk/debug/action.rb
|
97
|
+
- lib/gamefic-sdk/debug/plot.rb
|
98
|
+
- lib/gamefic-sdk/platform.rb
|
63
99
|
- lib/gamefic-sdk/platform/base.rb
|
64
100
|
- lib/gamefic-sdk/platform/gfic.rb
|
65
101
|
- lib/gamefic-sdk/platform/web.rb
|
66
102
|
- lib/gamefic-sdk/platform/web/app_config.rb
|
67
103
|
- lib/gamefic-sdk/platform/web/gamefic_opal.rb
|
68
104
|
- lib/gamefic-sdk/plot_config.rb
|
105
|
+
- lib/gamefic-sdk/shell.rb
|
106
|
+
- lib/gamefic-sdk/shell/command.rb
|
107
|
+
- lib/gamefic-sdk/shell/command/build.rb
|
108
|
+
- lib/gamefic-sdk/shell/command/clean.rb
|
109
|
+
- lib/gamefic-sdk/shell/command/init.rb
|
110
|
+
- lib/gamefic-sdk/shell/command/test.rb
|
69
111
|
- lib/gamefic-sdk/version.rb
|
70
|
-
- lib/gamefic-sdk/debug.rb
|
71
|
-
- lib/gamefic-sdk/debug/action.rb
|
72
|
-
- lib/gamefic-sdk/debug/plot.rb
|
73
|
-
- lib/gamefic-sdk/build.rb
|
74
|
-
- lib/gamefic-sdk/gfk.rb
|
75
|
-
- lib/gamefic-sdk/platform.rb
|
76
|
-
- html/skins/standard/config.rb
|
77
|
-
- html/skins/minimal/config.rb
|
78
|
-
- bin/gfk
|
79
112
|
homepage: http://gamefic.com
|
80
113
|
licenses:
|
81
114
|
- MIT
|
@@ -86,19 +119,18 @@ require_paths:
|
|
86
119
|
- lib
|
87
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
121
|
requirements:
|
89
|
-
- -
|
122
|
+
- - ">="
|
90
123
|
- !ruby/object:Gem::Version
|
91
124
|
version: 1.9.3
|
92
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
126
|
requirements:
|
94
|
-
- -
|
127
|
+
- - ">="
|
95
128
|
- !ruby/object:Gem::Version
|
96
129
|
version: '0'
|
97
130
|
requirements: []
|
98
131
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.4.8
|
100
133
|
signing_key:
|
101
134
|
specification_version: 4
|
102
135
|
summary: Gamefic SDK
|
103
136
|
test_files: []
|
104
|
-
has_rdoc:
|
data/lib/gamefic-sdk/gfk.rb
DELETED
@@ -1,243 +0,0 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
require 'zip'
|
3
|
-
require 'getoptlong'
|
4
|
-
require 'gamefic/engine/tty'
|
5
|
-
require 'gamefic-sdk'
|
6
|
-
require 'gamefic-sdk/build'
|
7
|
-
require 'securerandom'
|
8
|
-
require 'gamefic-sdk/debug'
|
9
|
-
|
10
|
-
include Gamefic
|
11
|
-
|
12
|
-
module Gamefic::Sdk
|
13
|
-
class Gfk
|
14
|
-
attr_accessor :argv
|
15
|
-
def initialize
|
16
|
-
|
17
|
-
end
|
18
|
-
def execute
|
19
|
-
if ARGV.length == 0
|
20
|
-
ARGV.push 'help'
|
21
|
-
end
|
22
|
-
cmd = ARGV.shift
|
23
|
-
case cmd
|
24
|
-
when 'test'
|
25
|
-
test ARGV.shift
|
26
|
-
when 'init'
|
27
|
-
init ARGV.shift
|
28
|
-
when 'build'
|
29
|
-
build ARGV.shift
|
30
|
-
when 'clean'
|
31
|
-
clean ARGV.shift
|
32
|
-
when 'fetch'
|
33
|
-
fetch ARGV.shift
|
34
|
-
when 'help'
|
35
|
-
help ARGV.shift
|
36
|
-
else
|
37
|
-
help nil
|
38
|
-
end
|
39
|
-
end
|
40
|
-
private
|
41
|
-
def test path
|
42
|
-
puts "Loading..."
|
43
|
-
STDOUT.flush
|
44
|
-
if !File.exist?(path)
|
45
|
-
raise "Invalid path: #{path}"
|
46
|
-
end
|
47
|
-
build_file = nil
|
48
|
-
main_file = path
|
49
|
-
test_file = nil
|
50
|
-
if File.directory?(path)
|
51
|
-
config = PlotConfig.new "#{path}/config.yaml"
|
52
|
-
else
|
53
|
-
config = PlotConfig.new
|
54
|
-
end
|
55
|
-
paths = config.script_paths + [Gamefic::Sdk::GLOBAL_SCRIPT_PATH]
|
56
|
-
plot = Gamefic::Sdk::Debug::Plot.new Source::File.new(*paths)
|
57
|
-
plot.script 'main'
|
58
|
-
plot.script 'debug'
|
59
|
-
engine = Tty::Engine.new plot
|
60
|
-
puts "\n"
|
61
|
-
engine.run
|
62
|
-
end
|
63
|
-
def init directory
|
64
|
-
quiet = false
|
65
|
-
html = nil
|
66
|
-
imports = []
|
67
|
-
opts = GetoptLong.new(
|
68
|
-
[ '-q', '--quiet', GetoptLong::NO_ARGUMENT ],
|
69
|
-
[ '--with-html-skin', GetoptLong::OPTIONAL_ARGUMENT ],
|
70
|
-
[ '-i', '--import', GetoptLong::REQUIRED_ARGUMENT ]
|
71
|
-
)
|
72
|
-
begin
|
73
|
-
opts.each { |opt, arg|
|
74
|
-
case opt
|
75
|
-
when '-q'
|
76
|
-
quiet = true
|
77
|
-
when '--with-html-skin'
|
78
|
-
html = arg || 'standard'
|
79
|
-
when '-i'
|
80
|
-
imports = arg.split(';')
|
81
|
-
end
|
82
|
-
}
|
83
|
-
rescue Exception => e
|
84
|
-
puts "#{e}"
|
85
|
-
exit 1
|
86
|
-
end
|
87
|
-
if directory.to_s == ''
|
88
|
-
puts "No directory specified."
|
89
|
-
exit 1
|
90
|
-
elsif File.exist?(directory)
|
91
|
-
if File.directory?(directory)
|
92
|
-
files = Dir[directory + '/*']
|
93
|
-
if files.length > 0
|
94
|
-
dotfiles = Dir[directory + '/\.*']
|
95
|
-
if dotfiles.length < files.length
|
96
|
-
puts "'#{directory}' is not an empty directory."
|
97
|
-
exit 1
|
98
|
-
end
|
99
|
-
end
|
100
|
-
else
|
101
|
-
puts "'#{directory}' is a file."
|
102
|
-
exit 1
|
103
|
-
end
|
104
|
-
else
|
105
|
-
Dir.mkdir(directory)
|
106
|
-
end
|
107
|
-
Dir.mkdir(directory + '/scripts')
|
108
|
-
main_rb = File.new(directory + '/scripts/main.plot.rb', 'w')
|
109
|
-
main_rb.write <<EOS
|
110
|
-
script 'standard'
|
111
|
-
EOS
|
112
|
-
imports.each { |i|
|
113
|
-
main_rb.write "require '#{i}'\n"
|
114
|
-
}
|
115
|
-
main_rb.close
|
116
|
-
test_rb = File.new(directory + '/scripts/test.plot.rb', 'w')
|
117
|
-
test_rb.write <<EOS
|
118
|
-
script 'standard/test'
|
119
|
-
EOS
|
120
|
-
test_rb.close
|
121
|
-
build_rb = File.new(directory + '/build.yaml', 'w')
|
122
|
-
build_rb.write <<EOS
|
123
|
-
web:
|
124
|
-
platform: Web
|
125
|
-
gfic:
|
126
|
-
platform: Gfic
|
127
|
-
EOS
|
128
|
-
build_rb.close
|
129
|
-
config_rb = File.new(directory + '/config.yaml', 'w')
|
130
|
-
config_rb.write <<EOS
|
131
|
-
title: Untitled
|
132
|
-
author: Anonymous
|
133
|
-
|
134
|
-
script_paths:
|
135
|
-
- ./scripts
|
136
|
-
asset_paths:
|
137
|
-
- ./assets
|
138
|
-
EOS
|
139
|
-
config_rb.close
|
140
|
-
Dir.mkdir(directory + '/html')
|
141
|
-
if !html.nil?
|
142
|
-
FileUtils.cp_r(Dir[Gamefic::Sdk::HTML_TEMPLATE_PATH + "/skins/" + html + "/*"], directory + "/html")
|
143
|
-
end
|
144
|
-
uuid = SecureRandom.uuid
|
145
|
-
File.open("#{directory}/.uuid", "w") { |f| f.write uuid }
|
146
|
-
puts "Game directory '#{directory}' initialized." unless quiet
|
147
|
-
end
|
148
|
-
def fetch directory
|
149
|
-
if directory.to_s == ''
|
150
|
-
puts "No source directory was specified."
|
151
|
-
exit 1
|
152
|
-
end
|
153
|
-
if !File.directory?(directory)
|
154
|
-
puts "#{directory} is not a directory."
|
155
|
-
exit 1
|
156
|
-
end
|
157
|
-
puts "Loading game data..."
|
158
|
-
story = Plot.new(Source.new(GLOBAL_SCRIPT_PATH))
|
159
|
-
begin
|
160
|
-
story.load directory + '/main', true
|
161
|
-
rescue Exception => e
|
162
|
-
puts "'#{directory}' has errors or is not a valid source directory."
|
163
|
-
puts "#{e}"
|
164
|
-
exit 1
|
165
|
-
end
|
166
|
-
puts "Checking for external script references..."
|
167
|
-
fetched = 0
|
168
|
-
story.imported_scripts.each { |script|
|
169
|
-
if !script.filename.start_with?(directory)
|
170
|
-
base = script.filename[(script.filename.rindex('scripts/') + 7)..-1]
|
171
|
-
puts "Fetching #{base}"
|
172
|
-
FileUtils.mkdir_p directory + '/scripts/' + File.dirname(base)
|
173
|
-
FileUtils.copy script.filename, directory + '/scripts/' + base
|
174
|
-
fetched += 1
|
175
|
-
end
|
176
|
-
}
|
177
|
-
if fetched == 0
|
178
|
-
puts "Nothing to fetch."
|
179
|
-
else
|
180
|
-
puts "Done."
|
181
|
-
end
|
182
|
-
end
|
183
|
-
def build directory
|
184
|
-
Build.release directory
|
185
|
-
end
|
186
|
-
def clean directory
|
187
|
-
config = YAML.load(File.read(directory + '/build.yaml'))
|
188
|
-
Build.clean directory, config
|
189
|
-
end
|
190
|
-
def help command
|
191
|
-
shell_script = File.basename($0)
|
192
|
-
case command
|
193
|
-
when "test"
|
194
|
-
puts <<EOS
|
195
|
-
#{shell_script} test [path]
|
196
|
-
Test a Gamefic source directory or script.
|
197
|
-
EOS
|
198
|
-
when "init"
|
199
|
-
puts <<EOS
|
200
|
-
#{shell_script} init [directory]
|
201
|
-
Initialize a Gamefic source directory. The resulting directory will contain
|
202
|
-
source files ready to build into a Gamefic file.
|
203
|
-
EOS
|
204
|
-
when "fetch"
|
205
|
-
puts <<EOS
|
206
|
-
#{shell_script} fetch [directory]
|
207
|
-
Copy shared scripts to the source directory.
|
208
|
-
If the specified game directory imports external scripts, such as the ones
|
209
|
-
that are distributed with the Gamefic gem, this command will copy them into
|
210
|
-
the game's script directory. Fetching can be useful if you want to customize
|
211
|
-
common features.
|
212
|
-
EOS
|
213
|
-
when "build"
|
214
|
-
puts <<EOS
|
215
|
-
#{shell_script} build [directory] [-o | --output filename]
|
216
|
-
Build a distributable Gamefic file from the source directory. The default
|
217
|
-
filename is [directory].gfic. You can change the filename with the -o option.
|
218
|
-
EOS
|
219
|
-
when "clean"
|
220
|
-
puts <<EOS
|
221
|
-
#{shell_script} clean [directory]
|
222
|
-
Clean Gamefic source directories. This command will delete any intermediate
|
223
|
-
files that are used during the build process. The next build will rebuild
|
224
|
-
everything from source.
|
225
|
-
EOS
|
226
|
-
when nil, "help"
|
227
|
-
puts <<EOS
|
228
|
-
#{shell_script} init [directory] - initialize a Gamefic source directory
|
229
|
-
#{shell_script} test [path] - test a Gamefic source directory or script
|
230
|
-
#{shell_script} fetch [directory] - copy shared scripts into directory
|
231
|
-
#{shell_script} build [directory] - build games
|
232
|
-
#{shell_script} build [directory] - clean game directories
|
233
|
-
#{shell_script} help - display this message
|
234
|
-
#{shell_script} help [command] - display info about command
|
235
|
-
EOS
|
236
|
-
else
|
237
|
-
puts "Unrecognized command '#{command}'"
|
238
|
-
exit 1
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
end
|