File indexing completed on 2024-04-28 08:27:00
0001 /* 0002 * This file is part of KDevelop 0003 * 0004 * Copyright 2007-2010 Alexander Dymo <adymo@kdevelop.org> 0005 * Copyright (C) 2014-2015 Miquel Sabaté Solà <mikisabate@gmail.com> 0006 * 0007 * This program is free software; you can redistribute it and/or modify 0008 * it under the terms of the GNU Library General Public License as 0009 * published by the Free Software Foundation; either version 2 of the 0010 * License, or (at your option) any later version. 0011 * 0012 * This program is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 * GNU General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU General Public 0018 * License along with this program; if not, write to the 0019 * Free Software Foundation, Inc., 0020 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0021 */ 0022 0023 #ifndef RAILS_HELPERS_H 0024 #define RAILS_HELPERS_H 0025 0026 #include <rails/export.h> 0027 #include <util/path.h> 0028 0029 namespace ruby { 0030 namespace rails { 0031 0032 /** 0033 * @class Helpers 0034 * 0035 * This class contains common utilities for all the code across the 0036 * Rails namespace. 0037 */ 0038 class KDEVRUBYRAILS_EXPORT Helpers 0039 { 0040 public: 0041 /** 0042 * Finds the root directory of the Rails application. Not all the paths are 0043 * being looked up by this method, only the ones that the different 0044 * switchers might use: controllers, models, views and tests. 0045 * 0046 * @param url The current file or directory that is included inside a 0047 * Rails application. 0048 * @returns an invalid Path if an error has been found. Otherwise this 0049 * method returns a valid Path that points to the root of the Rails 0050 * application. 0051 */ 0052 static KDevelop::Path findRailsRoot(const QUrl &url); 0053 }; 0054 0055 } 0056 } 0057 0058 #endif // RAILS_HELPERS_H 0059