You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Constants.java 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright 2011 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit;
  17. public class Constants {
  18. public final static String NAME = "Gitblit";
  19. public final static String FULL_NAME = "Gitblit - a pure Java Git solution";
  20. // The build script extracts this exact line so be careful editing it
  21. // and only use A-Z a-z 0-9 .-_ in the string.
  22. public final static String VERSION = "0.1.0-SNAPSHOT";
  23. // The build script extracts this exact line so be careful editing it
  24. // and only use A-Z a-z 0-9 .-_ in the string.
  25. public final static String JGIT_VERSION = "JGit 0.12.1";
  26. public final static String ADMIN_ROLE = "#admin";
  27. public final static String PROPERTIES_FILE = "gitblit.properties";
  28. public final static String GIT_SERVLET_PATH = "/git/";
  29. public final static String ZIP_SERVLET_PATH = "/zip/";
  30. public static enum AccessRestrictionType {
  31. NONE, PUSH, CLONE, VIEW;
  32. public static AccessRestrictionType fromName(String name) {
  33. for (AccessRestrictionType type : values()) {
  34. if (type.name().equalsIgnoreCase(name)) {
  35. return type;
  36. }
  37. }
  38. return NONE;
  39. }
  40. public boolean exceeds(AccessRestrictionType type) {
  41. return this.ordinal() > type.ordinal();
  42. }
  43. public boolean atLeast(AccessRestrictionType type) {
  44. return this.ordinal() >= type.ordinal();
  45. }
  46. public String toString() {
  47. return name();
  48. }
  49. }
  50. public static String getGitBlitVersion() {
  51. return NAME + " v" + VERSION;
  52. }
  53. public static String getJGitVersion() {
  54. return JGIT_VERSION;
  55. }
  56. public static String getRunningVersion() {
  57. return getGitBlitVersion();
  58. }
  59. }