Class: Gamefic::Sdk::Platform::Gfic

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

Instance Attribute Summary

Attributes inherited from Base

#config, #source_dir

Instance Method Summary collapse

Methods inherited from Base

#clean, #initialize, #metadata, #plot, #plot_config

Constructor Details

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

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gamefic-sdk/platform/gfic.rb', line 15

def build
  target_dir = config['target_dir']
  if config['filename'].to_s == ''
    if plot_config.title.to_s == ''
      filename = File.join(target_dir, File.expand_path(source_dir).split('/').delete_if{|i| i.to_s == ''}.last + '.gfic')
    else
      filename = File.join(target_dir, plot_config.title.gsub(/ /, '-').downcase + '.gfic')
    end
  else
    filename = File.join(target_dir, config['filename'])
  end
  FileUtils.rm filename if File.file?(filename)
  FileUtils.mkdir_p target_dir
  Zip::File.open(filename, Zip::File::CREATE) do |zipfile|
    plot.imported_scripts.each { |script|
      zipfile.add File.join('scripts', "#{script.path}.plot.rb"), script.absolute_path
    }
    Tempfile.open('metadata.yaml') do |file|
      file.puts .to_yaml
      zipfile.add "metadata.yaml", file.path
    end
  end
end

#defaultsObject



8
9
10
11
12
13
14
# File 'lib/gamefic-sdk/platform/gfic.rb', line 8

def defaults
  @defaults ||= {
    :filename => nil,
    :with_html => true,
    :with_media => true
  }
end