Class: Reflex::Packager::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/reflex/packager/profile.rb

Overview

Describes the runtime a packaged app embeds: the umbrella pod that provides the native build, the extensions and libraries registered with CRuby, and the scaffold for the 'new' command.

The packager itself is runtime-agnostic; each gem (reflex, rubysketch, ...) supplies its own profile and reuses this packager as the engine.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pod:, git:, version:, libraries:, extensions:, config_files:, templates:, command: nil, boot: nil) ⇒ Profile

Returns a new instance of Profile.

Parameters:

  • pod (String)

    umbrella pod name (e.g. 'Reflex')

  • git (String)

    umbrella pod git repository

  • version (String)

    umbrella pod version (for the tag)

  • libraries (Array<String>)

    ruby lib bundles to add to load path

  • extensions (Array<String>)

    native exts to register (Init_)

  • config_files (Array<String>)

    config file names, preferred first

  • templates (Hash{String=>String})

    'new' scaffold files (=> content)

  • command (String, nil) (defaults to: nil)

    CLI command name (default: pod_key)

  • boot (String, nil) (defaults to: nil)

    boot script overrides config main (default: nil)



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/reflex/packager/profile.rb', line 26

def initialize(
  pod:, git:, version:, libraries:, extensions:, config_files:, templates:,
  command: nil, boot: nil)

  @pod          = pod
  @git          = git
  @version      = version
  @libraries    = libraries
  @extensions   = extensions
  @config_files = config_files
  @templates    = templates
  @command      = command
  @boot         = boot
end

Instance Attribute Details

#bootObject (readonly)

Returns the value of attribute boot.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def boot
  @boot
end

#config_filesObject (readonly)

Returns the value of attribute config_files.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def config_files
  @config_files
end

#extensionsObject (readonly)

Returns the value of attribute extensions.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def extensions
  @extensions
end

#gitObject (readonly)

Returns the value of attribute git.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def git
  @git
end

#librariesObject (readonly)

Returns the value of attribute libraries.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def libraries
  @libraries
end

#podObject (readonly)

Returns the value of attribute pod.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def pod
  @pod
end

#templatesObject (readonly)

Returns the value of attribute templates.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def templates
  @templates
end

#versionObject (readonly)

Returns the value of attribute version.



41
42
43
# File 'lib/reflex/packager/profile.rb', line 41

def version
  @version
end

Instance Method Details

#boot_mainObject



52
53
54
# File 'lib/reflex/packager/profile.rb', line 52

def boot_main()
  @boot ? '__reflex_main__.rb' : nil
end

#bundle_id_prefixObject



60
61
62
# File 'lib/reflex/packager/profile.rb', line 60

def bundle_id_prefix()
  "org.xord.#{pod_key}"
end

#commandObject



44
45
46
# File 'lib/reflex/packager/profile.rb', line 44

def command()
  @command || pod_key
end

#mainObject



48
49
50
# File 'lib/reflex/packager/profile.rb', line 48

def main()
  templates.keys.first
end

#pod_keyObject



56
57
58
# File 'lib/reflex/packager/profile.rb', line 56

def pod_key()
  pod.downcase.to_sym
end