Class: HotCocoa::ApplicationBuilder
- Defined in:
- lib/hotcocoa/application_builder.rb
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#config ⇒ HotCocoa::ApplicationBuilder::Configuration
The cached app configuration options.
- #data_models ⇒ Array<String>
-
#deploy ⇒ Boolean
(also: #deploy?)
Whether or not to build the app bundle for deployment by calling
macruby_deploy
on the generated app bundle. - #resources ⇒ Array<String>
- #sources ⇒ Array<String>
Class Method Summary collapse
Instance Method Summary collapse
- #add_data_model(model) ⇒ Object
- #add_resource_path(resource_file_pattern) ⇒ Object
- #add_source_path(source_file_pattern) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ ApplicationBuilder
constructor
A new instance of ApplicationBuilder.
Constructor Details
#initialize ⇒ ApplicationBuilder
Returns a new instance of ApplicationBuilder.
186 187 188 189 190 |
# File 'lib/hotcocoa/application_builder.rb', line 186 def initialize @sources = [] @resources = [] @data_models = [] end |
Instance Attribute Details
#config ⇒ HotCocoa::ApplicationBuilder::Configuration
The cached app configuration options
151 152 153 |
# File 'lib/hotcocoa/application_builder.rb', line 151 def config @config end |
#data_models ⇒ Array<String>
168 169 170 |
# File 'lib/hotcocoa/application_builder.rb', line 168 def data_models @data_models end |
#deploy ⇒ Boolean Also known as: deploy?
Whether or not to build the app bundle for deployment by calling
macruby_deploy
on the generated app bundle
158 159 160 |
# File 'lib/hotcocoa/application_builder.rb', line 158 def deploy @deploy end |
#resources ⇒ Array<String>
165 166 167 |
# File 'lib/hotcocoa/application_builder.rb', line 165 def resources @resources end |
#sources ⇒ Array<String>
162 163 164 |
# File 'lib/hotcocoa/application_builder.rb', line 162 def sources @sources end |
Class Method Details
.build(config, opts = {}) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/hotcocoa/application_builder.rb', line 170 def self.build config, opts = {} = { deploy: false }.merge opts builder = new builder.config = config builder.deploy = [:deploy] config.sources.each { |source| builder.add_source_path(source) } config.resources.each { |resource| builder.add_resource_path(resource) } config.data_models.each do |data| builder.add_data_model(data) if File.extname(data) == '.xcdatamodel' end builder.build end |
Instance Method Details
#add_data_model(model) ⇒ Object
215 216 217 218 219 |
# File 'lib/hotcocoa/application_builder.rb', line 215 def add_data_model model Dir.glob(model).each do |data| data_models << data end end |
#add_resource_path(resource_file_pattern) ⇒ Object
209 210 211 212 213 |
# File 'lib/hotcocoa/application_builder.rb', line 209 def add_resource_path resource_file_pattern Dir.glob(resource_file_pattern).each do |resource_file| resources << resource_file end end |
#add_source_path(source_file_pattern) ⇒ Object
203 204 205 206 207 |
# File 'lib/hotcocoa/application_builder.rb', line 203 def add_source_path source_file_pattern Dir.glob(source_file_pattern).each do |source_file| sources << source_file end end |
#build ⇒ Object
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/hotcocoa/application_builder.rb', line 192 def build check_for_bundle_root build_bundle_structure write_bundle_files copy_sources copy_resources compile_data_models if deploy? copy_icon_file if config.icon_exists? end |