Class: RailsInfo::System::DirectoriesController

Inherits:
RailsInfoController
  • Object
show all
Defined in:
app/controllers/rails_info/system/directories_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
# File 'app/controllers/rails_info/system/directories_controller.rb', line 4

def index
  commands = []
  
  commands << "cd #{params[:parent_directory]}"  if params[:parent_directory].present?
  commands << "ls -d */"
  
  respond_with IO.popen(commands.join(' && ')).readlines.map{|d| d.strip.gsub('/', '')}
end