class MetaBuild::Helper::AppHelper

Public Class Methods

set_target_name(name = '', source_file) click to toggle source
# 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) click to toggle source
# File lib/meta_build/helper/app_helper.rb, line 7
def validate_options(options)
  if options[:compressed_file].to_s.empty?
    return "Parameter [-f, --file] is required."
  elsif !File.exist?(options[:compressed_file])
    return "File denoted by the path '#{options[:compressed_file]}' does not exist."
  end

  if options[:output_dir].to_s.empty?
    return "Parameter [-o, --output-dir] is required."
  elsif (!File.exist?(options[:output_dir])) && (options[:create_dir] != true)
    return "Directory #{options[:output_dir]} does not exist. You might want to call this feature with the parameter [-c, --create-dir]"
  end
end
work_dir() click to toggle source
# File lib/meta_build/helper/app_helper.rb, line 34
def work_dir
  File.join Dir.tmpdir, 'meta-build'
end