Sha256: bbdb89d87617e6ff7b69aeb1fd05dbc3c85882f3e4e586dfb1dafd9d7ec78a25

Contents?: true

Size: 603 Bytes

Versions: 4

Compression:

Stored size: 603 Bytes

Contents

require 'damagecontrol/directories'

class FilesController < ApplicationController

  def list
    load_project
    
    root = @project.checkout_dir
    relative_path = @params['path']
    absolute_path = relative_path ? "#{root}/#{relative_path}" : root
    if(File.file?(absolute_path))
      # TODO: use http://rubyforge.org/projects/syntax/
      # TODO: the file contents should be rendered within the regular layout
      render_text(File.open(absolute_path).read)
    else
      @relative_paths = Dir["#{absolute_path}/*"].collect {|f| f[root.length+1..-1]}
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
damagecontrol-0.5.0.1391 app/controllers/files_controller.rb
damagecontrol-0.5.0.1392 app/controllers/files_controller.rb
damagecontrol-0.5.0.1393 app/controllers/files_controller.rb
damagecontrol-0.5.0.1404 app/controllers/files_controller.rb