Class: Gamefic::Sdk::Platform::Web

Inherits:
Base
  • Object
show all
Defined in:
lib/gamefic-sdk/platform/web.rb

Direct Known Subclasses

Sinatra

Defined Under Namespace

Classes: AppConfig

Instance Attribute Summary

Attributes inherited from Base

#config, #target

Instance Method Summary collapse

Methods inherited from Base

#build_target, #initialize, #metadata, #name, #plot, #release_target

Constructor Details

This class inherits a constructor from Gamefic::Sdk::Platform::Base

Instance Method Details

#app_configObject



11
12
13
# File 'lib/gamefic-sdk/platform/web.rb', line 11

def app_config
  @app_config ||= AppConfig.new config.source_dir, config, ["core/opal.js", "core/gamefic.js", "core/static.js", "core/scripts.js", "core/engine.js"]
end

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gamefic-sdk/platform/web.rb', line 15

def build
  FileUtils.mkdir_p release_target
  FileUtils.mkdir_p build_target
  copy_html_files
  build_opal_js
  build_gamefic_js
  build_static_js
  build_scripts_js
  render_index
  copy_assets
  copy_media
end

#cleanObject



28
29
30
31
# File 'lib/gamefic-sdk/platform/web.rb', line 28

def clean
  FileUtils.remove_entry_secure build_target if File.exist?(build_target)
  puts "#{name} cleaned."
end

#html_dirObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gamefic-sdk/platform/web.rb', line 33

def html_dir
  if @html_dir.nil?
    local_dir = (target['html'] ? target['html'] : 'html')
    @html_dir = Pathname.new(config.source_dir).join(local_dir).to_s
    @html_dir = nil unless Dir.exist?(@html_dir)
    if @html_dir.nil?
      @html_dir = File.join(Gamefic::Sdk::HTML_TEMPLATE_PATH, 'skins', 'standard')
    end
  end
  @html_dir
end