Class: MetaBuild::Helper::AppHelper
- Inherits:
-
Object
- Object
- MetaBuild::Helper::AppHelper
- Defined in:
- lib/meta_build/helper/app_helper.rb
Class Method Summary collapse
- .set_target_name(name = '', source_file) ⇒ Object
- .validate_options(options) ⇒ Object
- .work_dir ⇒ Object
Class Method Details
.set_target_name(name = '', source_file) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/meta_build/helper/app_helper.rb', line 21 def set_target_name(name = '', source_file) name ||= '' if name.empty? name = source_file.split(File::SEPARATOR).last name.sub! /\.\w+\z/, '.json' elsif !name.end_with?('.json') name << '.json' end name end |
.validate_options(options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/meta_build/helper/app_helper.rb', line 7 def () if [:compressed_file].to_s.empty? return "Parameter [-f, --file] is required." elsif !File.exist?([:compressed_file]) return "File denoted by the path '#{[:compressed_file]}' does not exist." end if [:output_dir].to_s.empty? return "Parameter [-o, --output-dir] is required." elsif (!File.exist?([:output_dir])) && ([:create_dir] != true) return "Directory #{[:output_dir]} does not exist. You might want to call this feature with the parameter [-c, --create-dir]" end end |
.work_dir ⇒ Object
34 35 36 |
# File 'lib/meta_build/helper/app_helper.rb', line 34 def work_dir File.join Dir.tmpdir, 'meta-build' end |