| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 463893f commit 570e75d
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,6 @@ API objects manipulation | |||
| 16 | 16 | gl_objects/groups | |
| 17 | 17 | gl_objects/issues | |
| 18 | 18 | gl_objects/labels | |
| 19 | - gl_objects/licenses | ||
| 20 | 19 | gl_objects/notifications | |
| 21 | 20 | gl_objects/mrs | |
| 22 | 21 | gl_objects/namespaces | |
@@ -25,6 +24,7 @@ API objects manipulation | |||
| 25 | 24 | gl_objects/runners | |
| 26 | 25 | gl_objects/settings | |
| 27 | 26 | gl_objects/system_hooks | |
| 27 | + gl_objects/templates | ||
| 28 | 28 | gl_objects/todos | |
| 29 | 29 | gl_objects/users | |
| 30 | 30 | gl_objects/sidekiq | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + # license list | ||
| 2 | + licenses = gl.licenses.list() | ||
| 3 | + # end license list | ||
| 4 | + | ||
| 5 | + # license get | ||
| 6 | + license = gl.licenses.get('apache-2.0', project='foobar', fullname='John Doe') | ||
| 7 | + print(license.content) | ||
| 8 | + # end license get | ||
| 9 | + | ||
| 10 | + # gitignore list | ||
| 11 | + gitignores = gl.gitignores.list() | ||
| 12 | + # end gitignore list | ||
| 13 | + | ||
| 14 | + # gitignore get | ||
| 15 | + gitignore = gl.gitignores.get('Python') | ||
| 16 | + print(gitignore.content) | ||
| 17 | + # end gitignore get | ||
| 18 | + | ||
| 19 | + # gitlabciyml list | ||
| 20 | + gitlabciymls = gl.gitlabciymls.list() | ||
| 21 | + # end gitlabciyml list | ||
| 22 | + | ||
| 23 | + # gitlabciyml get | ||
| 24 | + gitlabciyml = gl.gitlabciymls.get('Pelican') | ||
| 25 | + print(gitlabciyml.content) | ||
| 26 | + # end gitlabciyml get | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,72 @@ | |||
| 1 | + ######### | ||
| 2 | + Templates | ||
| 3 | + ######### | ||
| 4 | + | ||
| 5 | + You can request templates for different type of files: | ||
| 6 | + | ||
| 7 | + * License files | ||
| 8 | + * .gitignore files | ||
| 9 | + * GitLab CI configuration files | ||
| 10 | + | ||
| 11 | + License templates | ||
| 12 | + ================= | ||
| 13 | + | ||
| 14 | + * Object class: :class:`~gitlab.objects.License` | ||
| 15 | + * Manager object: :attr:`gitlab.Gitlab.licenses` | ||
| 16 | + | ||
| 17 | + Examples | ||
| 18 | + -------- | ||
| 19 | + | ||
| 20 | + List known license templates: | ||
| 21 | + | ||
| 22 | + .. literalinclude:: templates.py | ||
| 23 | + :start-after: # license list | ||
| 24 | + :end-before: # end license list | ||
| 25 | + | ||
| 26 | + Generate a license content for a project: | ||
| 27 | + | ||
| 28 | + .. literalinclude:: templates.py | ||
| 29 | + :start-after: # license get | ||
| 30 | + :end-before: # end license get | ||
| 31 | + | ||
| 32 | + .gitignore templates | ||
| 33 | + ==================== | ||
| 34 | + | ||
| 35 | + * Object class: :class:`~gitlab.objects.Gitignore` | ||
| 36 | + * Manager object: :attr:`gitlab.Gitlab.gitognores` | ||
| 37 | + | ||
| 38 | + Examples | ||
| 39 | + -------- | ||
| 40 | + | ||
| 41 | + List known gitignore templates: | ||
| 42 | + | ||
| 43 | + .. literalinclude:: templates.py | ||
| 44 | + :start-after: # gitignore list | ||
| 45 | + :end-before: # end gitignore list | ||
| 46 | + | ||
| 47 | + Get a gitignore template: | ||
| 48 | + | ||
| 49 | + .. literalinclude:: templates.py | ||
| 50 | + :start-after: # gitignore get | ||
| 51 | + :end-before: # end gitignore get | ||
| 52 | + | ||
| 53 | + GitLab CI templates | ||
| 54 | + =================== | ||
| 55 | + | ||
| 56 | + * Object class: :class:`~gitlab.objects.Gitlabciyml` | ||
| 57 | + * Manager object: :attr:`gitlab.Gitlab.gitlabciymls` | ||
| 58 | + | ||
| 59 | + Examples | ||
| 60 | + -------- | ||
| 61 | + | ||
| 62 | + List known GitLab CI templates: | ||
| 63 | + | ||
| 64 | + .. literalinclude:: templates.py | ||
| 65 | + :start-after: # gitlabciyml list | ||
| 66 | + :end-before: # end gitlabciyml list | ||
| 67 | + | ||
| 68 | + Get a GitLab CI template: | ||
| 69 | + | ||
| 70 | + .. literalinclude:: templates.py | ||
| 71 | + :start-after: # gitlabciyml get | ||
| 72 | + :end-before: # end gitlabciyml get | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -91,6 +91,8 @@ def __init__(self, url, private_token=None, email=None, password=None, | |||
| 91 | 91 | ||
| 92 | 92 | self.broadcastmessages = BroadcastMessageManager(self) | |
| 93 | 93 | self.keys = KeyManager(self) | |
| 94 | + self.gitlabciymls = GitlabciymlManager(self) | ||
| 95 | + self.gitignores = GitignoreManager(self) | ||
| 94 | 96 | self.groups = GroupManager(self) | |
| 95 | 97 | self.hooks = HookManager(self) | |
| 96 | 98 | self.issues = IssueManager(self) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -811,6 +811,30 @@ class NotificationSettingsManager(BaseManager): | |||
| 811 | 811 | obj_cls = NotificationSettings | |
| 812 | 812 | ||
| 813 | 813 | ||
| 814 | + class Gitignore(GitlabObject): | ||
| 815 | + _url = '/templates/gitignores' | ||
| 816 | + canDelete = False | ||
| 817 | + canUpdate = False | ||
| 818 | + canCreate = False | ||
| 819 | + idAttr = 'name' | ||
| 820 | + | ||
| 821 | + | ||
| 822 | + class GitignoreManager(BaseManager): | ||
| 823 | + obj_cls = Gitignore | ||
| 824 | + | ||
| 825 | + | ||
| 826 | + class Gitlabciyml(GitlabObject): | ||
| 827 | + _url = '/templates/gitlab_ci_ymls' | ||
| 828 | + canDelete = False | ||
| 829 | + canUpdate = False | ||
| 830 | + canCreate = False | ||
| 831 | + idAttr = 'name' | ||
| 832 | + | ||
| 833 | + | ||
| 834 | + class GitlabciymlManager(BaseManager): | ||
| 835 | + obj_cls = Gitlabciyml | ||
| 836 | + | ||
| 837 | + | ||
| 814 | 838 | class GroupIssue(GitlabObject): | |
| 815 | 839 | _url = '/groups/%(group_id)s/issues' | |
| 816 | 840 | canGet = 'from_list' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments