builder/extra/tools/ruby-tpm/configurator.rb
def arguments_valid?
    if @options.config == nil
      @options.config = @command.get_default_config_file()
    else
      # Evaluate tildes
      @options.config = cmd_result("echo #{@options.config}")
      
      if @options.config.index("/")
        @options.config=File.expand_path(@options.config)
      else
        profiles_dir = @command.get_profiles_dir()
        if profiles_dir.to_s() != ""
          @options.config = File.expand_path("#{profiles_dir}/#{@options.config}")
        end
      end
    end
    
    if File.exist?(@options.config)
      if ! File.writable?(@options.config)
        write "Config file must be writable: #{@options.config}", Logger::ERROR
        return false
      end
      if ! File.readable?(@options.config) && File.exist?(@options.config)
        write "Config file is not readable: #{@options.config}", Logger::ERROR
        return false
      end
    else
      if ! File.writable?(File.dirname(@options.config))
        write "Config file directory must be writable: #{@options.config}", Logger::ERROR
        return false
      end
      if ! File.readable?(File.dirname(@options.config))
        write "Config file directory must be readable: #{@options.config}", Logger::ERROR
        return false
      end
    end
    
    # Load the current configuration values
    if File.exist?(@options.config)
      @config.load(@options.config)
    end
    
    true
  end
# True if required arguments were provided
True if required arguments were provided
True if required arguments were provided
def arguments_valid?
    if @options.config == nil
      @options.config = @command.get_default_config_file()
    else
      @options.config = cmd_result("echo #{@options.config}")
      if @options.config.index("/")
        @options.config=File.expand_path(@options.config)
      else
        profiles_dir = @command.get_profiles_dir()
        if profiles_dir.to_s() != ""
          @options.config = File.expand_path("#{profiles_dir}/#{@options.config}")
        end
      end
    end
    if File.exist?(@options.config)
      if ! File.writable?(@options.config)
        write "Config file must be writable: #{@options.config}", Logger::ERROR
        return false
      end
      if ! File.readable?(@options.config) && File.exist?(@options.config)
        write "Config file is not readable: #{@options.config}", Logger::ERROR
        return false
      end
    else
      if ! File.writable?(File.dirname(@options.config))
        write "Config file directory must be writable: #{@options.config}", Logger::ERROR
        return false
      end
      if ! File.readable?(File.dirname(@options.config))
        write "Config file directory must be readable: #{@options.config}", Logger::ERROR
        return false
      end
    end
    if File.exist?(@options.config)
      @config.load(@options.config)
    end
    true
  end
def arguments_valid? if @options . config == nil @options . config = @command . get_default_config_file ( ) else @options . config = cmd_result ( "echo #{@options.config}" ) if @options . config . index ( "/" ) @options . config = File . expand_path ( @options . config ) else profiles_dir = @command . get_profiles_dir ( ) if profiles_dir . to_s ( ) != "" @options . config = File . expand_path ( "#{profiles_dir}/#{@options.config}" ) end end end if File . exist? ( @options . config ) if ! File . writable? ( @options . config ) write "Config file must be writable: #{@options.config}" , Logger :: ERROR return false end if ! File . readable? ( @options . config ) && File . exist? ( @options . config ) write "Config file is not readable: #{@options.config}" , Logger :: ERROR return false end else if ! File . writable? ( File . dirname ( @options . config ) ) write "Config file directory must be writable: #{@options.config}" , Logger :: ERROR return false end if ! File . readable? ( File . dirname ( @options . config ) ) write "Config file directory must be readable: #{@options.config}" , Logger :: ERROR return false end end if File . exist? ( @options . config ) @config . load ( @options . config ) end true end
True if required arguments were provided
True if required arguments were provided
# Evaluate tildes # Load the current configuration values