Class: IRPack::Specification
- Inherits:
-
Object
- Object
- IRPack::Specification
- Defined in:
- lib/irpack/specification.rb
Defined Under Namespace
Classes: RuntimeOptions
Instance Attribute Summary collapse
-
#base_paths ⇒ Object
Base paths stripped from files and entry_file.
-
#compress ⇒ Object
True if compress embeded files (default is false).
-
#embed_assemblies ⇒ Object
True if embed IronRuby assemblies (default is true).
-
#embed_stdlibs ⇒ Object
(also: #complete)
True if embed standard libraries (default is true).
-
#entry_file ⇒ Object
Path of entry script.
-
#files ⇒ Object
Array of files to embed, or Hash maps runtime paths to real files.
-
#module_name ⇒ Object
Namespace of entry point.
-
#output_file ⇒ Object
Generated exe file path (default is entry_file replaced extention by ‘.exe’).
-
#runtime_options ⇒ Object
readonly
RuntimeOptions passed to script engine.
-
#target ⇒ Object
Type of generated executable.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Specification
constructor
A new instance of Specification.
-
#map_entry ⇒ Object
Return entry file path at runtime.
-
#map_files ⇒ Object
Map runtime file path to real files.
Constructor Details
#initialize {|_self| ... } ⇒ Specification
Returns a new instance of Specification.
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/irpack/specification.rb', line 124 def initialize @output_file = nil @entry_file = nil @module_name = nil @files = [] @base_paths = [] @compress = false @target = :exe @embed_assemblies = true @embed_stdlibs = false @runtime_options = RuntimeOptions.new yield self if block_given? end |
Instance Attribute Details
#base_paths ⇒ Object
Base paths stripped from files and entry_file.
35 36 37 |
# File 'lib/irpack/specification.rb', line 35 def base_paths @base_paths end |
#compress ⇒ Object
True if compress embeded files (default is false).
39 40 41 |
# File 'lib/irpack/specification.rb', line 39 def compress @compress end |
#embed_assemblies ⇒ Object
True if embed IronRuby assemblies (default is true).
41 42 43 |
# File 'lib/irpack/specification.rb', line 41 def @embed_assemblies end |
#embed_stdlibs ⇒ Object Also known as: complete
True if embed standard libraries (default is true).
43 44 45 |
# File 'lib/irpack/specification.rb', line 43 def @embed_stdlibs end |
#entry_file ⇒ Object
Path of entry script.
31 32 33 |
# File 'lib/irpack/specification.rb', line 31 def entry_file @entry_file end |
#files ⇒ Object
Array of files to embed, or Hash maps runtime paths to real files.
33 34 35 |
# File 'lib/irpack/specification.rb', line 33 def files @files end |
#module_name ⇒ Object
Namespace of entry point.
47 48 49 |
# File 'lib/irpack/specification.rb', line 47 def module_name @module_name end |
#output_file ⇒ Object
Generated exe file path (default is entry_file replaced extention by ‘.exe’).
29 30 31 |
# File 'lib/irpack/specification.rb', line 29 def output_file @output_file end |
#runtime_options ⇒ Object (readonly)
RuntimeOptions passed to script engine.
49 50 51 |
# File 'lib/irpack/specification.rb', line 49 def @runtime_options end |
#target ⇒ Object
Type of generated executable. :exe for console app, :winexe for window app (default is :exe).
37 38 39 |
# File 'lib/irpack/specification.rb', line 37 def target @target end |
Instance Method Details
#map_entry ⇒ Object
Return entry file path at runtime.
139 140 141 142 143 |
# File 'lib/irpack/specification.rb', line 139 def map_entry raise ArgumentError, "No entry file specified" unless @entry_file base_paths = @base_paths.collect {|path| Pathname.new(path). } (strip_path(base_paths, @entry_file) || @entry_file).to_s end |
#map_files ⇒ Object
Map runtime file path to real files.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/irpack/specification.rb', line 146 def map_files file_map = {} entry_file = Pathname.new(map_entry) entry_found = false case @files when Hash @files.each do |path, file| file_map[path.to_s] = File.(file.to_s) entry_found = true if path.to_s==entry_file.to_s end else base_paths = @base_paths.collect {|path| Pathname.new(path). } @files.each do |fn| next unless fn relpath = strip_path(base_paths, fn) || fn file_map[relpath.to_s] = File.(fn.to_s) entry_found = true if relpath==entry_file end end file_map[entry_file.to_s] = File.(@entry_file.to_s) unless entry_found file_map end |