mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 06:51:17 +07:00
#RUBY-17510 support of github RailsApp Samples in RubyMine and IDEA
This commit is contained in:
+19
-1
@@ -21,6 +21,7 @@ import java.util.concurrent.Callable;
|
||||
* @author Sergey Simonchik
|
||||
*/
|
||||
public class GithubDownloadUtil {
|
||||
private static final String PROJECT_GENERATORS = "projectGenerators";
|
||||
|
||||
private GithubDownloadUtil() {}
|
||||
|
||||
@@ -29,9 +30,14 @@ public class GithubDownloadUtil {
|
||||
return "github-" + userName + "-" + repositoryName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String formatGithubUserName(@NotNull String userName) {
|
||||
return "github-" + userName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getCacheDir(@NotNull String userName, @NotNull String repositoryName) {
|
||||
File generatorsDir = new File(PathManager.getSystemPath(), "projectGenerators");
|
||||
File generatorsDir = new File(PathManager.getSystemPath(), PROJECT_GENERATORS);
|
||||
String dirName = formatGithubRepositoryName(userName, repositoryName);
|
||||
File dir = new File(generatorsDir, dirName);
|
||||
try {
|
||||
@@ -41,6 +47,18 @@ public class GithubDownloadUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getUserCacheDir(@NotNull String userName) {
|
||||
File generatorsDir = new File(PathManager.getSystemPath(), PROJECT_GENERATORS);
|
||||
String dirName = formatGithubUserName(userName);
|
||||
File dir = new File(generatorsDir, dirName);
|
||||
try {
|
||||
return dir.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
public static File findCacheFile(@NotNull String userName, @NotNull String repositoryName, @NotNull String cacheFileName) {
|
||||
File dir = getCacheDir(userName, repositoryName);
|
||||
return new File(dir, cacheFileName);
|
||||
|
||||
Reference in New Issue
Block a user