Sha256: 61d6d7e4cde79a6d884332512b4050911847403fb8849bd74d77186522751351

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 Bytes

Contents

module Termvana
  class Environment
    include Virtus
    attribute :cwd, String, :default => "~"
    attribute :env, Hash, :default => {}
    def messenger
      @messenger = Proc.new
    end
    def send_message(response)
      @messenger[response]
    end
    def fullpath(path)
      path.gsub("~", home)
    end
    def home
      env['HOME']
    end
    def setup
      Dir.chdir(fullpath(cwd))
    end
    def envs
      my_envs = env.map do |k, v|
        "#{k.upcase}=#{v}"
      end.join(" ")
    end
    def runnable(request)
      "env -i #{envs} #{request.full_command}"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
termvana-0.2.0.beta3 lib/termvana/app/models/environment.rb
termvana-0.2.0.beta2 lib/termvana/app/models/environment.rb
termvana-0.2.0.beta1 lib/termvana/app/models/environment.rb