Class: MetaBuild::App
- Inherits:
-
Object
- Object
- MetaBuild::App
- Defined in:
- lib/meta_build/app.rb
Instance Attribute Summary collapse
-
#compressed_file ⇒ Object
readonly
Returns the value of attribute compressed_file.
-
#create_dir ⇒ Object
readonly
Returns the value of attribute create_dir.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#replace_files ⇒ Object
readonly
Returns the value of attribute replace_files.
Instance Method Summary collapse
- #extract_metadata ⇒ Object
-
#initialize(options = {}) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(options = {}) ⇒ App
Returns a new instance of App.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/meta_build/app.rb', line 29 def initialize( = {}) = MetaBuild::Helper::AppHelper. if raise "[ERROR] #{}" end @compressed_file = [:compressed_file] @output_dir = [:output_dir] @name = MetaBuild::Helper::AppHelper.set_target_name([:name], [:compressed_file]) @replace_files = [:replace_files] ||= false @create_dir = [:create_dir] ||= false end |
Instance Attribute Details
#compressed_file ⇒ Object (readonly)
Returns the value of attribute compressed_file.
27 28 29 |
# File 'lib/meta_build/app.rb', line 27 def compressed_file @compressed_file end |
#create_dir ⇒ Object (readonly)
Returns the value of attribute create_dir.
27 28 29 |
# File 'lib/meta_build/app.rb', line 27 def create_dir @create_dir end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/meta_build/app.rb', line 27 def name @name end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
27 28 29 |
# File 'lib/meta_build/app.rb', line 27 def output_dir @output_dir end |
#replace_files ⇒ Object (readonly)
Returns the value of attribute replace_files.
27 28 29 |
# File 'lib/meta_build/app.rb', line 27 def replace_files @replace_files end |
Instance Method Details
#extract_metadata ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/meta_build/app.rb', line 42 def _configure_prerequisites hash = MetaBuild::Builder::MetaBuilder.build file: @compressed_file FileUtils.makedirs @output_dir unless File.exist? @output_dir target_file = File.join(@output_dir, @name) if File.exist?(target_file) && (!@replace_files) puts "[ERROR] The file #{target_file} already exist. You might want to call this feature with the parameter [-r, --replace-file]" exit 1 end File.open(target_file, 'w') { |io| io.write hash.to_json } FileUtils.remove_dir MetaBuild::Helper::AppHelper.work_dir, true end |