gamefic-sdk 0.3.0 → 0.3.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c0f125ab1ce21b53aad57448dc6cec8bbbd0026
|
4
|
+
data.tar.gz: adbf7e761ad6e8be82b8151d58fe5aca7e80aeae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37125ae82a687f340871cb9516ae47e82472fdf0162b17401c688e67c46dcc70bbaaf0370d29991e7bae1e7dcbdd866ea6e357d51ae8bf9aaf3f0725e1bf8635
|
7
|
+
data.tar.gz: 5e0da62f2011f16283235fc7d66be7e0c9344780eb8b67ff309b2eca6d65cd5933562fae5f1ac8e3aad900aba4950f4465a8d45673b8172bdf7fac86a0fb4d28
|
@@ -1,10 +1,4 @@
|
|
1
|
-
javascripts.push "core/opal.js"
|
2
|
-
javascripts.push "core/gamefic.js"
|
3
|
-
javascripts.push "core/static.js"
|
4
|
-
javascripts.push "core/scripts.js"
|
5
|
-
javascripts.push "core/engine.js"
|
6
1
|
javascripts.push "core/jquery.js"
|
7
|
-
|
8
2
|
javascripts.push "play.js"
|
9
3
|
|
10
4
|
stylesheets.push "style.css"
|
data/lib/gamefic-sdk/gfk.rb
CHANGED
@@ -66,7 +66,7 @@ module Gamefic::Sdk
|
|
66
66
|
imports = []
|
67
67
|
opts = GetoptLong.new(
|
68
68
|
[ '-q', '--quiet', GetoptLong::NO_ARGUMENT ],
|
69
|
-
[ '--with-html', GetoptLong::
|
69
|
+
[ '--with-html-skin', GetoptLong::OPTIONAL_ARGUMENT ],
|
70
70
|
[ '-i', '--import', GetoptLong::REQUIRED_ARGUMENT ]
|
71
71
|
)
|
72
72
|
begin
|
@@ -74,8 +74,8 @@ module Gamefic::Sdk
|
|
74
74
|
case opt
|
75
75
|
when '-q'
|
76
76
|
quiet = true
|
77
|
-
when '--with-html'
|
78
|
-
html = arg
|
77
|
+
when '--with-html-skin'
|
78
|
+
html = arg || 'standard'
|
79
79
|
when '-i'
|
80
80
|
imports = arg.split(';')
|
81
81
|
end
|
@@ -139,7 +139,6 @@ EOS
|
|
139
139
|
config_rb.close
|
140
140
|
Dir.mkdir(directory + '/html')
|
141
141
|
if !html.nil?
|
142
|
-
FileUtils.cp_r(Dir[Gamefic::Sdk::HTML_TEMPLATE_PATH + "/core/*"], directory + "/html")
|
143
142
|
FileUtils.cp_r(Dir[Gamefic::Sdk::HTML_TEMPLATE_PATH + "/skins/" + html + "/*"], directory + "/html")
|
144
143
|
end
|
145
144
|
uuid = SecureRandom.uuid
|
@@ -9,24 +9,24 @@ module Gamefic::Sdk
|
|
9
9
|
|
10
10
|
def defaults
|
11
11
|
@defaults ||= {
|
12
|
-
|
13
|
-
|
12
|
+
'html_skin' => 'standard',
|
13
|
+
'with_media' => true
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
17
|
def build
|
18
18
|
target_dir = config['target_dir']
|
19
|
-
# TODO Configurable build folder?
|
20
19
|
build_dir = config['build_dir']
|
21
|
-
|
22
|
-
|
20
|
+
app_config = AppConfig.new source_dir, config
|
21
|
+
html_dir = app_config.html_dir
|
23
22
|
|
23
|
+
|
24
24
|
FileUtils.mkdir_p target_dir
|
25
25
|
|
26
26
|
# Copy everything in source except config and template
|
27
27
|
Dir.entries(html_dir).each { |entry|
|
28
28
|
if entry != 'config.rb' and entry != 'index.html.erb' and entry != '.' and entry != '..'
|
29
|
-
FileUtils.mkdir_p target_dir + File.dirname(entry)
|
29
|
+
FileUtils.mkdir_p target_dir + '/' + File.dirname(entry)
|
30
30
|
FileUtils.cp_r "#{html_dir}/#{entry}", "#{target_dir}/#{entry}"
|
31
31
|
end
|
32
32
|
}
|
@@ -112,19 +112,6 @@ module Gamefic::Sdk
|
|
112
112
|
absolute
|
113
113
|
end
|
114
114
|
|
115
|
-
def resolve_html_dir
|
116
|
-
html_dir = "#{source_dir}/html"
|
117
|
-
if !File.directory?(html_dir) and config['html_skin'].to_s != ''
|
118
|
-
html_dir = "#{Gamefic::Sdk::HTML_TEMPLATE_PATH}/skins/#{config['html_skin']}"
|
119
|
-
end
|
120
|
-
if !File.directory?(html_dir)
|
121
|
-
html_dir = "#{Gamefic::Sdk::HTML_TEMPLATE_PATH}/skins/minimal"
|
122
|
-
end
|
123
|
-
if !File.directory?(html_dir)
|
124
|
-
raise "Could not resolve HTML directory"
|
125
|
-
end
|
126
|
-
html_dir
|
127
|
-
end
|
128
115
|
end
|
129
116
|
|
130
117
|
end
|
@@ -3,36 +3,59 @@ require 'gamefic/stage'
|
|
3
3
|
|
4
4
|
class Gamefic::Sdk::Platform::Web::AppConfig
|
5
5
|
include Stage
|
6
|
-
attr_reader :javascripts, :stylesheets, :resource_paths
|
6
|
+
attr_reader :javascripts, :stylesheets, :resource_paths, :source_dir, :config, :html_dir
|
7
7
|
expose :javascripts, :stylesheets, :resource_paths
|
8
8
|
|
9
9
|
# @param main_dir [String] The directory containing the resources (config file, HTML template, etc.) for this build
|
10
|
-
def initialize source_dir
|
10
|
+
def initialize source_dir, config
|
11
11
|
@javascripts = []
|
12
12
|
@stylesheets = []
|
13
13
|
@source_dir = source_dir
|
14
|
-
@
|
15
|
-
|
14
|
+
@config = config
|
15
|
+
@html_dir = resolve_html_dir
|
16
|
+
@game_config = PlotConfig.new("#{source_dir}/config.yaml")
|
17
|
+
@resource_paths = ["#{html_dir}", Gamefic::Sdk::HTML_TEMPLATE_PATH]
|
18
|
+
config_file = "#{html_dir}/config.rb"
|
16
19
|
stage File.read(config_file), config_file
|
20
|
+
javascripts.push "core/opal.js", "core/gamefic.js", "core/static.js", "core/scripts.js", "core/engine.js"
|
17
21
|
end
|
18
22
|
|
19
23
|
# @return [BuildConfig::Data]
|
20
24
|
def data
|
21
|
-
Data.new @javascripts, @stylesheets
|
25
|
+
Data.new @game_config, @javascripts, @stylesheets
|
22
26
|
end
|
23
27
|
|
24
28
|
# Render HTML using the build config data
|
25
29
|
#
|
26
30
|
# @return [String] The resulting HTML
|
27
31
|
def render
|
28
|
-
erb = ERB.new(File.read(
|
32
|
+
erb = ERB.new(File.read(html_dir + "/index.html.erb"))
|
29
33
|
erb.result data.get_binding
|
30
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
|
+
|
31
52
|
end
|
32
53
|
|
33
54
|
class Gamefic::Sdk::Platform::Web::AppConfig::Data
|
34
|
-
attr_reader :javascripts, :stylesheets
|
35
|
-
def initialize javascripts, stylesheets
|
55
|
+
attr_reader :author, :title, :javascripts, :stylesheets
|
56
|
+
def initialize config, javascripts, stylesheets
|
57
|
+
@author = config.author
|
58
|
+
@title = config.title
|
36
59
|
@javascripts = javascripts
|
37
60
|
@stylesheets = stylesheets
|
38
61
|
end
|
data/lib/gamefic-sdk/version.rb
CHANGED
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: 0.3.
|
4
|
+
version: 0.3.1
|
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-04-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gamefic
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/gamefic-sdk/build.rb
|
74
74
|
- lib/gamefic-sdk/gfk.rb
|
75
75
|
- lib/gamefic-sdk/platform.rb
|
76
|
+
- html/skins/standard/config.rb
|
76
77
|
- html/skins/minimal/config.rb
|
77
78
|
- bin/gfk
|
78
79
|
homepage: http://gamefic.com
|