Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

README.md 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # hosted-git-info
  2. This will let you identify and transform various git hosts URLs between
  3. protocols. It also can tell you what the URL is for the raw path for
  4. particular file for direct access without git.
  5. ## Example
  6. ```javascript
  7. var hostedGitInfo = require("hosted-git-info")
  8. var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git", opts)
  9. /* info looks like:
  10. {
  11. type: "github",
  12. domain: "github.com",
  13. user: "npm",
  14. project: "hosted-git-info"
  15. }
  16. */
  17. ```
  18. If the URL can't be matched with a git host, `null` will be returned. We
  19. can match git, ssh and https urls. Additionally, we can match ssh connect
  20. strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
  21. `github:npm/hosted-git-info`). GitHub specifically, is detected in the case
  22. of a third, unprefixed, form: `npm/hosted-git-info`.
  23. If it does match, the returned object has properties of:
  24. * info.type -- The short name of the service
  25. * info.domain -- The domain for git protocol use
  26. * info.user -- The name of the user/org on the git host
  27. * info.project -- The name of the project on the git host
  28. ## Version Contract
  29. The major version will be bumped any time…
  30. * The constructor stops accepting URLs that it previously accepted.
  31. * A method is removed.
  32. * A method can no longer accept the number and type of arguments it previously accepted.
  33. * A method can return a different type than it currently returns.
  34. Implications:
  35. * I do not consider the specific format of the urls returned from, say
  36. `.https()` to be a part of the contract. The contract is that it will
  37. return a string that can be used to fetch the repo via HTTPS. But what
  38. that string looks like, specifically, can change.
  39. * Dropping support for a hosted git provider would constitute a breaking
  40. change.
  41. ## Usage
  42. ### var info = hostedGitInfo.fromUrl(gitSpecifier[, options])
  43. * *gitSpecifer* is a URL of a git repository or a SCP-style specifier of one.
  44. * *options* is an optional object. It can have the following properties:
  45. * *noCommittish* — If true then committishes won't be included in generated URLs.
  46. * *noGitPlus* — If true then `git+` won't be prefixed on URLs.
  47. ## Methods
  48. All of the methods take the same options as the `fromUrl` factory. Options
  49. provided to a method override those provided to the constructor.
  50. * info.file(path, opts)
  51. Given the path of a file relative to the repository, returns a URL for
  52. directly fetching it from the githost. If no committish was set then
  53. `master` will be used as the default.
  54. For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
  55. would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
  56. * info.shortcut(opts)
  57. eg, `github:npm/hosted-git-info`
  58. * info.browse(path, fragment, opts)
  59. eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`,
  60. `https://github.com/npm/hosted-git-info/tree/v1.2.0/package.json`,
  61. `https://github.com/npm/hosted-git-info/tree/v1.2.0/REAMDE.md#supported-hosts`
  62. * info.bugs(opts)
  63. eg, `https://github.com/npm/hosted-git-info/issues`
  64. * info.docs(opts)
  65. eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
  66. * info.https(opts)
  67. eg, `git+https://github.com/npm/hosted-git-info.git`
  68. * info.sshurl(opts)
  69. eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
  70. * info.ssh(opts)
  71. eg, `git@github.com:npm/hosted-git-info.git`
  72. * info.path(opts)
  73. eg, `npm/hosted-git-info`
  74. * info.tarball(opts)
  75. eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz`
  76. * info.getDefaultRepresentation()
  77. Returns the default output type. The default output type is based on the
  78. string you passed in to be parsed
  79. * info.toString(opts)
  80. Uses the getDefaultRepresentation to call one of the other methods to get a URL for
  81. this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
  82. you a normalized version of the URL that still uses the same protocol.
  83. Shortcuts will still be returned as shortcuts, but the special case github
  84. form of `org/project` will be normalized to `github:org/project`.
  85. SSH connect strings will be normalized into `git+ssh` URLs.
  86. ## Supported hosts
  87. Currently this supports GitHub, Bitbucket and GitLab. Pull requests for
  88. additional hosts welcome.