Class: HotCocoa::ApplicationBuilder::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/hotcocoa/application_builder.rb

Overview

TODO:

support CFBundleDocumentTypes

TODO:

support CFBundleShortVersionString

TODO:

support NSHumanReadableCopyright

TODO:

support arbitrary info.plist key/value pairs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Configuration

TODO:

validation (sources should not be an empty array)

Returns a new instance of Configuration.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/hotcocoa/application_builder.rb', line 124

def initialize file
  yml          = YAML.load(File.read(file))
  @name        = yml['name'] # mandatory
  @icon        = yml['icon']
  @identifier  = yml['identifier']  || "com.#{@name}"
  @version     = yml['version']     || '1.0'
  @sources     = yml['sources']     || [] # this should be mandatory?
  @resources   = yml['resources']   || []
  @data_models = yml['data_models'] || []
  @gems        = yml['gems']        || []
  @type        = yml['type']        || 'APPL'
  @signature   = yml['signature']   || '????'
  @overwrite   = yml['overwrite'] == true  ? true  : false
  @agent       = yml['agent']     == true  ? '1'   : '0'
  @stdlib      = yml['stdlib']    == false ? false : true
  @embed_bs    = yml['embed_bs']  == false ? false : true
end

Instance Attribute Details

#agentBoolean (readonly)

Whether the app is an daemon with UI or a regular app

Returns:

  • (Boolean)


64
65
66
# File 'lib/hotcocoa/application_builder.rb', line 64

def agent
  @agent
end

#data_modelsArray<String> (readonly)

Any .xcdatamodel directories to compile and add to the app bundle

Returns:

  • (Array<String>)


77
78
79
# File 'lib/hotcocoa/application_builder.rb', line 77

def data_models
  @data_models
end

#embed_bsBoolean (readonly) Also known as: embed_bs?

Whether or not to embed BridgeSupport files embedding the MacRuby framework

Returns:

  • (Boolean)


113
114
115
# File 'lib/hotcocoa/application_builder.rb', line 113

def embed_bs
  @embed_bs
end

#gemsArray<String> (readonly)

An array of gem names to embed in the app bundle during deployment

Returns:

  • (Array<String>)


106
107
108
# File 'lib/hotcocoa/application_builder.rb', line 106

def gems
  @gems
end

#iconString (readonly)

Path to the icon file

Returns:

  • (String)


44
45
46
# File 'lib/hotcocoa/application_builder.rb', line 44

def icon
  @icon
end

#identifierString (readonly)

Reverse URL unique identifier

Examples:

Identifier for Mail.app


'com.apple.mail'

Returns:

  • (String)


32
33
34
# File 'lib/hotcocoa/application_builder.rb', line 32

def identifier
  @identifier
end

#nameString (readonly)

Name of the app

Returns:

  • (String)


22
23
24
# File 'lib/hotcocoa/application_builder.rb', line 22

def name
  @name
end

#overwriteBoolean (readonly) Also known as: overwrite?

Always make a clean build of the app

Returns:

  • (Boolean)


120
121
122
# File 'lib/hotcocoa/application_builder.rb', line 120

def overwrite
  @overwrite
end

#resourcesArray<String> (readonly)

Globbing patterns describing where to find resources that need to be copied into the app bundle

Returns:

  • (Array<String>)


51
52
53
# File 'lib/hotcocoa/application_builder.rb', line 51

def resources
  @resources
end

#signatureString (readonly)

Four letter code that is a signature of the bundle, defaults to '????' since most apps never set this value

Examples:

TextEdit


'ttxt'

Mail


'emal'

Returns:

  • (String)


99
100
101
# File 'lib/hotcocoa/application_builder.rb', line 99

def signature
  @signature
end

#sourcesArray<String> (readonly)

Globbing patterns describing where to find source code that needs to be copied into the app bundle

Returns:

  • (Array<String>)


58
59
60
# File 'lib/hotcocoa/application_builder.rb', line 58

def sources
  @sources
end

#stdlibBoolean (readonly)

Whether to include the Ruby stdlib in the app

Returns:

  • (Boolean)


70
71
72
# File 'lib/hotcocoa/application_builder.rb', line 70

def stdlib
  @stdlib
end

#typeString (readonly)

Four letter code identifying bundle type, the default value is 'APPL' to specify the bundle is an application

Returns:

  • (String)


84
85
86
# File 'lib/hotcocoa/application_builder.rb', line 84

def type
  @type
end

#versionString (readonly)

Version of the app

Returns:

  • (String)


38
39
40
# File 'lib/hotcocoa/application_builder.rb', line 38

def version
  @version
end

Instance Method Details

#icon_exists?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/hotcocoa/application_builder.rb', line 142

def icon_exists?
  @icon ? File.exist?(@icon) : false
end