Sha256: 15109c64acaef694ad642b0611bf0289d42449df880908588bcd131756a9e709

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Roll

  # This script builds a list of all roll-ready bin locations
  # and writes that list as an environment setting shell script.
  # On Linux a call to this to you .bashrc file. Eg.
  #
  #   if [ -f ~/.rollrc ]; then
  #       . roll
  #   fi
  #
  # Currently this only supports bash.
  #
  # TODO: It would be better to "install" executables
  # to an appropriate bin dir, using links (soft if possible).
  # There could go in ~/.bin or .config/roll/<ledger>.bin/
  #
  class CommandPath < Command

    #
    def setup
      op.banner = "Usage: roll path"
      op.separator "Generate executable PATH list."
    end

    #
    def call
      case RUBY_PLATFORM
      when /mswin/, /wince/
        div = ';'
      else
        div = ':'
      end
      env_path = ENV['PATH'].split(/[#{div}]/)
      # Go thru each roll lib and make sure bin path is in path.
      binpaths = []
      Library.list.each do |name|
        lib = Library[name]
        if lib.bindir?
          binpaths << lib.bindir
        end
      end
      #pathenv = (["$PATH"] + binpaths).join(div)
      pathenv = binpaths.join(div)
      #puts %{export PATH="#{pathenv}"}
      puts pathenv
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roll-1.2.0 lib/roll/commands/path.rb