Class: Gamefic::Sdk::Platform::Base
- Inherits:
-
Object
- Object
- Gamefic::Sdk::Platform::Base
- Defined in:
- lib/gamefic-sdk/platform/base.rb
Instance Attribute Summary collapse
- #config ⇒ Gamefic::Sdk::Config readonly
- #target ⇒ Hash readonly
Instance Method Summary collapse
- #build ⇒ Object
- #build_target ⇒ Object
- #clean ⇒ Object
-
#initialize(config: Gamefic::Sdk::Config.new, target: {}) ⇒ Base
constructor
def initialize config, name = nil.
-
#metadata ⇒ Hash
Get a hash of build metadata.
- #name ⇒ Object
- #plot ⇒ Gamefic::Plot
- #release_target ⇒ Object
Constructor Details
#initialize(config: Gamefic::Sdk::Config.new, target: {}) ⇒ Base
def initialize config, name = nil
15 16 17 18 19 20 21 22 |
# File 'lib/gamefic-sdk/platform/base.rb', line 15 def initialize config: Gamefic::Sdk::Config.new, target: {} #@source_dir = source_dir #@name = name #@config = config #@config.freeze @config = config @target = target end |
Instance Attribute Details
#config ⇒ Gamefic::Sdk::Config (readonly)
9 10 11 |
# File 'lib/gamefic-sdk/platform/base.rb', line 9 def config @config end |
#target ⇒ Hash (readonly)
12 13 14 |
# File 'lib/gamefic-sdk/platform/base.rb', line 12 def target @target end |
Instance Method Details
#build ⇒ Object
47 48 49 50 |
# File 'lib/gamefic-sdk/platform/base.rb', line 47 def build # Platforms need to build/compile the deployment here. raise "The base Platform class does not have a build method" end |
#build_target ⇒ Object
28 29 30 |
# File 'lib/gamefic-sdk/platform/base.rb', line 28 def build_target @build_target ||= File.join(config.build_path, name) end |
#clean ⇒ Object
52 53 54 |
# File 'lib/gamefic-sdk/platform/base.rb', line 52 def clean puts "Nothing to do for this platform." end |
#metadata ⇒ Hash
Get a hash of build metadata.
59 60 61 62 63 64 65 66 |
# File 'lib/gamefic-sdk/platform/base.rb', line 59 def hash = {} hash[:uuid] = config.uuid hash[:gamefic_version] = "#{Gamefic::VERSION}" hash[:sdk_version] = "#{Gamefic::Sdk::VERSION}" hash[:build_date] = "#{DateTime.now}" hash end |
#name ⇒ Object
24 25 26 |
# File 'lib/gamefic-sdk/platform/base.rb', line 24 def name @name ||= (target['name'] || self.class.to_s.split('::').last.downcase) end |
#plot ⇒ Gamefic::Plot
37 38 39 40 41 42 43 44 45 |
# File 'lib/gamefic-sdk/platform/base.rb', line 37 def plot if @plot.nil? paths = [config.script_path, config.import_path, Gamefic::Sdk::GLOBAL_SCRIPT_PATH] # @todo: Should really use Gamefic::Sdk::Debug::Plot or just Gamfic::Plot? @plot = Gamefic::Sdk::Debug::Plot.new(Gamefic::Source::File.new(*paths)) @plot.script 'main' end @plot end |
#release_target ⇒ Object
32 33 34 |
# File 'lib/gamefic-sdk/platform/base.rb', line 32 def release_target @release_target ||= File.join(config.release_path, name) end |