Class: Application::Builder
- Inherits:
-
Object
- Object
- Application::Builder
- Defined in:
- lib/hotcocoa/application/builder.rb
Overview
This class is responsible for building application bundles, but could theoretically be used to build other bundles, such as frameworks, with only a few changes.
It is designed to work in conjunction with an Specification object which would provide details on how to build the bundle.
Instance Attribute Summary (collapse)
-
- (Application::Specification) spec
readonly
Cached spec.
Class Method Summary (collapse)
-
+ (Object) build(spec, opts = {})
Build an application from a specification, optionally for deployment.
Instance Method Summary (collapse)
- - (Object) build(opts = {})
-
- (Builder) initialize(spec)
constructor
A new instance of Builder.
-
- (Object) remove_bundle_root
Destroy the existing bundle, if it exists.
-
- (Object) run
Run the bundle's binary directly so
STDOUTandSTDERRappear in the terminal.
Constructor Details
- (Builder) initialize(spec)
A new instance of Builder
35 36 37 38 39 40 41 42 |
# File 'lib/hotcocoa/application/builder.rb', line 35 def initialize spec @spec = case spec when Specification spec when String Specification.load spec end end |
Instance Attribute Details
- (Application::Specification) spec (readonly)
Cached spec.
32 33 34 |
# File 'lib/hotcocoa/application/builder.rb', line 32 def spec @spec end |
Class Method Details
+ (Object) build(spec, opts = {})
Build an application from a specification, optionally for deployment.
24 25 26 |
# File 'lib/hotcocoa/application/builder.rb', line 24 def self.build spec, opts = {} new(spec).build(opts) end |
Instance Method Details
- (Object) build(opts = {})
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/hotcocoa/application/builder.rb', line 46 def build opts = {} if spec.overwrite? || opts[:deploy] # Deploying always makes a fresh build remove_bundle_root end build_bundle_structure write_bundle_files copy_sources copy_resources compile_data_models copy_icon_file if spec.icon_exists? deploy if opts[:deploy] end |
- (Object) remove_bundle_root
Destroy the existing bundle, if it exists.
68 69 70 |
# File 'lib/hotcocoa/application/builder.rb', line 68 def remove_bundle_root FileUtils.rm_rf bundle_root if File.exist?(bundle_root) end |
- (Object) run
Run the bundle's binary directly so STDOUT and STDERR appear in the
terminal.
62 63 64 |
# File 'lib/hotcocoa/application/builder.rb', line 62 def run `"./#{executable_file}"` end |