pax_global_header00006660000000000000000000000064134110742750014516gustar00rootroot0000000000000052 comment=96587c91888e20457c2cceea23eacc4f97385c57 gitlab-4.8.0/000077500000000000000000000000001341107427500127715ustar00rootroot00000000000000gitlab-4.8.0/.dockerignore000066400000000000000000000000751341107427500154470ustar00rootroot00000000000000.git Gemfile.lock Dockerfile docker-compose.yml *.gem deploy gitlab-4.8.0/.github/000077500000000000000000000000001341107427500143315ustar00rootroot00000000000000gitlab-4.8.0/.github/stale.yml000066400000000000000000000013041341107427500161620ustar00rootroot00000000000000# Number of days of inactivity before an issue becomes stale daysUntilStale: 90 # Number of days of inactivity before a stale issue is closed daysUntilClose: 10 # Issues with these labels will never be considered stale exemptLabels: - pinned - security - contribution welcome # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false gitlab-4.8.0/.gitignore000066400000000000000000000003171341107427500147620ustar00rootroot00000000000000*.gem *.rbc *.swp .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp vendor/bundle .idea .ruby-version .ruby-gemset gitlab-4.8.0/.rubocop.yml000066400000000000000000000010121341107427500152350ustar00rootroot00000000000000--- inherit_from: .rubocop_todo.yml AllCops: TargetRubyVersion: 2.3 Metrics/LineLength: Max: 125 Exclude: - 'lib/gitlab/client/*' - 'spec/**/*' Metrics/BlockLength: Exclude: - 'spec/**/*' Style/Documentation: Enabled: false Style/ClassAndModuleChildren: Exclude: - 'lib/gitlab/*' - 'lib/gitlab/client/*' Style/FrozenStringLiteralComment: Exclude: - 'spec/gitlab/file_response_spec.rb' - 'spec/gitlab/help_spec.rb' Style/SpecialGlobalVars: Exclude: - 'gitlab.gemspec' gitlab-4.8.0/.rubocop_todo.yml000066400000000000000000000021141341107427500162660ustar00rootroot00000000000000# This configuration was generated by # `rubocop --auto-gen-config` # on 2018-10-10 10:25:27 +0400 using RuboCop version 0.59.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 1 Lint/UriEscapeUnescape: Exclude: - 'lib/gitlab/client.rb' # Offense count: 5 Metrics/AbcSize: Max: 34 # Offense count: 4 Metrics/CyclomaticComplexity: Max: 14 # Offense count: 10 # Configuration parameters: CountComments, ExcludedMethods. Metrics/MethodLength: Max: 34 # Offense count: 2 # Configuration parameters: CountComments. Metrics/ModuleLength: Max: 165 # Offense count: 2 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: Max: 6 # Offense count: 1 Metrics/PerceivedComplexity: Max: 10 # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect. Security/JSONLoad: Exclude: - 'lib/gitlab/request.rb' gitlab-4.8.0/.travis.yml000066400000000000000000000002221341107427500150760ustar00rootroot00000000000000--- language: ruby rvm: - 2.3 - 2.4 - 2.5 - 2.6 jobs: include: - stage: lint rvm: 2.3 script: bundle exec rake rubocop gitlab-4.8.0/CHANGELOG.md000066400000000000000000000672551341107427500146210ustar00rootroot00000000000000## CHANGELOG ### Newer releases Please see: https://github.com/NARKOZ/gitlab/releases ### 4.2.0 (13/07/2017) - Use `url_encode` in all `Commit` resources (@grodowski) - Fix `project_search` path for APIv4 (@edaubert) - Add options to `Labels#create_label` (@hlidotbe) - Add `Board` API support (@hlidotbe) - `Award Emoji` API (@akkee) - Subscribe and unsubscribe actions for labels (@akkee) - Add `options` hash to `add_hook` method (@mltsy) - Update repository files endpoint APIv4 (@mltsy) - Update `Branch` docs and add `options` param to `protect_branch` (@mltsy) - Fix and clarify `edit_project` option docs (@mltsy) - Add `TODO` API (@akkee) - Use `body` parameter to send POST data (@sr189) - Add `Environments` module (@mltsy) - Edit and Delete methods for `Notes` API (@akkee) - Rename `branch_name` parameter to `branch` in `create_branch` & `create_commit` methods (@sr189) ### 4.1.0 (26/05/2017) - Add appropriate Content-Type header (@mltsy) - Add `Jobs` endpoint methods (@hjanuschka) - Update `BuildTriggers` to v4 API and rename to `PipelineTriggers`. (@IgnoredAmbience) - Add support for `keys` resource (@dirker) - Remove version-lock for terminal-table (@SuperTux88) ### 4.0.0 (10/04/2017) - Adds ability to create commits in a repository - (@logicminds) - Remove Ruby 1.x support from the project - (@orta) - Add `star_project` and `unstar_project` methods. (@connorshea) - Lock terminal-table to prevent build failures on Ruby 1.9/2.0. (@connorshea) - Update documentation to link to docs.gitlab.com instead of the GitHub mirror for GitLab CE. (@connorshea) - Add method `share_project_with_group` (@danhalligan) - Allow to retrieve `ssh_keys` for a specific user(@dirker) - Allow issues to use NAMESPACE/REPO identifier (@brodock) - Add issues subscribe/unsubscribe (@newellista) - Add merge_requests subscribe/unsubscribe (@newellista) - Updated `deploy_key` endpoints (@epintozzi) - Add milestone/merge_requests (API V4 only) (@joren) - Rename "git hook" to "push rule". (@asedge) - Change project fork endpoint for v4 API. (@asedge) - Block/unblock user now uses POST instead of PUT. (@asedge) - Project ID can also be a string (namespace/project_name). (@bergholdt) - Support pipeline. (@bergholdt) - Add methods to disable and enable deploy keys on projects. (@buzzdeee) - Add method to fetch issues a merge request will close. (@joren) - Fix `get_file` and `file_contents` methods to work with APIv4. (@asedge) ### 3.7.0 (16/08/2016) - Add in GitlabCI Runner support (@davidcollum) - Implemented tags API methods (@jblackman) - Expose response status when Gitlab raises an error. (@calavera) - Add `build_artifacts` method (@nanofi) - Add `user_search` method (@Dreeg) - Added project git hook support (@liger1978) - Add the ability to delete an issue (@dandunckelman) - Add missing Build APIs (@edgemaster) - Improve record table output to use Hash `id` field if it exists. (@asedge) - Support for listing merge request notes (@dlukman) - Update YARD so it can be formatted easier for the CLI. (@asedge) - Add `options` to `build` method (@sanderhahn) - Add `delete_group` method (@shadeslayer) - Add `group_projects` method (@shadeslayer) - Add `edit_merge_request_comment` (@hjanuschka) - Add `merge_request_commits` method (@nomeaning777) - Add method `edit_group_member` (@coder-hugo) - New builds endpoints (@kmarcisz) - Use `respond_to_missing?` instead of `respond_to?` (@tsigo) - Added possibility to change emails of user (@azomazo) - Added possibility to change services in the project (@azomazo) - Update README.md (@walterheck) ### 3.6.1 (13/12/2015) - Fixed CLI output for collections ### 3.6.0 (11/12/2015) - Improved output of the CLI help (@thomasdarimont) - Added `search_projects` alias for `project_search` method - Added pagination and auto pagination support (@nanofi) ### 3.5.0 (26/11/2015) - [a4f2150](https://github.com/NARKOZ/gitlab/commit/a4f21504a7288caace5b7433b49f49dc31e32b30) Add support for namespaces endpoint - [3ad81a1](https://github.com/NARKOZ/gitlab/commit/3ad81a19a10b35ea422c0abcf08e6d03a325f4cd) Add missing "@" in doc. (@asedge) - [fc34acb](https://github.com/NARKOZ/gitlab/commit/fc34acb6b475bb2555e4b035c11fdf42b3db4085) Add Gitlab::Client::Commits and rearrange methods and tests related to commits. (@asedge) - [527089b](https://github.com/NARKOZ/gitlab/commit/527089b17fa7ed74a39b30dc6e8bb33482c1044b) Add commit status API, was added in Gitlab 8.1 (@dsander) - [0a2f1db](https://github.com/NARKOZ/gitlab/commit/0a2f1dbe3efb66511dc836ef0ef884efedd70ef3) Add --json CLI parameter to output results as JSON - [3f9cb62](https://github.com/NARKOZ/gitlab/commit/3f9cb625517c7294652139f2748e4bc7b98848cc) Adding sudo option for when forking a project (@gregoriomelo) - [8dd964e](https://github.com/NARKOZ/gitlab/commit/8dd964ee743e051fade3137d8fac9bb387770150) Fix CLI configuration example comment line width to <= 80. (@asedge) - [bbb8b61](https://github.com/NARKOZ/gitlab/commit/bbb8b61db46b32b8649956cb81d9a41e132493d4) Add comment for CLI configuration example. (@asedge) - [30e96b9](https://github.com/NARKOZ/gitlab/commit/30e96b9444f7d60d4c0a56f57202c609497126eb) Update README.md (@raine) - [d81f05b](https://github.com/NARKOZ/gitlab/commit/d81f05b80b7aaccef49641acfada3b2181f1633d) Change #handle_error method so it handles errors that are returned as an Array. (@asedge) - [4c0395e](https://github.com/NARKOZ/gitlab/commit/4c0395ebc58c5a907489b6dc9dcac151e07b4dc8) Add Unprocessable error handler (@ondra-m) - [3179bed](https://github.com/NARKOZ/gitlab/commit/3179bedc498b6c5577cc3c0b04633f67eb286ea9) Add block/unblock user. This API feature was added in GitLab 7.13 (@azomazo) - [9946c7d](https://github.com/NARKOZ/gitlab/commit/9946c7d2a2c4261cbfc9c4a492b079c79abc2767) Check for specific exceptions in tests to suppress rspec warnings. (@asedge) - [5e1c025](https://github.com/NARKOZ/gitlab/commit/5e1c025b8fdf723770c7c7ac0116acdf5cc9f2d5) Added support description option in create_group method (@azomazo) - [46b657e](https://github.com/NARKOZ/gitlab/commit/46b657e47a29bc18f4122fff593a9eb58b73e4f1) deleting a gitlab project returns the string "true" (@tosmi) - [cc3b489](https://github.com/NARKOZ/gitlab/commit/cc3b489cdeb3bd18b4ec841f80e76e74ddd0ce37) add development scripts (@NARKOZ) - [24ad7fd](https://github.com/NARKOZ/gitlab/commit/24ad7fd2a1bd99eb468f1181d95c75fbec5d8fe0) Added specs edit_project, create_fork, create_user_with_username (@p404) - [42e73a2](https://github.com/NARKOZ/gitlab/commit/42e73a2fde3e64dc8e3cf0ec73b8cfad88e43ca8) Added edit_project method to Projects module && updated the create_user method (@p404) - [c9822f1](https://github.com/NARKOZ/gitlab/commit/c9822f1b61a8d7a5e855616e80e725730340cd48) Refactor create_user method (@p404) - [6d7c4e7](https://github.com/NARKOZ/gitlab/commit/6d7c4e7c3285ee082513b3125346e6ed9c18b24b) Added create_fork method to Projects module (@p404) - [54155b6](https://github.com/NARKOZ/gitlab/commit/54155b6c59d6e307744668cb3592ca98cf11d8f2) Add snippet_content method + tests. (@asedge) - [cfff385](https://github.com/NARKOZ/gitlab/commit/cfff385b7f528223bf9ddc5f4177883e5ca56492) Remove executable permission on fixture file. (@asedge) - [487a372](https://github.com/NARKOZ/gitlab/commit/487a372f7041d104975570747a63c9021881c952) Add RepositoryFiles#get_file method. (@asedge) - [c9c05ad](https://github.com/NARKOZ/gitlab/commit/c9c05adee50828cc2e31048006cc95b5f2b9b7ce) Hide auth_token method from CLI/shell. (@asedge) - [ef408a7](https://github.com/NARKOZ/gitlab/commit/ef408a7de0e677a568a66dbf212139aafc2e6186) Remove unnecessary require. (@asedge) - [a2752d1](https://github.com/NARKOZ/gitlab/commit/a2752d1f5a01759a85d1e2003bb81c8e59cf85d3) Add some missing examples. (@asedge) - [ac595af](https://github.com/NARKOZ/gitlab/commit/ac595af15a07601b3b657d4b4c1c479651aaa7d7) Add group_search method. (@asedge) - [53a6671](https://github.com/NARKOZ/gitlab/commit/53a667184ed3640aefcb3f67836d37f58a504f24) Added Users#delete_user method (@cthulhu666) - [a2360f0](https://github.com/NARKOZ/gitlab/commit/a2360f08019632c2660dbbc6753bd3094286b993) Add httparty ENV variable for CLI. Fixes #127. (@asedge) ### 3.4.0 (22/04/2015) - [9acb83d](https://github.com/NARKOZ/gitlab/commit/9acb83d2d068720b07934f5152313dc22a2f6374) remove check for missing attributes - [8896e2b](https://github.com/NARKOZ/gitlab/commit/8896e2b7d5e8df509d48a411fd4440e27ed13995) return false when response body is empty - [a04f3af](https://github.com/NARKOZ/gitlab/commit/a04f3af2d7aa8eec60c4f044fdb148e45c1ca133) escape ref parameter for repo_file_contents - [8dcfec5](https://github.com/NARKOZ/gitlab/commit/8dcfec5aaaff9ef1c12687c5f9ca90f6aed0f912) Add tests for project_search. (@asedge) - [75ead81](https://github.com/NARKOZ/gitlab/commit/75ead813b4335bab2464b6af0fb776c3d746242f) Added :page and :per_page query options to snippet_notes method (@StephenOTT) - [f9818cb](https://github.com/NARKOZ/gitlab/commit/f9818cb121c8eeb9197e66732fec30ab90deecad) Added :page and :per_page query options to issue_notes method (@StephenOTT) - [f92d745](https://github.com/NARKOZ/gitlab/commit/f92d745f1f561955d8fcbed4e23b43bb92ace255) Added :page and :per_page query options to notes method (@StephenOTT) - [d4c3f20](https://github.com/NARKOZ/gitlab/commit/d4c3f2052c844486cf2b99a5346af4cd3fc001c9) Add support for merge_request_changes (@dsander) - [2253fba](https://github.com/NARKOZ/gitlab/commit/2253fbab0a915d23f30de04a90167a0c783f9a6b) Allow authenticating via oauth with the private_token (@dsander) - [8b7bcb4](https://github.com/NARKOZ/gitlab/commit/8b7bcb478e168f5ce2c94b8633b33128c29252b9) add inspect method to ObjectifiedHash - [257737c](https://github.com/NARKOZ/gitlab/commit/257737c80ca93a71dfb5f8d990e5de1423603dfc) add delete_branch (@marc-ta) - [f6532d5](https://github.com/NARKOZ/gitlab/commit/f6532d5074e0bb0d06bc251fb43b73f49a7af17a) improve docs - [5164e6d](https://github.com/NARKOZ/gitlab/commit/5164e6de544bc34c57c3444e0b63cf3aada23776) Adding options hash to milestone_issues method. - [57fa92d](https://github.com/NARKOZ/gitlab/commit/57fa92d7eef96e84498fa005e7ab83abc2a41a2b) Added support to get milestone issues. (@pbendersky) - [d604e58](https://github.com/NARKOZ/gitlab/commit/d604e58732ea08fb15acdc1be339535e34e68d73) Add create_merge_request_note - [cea19b8](https://github.com/NARKOZ/gitlab/commit/cea19b8e607033700dcab4648c05ac398cfe9566) Add project_search method (@ey3ball) - [d0ebd3b](https://github.com/NARKOZ/gitlab/commit/d0ebd3b3a0ed83fc62d2a2e22ba9aa29a99cdcb6) Catch SIGINT earlier during shell session. Fixes #111. (@asedge) - [2133562](https://github.com/NARKOZ/gitlab/commit/21335623009553197b61826d9894a739de152665) Redo the actions_table to make it more readable. CLI can now display the same help as the Shell. Closes #106. (@asedge) - [da18909](https://github.com/NARKOZ/gitlab/commit/da1890949fb9eb60c13ab670dd8428d27de1814b) Add some method documentation and small style fixes. (@asedge) - [7e1b408](https://github.com/NARKOZ/gitlab/commit/7e1b408e48152df1ce6e2be74a653c3801a37c10) Authenticate via oauth an auth_token (@dsander) - [adb28b3](https://github.com/NARKOZ/gitlab/commit/adb28b30dab47bd3a58eae697d40e4aa346ea2c8) Update create_merge_request doc to include :target_project_id parameter. Closes #108. (@asedge) - [525e913](https://github.com/NARKOZ/gitlab/commit/525e9131fe99a3f7396b547810e957058ab5a092) add ruby-2.2 to travis-ci - [3671c89](https://github.com/NARKOZ/gitlab/commit/3671c89071d712ee71fa51cac67f3e0b9a28b03b) Save shell history when user presses Ctrl-d (@asedge) - [c8e5f50](https://github.com/NARKOZ/gitlab/commit/c8e5f50684533e00550bfa4474062665000df28a) Hide httparty & httparty= methods from Gitlab.actions - just like endpoint, private_token, etc. (@asedge) - [358deeb](https://github.com/NARKOZ/gitlab/commit/358deeb8ed849defe28c7cba84e1935d549fce22) Fix a regression with exception handling in shell. (@asedge) - [9612ce3](https://github.com/NARKOZ/gitlab/commit/9612ce3b8274a385ce8c1fcd5ca5d0a0eba71c7e) Added support for repository files create, edit and remove. (@razielgn) - [2203ad7](https://github.com/NARKOZ/gitlab/commit/2203ad7fcaa337da3d9700cbbc342d961be18eee) Fix headings in action_table. (@asedge) - [b4dceb3](https://github.com/NARKOZ/gitlab/commit/b4dceb3d2d582682f3cb35ca63e41e237d222596) add CHANGELOG.md - [e2bd91c](https://github.com/NARKOZ/gitlab/commit/e2bd91ccf488dfede7688801e54270da0d395a56) Small refactor of Gitlab::Help, Gitlab::Shell & Gitlab::CLI::Helpers. Add some new tests and refactor ones recently added. (@asedge) - [bffd84f](https://github.com/NARKOZ/gitlab/commit/bffd84f4e9e37d056772536f33a52f40df0b7882) Refactor Gitlab::Help. Add tests some. (@asedge) - [9bd4f7a](https://github.com/NARKOZ/gitlab/commit/9bd4f7ad69614ee009c351811deee9eb2a6c3d05) Add test for Gitlab::Shell. (@asedge) - [bc14ec5](https://github.com/NARKOZ/gitlab/commit/bc14ec5173e432ced601c108cae6eca56026d41e) Refactor of Gitlab::Shell to hopefully make it more readable & testable. Wrote tests for some Gitlab::Shell & Gitlab::CLI::Helper methods. Other minor improvements and refactors. (@asedge) ### 3.3.0 (22/12/2014) - [42b4bc7](https://github.com/NARKOZ/gitlab/commit/42b4bc7b0e5e35f151ab61e27099606f0f38af31) fix docs and specs - [04e39e0](https://github.com/NARKOZ/gitlab/commit/04e39e013a7a74f6101a97c3791da0594da232a3) ability to update hook triggers - [6c66fe9](https://github.com/NARKOZ/gitlab/commit/6c66fe92a56cca58630a34ed3e7991517dd63604) remove useless check for available hook events - [c4b981d](https://github.com/NARKOZ/gitlab/commit/c4b981dd69974aa7e1cb088c9b9fd44e0c0a9b54) add accept_merge_request method - [51611fe](https://github.com/NARKOZ/gitlab/commit/51611fe669987cd9f4c1fac0ed96c743e391bbf2) Use endpoint instance var instead of base_uri class method. Fixes #94. (@asedge) - [1ec8b38](https://github.com/NARKOZ/gitlab/commit/1ec8b38322657c3f97a60deb10dc08b828ba9875) test multiple clients - [44d013a](https://github.com/NARKOZ/gitlab/commit/44d013af76535a2227678869148fb7a8195691df) Capture CTRL-C in Shell (@chrisdambrosio) - [3cba3b2](https://github.com/NARKOZ/gitlab/commit/3cba3b2420d72d8aead0febf0ba3564c7615cf8c) Adding respond_to override to the ObjectifiedHash class so it properly responds to respond_to? calls (@koglinjg) - [ce20c47](https://github.com/NARKOZ/gitlab/commit/ce20c4768c3e591b0cea72e8738371ab76d7289e) limit history file size - closes #93 (@chrisdambrosio) - [1cf656f](https://github.com/NARKOZ/gitlab/commit/1cf656f7cf9f1821339b9e6ed711f6218cddbf0f) Save/load shell mode history - closes #79 (@chrisdambrosio) - [727780b](https://github.com/NARKOZ/gitlab/commit/727780b8f282bb8fe461a54e558fe0775b4b36fd) HTTP proxy support - closes #52 (@chrisdambrosio) - [e4ceb18](https://github.com/NARKOZ/gitlab/commit/e4ceb187aa5e47d20740676aea4f36c473ddd241) implement .file_contents (@chrisdambrosio) - [0d0e7e0](https://github.com/NARKOZ/gitlab/commit/0d0e7e01bab1708cd85294788f9b9cca33a33ddb) Now must use YAML valid syntax in CLI or CLI Shell where Gitlab methods expect Hashes (usually in the form of options). (@asedge) - [a7d0e0a](https://github.com/NARKOZ/gitlab/commit/a7d0e0a8c1c50c4ab43faccdb88f049f5b84a1cf) add CONTRIBUTING.md - [1f4ef8e](https://github.com/NARKOZ/gitlab/commit/1f4ef8ed25ccd1bdbeccf677a0a94106903d0f24) improve docs - [3a8d339](https://github.com/NARKOZ/gitlab/commit/3a8d33946adec71724304f661d70eb515a2f6848) Repository tree root level files (@semenyukdmitriy) - [ddab89e](https://github.com/NARKOZ/gitlab/commit/ddab89e6aa9917d06cddd121aa486424753bdf84) Adds support for comments on commits (@jeroenj) - [a7c18f1](https://github.com/NARKOZ/gitlab/commit/a7c18f1180157021ef8d24791f32a30511940fbf) Add labels api for list, create, edit and delete. (@artworx) - [d9940d5](https://github.com/NARKOZ/gitlab/commit/d9940d5f4dfd8fdc4530b249b518e0d048dbfdbb) Support pagination in Gitlab.merge_request_comments (@cubiware) - [13a550c](https://github.com/NARKOZ/gitlab/commit/13a550cb82a4775f3c72850dcd65e807abe46e69) Update tests for create_tags method so it more closely matches what will happen in Gitlab 7.5.0. (@asedge) - [6d8a98f](https://github.com/NARKOZ/gitlab/commit/6d8a98f7930d2df5af19cc838eb95ae9c775e1a1) Add repo compare API (@zlx) - [76e29e6](https://github.com/NARKOZ/gitlab/commit/76e29e632ce345ed17d69401dcb286dc85a951aa) Add support for annotated tag creation. Update tests for create_tag. (@asedge) - [40295b8](https://github.com/NARKOZ/gitlab/commit/40295b8889c0094babffc81a5d7749d32b0fbda6) introduce HTTParty-configuration, fix #61 (@barraq) - [916e8a7](https://github.com/NARKOZ/gitlab/commit/916e8a72371a097fa63065b05d3dca0be7bc9e93) Improved arg parsing for gitlab readline shell. Other small fixes/improvements on regexes. (@asedge) - [382fe71](https://github.com/NARKOZ/gitlab/commit/382fe71e3d509a57f736138ffbb673695577f709) Add missing documentation: :group_id, :namespace_id (@arioch) - [c9f9662](https://github.com/NARKOZ/gitlab/commit/c9f9662a9b1116c838b523ed64c6abdb4aae4b8b) add exit command to shell ### 3.2.0 (22/06/2014) - [fee67da](https://github.com/NARKOZ/gitlab/commit/fee67da36cdab7906004e7a060602eb342c8b946) Handling some error cases when calling for help. (@asedge) - [7705b01](https://github.com/NARKOZ/gitlab/commit/7705b01c94d8833fb055ca072d34c0019c622caf) Adding online help for Gitlab::Shell using "ri" command. I'm unsure if this is the best idea. Some refactoring still needs to be done to remove duplicate code. (@asedge) - [599deff](https://github.com/NARKOZ/gitlab/commit/599deffbe193aed420747be16516b29b8beeb31f) Fix output_table call in CLI. (@asedge) - [4a5f81f](https://github.com/NARKOZ/gitlab/commit/4a5f81f0e605a89205c05a4baefdbf6d2331d667) Initial commit of Gitlab CLI shell. Tab completion for Gitlab.actions. (@asedge) - [48ba2a1](https://github.com/NARKOZ/gitlab/commit/48ba2a178b0e3f206588ccd5aeed14e52d1ba269) fix specs after update to RSpec 3 - [a8284af](https://github.com/NARKOZ/gitlab/commit/a8284af9af017e0bf381347a534f9a2426e35d64) Add spec for project_events method (@hassaku) - [8e8527c](https://github.com/NARKOZ/gitlab/commit/8e8527cc4743a11ea285072e11f1bb4e703757ff) Add method to get a list of project events (@hassaku) - [8c2aa8f](https://github.com/NARKOZ/gitlab/commit/8c2aa8fc9f660696596639d458444bc00fe17f0c) Add create_tag method. Add tests for new method. (@asedge) - [cd5ae8b](https://github.com/NARKOZ/gitlab/commit/cd5ae8ba8aca5025a41ec1dd9fad70dae10c2fd3) clarify default config options ### 3.1.0 (22/05/2014) - [16834bb](https://github.com/NARKOZ/gitlab/commit/16834bb178fa6bf6c7ec8b67bfedfdc32145769d) add info command to CLI - [68aebb7](https://github.com/NARKOZ/gitlab/commit/68aebb76b24972b7d00a78f3d4f923fca009ba31) ability to delete a project - [ac54e55](https://github.com/NARKOZ/gitlab/commit/ac54e55825d16373862fbbc176d6c9c2594dc593) set command arguments when no filters - [23be13e](https://github.com/NARKOZ/gitlab/commit/23be13e87c3c99764fcb27393ce99d9cc05633b9) fix docs - [1b298dc](https://github.com/NARKOZ/gitlab/commit/1b298dcd5f71321867ad2bd3c18522a7602357ad) fix ruby 1.9 compatibility - [af92ff5](https://github.com/NARKOZ/gitlab/commit/af92ff546af578ba0753c254fabf73761553f4c8) add confirmation for destructive commands - [b1602d2](https://github.com/NARKOZ/gitlab/commit/b1602d2f5ce0a614de48d5295654d0699fe69c0d) move methods related to CLI output to a separate module - [4183a52](https://github.com/NARKOZ/gitlab/commit/4183a52ca6344d86aa152e189bc20c467c96c5a5) improve help message - [0bba284](https://github.com/NARKOZ/gitlab/commit/0bba284e9447a4a6aa95990b65db5ae4d44ce989) add specs for CLI - [5ec08bc](https://github.com/NARKOZ/gitlab/commit/5ec08bc0173e986e5979ca0c809d70002186f0cc) ability to filter CLI output - [ba86169](https://github.com/NARKOZ/gitlab/commit/ba861692bae33cba8d22ac3beb223995a4df216c) add table output for multiple records - [9cc540c](https://github.com/NARKOZ/gitlab/commit/9cc540c948bd71a70e3c1f6fc656e1bbde0dcb00) initial wrap-up of CLI - [bee9745](https://github.com/NARKOZ/gitlab/commit/bee9745f2202f9dafd20b0edee185fe54f413cb2) include modules alphabetically - [4963f16](https://github.com/NARKOZ/gitlab/commit/4963f16f3eb0a3f3a6dd7fbdc3b7f3aeab8d57cc) add special method that lists available actions for client - [fe50c24](https://github.com/NARKOZ/gitlab/commit/fe50c24437ea2bd729044f30ef6afe8df1932f32) support environment variables - [7a5d40c](https://github.com/NARKOZ/gitlab/commit/7a5d40ccd576abfb35c137f9e172821351d2dac8) eliminate ruby warning - [b7fc447](https://github.com/NARKOZ/gitlab/commit/b7fc447211fe281e01f111f8a9fad08396fdfa4d) convert specs to new RSpec 2.14 syntax - [471a643](https://github.com/NARKOZ/gitlab/commit/471a643a60a17ea9048615a2ac2d295e0682edd4) pass private token using HTTP headers - [bbf6521](https://github.com/NARKOZ/gitlab/commit/bbf6521362d5af460c63a730d95f822e55160e82) fix users session spec - [672a8d5](https://github.com/NARKOZ/gitlab/commit/672a8d54988dfafce4e3288a63f6cf67bf13c292) test Request class - [3bf0363](https://github.com/NARKOZ/gitlab/commit/3bf03631769a419504f669bd3154953072701c61) set private_token param separately for each request - [90760cd](https://github.com/NARKOZ/gitlab/commit/90760cdeb3dfaa7be5fdfa5eba792c3a8e617c57) Single commit and diff of a commit (@nanofi) - [9b696d4](https://github.com/NARKOZ/gitlab/commit/9b696d4bd07c1ca5d8d41e6aaeb51f260393b789) pluralize module name: SystemHook -> SystemHooks - [3b2cda9](https://github.com/NARKOZ/gitlab/commit/3b2cda9e974568f8d1d6bfebbf3f114686638f44) get rid of ruby argument prefix warning - [0d6ca05](https://github.com/NARKOZ/gitlab/commit/0d6ca0565ee0eaf02ae077332f8082c8d939ce22) System Hook API (@nanofi) - [29e31e0](https://github.com/NARKOZ/gitlab/commit/29e31e0a565a083c22401bb99b3cb28c8a43f5d6) Create branches.rb. Move branch related actions there. Add new methods for (un)protecting branches and creating new branches - which requires Gitlab 6.8-stable or newer. Added tests for new methods and fixed old tests looking for methods in old locations. (@asedge) - [7f91a9a](https://github.com/NARKOZ/gitlab/commit/7f91a9a10dc8071d14d3ffaea001e32ac2f70180) Fixed: create project deploy key (@semenyukdmitriy) - [b347574](https://github.com/NARKOZ/gitlab/commit/b3475743c624e7cc426ca099f0c86411ffaf6dd8) Project hooks: set events to trigger on (@semenyukdmitriy) - [af49245](https://github.com/NARKOZ/gitlab/commit/af492453819678eca9f2a8e25b51d318e23d148c) Add merge_request_comments to get a MR's comments - [2b9e659](https://github.com/NARKOZ/gitlab/commit/2b9e659afd646f8ffca7b323e40246096837eae7) Doc & test that update_merge_request can set state - [45b0b9f](https://github.com/NARKOZ/gitlab/commit/45b0b9fc86016ba31e66b600172da6ace63f7a00) add 'to_hash' method for ObjectifiedHash - [ce5294f](https://github.com/NARKOZ/gitlab/commit/ce5294f2ec74417626403595899a85c97d92318c) test against MRI 2.1.0 - [35aadef](https://github.com/NARKOZ/gitlab/commit/35aadef3f321d4d700c3f7926f2206ac241e7191) scope for projects api (@voanhduy1512) - [7152c85](https://github.com/NARKOZ/gitlab/commit/7152c8520bf77f49385bb71ef82a574172500b00) Add edit_user method (@robertomiranda) ### 3.0.0 (22/10/2013) - [da31730](https://github.com/NARKOZ/gitlab/commit/da3173016870d76aabbd43ee1b04e7348cbdbb1e) handle response code 405 - [3c18ad0](https://github.com/NARKOZ/gitlab/commit/3c18ad0d373b4647232be3bbc1ee88aed9a3bbfc) remove ruby 1.8 patch - [3fca003](https://github.com/NARKOZ/gitlab/commit/3fca0033e8dabbefdbf50fc15713866521d0e1d3) re-implement handling of sudo requests - [49c54a6](https://github.com/NARKOZ/gitlab/commit/49c54a67a8c1a67dd1f471c93e63c6dace329817) ability to paginate group members - [8ba8361](https://github.com/NARKOZ/gitlab/commit/8ba8361d6fed3967986243a9c48871b79040bb51) fix compatibility with API v3; update docs - [93e8b81](https://github.com/NARKOZ/gitlab/commit/93e8b81632067879d874a31e18ab48a50ccaf05c) prettify error message - [1752997](https://github.com/NARKOZ/gitlab/commit/1752997f22586c76929c7396db8892fe930cb93a) Add methods to manage deployment keys (@sosedoff) - [613dda8](https://github.com/NARKOZ/gitlab/commit/613dda8f7b42770635023137fb6844709ad77ffd) Add group api, removed user_teams api - [8db4e88](https://github.com/NARKOZ/gitlab/commit/8db4e88ade68401e3e2dc26f8cc9b78a48a0f8ea) Update error_message to print request uri on response failure - [dd33a2f](https://github.com/NARKOZ/gitlab/commit/dd33a2feaa96022d6bd3795fb861eaf57f554bfa) Adding a check_attributes method in order to verify that the correct parameters have been passed into create_merge_request and comment_merge_request. Updating tests. (@thomasbiddle) - [6f4a170](https://github.com/NARKOZ/gitlab/commit/6f4a170191a401c7eaf97522c5b8e20970e90249) Adding tests for missing merge request api calls. (@thomasbiddle) - [af42bcb](https://github.com/NARKOZ/gitlab/commit/af42bcb7c18b27db266efdf7c9645d795d691760) Adding support for creating, updating, and commenting on merge requests. (@thomasbiddle) - [f7aac38](https://github.com/NARKOZ/gitlab/commit/f7aac3860169ce0d0268676dc278d8150e497df8) minor updates indicating support for creating public projects (@amacarthur) - [44a090d](https://github.com/NARKOZ/gitlab/commit/44a090d983de178ebdc7f6cd9cdcc339d731f9ef) added apis for the admin of fork links (@amacarthur) - [32f1419](https://github.com/NARKOZ/gitlab/commit/32f14199c53da58ce00572530a002f769c808024) Added sudo functionality - [b7f6c48](https://github.com/NARKOZ/gitlab/commit/b7f6c48b65b4d18cc18919fab12cefa99826578e) Made 409's throw exceptions - [d1f581f](https://github.com/NARKOZ/gitlab/commit/d1f581ff410ba5c42d03e2cf98efa548a6139b01) Fixed an issue with access level var in add team project - [8a5d679](https://github.com/NARKOZ/gitlab/commit/8a5d679806bd1dc8501965450fe12d0e807fbd93) Add user_team api - [b4444fc](https://github.com/NARKOZ/gitlab/commit/b4444fce8c3dd9f0caa2d1a096e61ce6373136fe) Adding user_teams api - [53d7a8a](https://github.com/NARKOZ/gitlab/commit/53d7a8a86dfed63e56eeb16ea496bb7a82de337e) consistently refer to feature as "project for user" per documentation @ https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md#create-project-for-user (@dylee) - [13457a4](https://github.com/NARKOZ/gitlab/commit/13457a4bfd67088e156489d09db148739a0af700) add support for POST /projects/user:user_id (@leesolutions) - [5e556fa](https://github.com/NARKOZ/gitlab/commit/5e556fac11daa25d3d9683904cf8f96b8e0bb009) update travis-ci config with ruby-2.0 - [3b8513d](https://github.com/NARKOZ/gitlab/commit/3b8513da22c8d78ce6a284ac8a7a5eaad6ab349d) Groups api additions - [f2ba111](https://github.com/NARKOZ/gitlab/commit/f2ba111dba70eca5346a880c541dafaf35d3332a) don't expose data in ObjectifiedHash - [c6889eb](https://github.com/NARKOZ/gitlab/commit/c6889ebfd455892690c0cddc3b88c670d8723435) add specs for notes - [e562a7d](https://github.com/NARKOZ/gitlab/commit/e562a7db8ffdf9ec947895800e9c5b7753b83bfb) bring support for ruby 1.8 - [63c3592](https://github.com/NARKOZ/gitlab/commit/63c3592af45aa0d01de09910f562a4f875d01f6a) Notes api for wall, issues, and snippets notes. List, read and create. (@jozefvaclavik) ### 2.2.0 (22/11/2012) - [2ef4d48](https://github.com/NARKOZ/gitlab/commit/2ef4d48a0db13a7363973455c3c0ac9d2bf6df56) support merge requests API ### 2.1.0 (22/10/2012) - [89541c1](https://github.com/NARKOZ/gitlab/commit/89541c1dddccf185318645bb2748541955f221b0) add ability to create a user - [483b4f6](https://github.com/NARKOZ/gitlab/commit/483b4f6812e657e9ea12c0c89199654393554aa7) fix typos in docs - [7632ecb](https://github.com/NARKOZ/gitlab/commit/7632ecba57c8fa3fe966ee6eb0055bb7752d79fd) add ability to list project snippets - [6c5637e](https://github.com/NARKOZ/gitlab/commit/6c5637e526f73bfb1c7791b12756ebdadeae4e5f) add project_hook and edit_project_hook methods - [5fcf078](https://github.com/NARKOZ/gitlab/commit/5fcf078437b62a39de7d49c6d92fd5cdf09c565c) Fix add_team_member (@mizzy) - [6a0176a](https://github.com/NARKOZ/gitlab/commit/6a0176aac542eacd9df24da20a8994f9f70e6ed7) refactor Request class - [53746d5](https://github.com/NARKOZ/gitlab/commit/53746d55f19f75e72b3439d25f7940ba66151c94) add convenient methods to change a state of an issue ### 2.0.0 (21/09/2012) - [b47a324](https://github.com/NARKOZ/gitlab/commit/b47a324d616b7fa4e23160abae357887b9dde13f) initial implementation gitlab-4.8.0/CONTRIBUTING.md000066400000000000000000000143131341107427500152240ustar00rootroot00000000000000# Contributing to Gitlab Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved! ## Using the issue tracker You can use the issues tracker for: * [bug reports](#bug-reports) * [feature requests](#feature-requests) * [submitting pull requests](#pull-requests) Use [Stackoverflow](http://stackoverflow.com/) for questions and personal support requests. ## Bug reports A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you! Guidelines for bug reports: 1. **Use the GitHub issue search** — check if the issue has already been reported. 2. **Check if the issue has been fixed** — try to reproduce it using the `master` branch in the repository. 3. **Isolate and report the problem** — ideally create a reduced test case. Please try to be as detailed as possible in your report. Include information about your Ruby, Gitlab client and GitLab instance versions. Please provide steps to reproduce the issue as well as the outcome you were expecting! All these details will help developers to fix any potential bugs. Example: > Short and descriptive example bug report title > > A summary of the issue and the environment in which it occurs. If suitable, > include the steps required to reproduce the bug. > > 1. This is the first step > 2. This is the second step > 3. Further steps, etc. > > Any other information you want to share that is relevant to the issue being > reported. This might include the lines of code that you have identified as > causing the bug, and potential solutions (and your opinions on their > merits). ## Feature requests Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the community of the merits of this feature. Please provide as much detail and context as possible. ## Contributing Documentation Code documentation has a special convention: it uses [YARD](http://yardoc.org/) formatting and the first paragraph is considered to be a short summary. For methods say what it will do. For example write something like: ```ruby # Reverses the contents of a String or IO object. # # @param [String, #read] contents the contents to reverse # @return [String] the contents reversed lexically def reverse(contents) contents = contents.read if contents.respond_to? :read contents.reverse end ``` For classes, modules say what it is. For example write something like: ```ruby # Defines methods related to groups. module Groups ``` Keep in mind that the documentation notes might show up in a summary somewhere, long texts in the documentation notes create very ugly summaries. As a rule of thumb anything longer than 80 characters is too long. Try to keep unnecessary details out of the first paragraph, it's only there to give a user a quick idea of what the documented "thing" does/is. The rest of the documentation notes can contain the details, for example parameters and what is returned. If possible include examples. For example: ```ruby # Gets information about a project. # # @example # Gitlab.project(3) # Gitlab.project('gitlab') # # @param [Integer, String] id The ID or name of a project. # @return [Gitlab::ObjectifiedHash] def project(id) ``` This makes it easy to test the examples so that they don't go stale and examples are often a great help in explaining what a method does. ## Pull requests Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. **IMPORTANT**: By submitting a patch, you agree that your work will be licensed under the license used by the project. If you have any large pull request in mind (e.g. implementing features, refactoring code, etc), **please ask first** otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. Please adhere to the coding conventions in the project (indentation, accurate comments, etc.) and don't forget to add your own tests and documentation. When working with git, we recommend the following process in order to craft an excellent pull request: 1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork, and configure the remotes: ```sh # Clone your fork of the repo into the current directory git clone https://github.com//gitlab # Navigate to the newly cloned directory cd gitlab # Assign the original repo to a remote called "upstream" git remote add upstream https://github.com/NARKOZ/gitlab ``` 2. If you cloned a while ago, get the latest changes from upstream: ```bash git checkout master git pull upstream master ``` 3. Create a new topic branch (off of `master`) to contain your feature, change, or fix. **IMPORTANT**: Making changes in `master` is discouraged. You should always keep your local `master` in sync with upstream `master` and make your changes in topic branches. ```sh git checkout -b ``` 4. Commit your changes in logical chunks. Keep your commit messages organized, with a short description in the first line and more detailed information on the following lines. Feel free to use Git's [interactive rebase](https://help.github.com/articles/about-git-rebase/) feature to tidy up your commits before making them public. 5. Make sure all the tests are still passing. ```sh rake ``` 6. Push your topic branch up to your fork: ```sh git push origin ``` 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description. 8. If you haven't updated your pull request for a while, you should consider rebasing on master and resolving any conflicts. **IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You should always `git rebase` on `master` to bring your changes up to date when necessary. ```sh git checkout master git pull upstream master git checkout git rebase master ``` Thank you for your contributions! gitlab-4.8.0/Dockerfile000066400000000000000000000001171341107427500147620ustar00rootroot00000000000000FROM ruby:2.5 WORKDIR /app COPY . ./ RUN bundle install CMD ["bin/console"] gitlab-4.8.0/Gemfile000066400000000000000000000001721341107427500142640ustar00rootroot00000000000000# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in gitlab.gemspec gemspec gitlab-4.8.0/LICENSE.txt000066400000000000000000000024401341107427500146140ustar00rootroot00000000000000Copyright (c) 2012-2019 Nihad Abbasov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. gitlab-4.8.0/README.md000066400000000000000000000213201341107427500142460ustar00rootroot00000000000000# Gitlab [![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg)](https://travis-ci.org/NARKOZ/gitlab) [![Maintainability](https://api.codeclimate.com/v1/badges/2e310b334b1b5db4a7e1/maintainability)](https://codeclimate.com/github/NARKOZ/gitlab) [![Inline docs](https://inch-ci.org/github/NARKOZ/gitlab.svg)](https://inch-ci.org/github/NARKOZ/gitlab) [![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab) [![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt) [website](https://narkoz.github.io/gitlab) | [documentation](https://rubydoc.info/gems/gitlab/frames) | [gitlab-live](https://github.com/NARKOZ/gitlab-live) Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://docs.gitlab.com/ce/api/README.html). As of version `4.0.0` this gem only supports Ruby 2.0+ and GitLab API v4. ## Installation Install it from rubygems: ```sh gem install gitlab ``` Or add to a Gemfile: ```ruby gem 'gitlab' # gem 'gitlab', github: 'NARKOZ/gitlab' ``` Mac OS users can install using Homebrew: ```sh brew install gitlab-gem ``` ## Usage Configuration example: ```ruby Gitlab.configure do |config| config.endpoint = 'https://example.net/api/v4' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT'] config.private_token = 'qEsq1pt6HJPaNciie3MG' # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN'] # Optional # config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]' # config.sudo = 'user' # username for sudo mode, default: nil end ``` (Note: If you are using GitLab.com's hosted service, your endpoint will be `https://gitlab.com/api/v4`) Usage examples: ```ruby # set an API endpoint Gitlab.endpoint = 'https://example.net/api/v4' # => "https://example.net/api/v4" # set a user private token Gitlab.private_token = 'qEsq1pt6HJPaNciie3MG' # => "qEsq1pt6HJPaNciie3MG" # configure a proxy server Gitlab.http_proxy('proxyhost', 8888) # proxy server with basic auth Gitlab.http_proxy('proxyhost', 8888, 'proxyuser', 'strongpasswordhere') # set timeout for responses ENV['GITLAB_API_HTTPARTY_OPTIONS'] = '{read_timeout: 60}' # list projects Gitlab.projects(per_page: 5) # => [#1, "code"=>"brute", "name"=>"Brute", "description"=>nil, "path"=>"brute", "default_branch"=>nil, "owner"=>#1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:56Z"}>, #2, "code"=>"mozart", "name"=>"Mozart", "description"=>nil, "path"=>"mozart", "default_branch"=>nil, "owner"=>#1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:57Z"}>, #3, "code"=>"gitlab", "name"=>"Gitlab", "description"=>nil, "path"=>"gitlab", "default_branch"=>nil, "owner"=>#1, "email"=>"john@example.com", "name"=>"John Smith", "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}>, "private"=>true, "issues_enabled"=>true, "merge_requests_enabled"=>true, "wall_enabled"=>true, "wiki_enabled"=>true, "created_at"=>"2012-09-17T09:41:58Z"}>] # initialize a new client g = Gitlab.client(endpoint: 'https://api.example.com', private_token: 'qEsq1pt6HJPaNciie3MG') # => # # get a user user = g.user # => #1, "email"=>"john@example.com", "name"=>"John Smith", "bio"=>nil, "skype"=>"", "linkedin"=>"", "twitter"=>"john", "dark_scheme"=>false, "theme_id"=>1, "blocked"=>false, "created_at"=>"2012-09-17T09:41:56Z"}> # get a user's email user.email # => "john@example.com" # set a sudo mode to perform API calls as another user Gitlab.sudo = 'other_user' # => "other_user" # disable a sudo mode Gitlab.sudo = nil # => nil # a paginated response projects = Gitlab.projects(per_page: 5) # check existence of the next page projects.has_next_page? # retrieve the next page projects.next_page # iterate all projects projects.auto_paginate do |project| # do something end # retrieve all projects as an array projects.auto_paginate ``` For more information, refer to [documentation](https://rubydoc.info/gems/gitlab/frames). ## CLI It is possible to use this gem as a command line interface to GitLab. In order to make that work you need to set a few environment variables: ```sh export GITLAB_API_ENDPOINT=https://gitlab.yourcompany.com/api/v4 export GITLAB_API_PRIVATE_TOKEN= # This one is optional and can be used to set any HTTParty option you may need # using YAML hash syntax. For example, this is how you would disable SSL # verification (useful if using a self-signed cert). export GITLAB_API_HTTPARTY_OPTIONS="{verify: false}" ``` Usage: When you want to know which CLI commands are supported, take a look at the client [commands implemented in this gem](https://www.rubydoc.info/gems/gitlab/4.5.0/Gitlab/Client). Any of those methods can be called as a command by passing the parameters of the commands as parameters of the CLI. Usage examples: ```sh # list users # see: https://www.rubydoc.info/gems/gitlab/4.5.0/Gitlab/Client/Users#users-instance_method gitlab users # get current user # see: https://www.rubydoc.info/gems/gitlab/4.5.0/Gitlab/Client/Users#user-instance_method gitlab user # get a user # see: https://www.rubydoc.info/gems/gitlab/4.5.0/Gitlab/Client/Users#user-instance_method gitlab user 2 # filter output gitlab user --only=id,username gitlab user --except=email,bio # get a user and render result as json gitlab user 2 --json # passing options hash to a command (use YAML) # see: https://www.rubydoc.info/gems/gitlab/4.5.0/Gitlab/Client/MergeRequests#create_merge_request-instance_method gitlab create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}" ``` ## CLI Shell Usage examples: ```sh # start shell session gitlab shell # list available commands gitlab> help # list groups gitlab> groups # protect a branch gitlab> protect_branch 1 master # passing options hash to a command (use YAML) gitlab> create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}" ``` Web version is available at https://gitlab-live.herokuapp.com For more information, refer to [website](https://narkoz.github.io/gitlab). ## Development ### With a dockerized GitLab instance ```shell docker-compose up -d gitlab # Will start the GitLab instance in the background (approx. 3 minutes) ``` After a while, your GitLab instance will be accessible on http://localhost:3000. Once you have set your new root password, you can login with the root user. You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens Once you have your token, set the variables to the correct values in the `docker.env` file. Then, launch the tool: ```shell docker-compose run app ``` ```ruby Gitlab.users => [#1, "name"=>"Administrator", "username"=>"root", ...] ``` To launch the specs: ```shell docker-compose run app rake spec ``` #### Want to use GitLab Enterprise? Just change the image from `gitlab/gitlab-ce:latest` to `gitlab/gitlab-ee:latest` in the `docker-compose.yml` file. ### With an external GitLab instance First, set the variables to the correct values in the `docker.env` file. Then, launch the tool: ```shell docker-compose run app ``` ```ruby Gitlab.users => [#1, "name"=>"Administrator", "username"=>"root", ...] ``` To launch the specs, ```shell docker-compose run app rake spec ``` ### Without Docker After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. For more information see [CONTRIBUTING.md](https://github.com/NARKOZ/gitlab/blob/master/CONTRIBUTING.md). ## License Released under the BSD 2-clause license. See LICENSE.txt for details. gitlab-4.8.0/Rakefile000066400000000000000000000004761341107427500144450ustar00rootroot00000000000000# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |spec| spec.rspec_opts = ['--color', '--format d'] end require 'rubocop/rake_task' RuboCop::RakeTask.new(:rubocop) do |task| task.options = ['-D', '--parallel'] end task default: :spec gitlab-4.8.0/bin/000077500000000000000000000000001341107427500135415ustar00rootroot00000000000000gitlab-4.8.0/bin/console000077500000000000000000000002771341107427500151370ustar00rootroot00000000000000#!/usr/bin/env ruby # frozen_string_literal: true # ENV['GITLAB_API_ENDPOINT'] = '' # ENV['GITLAB_API_PRIVATE_TOKEN'] = '' require 'bundler/setup' require 'gitlab' require 'pry' Pry.start gitlab-4.8.0/bin/setup000077500000000000000000000002501341107427500146240ustar00rootroot00000000000000#!/bin/bash set -euo pipefail IFS=$'\n\t' bundle install && echo 'NOTE: You may need to set GITLAB_API_ENDPOINT and GITLAB_API_PRIVATE_TOKEN environment variables.' gitlab-4.8.0/docker-compose.yml000066400000000000000000000010111341107427500164170ustar00rootroot00000000000000# For more information, see https://docs.gitlab.com/omnibus/docker/README.html#install-gitlab-using-docker-compose version: '3' services: app: build: . volumes: - ./:/app env_file: docker.env gitlab: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://gitlab.example.com:3000' # Add any other gitlab.rb configuration here, each on its own line ports: - 3000:3000 gitlab-4.8.0/docker.env000066400000000000000000000001341341107427500147500ustar00rootroot00000000000000GITLAB_API_ENDPOINT=http://gitlab:3000/api/v4 GITLAB_API_PRIVATE_TOKEN=j3CLYZMg_dsTPpCR2HWf gitlab-4.8.0/exe/000077500000000000000000000000001341107427500135525ustar00rootroot00000000000000gitlab-4.8.0/exe/gitlab000077500000000000000000000003371341107427500147450ustar00rootroot00000000000000#!/usr/bin/env ruby # frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('../lib', __dir__) # Exit cleanly from an early interrupt Signal.trap('INT') { exit 1 } require 'gitlab/cli' Gitlab::CLI.start(ARGV) gitlab-4.8.0/gitlab.gemspec000066400000000000000000000025321341107427500156020ustar00rootroot00000000000000# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'gitlab/version' Gem::Specification.new do |gem| gem.name = 'gitlab' gem.version = Gitlab::VERSION gem.authors = ['Nihad Abbasov', 'Sean Edge'] gem.email = ['mail@narkoz.me', 'asedge@gmail.com'] gem.description = 'Ruby client and CLI for GitLab API' gem.summary = 'A Ruby wrapper and CLI for the GitLab API' gem.homepage = 'https://github.com/narkoz/gitlab' gem.files = `git ls-files`.split($/) .grep_v(/^spec/) - %w[Dockerfile docker-compose.yml docker.env .travis.yml .rubocop.yml .dockerignore] gem.bindir = 'exe' gem.executables = gem.files.grep(%r{^exe/}) { |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ['lib'] gem.license = 'BSD' gem.required_ruby_version = '>= 2.3' gem.add_runtime_dependency 'httparty', '>= 0.14.0' gem.add_runtime_dependency 'terminal-table', '>= 1.5.1' gem.add_development_dependency 'pry' gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec' gem.add_development_dependency 'rubocop' gem.add_development_dependency 'webmock' end gitlab-4.8.0/lib/000077500000000000000000000000001341107427500135375ustar00rootroot00000000000000gitlab-4.8.0/lib/gitlab.rb000066400000000000000000000024611341107427500153310ustar00rootroot00000000000000# frozen_string_literal: true require 'gitlab/version' require 'gitlab/objectified_hash' require 'gitlab/configuration' require 'gitlab/error' require 'gitlab/page_links' require 'gitlab/paginated_response' require 'gitlab/file_response' require 'gitlab/request' require 'gitlab/api' require 'gitlab/client' module Gitlab extend Configuration # Alias for Gitlab::Client.new # # @return [Gitlab::Client] def self.client(options = {}) Gitlab::Client.new(options) end # Delegate to Gitlab::Client def self.method_missing(method, *args, &block) return super unless client.respond_to?(method) client.send(method, *args, &block) end # Delegate to Gitlab::Client def self.respond_to_missing?(method_name, include_private = false) client.respond_to?(method_name) || super end # Delegate to HTTParty.http_proxy def self.http_proxy(address = nil, port = nil, username = nil, password = nil) Gitlab::Request.http_proxy(address, port, username, password) end # Returns an unsorted array of available client methods. # # @return [Array] def self.actions hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|request_defaults|httparty/ (Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] } end end gitlab-4.8.0/lib/gitlab/000077500000000000000000000000001341107427500150015ustar00rootroot00000000000000gitlab-4.8.0/lib/gitlab/api.rb000066400000000000000000000011051341107427500160740ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab # @private class API < Request # @private attr_accessor(*Configuration::VALID_OPTIONS_KEYS) # @private alias auth_token= private_token= # Creates a new API. # @raise [Error:MissingCredentials] def initialize(options = {}) options = Gitlab.options.merge(options) (Configuration::VALID_OPTIONS_KEYS + [:auth_token]).each do |key| send("#{key}=", options[key]) if options[key] end request_defaults(sudo) self.class.headers 'User-Agent' => user_agent end end end gitlab-4.8.0/lib/gitlab/cli.rb000066400000000000000000000045141341107427500161010ustar00rootroot00000000000000# frozen_string_literal: true require 'gitlab' require 'terminal-table/import' require_relative 'cli_helpers' require_relative 'shell' class Gitlab::CLI extend Helpers # If set to true, JSON will be rendered as output @render_json = false # Starts a new CLI session. # # @example # Gitlab::CLI.start(['help']) # Gitlab::CLI.start(['help', 'issues']) # # @param [Array] args The command and it's optional arguments. def self.start(args) command = begin args.shift.strip rescue StandardError 'help' end run(command, args) end # Processes a CLI command and outputs a result to the stream (stdout). # # @example # Gitlab::CLI.run('help') # Gitlab::CLI.run('help', ['issues']) # # @param [String] cmd The name of a command. # @param [Array] args The optional arguments for a command. # @return [nil] def self.run(cmd, args = []) case cmd when 'help' puts help(args.shift) { |out| out.gsub!(/Gitlab\./, 'gitlab ') } when 'info' endpoint = Gitlab.endpoint || 'not set' private_token = Gitlab.private_token || 'not set' puts "Gitlab endpoint is #{endpoint}" puts "Gitlab private token is #{private_token}" puts "Ruby Version is #{RUBY_VERSION}" puts "Gitlab Ruby Gem #{Gitlab::VERSION}" when '-v', '--version' puts "Gitlab Ruby Gem #{Gitlab::VERSION}" when 'shell' Gitlab::Shell.start else if args.include? '--json' @json_output = true args.delete '--json' end unless valid_command?(cmd) puts 'Unknown command. Run `gitlab help` for a list of available commands.' exit(1) end command_args = args.any? && args.last.start_with?('--only=', '--except=') ? args[0..-2] : args begin command_args.map! { |arg| symbolize_keys(yaml_load(arg)) } rescue StandardError => e puts e.message exit 1 end confirm_command(cmd) data = gitlab_helper(cmd, command_args) { exit(1) } render_output(cmd, args, data) end end # Helper method that checks whether we want to get the output as json # @return [nil] def self.render_output(cmd, args, data) if @json_output output_json(cmd, args, data) else output_table(cmd, args, data) end end end gitlab-4.8.0/lib/gitlab/cli_helpers.rb000066400000000000000000000145711341107427500176270ustar00rootroot00000000000000# frozen_string_literal: true require 'yaml' require 'json' require 'base64' class Gitlab::CLI # Defines methods related to CLI output and formatting. module Helpers module_function # Returns actions available to CLI & Shell # # @return [Array] def actions @actions ||= Gitlab.actions end # Returns Gitlab::Client instance # # @return [Gitlab::Client] def client @client ||= Gitlab::Client.new(endpoint: (Gitlab.endpoint || '')) end # Returns method names and their owners # # @return [Array] def method_owners @method_owners ||= actions.map do |action| { name: action.to_s, owner: client.method(action).owner.to_s } end end # Returns filtered required fields. # # @return [Array] def required_fields(args) if args.any? && args.last.is_a?(String) && args.last.start_with?('--only=') args.last.gsub('--only=', '').split(',') else [] end end # Returns filtered excluded fields. # # @return [Array] def excluded_fields(args) if args.any? && args.last.is_a?(String) && args.last.start_with?('--except=') args.last.gsub('--except=', '').split(',') else [] end end # Confirms command is valid. # # @return [Boolean] def valid_command?(cmd) command = cmd.is_a?(Symbol) ? cmd : cmd.to_sym Gitlab.actions.include?(command) end # Confirms command with a desctructive action. # # @return [String] def confirm_command(cmd) return unless cmd.start_with?('remove_', 'delete_') puts 'Are you sure? (y/n)' if %w[y yes].include?($stdin.gets.to_s.strip.downcase) puts 'Proceeding..' else puts 'Command aborted.' exit(1) end end # Gets defined help for a specific command/action. # # @return [String] def help(cmd = nil, &block) if cmd.nil? || Gitlab::Help.help_map.key?(cmd) Gitlab::Help.actions_table(cmd) else Gitlab::Help.get_help(cmd, &block) end end # Outputs a nicely formatted table or error message. def output_table(cmd, args, data) case data when Gitlab::ObjectifiedHash, Gitlab::FileResponse puts record_table([data], cmd, args) when Gitlab::PaginatedResponse puts record_table(data, cmd, args) else # probably just an error message puts data end end def output_json(cmd, args, data) if data.respond_to?(:empty?) && data.empty? puts '{}' else hash_result = case data when Gitlab::ObjectifiedHash, Gitlab::FileResponse record_hash([data], cmd, args, true) when Gitlab::PaginatedResponse record_hash(data, cmd, args) else { cmd: cmd, data: data, args: args } end puts JSON.pretty_generate(hash_result) end end # Table to display records. # # @return [Terminal::Table] def record_table(data, cmd, args) return 'No data' if data.empty? arr, keys = get_keys(args, data) table do |t| t.title = "Gitlab.#{cmd} #{args.join(', ')}" t.headings = keys arr.each_with_index do |hash, index| values = [] keys.each do |key| case value = hash[key] when Hash value = value.key?('id') ? value['id'] : 'Hash' when StringIO value = 'File' when nil value = 'null' end values << value end t.add_row values t.add_separator unless arr.size - 1 == index end end end # Renders the result of given commands and arguments into a Hash # # @param [Array] data Resultset from the API call # @param [String] cmd The command passed to the API # @param [Array] args Options passed to the API call # @param [bool] single_value If set to true, a single result should be returned # @return [Hash] Result hash def record_hash(data, cmd, args, single_value = false) if data.empty? result = nil else arr, keys = get_keys(args, data) result = [] arr.each do |hash| row = {} keys.each do |key| row[key] = case hash[key] when Hash 'Hash' when StringIO Base64.encode64(hash[key].read) when nil nil else hash[key] end end result.push row end result = result[0] if single_value && result.count.positive? end { cmd: "Gitlab.#{cmd} #{args.join(', ')}".strip, result: result } end # Helper function to get rows and keys from data returned from API call def get_keys(args, data) arr = data.map(&:to_h) keys = arr.first.keys.sort_by(&:to_s) keys &= required_fields(args) if required_fields(args).any? keys -= excluded_fields(args) [arr, keys] end # Helper function to call Gitlab commands with args. def gitlab_helper(cmd, args = []) begin data = args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd) rescue StandardError => e puts e.message yield if block_given? end data end # Convert a hash (recursively) to use symbol hash keys # @return [Hash] def symbolize_keys(hash) if hash.is_a?(Hash) hash = hash.each_with_object({}) do |(key, value), new_hash| begin new_hash[key.to_sym] = symbolize_keys(value) rescue NoMethodError raise "Error: cannot convert hash key to symbol: #{key}" end end end hash end # Check if arg is a color in 6-digit hex notation with leading '#' sign def hex_color?(arg) pattern = /\A#\h{6}\Z/ pattern.match(arg) end # YAML::load on a single argument def yaml_load(arg) hex_color?(arg) ? arg : YAML.safe_load(arg) rescue Psych::SyntaxError raise "Error: Argument is not valid YAML syntax: #{arg}" end end end gitlab-4.8.0/lib/gitlab/client.rb000066400000000000000000000031231341107427500166030ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab # Wrapper for the Gitlab REST API. class Client < API Dir[File.expand_path('client/*.rb', __dir__)].each { |f| require f } # Please keep in alphabetical order include AccessRequests include AwardEmojis include Boards include Branches include BroadcastMessages include BuildVariables include Builds include Commits include Deployments include Environments include Events include GroupMilestones include Groups include Issues include Jobs include Keys include Labels include MergeRequestApprovals include MergeRequests include Milestones include Namespaces include Notes include PipelineSchedules include PipelineTriggers include Pipelines include ProjectBadges include Projects include ProtectedTags include Repositories include RepositoryFiles include RepositorySubmodules include Runners include Services include Sidekiq include Snippets include SystemHooks include Tags include Templates include Todos include Users include Versions include Wikis # Text representation of the client, masking private token. # # @return [String] def inspect inspected = super inspected.sub! @private_token, only_show_last_four_chars(@private_token) if @private_token inspected end def url_encode(url) URI.encode(url.to_s, /\W/) end private def only_show_last_four_chars(token) "#{'*' * (token.size - 4)}#{token[-4..-1]}" end end end gitlab-4.8.0/lib/gitlab/client/000077500000000000000000000000001341107427500162575ustar00rootroot00000000000000gitlab-4.8.0/lib/gitlab/client/access_requests.rb000066400000000000000000000103231341107427500217770ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to Award Emojis. # @see https://docs.gitlab.com/ce/api/access_requests.html module AccessRequests # Gets a list of access requests for a project viewable by the authenticated user. # # @example # Gitlab.project_access_requests(1) # # @param [Integer, String] :project(required) The ID or name of a project. # @return [Array] List of project access requests def project_access_requests(project) get("/projects/#{url_encode project}/access_requests") end # Gets a list of access requests for a group viewable by the authenticated user. # # @example # Gitlab.group_access_requests(1) # # @param [Integer, String] :group(required) The ID or name of a group. # @return [Array] List of group access requests def group_access_requests(group) get("/groups/#{url_encode group}/access_requests") end # Requests access for the authenticated user to a project. # # @example # Gitlab.request_project_access(1) # # @param [Integer, String] :project(required) The ID or name of a project. # @return ] def award_emojis(project, awardable_id, awardable_type) get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji") end # Gets a list of all award emoji for a single note on an awardable(issue, merge request or snippet) # # @example # Gitlab.note_award_emojis(1, 80, 'issue', 1) # Gitlab.note_award_emojis(1, 60, 'merge_request', 1) # Gitlab.note_award_emojis(1, 40, 'snippet', 1) # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [Integer] note_id The ID of a note. # @return [Array] def note_award_emojis(project, awardable_id, awardable_type, note_id) get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji") end # Gets a single award emoji for an awardable(issue, merge request or snippet) # # @example # Gitlab.award_emoji(1, 80, 'issue', 4) # Gitlab.award_emoji(1, 60, 'merge_request', 4) # Gitlab.award_emoji(1, 40, 'snippet', 4) # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [Integer] award_id The ID of an award emoji. # @return [Gitlab::ObjectifiedHash] def award_emoji(project, awardable_id, awardable_type, award_id) get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}") end # Gets a single award emoji from a single note on an awardable(issue, merge request or snippet) # # @example # Gitlab.note_award_emoji(1, 80, 'issue', 1, 4) # Gitlab.note_award_emoji(1, 60, 'merge_request', 1, 4) # Gitlab.note_award_emoji(1, 40, 'snippet', 1, 4) # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [Integer] note_id The ID of a note. # @param [Integer] award_id The ID of an award emoji. # @return [Gitlab::ObjectifiedHash] def note_award_emoji(project, awardable_id, awardable_type, note_id, award_id) get("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}") end # Awards a new emoji to an awardable(issue, merge request or snippet) # # @example # Gitlab.create_award_emoji(1, 80, 'issue', 'blowfish') # Gitlab.create_award_emoji(1, 80, 'merge_request', 'blowfish') # Gitlab.create_award_emoji(1, 80, 'snippet', 'blowfish') # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [String] emoji_name The name of the emoji, without colons. # @return [Gitlab::ObjectifiedHash] def create_award_emoji(project, awardable_id, awardable_type, emoji_name) post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji", body: { name: emoji_name }) end # Awards a new emoji to a note on an awardable(issue, merge request or snippet) # # @example # Gitlab.create_note_award_emoji(1, 80, 'issue', 1, 'blowfish') # Gitlab.create_note_award_emoji(1, 80, 'merge_request', 1, 'blowfish') # Gitlab.create_note_award_emoji(1, 80, 'snippet', 1, 'blowfish') # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [Integer] note_id The ID of a note. # @param [String] emoji_name The name of the emoji, without colons. # @return [Gitlab::ObjectifiedHash] def create_note_award_emoji(project, awardable_id, awardable_type, note_id, emoji_name) post("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji", body: { name: emoji_name }) end # Deletes a single award emoji from an awardable(issue, merge request or snippet) # # @example # Gitlab.delete_award_emoji(1, 80, 'issue', 4) # Gitlab.delete_award_emoji(1, 60, 'merge_request', 4) # Gitlab.delete_award_emoji(1, 40, 'snippet', 4) # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [Integer] award_id The ID of an award emoji. # @return [void] This API call returns an empty response body. def delete_award_emoji(project, awardable_id, awardable_type, award_id) delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/award_emoji/#{award_id}") end # Deletes a single award emoji from a single note on an awardable(issue, merge request or snippet) # # @example # Gitlab.delete_note_award_emoji(1, 80, 'issue', 1, 4) # Gitlab.delete_note_award_emoji(1, 60, 'merge_request', 1, 4) # Gitlab.delete_note_award_emoji(1, 40, 'snippet', 1, 4) # # @param [Integer] project The ID of a project. # @param [Integer] awardable_id The ID of an awardable(issue, merge request or snippet). # @param [String] awardable_type The type of the awardable(can be 'issue', 'merge_request' or 'snippet') # @param [Integer] note_id The ID of a note. # @param [Integer] award_id The ID of an award emoji. # @return [void] This API call returns an empty response body. def delete_note_award_emoji(project, awardable_id, awardable_type, note_id, award_id) delete("/projects/#{url_encode project}/#{awardable_type}s/#{awardable_id}/notes/#{note_id}/award_emoji/#{award_id}") end end end gitlab-4.8.0/lib/gitlab/client/boards.rb000066400000000000000000000060741341107427500200650ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to issue boards. # @see https://docs.gitlab.com/ce/api/boards.html module Boards # Gets a list of project's boards. # # @example # Gitlab.boards(5) # Gitlab.boards({ per_page: 40 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def boards(project, options = {}) get("/projects/#{url_encode project}/boards", query: options) end # Gets a board lists # # @example # Gitlab.board_lists(5, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a board. # @return [Gitlab::ObjectifiedHash] def board_lists(project, id) get("/projects/#{url_encode project}/boards/#{id}/lists") end # # Gets a single board list # # @example # Gitlab.board_list(5, 42, 25) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] board_id The ID of a board. # @param [Integer] id The ID of a list. # @return [Gitlab::ObjectifiedHash] def board_list(project, board_id, id) get("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}") end # Creates a new board list. # Only for admins and project owners # # @example # Gitlab.create_board_list(5, 42, 25) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a board. # @param [Integer] label_id The ID of a label. # @return [Gitlab::ObjectifiedHash] Information about created list. def create_board_list(project, board_id, label_id) post("/projects/#{url_encode project}/boards/#{board_id}/lists", body: { label_id: label_id }) end # Updates a board list. # Only for admins and project owners # # @example # Gitlab.edit_board_list(6, 1, 12, 5) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] board_id The ID of a board. # @param [Integer] id The ID of a list. # @return [Gitlab::ObjectifiedHash] Information about updated board list. def edit_board_list(project, board_id, id, position) put("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}", body: { position: position }) end # Deletes a board list. # Only for admins and project owners # # @example # Gitlab.delete_board_list(3, 42, 32) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] board_id The ID of a board. # @param [Integer] id The ID of a list. # @return [Gitlab::ObjectifiedHash] Information about deleted board list. def delete_board_list(project, board_id, id) delete("/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}") end end end gitlab-4.8.0/lib/gitlab/client/branches.rb000066400000000000000000000123551341107427500203770ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to repositories. # @see https://docs.gitlab.com/ce/api/branches.html module Branches # Gets a list of project repositiory branches. # # @example # Gitlab.branches(42) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def branches(project, options = {}) get("/projects/#{url_encode project}/repository/branches", query: options) end alias repo_branches branches # Gets information about a repository branch. # # @example # Gitlab.branch(3, 'api') # Gitlab.repo_branch(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch. # @return [Gitlab::ObjectifiedHash] def branch(project, branch) get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end alias repo_branch branch # Protects a repository branch. # # @example # Gitlab.protect_branch(3, 'api') # Gitlab.repo_protect_branch(5, 'master') # Gitlab.protect_branch(5, 'api', developers_can_push: true) # # To update options, call `protect_branch` again with new options (i.e. `developers_can_push: false`) # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch. # @param [Hash] options A customizable set of options. # @option options [Boolean] :developers_can_push True to allow developers to push to the branch (default = false) # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false) # @return [Gitlab::ObjectifiedHash] Details about the branch def protect_branch(project, branch, options = {}) post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge(options)) end alias repo_protect_branch protect_branch # Unprotects a repository branch. # # @example # Gitlab.unprotect_branch(3, 'api') # Gitlab.repo_unprotect_branch(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch. # @return [Gitlab::ObjectifiedHash] Details about the branch def unprotect_branch(project, branch) delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") end alias repo_unprotect_branch unprotect_branch # Creates a repository branch. Requires Gitlab >= 6.8.x # # @example # Gitlab.create_branch(3, 'api', 'feat/new-api') # Gitlab.repo_create_branch(5, 'master', 'develop') # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the new branch. # @param [String] ref Create branch from commit sha or existing branch # @return [Gitlab::ObjectifiedHash] Details about the branch def create_branch(project, branch, ref) post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref }) end alias repo_create_branch create_branch # Deletes a repository branch. Requires Gitlab >= 6.8.x # # @example # Gitlab.delete_branch(3, 'api') # Gitlab.repo_delete_branch(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch to delete def delete_branch(project, branch) delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end alias repo_delete_branch delete_branch # Delete all branches that are merged into the project default branch. Protected branches will not be deleted as part of this operation. # # @example # Gitlab.delete_merged_branches(3) # # @param [Integer, String] project The ID or name of a project. # @return [nil] This API call returns an empty response body. def delete_merged_branches(project) delete("/projects/#{url_encode project}/repository/merged_branches") end alias repo_delete_merged_branches delete_merged_branches # Gets a list of protected branches from a project. # # @example # Gitlab.protected_branches(42) # # @param [Integer, String] project The ID or name of a project. # @return [Array] def protected_branches(project) get("/projects/#{url_encode project}/protected_branches") end alias repo_protected_branches protected_branches # Gets a single protected branch or wildcard protected branch # # @example # Gitlab.protected_branch(3, 'api') # # @param [Integer, String] project The ID or name of a project. # @param [String] name The name of the branch or wildcard # @return [Gitlab::ObjectifiedHash] def protected_branch(project, branch) get("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") end alias repo_protected_branch protected_branch end end gitlab-4.8.0/lib/gitlab/client/broadcast_messages.rb000066400000000000000000000055521341107427500224440ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to broadcast messages (only accessible to administrators). # @see https://docs.gitlab.com/ce/api/broadcast_messages.html module BroadcastMessages # Get all broadcast messages # # @example # Gitlab.broadcast_messages # # @return [Array] def broadcast_messages get('/broadcast_messages') end # Get a specific broadcast message # # @example # Gitlab.broadcast_message(3) # # @param [Integer] id The ID of broadcast message # @return [Gitlab::ObjectifiedHash] def broadcast_message(id) get("/broadcast_messages/#{id}") end # Create a broadcast message. # # @example # Gitlab.create_broadcast_message('Mayday') # Gitlab.create_broadcast_message('Mayday', {starts_at: Time.zone.now, ends_at: Time.zone.now + 30.minutes, color: '#cecece', font: '#FFFFFF'}) # # @param [String] message Message to display # @param [Hash] options A customizable set of options. # @option options [DateTime] :starts_at(optional) Starting time (defaults to current time) # @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time) # @option options [String] :color(optional) Background color hex code # @option options [String] :font(optional) Foreground color hex code # @return [Gitlab::ObjectifiedHash] Information about created broadcast message. def create_broadcast_message(message, options = {}) body = { message: message }.merge(options) post('/broadcast_messages', body: body) end # Update a broadcast message # # @example # Gitlab.edit_broadcast_message(6, { message: 'No Mayday' }) # Gitlab.edit_broadcast_message(6, { font: '#FEFEFE' }) # # @param [Integer] id The ID of a broadcast message # @param [Hash] options A customizable set of options. # @option options [String] :message(optional) Message to display # @option options [DateTime] :starts_at(optional) Starting time (defaults to current time) # @option options [DateTime] :ends_at(optional) Ending time (defaults to one hour from current time) # @option options [String] :color(optional) Background color hex code # @option options [String] :font(optional) Foreground color hex code # @return [Gitlab::ObjectifiedHash] Information about updated broadcast message. def edit_broadcast_message(id, options = {}) put("/broadcast_messages/#{id}", body: options) end # Delete a broadcast message. # # @example # Gitlab.delete_broadcast_message(3) # # @param [Integer] id The ID of a broadcast message. # @return [nil] This API call returns an empty response body. def delete_broadcast_message(id) delete("/broadcast_messages/#{id}") end end end gitlab-4.8.0/lib/gitlab/client/build_variables.rb000066400000000000000000000111561341107427500217370ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to builds. # @see https://docs.gitlab.com/ce/api/build_variables.html # @see https://docs.gitlab.com/ee/api/group_level_variables.html module BuildVariables # Gets a list of the project's build variables # # @example # Gitlab.variables(5) # # @param [Integer, String] project The ID or name of a project. # @return [Array] The list of variables. def variables(project) get("/projects/#{url_encode project}/variables") end # Gets details of a project's specific build variable. # # @example # Gitlab.variable(5, "TEST_VARIABLE_1") # # @param [Integer, String] project The ID or name of a project. # @param [String] key The key of a variable. # @return [Gitlab::ObjectifiedHash] The variable. def variable(project, key) get("/projects/#{url_encode project}/variables/#{key}") end # Create a build variable for a project. # # @example # Gitlab.create_variable(5, "NEW_VARIABLE", "new value") # # @param [Integer, String] project The ID or name of a project. # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed # @param [String] value The value of a variable # @return [Gitlab::ObjectifiedHash] The variable. def create_variable(project, key, value) post("/projects/#{url_encode project}/variables", body: { key: key, value: value }) end # Update a project's build variable. # # @example # Gitlab.update_variable(5, "NEW_VARIABLE", "updated value") # # @param [Integer, String] project The ID or name of a project. # @param [String] key The key of a variable # @param [String] value The value of a variable # @return [Gitlab::ObjectifiedHash] The variable. def update_variable(project, key, value) put("/projects/#{url_encode project}/variables/#{key}", body: { value: value }) end # Remove a project's build variable. # # @example # Gitlab.remove_variable(5, "VARIABLE_1") # # @param [Integer, String] project The ID or name of a project. # @param [String] key The key of a variable. # @return [Gitlab::ObjectifiedHash] The variable. def remove_variable(project, key) delete("/projects/#{url_encode project}/variables/#{key}") end # Gets a list of the group's build variables # # @example # Gitlab.group_variables(5) # # @param [Integer, String] group The ID or name of a group. # @return [Array] The list of variables. def group_variables(group) get("/groups/#{url_encode group}/variables") end # Gets details of a group's specific build variable. # # @example # Gitlab.group_variable(5, "TEST_VARIABLE_1") # # @param [Integer, String] group The ID or name of a group. # @param [String] key The key of a variable. # @return [Gitlab::ObjectifiedHash] The variable. def group_variable(group, key) get("/groups/#{url_encode group}/variables/#{key}") end # Create a build variable for a group. # # @example # Gitlab.create_group_variable(5, "NEW_VARIABLE", "new value") # # @param [Integer, String] group The ID or name of a group. # @param [String] key The key of a variable; must have no more than 255 characters; only `A-Z`, `a-z`, `0-9` and `_` are allowed # @param [String] value The value of a variable # @return [Gitlab::ObjectifiedHash] The variable. def create_group_variable(group, key, value) post("/groups/#{url_encode group}/variables", body: { key: key, value: value }) end # Update a group's build variable. # # @example # Gitlab.update_group_variable(5, "NEW_VARIABLE", "updated value") # # @param [Integer, String] group The ID or name of a group. # @param [String] key The key of a variable # @param [String] value The value of a variable # @return [Gitlab::ObjectifiedHash] The variable. def update_group_variable(group, key, value) put("/groups/#{url_encode group}/variables/#{key}", body: { value: value }) end # Remove a group's build variable. # # @example # Gitlab.remove_group_variable(5, "VARIABLE_1") # # @param [Integer, String] group The ID or name of a group. # @param [String] key The key of a variable. # @return [Gitlab::ObjectifiedHash] The variable. def remove_group_variable(group, key) delete("/groups/#{url_encode group}/variables/#{key}") end end end gitlab-4.8.0/lib/gitlab/client/builds.rb000066400000000000000000000073331341107427500200740ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to builds. # @see https://docs.gitlab.com/ce/api/builds.html module Builds # Gets a list of project builds. # # @example # Gitlab.builds(5) # Gitlab.builds(5, { per_page: 10, page: 2 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @param [Integer, String] project The ID or name of a project. # @return [Array] def builds(project, options = {}) get("/projects/#{url_encode project}/builds", query: options) end # Gets a single build. # # @example # Gitlab.build(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a build. # @return [Gitlab::ObjectifiedHash] def build(project, id) get("/projects/#{url_encode project}/builds/#{id}") end # Gets build artifacts. # # @example # Gitlab.build_artifacts(1, 8) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a build. # @return [Gitlab::FileResponse] def build_artifacts(project, id) get("/projects/#{url_encode project}/builds/#{id}/artifacts", format: nil, headers: { Accept: 'application/octet-stream' }, parser: proc { |body, _| if body.encoding == Encoding::ASCII_8BIT # binary response ::Gitlab::FileResponse.new StringIO.new(body, 'rb+') else # error with json response ::Gitlab::Request.parse(body) end }) end # Gets a list of builds for specific commit in a project. # # @example # Gitlab.commit_builds(5, 'asdf') # Gitlab.commit_builds(5, 'asdf', { per_page: 10, page: 2 }) # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The SHA checksum of a commit. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] The list of builds. def commit_builds(project, sha, options = {}) get("/projects/#{url_encode project}/repository/commits/#{sha}/builds", query: options) end # Cancels a build. # # @example # Gitlab.build_cancel(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a build. # @return [Gitlab::ObjectifiedHash] The builds changes. def build_cancel(project, id) post("/projects/#{url_encode project}/builds/#{id}/cancel") end # Retry a build. # # @example # Gitlab.build_retry(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a build. # @return [Array] The builds changes. def build_retry(project, id) post("/projects/#{url_encode project}/builds/#{id}/retry") end # Erase a single build of a project (remove build artifacts and a build trace) # # @example # Gitlab.build_erase(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a build. # @return [Gitlab::ObjectifiedHash] The build's changes. def build_erase(project, id) post("/projects/#{url_encode project}/builds/#{id}/erase") end end end gitlab-4.8.0/lib/gitlab/client/commits.rb000066400000000000000000000205351341107427500202640ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to repository commits. # @see https://docs.gitlab.com/ce/api/commits.html module Commits # Gets a list of project commits. # # @example # Gitlab.commits('viking') # Gitlab.repo_commits('gitlab', { ref_name: 'api' }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [String] :ref_name The branch or tag name of a project repository. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def commits(project, options = {}) get("/projects/#{url_encode project}/repository/commits", query: options) end alias repo_commits commits # Gets a specific commit identified by the commit hash or name of a branch or tag. # # @example # Gitlab.commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6') # Gitlab.repo_commit(3, 'ed899a2f4b50b4370feeea94676502b42383c746') # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The commit hash or name of a repository branch or tag # @return [Gitlab::ObjectifiedHash] def commit(project, sha) get("/projects/#{url_encode project}/repository/commits/#{sha}") end alias repo_commit commit # Cherry picks a commit to a given branch. # # @example # Gitlab.cherry_pick_commit(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The commit hash or name of a repository branch or tag # @param [String] branch The name of the branch # @return [Gitlab::ObjectifiedHash] def cherry_pick_commit(project, sha, branch) post("/projects/#{url_encode project}/repository/commits/#{sha}/cherry_pick", body: { branch: branch }) end # Get the diff of a commit in a project. # # @example # Gitlab.commit_diff(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6') # Gitlab.repo_commit_diff(3, 'ed899a2f4b50b4370feeea94676502b42383c746') # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The name of a repository branch or tag or if not given the default branch. # @return [Gitlab::ObjectifiedHash] def commit_diff(project, sha) get("/projects/#{url_encode project}/repository/commits/#{sha}/diff") end alias repo_commit_diff commit_diff # Gets a list of comments for a commit. # # @example # Gitlab.commit_comments(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b') # # @param [Integer] project The ID of a project. # @param [String] sha The commit hash or name of a repository branch or tag. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def commit_comments(project, commit, options = {}) get("/projects/#{url_encode project}/repository/commits/#{commit}/comments", query: options) end alias repo_commit_comments commit_comments # Creates a new comment for a commit. # # @example # Gitlab.create_commit_comment(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b', 'Nice work on this commit!') # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The commit hash or name of a repository branch or tag. # @param [String] note The text of a comment. # @param [Hash] options A customizable set of options. # @option options [String] :path The file path. # @option options [Integer] :line The line number. # @option options [String] :line_type The line type (new or old). # @return [Gitlab::ObjectifiedHash] Information about created comment. def create_commit_comment(project, commit, note, options = {}) post("/projects/#{url_encode project}/repository/commits/#{commit}/comments", body: options.merge(note: note)) end alias repo_create_commit_comment create_commit_comment # Get the status of a commit # # @example # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6') # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins' }) # Gitlab.commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', { name: 'jenkins', all: true }) # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The commit hash # @param [Hash] options A customizable set of options. # @option options [String] :ref Filter by ref name, it can be branch or tag # @option options [String] :stage Filter by stage # @option options [String] :name Filter by status name, eg. jenkins # @option options [Boolean] :all The flag to return all statuses, not only latest ones def commit_status(project, sha, options = {}) get("/projects/#{url_encode project}/repository/commits/#{sha}/statuses", query: options) end alias repo_commit_status commit_status # Adds or updates a status of a commit. # # @example # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'success') # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'failed', { name: 'jenkins' }) # Gitlab.update_commit_status(42, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'canceled', { name: 'jenkins', target_url: 'http://example.com/builds/1' }) # # @param [Integer, String] project The ID or name of a project. # @param [String] sha The commit hash # @param [String] state of the status. Can be: pending, running, success, failed, canceled # @param [Hash] options A customizable set of options. # @option options [String] :ref The ref (branch or tag) to which the status refers # @option options [String] :name Filter by status name, eg. jenkins # @option options [String] :target_url The target URL to associate with this status def update_commit_status(project, sha, state, options = {}) post("/projects/#{url_encode project}/statuses/#{sha}", query: options.merge(state: state)) end alias repo_update_commit_status update_commit_status # Creates a single commit with one or more changes # # @see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions # Introduced in Gitlab 8.13 # # @example # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'create', file_path: '/foo.txt', content: 'bar'}]) # Gitlab.create_commit(2726132, 'master', 'refactors everything', [{action: 'delete', file_path: '/foo.txt'}]) # # @param [Integer, String] project The ID or name of a project. # @param [String] branch the branch name you wish to commit to # @param [String] message the commit message # @param [Array[Hash]] An array of action hashes to commit as a batch. See the next table for what attributes it can take. # @option options [String] :author_email the email address of the author # @option options [String] :author_name the name of the author # @return [Gitlab::ObjectifiedHash] hash of commit related data def create_commit(project, branch, message, actions, options = {}) payload = { branch: branch, commit_message: message, actions: actions }.merge(options) post("/projects/#{url_encode project}/repository/commits", body: payload) end # Gets a list of merge requests for a commit. # # @see https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit # Introduced in Gitlab 10.7 # # @example # Gitlab.commit_merge_requests(5, 'c9f9662a9b1116c838b523ed64c6abdb4aae4b8b') # # @param [Integer] project The ID of a project. # @param [String] sha The commit hash. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def commit_merge_requests(project, commit, options = {}) get("/projects/#{url_encode project}/repository/commits/#{commit}/merge_requests", query: options) end alias repo_commit_merge_requests commit_merge_requests end end gitlab-4.8.0/lib/gitlab/client/deployments.rb000066400000000000000000000021471341107427500211530ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to deployments. # @see https://docs.gitlab.com/ce/api/deployments.html module Deployments # Gets a list of project deployments. # # @example # Gitlab.deployments(5) # Gitlab.deployments(5, { per_page: 10, page: 2 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def deployments(project, options = {}) get("/projects/#{url_encode project}/deployments", query: options) end # Gets a single deployment. # # @example # Gitlab.deployment(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an deployment. # @return [Gitlab::ObjectifiedHash] def deployment(project, id) get("/projects/#{url_encode project}/deployments/#{id}") end end end gitlab-4.8.0/lib/gitlab/client/environments.rb000066400000000000000000000066011341107427500213360ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to environments. # @see https://docs.gitlab.com/ce/api/environments.html module Environments # Gets a list of project environments. # # @example # Gitlab.environments(5) # Gitlab.environments(5, { per_page: 10, page: 2 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def environments(project, options = {}) get("/projects/#{url_encode project}/environments", query: options) end # Gets a single environment. # # @example # Gitlab.environment(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an environment. # @return [Gitlab::ObjectifiedHash] def environment(project, id) get("/projects/#{url_encode project}/environments/#{id}") end # Create an environment. # # @examples # Gitlab.create_environment(5, 'test-branch') # Gitlab.create_environment(5, 'test-branch', external_url: 'https://test-branch.example.host.com') # # @param [Integer, String] project The ID or name of a project. # @param [String] env_name Name for the environment # @option options [String] :external_url Optional URL for viewing the deployed project in this environment # @return [Gitlab::ObjectifiedHash] The updated environment. def create_environment(project, env_name, options = {}) body = { name: env_name }.merge(options) post("/projects/#{url_encode project}/environments", body: body) end # Update an environment. # # @examples # Gitlab.edit_environment(5, 36, name: 'test-branch') # Gitlab.edit_environment(5, 36, external_url: 'https://test-branch.example.host.com') # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an environment. # @param [Hash] options A hash of the attribute keys & values to update. # @option options [String] env_name Name for the environment # @option options [String] external_url Optional URL for viewing the deployed project in this environment # @return [Gitlab::ObjectifiedHash] The updated environment. def edit_environment(project, id, options = {}) put("/projects/#{url_encode project}/environments/#{id}", body: options) end # Deletes an environment. # # @example # Gitlab.delete_environment(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an environment. # @return [Gitlab::ObjectifiedHash] Information about the deleted environment. def delete_environment(project, id) delete("/projects/#{url_encode project}/environments/#{id}") end # Stop an environment. # # @example # Gitlab.stop_environment(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an environment. # @return [Array] The stopped environment. def stop_environment(project, id) post("/projects/#{url_encode project}/environments/#{id}/stop") end end end gitlab-4.8.0/lib/gitlab/client/events.rb000066400000000000000000000047641341107427500201230ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to events. # @see https://docs.gitlab.com/ce/api/events.html module Events # Gets a list of authenticated user's events # # @example # Gitlab.events() # Gitlab.events({ action: 'created', target_type: 'issue' }) # # @param [Hash] options A customizable set of options. # @option options [String] :action Only events of specific action type # @option options [String] :target_type Only events of specific target type # @option options [String] :before Only events created before YYYY-MM-DD # @option options [String] :after Only events created after YYYY-MM-DD # @option options [String] :sort Sort by created_at either 'asc' or 'desc' # @return [Array] def events(options = {}) get('/events', query: options) end # Gets a list of user contribution events # # @example # Gitlab.user_events(1) # Gitlab.user_events(1, { action: created}) # # @param [Integer, String] user The ID or username of user # @param [Hash] options A customizable set of options. # @option options [String] :action Only events of specific action type # @option options [String] :target_type Only events of specific target type # @option options [String] :before Only events created before YYYY-MM-DD # @option options [String] :after Only events created after YYYY-MM-DD # @option options [String] :sort Sort by created_at either 'asc' or 'desc' # @return [Array] def user_events(user, options = {}) get("/users/#{url_encode user}/events", query: options) end # Gets a list of visible project events # # @example # Gitlab.project_events(1) # Gitlab.project_events(1, { action: created }) # # @param [Integer] project The ID of project # @param [Hash] options A customizable set of options. # @option options [String] :action Only events of specific action type # @option options [String] :target_type Only events of specific target type # @option options [String] :before Only events created before YYYY-MM-DD # @option options [String] :after Only events created after YYYY-MM-DD # @option options [String] :sort Sort by created_at either 'asc' or 'desc' # @return [Array] def project_events(project, options = {}) get("/projects/#{url_encode project}/events", query: options) end end end gitlab-4.8.0/lib/gitlab/client/group_milestones.rb000066400000000000000000000073731341107427500222140ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to group milestones. # @see https://docs.gitlab.com/ee/api/group_milestones.html module GroupMilestones # Gets a list of a group's milestones. # # @example # Gitlab.group_milestones(5) # # @param [Integer, String] id The ID or name of a group. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def group_milestones(id, options = {}) get("/groups/#{url_encode id}/milestones", query: options) end # Gets a single group milestone. # # @example # Gitlab.group_milestone(5, 36) # # @param [Integer, String] id The ID or name of a group. # @param [Integer] milestone_id The ID of a milestone. # @return [Gitlab::ObjectifiedHash] def group_milestone(id, milestone_id) get("/groups/#{url_encode id}/milestones/#{milestone_id}") end # Creates a new group milestone. # # @example # Gitlab.create_group_milestone(5, 'v1.0') # # @param [Integer, String] id The ID or name of a group. # @param [String] title The title of a milestone. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of a milestone. # @option options [String] :due_date The due date of a milestone. # @return [Gitlab::ObjectifiedHash] Information about created milestone. def create_group_milestone(id, title, options = {}) body = { title: title }.merge(options) post("/groups/#{url_encode id}/milestones", body: body) end # Updates a group milestone. # # @example # Gitlab.edit_group_milestone(5, 2, { state_event: 'activate' }) # # @param [Integer, String] id The ID or name of a group. # @param [Integer] milestone_id The ID of a milestone. # @param [Hash] options A customizable set of options. # @option options [String] :title The title of a milestone. # @option options [String] :description The description of a milestone. # @option options [String] :due_date The due date of a milestone. # @option options [String] :state_event The state of a milestone ('close' or 'activate'). # @return [Gitlab::ObjectifiedHash] Information about updated milestone. def edit_group_milestone(id, milestone_id, options = {}) put("/groups/#{url_encode id}/milestones/#{milestone_id}", body: options) end # Gets the issues of a given group milestone. # # @example # Gitlab.group_milestone_issues(5, 2) # # @param [Integer, String] id The ID or name of a group. # @param [Integer, String] milestone_id The ID of a milestone. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def group_milestone_issues(id, milestone_id, options = {}) get("/groups/#{url_encode id}/milestones/#{milestone_id}/issues", query: options) end # Gets the merge_requests of a given group milestone. # # @example # Gitlab.group_milestone_merge_requests(5, 2) # # @param [Integer, String] group The ID or name of a group. # @param [Integer, String] milestone_id The ID of a milestone. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def group_milestone_merge_requests(id, milestone_id, options = {}) get("/groups/#{url_encode id}/milestones/#{milestone_id}/merge_requests", query: options) end end end gitlab-4.8.0/lib/gitlab/client/groups.rb000066400000000000000000000162521341107427500201310ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to groups. # @see https://docs.gitlab.com/ce/api/groups.html module Groups # Gets a list of groups. # # @example # Gitlab.groups # Gitlab.groups({ per_page: 40, page: 2 }) # # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def groups(options = {}) get('/groups', query: options) end # Gets a single group. # # @example # Gitlab.group(42) # # @param [Integer] id The ID of a group. # @return [Gitlab::ObjectifiedHash] def group(id) get("/groups/#{url_encode id}") end # Creates a new group. # # @example # Gitlab.create_group('new-group', 'group-path') # Gitlab.create_group('gitlab', 'gitlab-path', { description: 'New Gitlab project' }) # # @param [String] name The name of a group. # @param [String] path The path of a group. # @return [Gitlab::ObjectifiedHash] Information about created group. def create_group(name, path, options = {}) body = { name: name, path: path }.merge(options) post('/groups', body: body) end # Delete's a group. # # @example # Gitlab.delete_group(42) # @param [Integer] id The ID of a group # @return [Gitlab::ObjectifiedHash] Information about the deleted group. def delete_group(id) delete("/groups/#{url_encode id}") end # Get a list of group members. # # @example # Gitlab.group_members(1) # Gitlab.group_members(1, { per_page: 40 }) # # @param [Integer] id The ID of a group. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def group_members(id, options = {}) get("/groups/#{url_encode id}/members", query: options) end # Get details of a single group member. # # @example # Gitlab.group_member(1, 10) # # @param [Integer] team_id The ID of the group to find a member in. # @param [Integer] user_id The user id of the member to find. # @return [Gitlab::ObjectifiedHash] (id, username, name, email, state, access_level ...) def group_member(team_id, user_id) get("/groups/#{url_encode team_id}/members/#{user_id}") end # Adds a user to group. # # @example # Gitlab.add_group_member(1, 2, 40) # # @param [Integer] team_id The group id to add a member to. # @param [Integer] user_id The user id of the user to add to the team. # @param [Integer] access_level Project access level. # @return [Gitlab::ObjectifiedHash] Information about added team member. def add_group_member(team_id, user_id, access_level) post("/groups/#{url_encode team_id}/members", body: { user_id: user_id, access_level: access_level }) end # Edit a user of a group. # # @example # Gitlab.edit_group_member(1, 2, 40) # # @param [Integer] team_id The group id of member to edit. # @param [Integer] user_id The user id of the user to edit. # @param [Integer] access_level Project access level. # @return [Gitlab::ObjectifiedHash] Information about edited team member. def edit_group_member(team_id, user_id, access_level) put("/groups/#{url_encode team_id}/members/#{user_id}", body: { access_level: access_level }) end # Removes user from user group. # # @example # Gitlab.remove_group_member(1, 2) # # @param [Integer] team_id The group ID. # @param [Integer] user_id The ID of a user. # @return [Gitlab::ObjectifiedHash] Information about removed team member. def remove_group_member(team_id, user_id) delete("/groups/#{url_encode team_id}/members/#{user_id}") end # Transfers a project to a group # # @example # Gitlab.transfer_project_to_group(3, 50) # # @param [Integer] id The ID of a group. # @param [Integer] project_id The ID of a project. def transfer_project_to_group(id, project_id) body = { id: id, project_id: project_id } post("/groups/#{url_encode id}/projects/#{project_id}", body: body) end # Search for groups by name # # @example # Gitlab.group_search('gitlab') # # @param [String] search A string to search for in group names and paths. # @param [Hash] options A customizable set of options. # @option options [String] :per_page Number of projects to return per page # @option options [String] :page The page to retrieve # @return [Array] def group_search(search, options = {}) options[:search] = search get('/groups', query: options) end # Get a list of projects under a group # @example # Gitlab.group_projects(1) # # @param [Integer] id The ID of a group # @return [Array] List of projects under a group def group_projects(id, options = {}) get("/groups/#{url_encode id}/projects", query: options) end # Get a list of subgroups under a group # @example # Gitlab.group_subgroups(1) # # @param [Integer] id the ID of a group # @param [Hash] options A customizable set of options. # @option options [String] :skip_groups Skip the group IDs passed. # @option options [String] :all_available Show all the groups you have access to (defaults to false for authenticated users). # @option options [String] :search Return the list of authorized groups matching the search criteria. # @option options [String] :order_by Order groups by name or path. Default is name. # @option options [String] :sort Order groups in asc or desc order. Default is asc. # @option options [String] :statistics Include group statistics (admins only). # @option options [String] :owned Limit to groups owned by the current user. # @return [Array] List of subgroups under a group def group_subgroups(id, options = {}) get("/groups/#{url_encode id}/subgroups", query: options) end # Updates an existing group. # # @example # Gitlab.edit_group(42) # Gitlab.edit_group(42, { name: 'Group Name' }) # # @param [Integer] group The ID. # @param [Hash] options A customizable set of options # @option options [String] :name The name of the group. # @option options [String] :path The path of the group. # @option options [String] :description The description of the group. # @option options [String] :visibility The visibility level of the group. Can be private, internal, or public # @option options [String] :lfs_enabled Enable/disable Large File Storage (LFS) for the projects in this groupr. # @option options [String] :request_access_enabled Allow users to request member access. # @return [Gitlab::ObjectifiedHash] Information about the edited group. def edit_group(id, options = {}) put("/groups/#{url_encode id}", body: options) end end end gitlab-4.8.0/lib/gitlab/client/issues.rb000066400000000000000000000205771341107427500201320ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to issues. # @see https://docs.gitlab.com/ce/api/issues.html module Issues # Gets a list of user's issues. # Will return a list of project's issues if project ID passed. # # @example # Gitlab.issues # Gitlab.issues(5) # Gitlab.issues({ per_page: 40 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def issues(project = nil, options = {}) if project.to_s.empty? && project.to_i.zero? get('/issues', query: options) else get("/projects/#{url_encode project}/issues", query: options) end end # Gets a single issue. # # @example # Gitlab.issue(5, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @return [Gitlab::ObjectifiedHash] def issue(project, id) get("/projects/#{url_encode project}/issues/#{id}") end # Creates a new issue. # # @example # Gitlab.create_issue(5, 'New issue') # Gitlab.create_issue(5, 'New issue', { description: 'This is a new issue', assignee_id: 42 }) # # @param [Integer, String] project The ID or name of a project. # @param [String] title The title of an issue. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of an issue. # @option options [Integer] :assignee_id The ID of a user to assign issue. # @option options [Integer] :milestone_id The ID of a milestone to assign issue. # @option options [String] :labels Comma-separated label names for an issue. # @return [Gitlab::ObjectifiedHash] Information about created issue. def create_issue(project, title, options = {}) body = { title: title }.merge(options) post("/projects/#{url_encode project}/issues", body: body) end # Updates an issue. # # @example # Gitlab.edit_issue(6, 1, { title: 'Updated title' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @param [Hash] options A customizable set of options. # @option options [String] :title The title of an issue. # @option options [String] :description The description of an issue. # @option options [Integer] :assignee_id The ID of a user to assign issue. # @option options [Integer] :milestone_id The ID of a milestone to assign issue. # @option options [String] :labels Comma-separated label names for an issue. # @option options [String] :state_event The state event of an issue ('close' or 'reopen'). # @return [Gitlab::ObjectifiedHash] Information about updated issue. def edit_issue(project, id, options = {}) put("/projects/#{url_encode project}/issues/#{id}", body: options) end # Closes an issue. # # @example # Gitlab.close_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @return [Gitlab::ObjectifiedHash] Information about closed issue. def close_issue(project, id) put("/projects/#{url_encode project}/issues/#{id}", body: { state_event: 'close' }) end # Reopens an issue. # # @example # Gitlab.reopen_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @return [Gitlab::ObjectifiedHash] Information about reopened issue. def reopen_issue(project, id) put("/projects/#{url_encode project}/issues/#{id}", body: { state_event: 'reopen' }) end # Subscribe to an issue. # # @example # Gitlab.subscribe_to_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @return [Gitlab::ObjectifiedHash] Information about subscribed issue. def subscribe_to_issue(project, id) post("/projects/#{url_encode project}/issues/#{id}/subscribe") end # Unsubscribe from an issue. # # @example # Gitlab.unsubscribe_from_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @return [Gitlab::ObjectifiedHash] Information about unsubscribed issue. def unsubscribe_from_issue(project, id) post("/projects/#{url_encode project}/issues/#{id}/unsubscribe") end # Deletes an issue. # Only for admins and project owners # # @example # Gitlab.delete_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @return [Gitlab::ObjectifiedHash] Information about deleted issue. def delete_issue(project, id) delete("/projects/#{url_encode project}/issues/#{id}") end # Move an issue. # # @example # Gitlab.move_issue(3, 42, { to_project_id: '4' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @option options [String] :to_project_id The ID of the new project. # @return [Gitlab::ObjectifiedHash] Information about moved issue. def move_issue(project, id, options = {}) post("/projects/#{url_encode project}/issues/#{id}/move", body: options) end # Sets an estimated time of work for an issue. # # @example # Gitlab.estimate_time_of_issue(3, 42, '3h30m') # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @param [String] duration The duration in human format. e.g: 3h30m def estimate_time_of_issue(project, id, duration) post("/projects/#{url_encode project}/issues/#{id}/time_estimate", body: { duration: url_encode(duration) }) end # Resets the estimated time for an issue to 0 seconds. # # @example # Gitlab.reset_time_estimate_of_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. def reset_time_estimate_of_issue(project, id) post("/projects/#{url_encode project}/issues/#{id}/reset_time_estimate") end # Adds spent time for an issue # # @example # Gitlab.estimate_time_of_issue(3, 42, '3h30m') # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. # @param [String] duration The time spent in human format. e.g: 3h30m def add_time_spent_on_issue(project, id, duration) post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) }) end # Resets the total spent time for this issue to 0 seconds. # # @example # Gitlab.reset_time_spent_on_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. def reset_time_spent_on_issue(project, id) post("/projects/#{url_encode project}/issues/#{id}/reset_spent_time") end # Get time tracking stats for an issue # # @example # @gitlab.time_stats_for_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. def time_stats_for_issue(project, id) get("/projects/#{url_encode project}/issues/#{id}/time_stats") end # Get participants on issue # # @example # @gitlab.participants_on_issue(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. def participants_on_issue(project, id) get("/projects/#{url_encode project}/issues/#{id}/participants") end # List merge requests that will close issue on merge # # @example # Gitlab.merge_requests_closing_issue_on_merge(3, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of an issue. def merge_requests_closing_issue_on_merge(project, id) get("/projects/#{url_encode project}/issues/#{id}/closed_by") end end end gitlab-4.8.0/lib/gitlab/client/jobs.rb000066400000000000000000000135271341107427500175510ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to projects. # @see https://docs.gitlab.com/ee/api/jobs.html module Jobs # Gets a list of Jobs for a Project # # @example # Gitlab.jobs(1) # Gitlab.jobs("project") # Gitlab.jobs("project", {scope: ["manual", "success"], per_page: 100 }) # # @param [Integer, String] id The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Array] :scope The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def jobs(project_id, options = {}) get("/projects/#{url_encode project_id}/jobs", query: options) end # Gets a list of Jobs from a pipeline # # @example # Gitlab.pipeline_jobs(1, 2) # Gitlab.pipeline_jobs("project", 2) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the pipeline # @param [Hash] options A customizable set of options. # @option options [Array] :scope The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided. # @return [Array] def pipeline_jobs(project_id, pipeline_id, options = {}) get("/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/jobs", query: options) end # Gets a single job # # @example # Gitlab.job(1, 2) # Gitlab.job("project", 2) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job def job(project_id, job_id) get("/projects/#{url_encode project_id}/jobs/#{job_id}") end # Gets artifacts from a job # # @example # Gitlab.job_artifacts(1, 2) # Gitlab.job_artifacts("project", 2) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_artifacts(project_id, job_id) get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end # Download Job Artifact # # @example # Gitlab.job_artifacts_download(1, "master", "release") # Gitlab.job_artifacts_download("project", "master", "release") # # @param [Integer, String] id, The ID or name of a project. # @param [String] ref, Ref Name # @param [String] job, jobname # @return [Array] def job_artifacts_download(project_id, ref_name, job_name) get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download", query: { job: job_name }, format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end # Get Job Trace # # @example # Gitlab.job_trace(1,1) # Gitlab.job_trace("project", 1) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_trace(project_id, job_id) get("/projects/#{url_encode project_id}/jobs/#{job_id}/trace", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end # Cancel a job # # @example # Gitlab.job_cancel(1,1) # Gitlab.job_cancel("project", 1) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_cancel(project_id, job_id) post("/projects/#{url_encode project_id}/jobs/#{job_id}/cancel") end # Retry a job # # @example # Gitlab.job_retry(1,1) # Gitlab.job_retry("project", 1) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_retry(project_id, job_id) post("/projects/#{url_encode project_id}/jobs/#{job_id}/retry") end # Erase Job # # @example # Gitlab.job_erase(1,1) # Gitlab.job_erase("project", 1) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_erase(project_id, job_id) post("/projects/#{url_encode project_id}/jobs/#{job_id}/erase") end # Play a Job # Triggers a manual action to start a job. # # @example # Gitlab.job_play(1,1) # Gitlab.job_play("project", 1) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_play(project_id, job_id) post("/projects/#{url_encode project_id}/jobs/#{job_id}/play") end # Keep Artifacts # Prevents artifacts from being deleted when expiration is set. # # @example # Gitlab.job_artifacts_keep(1,1) # Gitlab.job_artifacts_keep("project", 1) # # @param [Integer, String] The ID or name of a project. # @param [Integer] the id of the job # @return [Array] def job_artifacts_keep(project_id, job_id) post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep") end end end gitlab-4.8.0/lib/gitlab/client/keys.rb000066400000000000000000000005751341107427500175660ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to keys. # @see https://docs.gitlab.com/ce/api/keys.html module Keys # Gets information about a key. # # @example # Gitlab.key(1) # # @param [Integer] id The ID of a key. # @return [Gitlab::ObjectifiedHash] def key(id) get("/keys/#{id}") end end end gitlab-4.8.0/lib/gitlab/client/labels.rb000066400000000000000000000067661341107427500200650ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to labels. # @see https://docs.gitlab.com/ce/api/labels.html module Labels # Gets a list of project's labels. # # @example # Gitlab.labels(5) # # @param [Integer, String] project The ID or name of a project. # @return [Array] def labels(project, options = {}) get("/projects/#{url_encode project}/labels", query: options) end # Creates a new label. # # @example # Gitlab.create_label(42, "Backlog", '#DD10AA') # # @param [Integer, String] project The ID or name of a project. # @param [String] name The name of a label. # @param [String] color The color of a label. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of the label. # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority. # @return [Gitlab::ObjectifiedHash] Information about created label. def create_label(project, name, color, options = {}) post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color)) end # Updates a label. # # @example # Gitlab.edit_label(42, "Backlog", { new_name: 'TODO' }) # Gitlab.edit_label(42, "Backlog", { new_name: 'TODO', color: '#DD10AA' }) # # @param [Integer, String] project The ID or name of a project. # @param [String] name The name of a label. # @param [Hash] options A customizable set of options. # @option options [String] :new_name The new name of a label. # @option options [String] :color The color of a label. # @option options [String] :description The description of the label. # @option options [String] :priority The priority of the label. Must be greater or equal than zero or null to remove the priority. # @return [Gitlab::ObjectifiedHash] Information about updated label. def edit_label(project, name, options = {}) put("/projects/#{url_encode project}/labels", body: options.merge(name: name)) end # Deletes a label. # # @example # Gitlab.delete_label(2, 'Backlog') # # @param [Integer, String] project The ID or name of a project. # @param [String] name The name of a label. # @return [Gitlab::ObjectifiedHash] Information about deleted label. def delete_label(project, name) delete("/projects/#{url_encode project}/labels", body: { name: name }) end # Subscribes the user to a label to receive notifications # # @example # Gitlab.subscribe_to_label(2, 'Backlog') # # @param [Integer, String] project The ID or name of a project. # @param [String] name The name of a label. # @return [Gitlab::ObjectifiedHash] Information about the label subscribed to. def subscribe_to_label(project, name) post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe") end # Unsubscribes the user from a label to not receive notifications from it # # @example # Gitlab.unsubscribe_from_label(2, 'Backlog') # # @param [Integer, String] project The ID or name of a project. # @param [String] name The name of a label. # @return [Gitlab::ObjectifiedHash] Information about the label unsubscribed from. def unsubscribe_from_label(project, name) post("/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe") end end end gitlab-4.8.0/lib/gitlab/client/merge_request_approvals.rb000066400000000000000000000126101341107427500235420ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to MR Approvals. # @see https://docs.gitlab.com/ee/api/merge_request_approvals.html module MergeRequestApprovals # Gets MR Approval Configuration for a project # # @example # Gitlab.project_merge_request_approvals(1) # # @param [Integer] project The ID of a project. # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project def project_merge_request_approvals(project) get("/projects/#{url_encode project}/approvals") end # Change MR Approval Configuration for a project # # @example # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3}) # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, reset_approvals_on_push: true}) # Gitlab.edit_project_merge_request_approvals(1, {approvals_before_merge: 3, disable_overriding_approvers_per_merge_request: false}) # # @param [Integer] project(required) The ID of a project. # @option options [Integer] :approvals_before_merge(optional) How many approvals are required before an MR can be merged # @option options [Boolean] :reset_approvals_on_push(optional) Reset approvals on a new push # @option options [Boolean] :disable_overriding_approvers_per_merge_request(optional) Allow/Disallow overriding approvers per MR # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project def edit_project_merge_request_approvals(project, options = {}) post("/projects/#{url_encode project}/approvals", body: options) end # Change allowed approvers and approver groups for a project # # @example # Gitlab.edit_project_approvers(1, {approver_ids: [5], approver_groups: [1]}) # # @param [Integer] project(required) The ID of a project. # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project def edit_project_approvers(project, options = {}) put("/projects/#{url_encode project}/approvals", body: options) end # Get Configuration for approvals on a specific Merge Request. # # @example # Gitlab.merge_request_approvals(1, 5) # # @param [Integer] project(required) The ID of a project. # @param [Integer] merge_request(required) The IID of a merge_request. # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the merge request def merge_request_approvals(project, merge_request) get("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals") end # Change configuration for approvals on a specific merge request. # # @example # Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2) # # @param [Integer] project(required) The ID of a project. # @param [Integer] merge_request(required) The IID of a merge_request. # @option options [Integer] :approvals_required(required) Approvals required before MR can be merged # @return [Gitlab::ObjectifiedHash] Updated MR approval configuration information about the merge request def edit_merge_request_approvals(project, merge_request, options = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) end # Change allowed approvers and approver groups for a merge request # # @example # Gitlab.edit_merge_request_approvers(1, 5, {approver_ids: [5], approver_groups: [1]}) # # @param [Integer] project(required) The ID of a project. # @param [Integer] merge_request(required) The IID of a merge_request. # @option options [Array] :approver_ids(optional) An array of User IDs that can approve MRs # @option options [Array] :approver_group_ids(optional) An array of Group IDs whose members can approve MRs # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project def edit_merge_request_approvers(project, merge_request, options = {}) put("/projects/#{url_encode project}/merge_requests/#{merge_request}/approvals", body: options) end # Approve a merge request # # @example # Gitlab.approve_merge_request(1, 5) # Gitlab.approve_merge_request(1, 5, sha: 'fe678da') # # @param [Integer] project(required) The ID of a project. # @param [Integer] merge_request(required) The IID of a merge request. # @option options [String] :sha(optional) The HEAD of the MR # @return [Gitlab::ObjectifiedHash] MR approval configuration information about the project def approve_merge_request(project, merge_request, options = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/approve", body: options) end # Unapprove a merge request # # @example # Gitlab.unapprove_merge_request(1, 5) # # @param [Integer] project(required) The ID of a project. # @param [Integer] merge_request(required) The IID of a merge request. # @return [void] This API call returns an empty response body. def unapprove_merge_request(project, merge_request) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/unapprove") end end end gitlab-4.8.0/lib/gitlab/client/merge_requests.rb000066400000000000000000000346051341107427500216460ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to merge requests. # @see https://docs.gitlab.com/ce/api/merge_requests.html module MergeRequests # Gets a list of all of the merge requests the authenticated user has access to. # # @example # Gitlab.user_merge_requests # Gitlab.user_merge_requests(state: :opened, scope: :all) # # @param [Hash] options A customizable set of options. # @return [Array] def user_merge_requests(options = {}) get('/merge_requests', query: options) end # Gets a list of project merge requests. # # @example # Gitlab.merge_requests(5) # Gitlab.merge_requests(5, { per_page: 40 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def merge_requests(project, options = {}) get("/projects/#{url_encode project}/merge_requests", query: options) end # Gets a single merge request. # # @example # Gitlab.merge_request(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return ] def merge_request_pipelines(project, id) get("/projects/#{url_encode project}/merge_requests/#{id}/pipelines") end # Creates a merge request. # # @example # Gitlab.create_merge_request(5, 'New merge request', # { source_branch: 'source_branch', target_branch: 'target_branch' }) # Gitlab.create_merge_request(5, 'New merge request', # { source_branch: 'source_branch', target_branch: 'target_branch', assignee_id: 42 }) # # @param [Integer, String] project The ID or name of a project. # @param [String] title The title of a merge request. # @param [Hash] options A customizable set of options. # @option options [String] :source_branch (required) The source branch name. # @option options [String] :target_branch (required) The target branch name. # @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request. # @option options [Integer] :target_project_id (optional) The target project ID. # @option options [String] :labels (optional) Labels as a comma-separated list. # @return [Gitlab::ObjectifiedHash] Information about created merge request. def create_merge_request(project, title, options = {}) body = { title: title }.merge(options) post("/projects/#{url_encode project}/merge_requests", body: body) end # Updates a merge request. # # @example # Gitlab.update_merge_request(5, 42, { title: 'New title' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Hash] options A customizable set of options. # @option options [String] :title The title of a merge request. # @option options [String] :source_branch The source branch name. # @option options [String] :target_branch The target branch name. # @option options [Integer] :assignee_id The ID of a user to assign merge request. # @option options [String] :state_event New state (close|reopen|merge). # @return [Gitlab::ObjectifiedHash] Information about updated merge request. def update_merge_request(project, id, options = {}) put("/projects/#{url_encode project}/merge_requests/#{id}", body: options) end # Accepts a merge request. # # @example # Gitlab.accept_merge_request(5, 42, { merge_commit_message: 'Nice!' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Hash] options A customizable set of options. # @option options [String] :merge_commit_message Custom merge commit message # @return [Gitlab::ObjectifiedHash] Information about updated merge request. def accept_merge_request(project, id, options = {}) put("/projects/#{url_encode project}/merge_requests/#{id}/merge", body: options) end # Gets the changes of a merge request. # # @example # Gitlab.merge_request_changes(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] The merge request's changes. def merge_request_changes(project, id) get("/projects/#{url_encode project}/merge_requests/#{id}/changes") end # Gets the commits of a merge request. # # @example # Gitlab.merge_request_commits(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return [Array] The merge request's commits. def merge_request_commits(project, id) get("/projects/#{url_encode project}/merge_requests/#{id}/commits") end # List issues that will close on merge # # @example # Gitlab.merge_request_closes_issues(5, 1) # # @param [Integer] project The ID of a project # @param [Integer] iid The internal ID of a merge request def merge_request_closes_issues(project_id, merge_request_iid) get("/projects/#{project_id}/merge_requests/#{merge_request_iid}/closes_issues") end # Subscribes to a merge request. # # @example # Gitlab.subscribe_to_merge_request(5, 1) # Gitlab.subscribe_to_merge_request('gitlab', 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] Information about subscribed merge request. def subscribe_to_merge_request(project, id) post("/projects/#{url_encode project}/merge_requests/#{id}/subscribe") end # Unsubscribes from a merge request. # # @example # Gitlab.unsubscribe_from_merge_request(5, 1) # Gitlab.unsubscribe_from_merge_request('gitlab', 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] Information about unsubscribed merge request. def unsubscribe_from_merge_request(project, id) post("/projects/#{url_encode project}/merge_requests/#{id}/unsubscribe") end # List project merge request discussions # # @example # Gitlab.merge_request_discussions(5, 1) # Gitlab.merge_request_discussions('gitlab', 1) # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] List of the merge request discussions. def merge_request_discussions(project, merge_request_id) get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions") end # Get single merge request discussion # # @example # Gitlab.merge_request_discussion(5, 1, 1) # Gitlab.merge_request_discussion('gitlab', 1, 1) # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Integer] discussion_id The ID of a discussion. # @return [Gitlab::ObjectifiedHash] The merge request discussion. def merge_request_discussion(project, merge_request_id, discussion_id) get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}") end # Create new merge request discussion # # @example # Gitlab.create_merge_request_discussion(5, 1, body: 'discuss') # Gitlab.create_merge_request_discussion('gitlab', 1, body: 'discuss') # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Hash] options A customizable set of options. # * :body (String) The content of a discussion # * :created_at (String) Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z # * :position (Hash) Position when creating a diff note # * :base_sha (String) Base commit SHA in the source branch # * :start_sha (String) SHA referencing commit in target branch # * :head_sha (String) SHA referencing HEAD of this merge request # * :position_type (String) Type of the position reference', allowed values: 'text' or 'image' # * :new_path (String) File path after change # * :new_line (Integer) Line number after change (for 'text' diff notes) # * :old_path (String) File path before change # * :old_line (Integer) Line number before change (for 'text' diff notes) # * :width (Integer) Width of the image (for 'image' diff notes) # * :height (Integer) Height of the image (for 'image' diff notes) # * :x (Integer) X coordinate (for 'image' diff notes) # * :y (Integer) Y coordinate (for 'image' diff notes) # @return [Gitlab::ObjectifiedHash] The created merge request discussion. def create_merge_request_discussion(project, merge_request_id, options = {}) post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions", body: options) end # Resolve a merge request discussion # # @example # Gitlab.resolve_merge_request_discussion(5, 1, 1, true) # Gitlab.resolve_merge_request_discussion('gitlab', 1, 1, false) # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Integer] discussion_id The ID of a discussion. # @param [Hash] options A customizable set of options. # @option options [Boolean] :resolved Resolve/unresolve the discussion. # @return [Gitlab::ObjectifiedHash] The merge request discussion. def resolve_merge_request_discussion(project, merge_request_id, discussion_id, options) put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}", body: options) end # Add note to existing merge request discussion # # @example # Gitlab.create_merge_request_discussion_note(5, 1, 1, note_id: 1, body: 'note') # Gitlab.create_merge_request_discussion_note('gitlab', 1, 1, note_id: 1, body: 'note') # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Integer] discussion_id The ID of a discussion. # @param [Hash] options A customizable set of options. # @option options [Integer] :note_id The ID of a discussion note. # @option options [String] :body The content of a discussion. # @option options [String] :created_at Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z. # @return [Gitlab::ObjectifiedHash] The merge request discussion note. def create_merge_request_discussion_note(project, merge_request_id, discussion_id, options) post("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes", body: options) end # Modify an existing merge request discussion note # # @example # Gitlab.update_merge_request_discussion_note(5, 1, 1, 1, body: 'note') # Gitlab.update_merge_request_discussion_note('gitlab', 1, 1, 1, body: 'note') # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Integer] discussion_id The ID of a discussion. # @param [Integer] note_id The ID of a discussion note. # @param [Hash] options A customizable set of options. # @option options [String] :body The content of a discussion. # @option options [Boolean] :resolved Resolve/unresolve the note. # @return [Gitlab::ObjectifiedHash] The merge request discussion note. def update_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id, options) put("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}", body: options) end # Delete a merge request discussion note # # @example # Gitlab.delete_merge_request_discussion_note(5, 1, 1, 1) # Gitlab.delete_merge_request_discussion_note('gitlab', 1, 1, 1) # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Integer] discussion_id The ID of a discussion. # @param [Integer] note_id The ID of a discussion note. # @return [Gitlab::ObjectifiedHash] An empty response. def delete_merge_request_discussion_note(project, merge_request_id, discussion_id, note_id) delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/discussions/#{discussion_id}/notes/#{note_id}") end # Gets a list of merge request diff versions # # @example # Gitlab.merge_request_versions(5, 1) # Gitlab.merge_request_versions('gitlab', 1) # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @return [Gitlab::ObjectifiedHash] A list of the merge request versions. def merge_request_diff_versions(project, merge_request_id) get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions") end # Gets the diff a single merge request diff version\ # # @example # Gitlab.merge_request_diff_version(5, 1, 1) # Gitlab.merge_request_diff_version('gitlab', 1, 1) # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a merge request. # @param [Integer] id The ID of a merge request diff version. # @return [Gitlab::ObjectifiedHash] Record of the specific diff def merge_request_diff_version(project, merge_request_id, version_id) get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/versions/#{version_id}") end end end gitlab-4.8.0/lib/gitlab/client/milestones.rb000066400000000000000000000100611341107427500207640ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to milestones. # @see https://docs.gitlab.com/ce/api/milestones.html module Milestones # Gets a list of project's milestones. # # @example # Gitlab.milestones(5) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def milestones(project, options = {}) get("/projects/#{url_encode project}/milestones", query: options) end # Gets a single milestone. # # @example # Gitlab.milestone(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a milestone. # @return [Gitlab::ObjectifiedHash] def milestone(project, id) get("/projects/#{url_encode project}/milestones/#{id}") end # Gets the issues of a given milestone. # # @example # Gitlab.milestone_issues(5, 2) # # @param [Integer, String] project The ID or name of a project. # @param [Integer, String] milestone The ID of a milestone. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def milestone_issues(project, milestone, options = {}) get("/projects/#{url_encode project}/milestones/#{milestone}/issues", query: options) end # Gets the merge_requests of a given milestone. # # @example # Gitlab.milestone_merge_requests(5, 2) # # @param [Integer, String] project The ID or name of a project. # @param [Integer, String] milestone The ID of a milestone. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def milestone_merge_requests(project, milestone, options = {}) get("/projects/#{url_encode project}/milestones/#{milestone}/merge_requests", query: options) end # Creates a new milestone. # # @example # Gitlab.create_milestone(5, 'v1.0') # # @param [Integer, String] project The ID or name of a project. # @param [String] title The title of a milestone. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of a milestone. # @option options [String] :due_date The due date of a milestone. # @return [Gitlab::ObjectifiedHash] Information about created milestone. def create_milestone(project, title, options = {}) body = { title: title }.merge(options) post("/projects/#{url_encode project}/milestones", body: body) end # Updates a milestone. # # @example # Gitlab.edit_milestone(5, 2, { state_event: 'activate' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a milestone. # @param [Hash] options A customizable set of options. # @option options [String] :title The title of a milestone. # @option options [String] :description The description of a milestone. # @option options [String] :due_date The due date of a milestone. # @option options [String] :state_event The state of a milestone ('close' or 'activate'). # @return [Gitlab::ObjectifiedHash] Information about updated milestone. def edit_milestone(project, id, options = {}) put("/projects/#{url_encode project}/milestones/#{id}", body: options) end # Delete a project milestone. # # @example # Gitlab.delete_milestone(5, 2) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a milestone. # @return [nil] This API call returns an empty response body. def delete_milestone(project, id) delete("/projects/#{url_encode project}/milestones/#{id}") end end end gitlab-4.8.0/lib/gitlab/client/namespaces.rb000066400000000000000000000013271341107427500207260ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to namespaces # @see https://docs.gitlab.com/ce/api/namespaces.html module Namespaces # Gets a list of namespaces. # @see https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces # # @example # Gitlab.namespaces # # @param [Hash] options A customizable set of options. # @options options [Integer] :page The page number. # @options options [Integer] :per_page The number of results per page. # @options opttion [String] :search The string to search for. # @return [Array] def namespaces(options = {}) get('/namespaces', query: options) end end end gitlab-4.8.0/lib/gitlab/client/notes.rb000066400000000000000000000236061341107427500177430ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to notes. # @see https://docs.gitlab.com/ce/api/notes.html module Notes # Gets a list of projects notes. # # @example # Gitlab.notes(5) # # @param [Integer] project The ID of a project. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def notes(project, options = {}) get("/projects/#{url_encode project}/notes", query: options) end # Gets a list of notes for a issue. # # @example # Gitlab.issue_notes(5, 10) # # @param [Integer] project The ID of a project. # @param [Integer] issue The ID of an issue. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def issue_notes(project, issue, options = {}) get("/projects/#{url_encode project}/issues/#{issue}/notes", query: options) end # Gets a list of notes for a snippet. # # @example # Gitlab.snippet_notes(5, 1) # # @param [Integer] project The ID of a project. # @param [Integer] snippet The ID of a snippet. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def snippet_notes(project, snippet, options = {}) get("/projects/#{url_encode project}/snippets/#{snippet}/notes", query: options) end # Gets a list of notes for a merge request. # # @example # Gitlab.merge_request_notes(5, 1) # # @param [Integer] project The ID of a project. # @param [Integer] merge_request The ID of a merge request. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def merge_request_notes(project, merge_request, options = {}) get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", query: options) end alias merge_request_comments merge_request_notes # Gets a single wall note. # # @example # Gitlab.note(5, 15) # # @param [Integer] project The ID of a project. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def note(project, id) get("/projects/#{url_encode project}/notes/#{id}") end # Gets a single issue note. # # @example # Gitlab.issue_note(5, 10, 1) # # @param [Integer] project The ID of a project. # @param [Integer] issue The ID of an issue. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def issue_note(project, issue, id) get("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}") end # Gets a single snippet note. # # @example # Gitlab.snippet_note(5, 11, 3) # # @param [Integer] project The ID of a project. # @param [Integer] snippet The ID of a snippet. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def snippet_note(project, snippet, id) get("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}") end # Gets a single merge_request note. # # @example # Gitlab.merge_request_note(5, 11, 3) # # @param [Integer] project The ID of a project. # @param [Integer] merge_request The ID of a merge_request. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def merge_request_note(project, merge_request, id) get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}") end # Creates a new wall note. # # @example # Gitlab.create_note(5, 'This is a wall note!') # # @param [Integer, String] project The ID or name of a project. # @param [String] body The body of a note. # @return [Gitlab::ObjectifiedHash] Information about created note. def create_note(project, body) post("/projects/#{url_encode project}/notes", body: { body: body }) end # Creates a new issue note. # # @example # Gitlab.create_issue_note(6, 1, 'Adding a note to my issue.') # # @param [Integer, String] project The ID or name of a project. # @param [Integer] issue The ID of an issue. # @param [String] body The body of a note. # @return [Gitlab::ObjectifiedHash] Information about created note. def create_issue_note(project, issue, body) post("/projects/#{url_encode project}/issues/#{issue}/notes", body: { body: body }) end # Creates a new snippet note. # # @example # Gitlab.create_snippet_note(3, 2, 'Look at this awesome snippet!') # # @param [Integer, String] project The ID or name of a project. # @param [Integer] snippet The ID of a snippet. # @param [String] body The body of a note. # @return [Gitlab::ObjectifiedHash] Information about created note. def create_snippet_note(project, snippet, body) post("/projects/#{url_encode project}/snippets/#{snippet}/notes", body: { body: body }) end # Creates a new note for a single merge request. # # @example # Gitlab.create_merge_request_note(5, 3, 'This MR is ready for review.') # # @param [Integer] project The ID of a project. # @param [Integer] merge_request The ID of a merge request. # @param [String] body The content of a note. def create_merge_request_note(project, merge_request, body) post("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", body: { body: body }) end alias create_merge_request_comment create_merge_request_note # Deletes a wall note. # # @example # Gitlab.delete_note(5, 15) # # @param [Integer] project The ID of a project. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def delete_note(project, id) delete("/projects/#{url_encode project}/notes/#{id}") end # Deletes an issue note. # # @example # Gitlab.delete_issue_note(5, 10, 1) # # @param [Integer] project The ID of a project. # @param [Integer] issue The ID of an issue. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def delete_issue_note(project, issue, id) delete("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}") end # Deletes a snippet note. # # @example # Gitlab.delete_snippet_note(5, 11, 3) # # @param [Integer] project The ID of a project. # @param [Integer] snippet The ID of a snippet. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def delete_snippet_note(project, snippet, id) delete("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}") end # Deletes a merge_request note. # # @example # Gitlab.delete_merge_request_note(5, 11, 3) # # @param [Integer] project The ID of a project. # @param [Integer] merge_request The ID of a merge_request. # @param [Integer] id The ID of a note. # @return [Gitlab::ObjectifiedHash] def delete_merge_request_note(project, merge_request, id) delete("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}") end alias delete_merge_request_comment delete_merge_request_note # Modifies a wall note. # # @example # Gitlab.edit_note(5, 15, 'This is an edited note') # # @param [Integer] project The ID of a project. # @param [Integer] id The ID of a note. # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_note(project, id, body) put("/projects/#{url_encode project}/notes/#{id}", body: note_content(body)) end # Modifies an issue note. # # @example # Gitlab.edit_issue_note(5, 10, 1, 'This is an edited issue note') # # @param [Integer] project The ID of a project. # @param [Integer] issue The ID of an issue. # @param [Integer] id The ID of a note. # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_issue_note(project, issue, id, body) put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: note_content(body)) end # Modifies a snippet note. # # @example # Gitlab.edit_snippet_note(5, 11, 3, 'This is an edited snippet note') # # @param [Integer] project The ID of a project. # @param [Integer] snippet The ID of a snippet. # @param [Integer] id The ID of a note. # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_snippet_note(project, snippet, id, body) put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: note_content(body)) end # Modifies a merge_request note. # # @example # Gitlab.edit_merge_request_note(5, 11, 3, 'This is an edited merge request note') # # @param [Integer] project The ID of a project. # @param [Integer] merge_request The ID of a merge_request. # @param [Integer] id The ID of a note. # @param [String] body The content of a note. # @return [Gitlab::ObjectifiedHash] def edit_merge_request_note(project, merge_request, id, body) put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: note_content(body)) end alias edit_merge_request_comment edit_merge_request_note private # TODO: Remove this method after a couple deprecation cycles. Replace calls with the code # in the 'else'. def note_content(body) if body.is_a?(Hash) STDERR.puts 'Passing the note body as a Hash is deprecated. You should just pass the String.' body else { body: body } end end end end gitlab-4.8.0/lib/gitlab/client/pipeline_schedules.rb000066400000000000000000000145311341107427500224540ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to pipeline schedules. # @see https://docs.gitlab.com/ce/api/pipeline_schedules.html module PipelineSchedules # Gets a list of project pipeline schedules. # # @example # Gitlab.pipeline_schedules(5) # Gitlab.pipeline_schedules(5, { scope: 'active' }) # # @param [Integer, String] project the ID or name of a project. # @param [Hash] options A customizable set of options. # @options options [String] :scope The scope of pipeline schedules, one of a 'active' or 'inactive'. # @return [Array] def pipeline_schedules(project, options = {}) get("/projects/#{url_encode project}/pipeline_schedules", query: options) end # Gets a single pipeline schedule. # # @example # Gitlab.pipeline_schedule(5, 3) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of the pipeline schedule. # @return [Gitlab::ObjectifiedHash] def pipeline_schedule(project, id) get("/projects/#{url_encode project}/pipeline_schedules/#{id}") end # Create a pipeline schedule. # # @example # Gitlab.create_pipeline_schedule(5, { description: 'example' }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of pipeline scehdule. # @option options [String] :ref The branch/tag name will be triggered. # @option options [String] :cron The cron (e.g. 0 1 * * *). # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC'). # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true). # @return [Array] def create_pipeline_schedule(project, options = {}) post("/projects/#{url_encode project}/pipeline_schedules", query: options) end # Updates the pipeline schedule of a project. # # @example # Gitlab.edit_pipeline_schedule(3, 2, { description: 'example2' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] The pipeline schedule ID. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of pipeline scehdule. # @option options [String] :ref The branch/tag name will be triggered. # @option options [String] :cron The cron (e.g. 0 1 * * *). # @option options [String] :cron_timezone The timezone supproted by ActiveSupport::TimeZone (e.g. Pacific Time (US & Canada)) (default: 'UTC'). # @option options [Boolean] :active The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: true). # @return [Array] The updated pipeline schedule. def edit_pipeline_schedule(project, pipeline_schedule_id, options = {}) put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}", query: options) end # Take ownership of a pipeline schedule. # # @example # Gitlab.pipeline_schedule_take_ownership(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The pipeline schedule ID. # @return [Gitlab::ObjectifiedHash] The updated pipeline schedule. def pipeline_schedule_take_ownership(project, pipeline_schedule_id) post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/take_ownership") end # Delete a pipeline schedule. # # @example # Gitlab.delete_pipeline_schedule(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The pipeline schedule ID. # @return [Gitlab::ObjectifiedHash] The deleted pipeline schedule. def delete_pipeline_schedule(project, pipeline_schedule_id) delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}") end # Create a pipeline schedule variable. # # @example # Gitlab.create_pipeline_schedule_variable(5, 1, { key: 'foo', value: 'bar' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The pipeline schedule ID. # @param [Hash] options A customizable set of options. # @option options [String] :key The key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed. # @option options [String] :value The value of a variable # @return [Array] The created pipeline schedule variable. def create_pipeline_schedule_variable(project, pipeline_schedule_id, options = {}) post("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables", query: options) end # Updates the variable of a pipeline schedule. # # @example # Gitlab.edit_pipeline_schedule_variable(3, 2, "foo" { value: 'bar' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] The pipeline schedule ID. # @param [String] The key of a variable. # @param [Hash] options A customizable set of options. # @option options [String] :value The value of a variable. # @return [Array] The updated pipeline schedule variable. def edit_pipeline_schedule_variable(project, pipeline_schedule_id, key, options = {}) put("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}", query: options) end # Delete the variable of a pipeline schedule # # @example # Gitlab.delete_pipeline_schedule_variable(3, 2, "foo") # # @param [Integer, String] project The ID or name of a project. # @param [Integer] The pipeline schedule ID. # @param [String] The key of a variable. # @return [Array] The deleted pipeline schedule variable. def delete_pipeline_schedule_variable(project, pipeline_schedule_id, key, _options = {}) delete("/projects/#{url_encode project}/pipeline_schedules/#{pipeline_schedule_id}/variables/#{url_encode key}") end end end gitlab-4.8.0/lib/gitlab/client/pipeline_triggers.rb000066400000000000000000000073661341107427500223330ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to pipelines. # @see https://docs.gitlab.com/ce/api/pipeline_triggers.html # @see https://docs.gitlab.com/ce/ci/triggers/README.html module PipelineTriggers # Gets a list of the project's pipeline triggers # # @example # Gitlab.triggers(5) # # @param [Integer, String] project The ID or name of a project. # @return [Array] The list of triggers. def triggers(project) get("/projects/#{url_encode project}/triggers") end # Gets details of project's pipeline trigger. # # @example # Gitlab.trigger(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The trigger ID. # @return [Gitlab::ObjectifiedHash] The trigger. def trigger(project, trigger_id) get("/projects/#{url_encode project}/triggers/#{trigger_id}") end # Create a pipeline trigger for a project. # # @example # Gitlab.create_trigger(5, description: "my description") # # @param [Integer, String] project The ID or name of a project. # @param [String] description The trigger name # @return [Gitlab::ObjectifiedHash] The created trigger. def create_trigger(project, description) post("/projects/#{url_encode project}/triggers", body: { description: description }) end # Update a project trigger # # @example # Gitlab.update_trigger(5, 1, description: "my description") # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The trigger ID. # @param [Hash] options A customizable set of options. # @option options [String] :description The trigger name. # @return [Gitlab::ObjectifiedHash] The updated trigger. def update_trigger(project, trigger_id, options = {}) put("/projects/#{url_encode project}/triggers/#{trigger_id}", body: options) end # Take ownership of a project trigger # # @example # Gitlab.trigger_take_ownership(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The trigger ID. # @return [Gitlab::ObjectifiedHash] The updated trigger. def trigger_take_ownership(project, trigger_id) post("/projects/#{url_encode project}/triggers/#{trigger_id}/take_ownership") end # Remove a project's pipeline trigger. # # @example # Gitlab.remove_trigger(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] trigger_id The trigger ID. # @return [void] This API call returns an empty response body. def remove_trigger(project, trigger_id) delete("/projects/#{url_encode project}/triggers/#{trigger_id}") end alias delete_trigger remove_trigger # Run the given project pipeline trigger. # # @example # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master') # Gitlab.run_trigger(5, '7b9148c158980bbd9bcea92c17522d', 'master', { variable1: "value", variable2: "value2" }) # # @see https://docs.gitlab.com/ce/ci/triggers/README.html # # @param [Integer, String] project The ID or name of the project. # @param [String] token The token of a trigger. # @param [String] ref Branch or tag name to build. # @param [Hash] variables A set of build variables to use for the build. (optional) # @return [Gitlab::ObjectifiedHash] The trigger. def run_trigger(project, token, ref, variables = {}) post("/projects/#{url_encode project}/trigger/pipeline", unauthenticated: true, body: { token: token, ref: ref, variables: variables }) end end end gitlab-4.8.0/lib/gitlab/client/pipelines.rb000066400000000000000000000052211341107427500205740ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to pipelines. # @see https://docs.gitlab.com/ce/api/pipelines.html module Pipelines # Gets a list of project pipelines. # # @example # Gitlab.pipelines(5) # Gitlab.pipelines(5, { per_page: 10, page: 2 }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def pipelines(project, options = {}) get("/projects/#{url_encode project}/pipelines", query: options) end # Gets a single pipeline. # # @example # Gitlab.pipeline(5, 36) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a pipeline. # @return [Gitlab::ObjectifiedHash] def pipeline(project, id) get("/projects/#{url_encode project}/pipelines/#{id}") end # Create a pipeline. # # @example # Gitlab.create_pipeline(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] ref Reference to commit. # @param [Hash] variables Variables passed to pipelines # @return [Gitlab::ObjectifiedHash] The pipelines changes. def create_pipeline(project, ref, variables = {}) body = {} # This mapping is necessary, cause the API expects an array with objects (with `key` and `value` keys) # See: https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline body[:variables] = variables.map { |(key, value)| { key: key, value: value } } if variables.any? post( "/projects/#{url_encode project}/pipeline", query: { ref: ref }, body: body ) end # Cancels a pipeline. # # @example # Gitlab.cancel_pipeline(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a pipeline. # @return [Gitlab::ObjectifiedHash] The pipelines changes. def cancel_pipeline(project, id) post("/projects/#{url_encode project}/pipelines/#{id}/cancel") end # Retry a pipeline. # # @example # Gitlab.retry_pipeline(5, 1) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a pipeline. # @return [Array] The pipelines changes. def retry_pipeline(project, id) post("/projects/#{url_encode project}/pipelines/#{id}/retry") end end end gitlab-4.8.0/lib/gitlab/client/project_badges.rb000066400000000000000000000070131341107427500215600ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to project badges. # @see https://docs.gitlab.com/ee/api/project_badges.html module ProjectBadges # Gets a list of a projects badges and its group badges. # # @example # Gitlab.project_badges(5) # # @param [Integer, String] project The ID or name of a project. # @return [Array] List of all badges of a project def project_badges(project) get("/projects/#{url_encode project}/badges") end # Gets a badge of a project. # # @example # Gitlab.project_badge(5, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] badge_id The badge ID. # @return [Gitlab::ObjectifiedHash] Information about the requested badge def project_badge(project, badge_id) get("/projects/#{url_encode project}/badges/#{badge_id}") end # Adds a badge to a project. # # @example # Gitlab.add_project_badge(5, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' }) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [String] :link_url(required) URL of the badge link # @option options [String] :image_url(required) URL of the badge image # @return [Gitlab::ObjectifiedHash] Information about the added project badge. def add_project_badge(project, options = {}) post("/projects/#{url_encode project}/badges", body: options) end # Updates a badge of a project.. # # @example # Gitlab.edit_project_badge(5, 1, { link_url: 'https://abc.com/gitlab/gitlab-ce/commits/master', image_url: 'https://shields.io/my/badge1' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] badge_id The badge ID. # @param [Hash] options A customizable set of options. # @option options [String] :link_url(optional) URL of the badge link # @option options [String] :image_url(optional) URL of the badge image # @return [Gitlab::ObjectifiedHash] Information about the updated project badge. def edit_project_badge(project, badge_id, options = {}) put("/projects/#{url_encode project}/badges/#{badge_id}", body: options) end # Removes a badge from a project. Only projects badges will be removed by using this endpoint. # # @example # Gitlab.remove_project_badge(5, 42) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] badge_id The badge ID. # @return [nil] This API call returns an empty response body. def remove_project_badge(project, badge_id) delete("/projects/#{url_encode project}/badges/#{badge_id}") end # Preview a badge from a project. # # @example # Gitlab.preview_project_badge(3, 'https://abc.com/gitlab/gitlab-ce/commits/master', 'https://shields.io/my/badge1') # # @param [Integer, String] project The ID or name of a project. # @param [String] :link_url URL of the badge link # @param [String] :image_url URL of the badge image # @return [Gitlab::ObjectifiedHash] Returns how the link_url and image_url final URLs would be after resolving the placeholder interpolation. def preview_project_badge(project, link_url, image_url) query = { link_url: link_url, image_url: image_url } get("/projects/#{url_encode project}/badges/render", query: query) end end end gitlab-4.8.0/lib/gitlab/client/projects.rb000066400000000000000000000572441341107427500204510ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to projects. # @see https://docs.gitlab.com/ce/api/projects.html module Projects # Gets a list of projects owned by the authenticated user. # # @example # Gitlab.projects # # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # (Any provided options will be passed to Gitlab. See {https://docs.gitlab.com/ce/api/projects.html#list-all-projects Gitlab docs} for all valid options) # # @return [Array] def projects(options = {}) get('/projects', query: options) end # Search for projects by name. # # @example # Gitlab.project_search('gitlab') # Gitlab.project_search('gitlab', { order_by: 'last_activity_at' }) # Gitlab.search_projects('gitlab', { order_by: 'name', sort: 'asc' }) # # @param [Hash] options A customizable set of options. # @option options [String] :per_page Number of projects to return per page # @option options [String] :page The page to retrieve # @option options [String] :order_by Return requests ordered by id, name, created_at or last_activity_at fields # @option options [String] :sort Return requests sorted in asc or desc order # @return [Array] def project_search(query, options = {}) get('/projects', query: options.merge(search: query)) end alias search_projects project_search # Gets information about a project. # # @example # Gitlab.project(3) # Gitlab.project('gitlab') # # @param [Integer, String] id The ID or path of a project. # @return [Gitlab::ObjectifiedHash] def project(id) get("/projects/#{url_encode id}") end # Creates a new project. # # @example # Gitlab.create_project('gitlab') # Gitlab.create_project('viking', { description: 'Awesome project' }) # Gitlab.create_project('Red', { wall_enabled: false }) # # @param [String] name The name of a project. # @param [Hash] options A customizable set of options. # @option options [String] :description The description of a project. # @option options [String] :default_branch The default branch of a project. # @option options [String] :path Repository name for new project. (Default is lowercase name with dashes) # @option options [String] :namespace_id The namespace in which to create a project. # @option options [Boolean] :wiki_enabled The wiki integration for a project (0 = false, 1 = true). # @option options [Boolean] :wall_enabled The wall functionality for a project (0 = false, 1 = true). # @option options [Boolean] :issues_enabled The issues integration for a project (0 = false, 1 = true). # @option options [Boolean] :snippets_enabled The snippets integration for a project (0 = false, 1 = true). # @option options [Boolean] :merge_requests_enabled The merge requests functionality for a project (0 = false, 1 = true). # @option options [Boolean] :public The setting for making a project public (0 = false, 1 = true). # @option options [Integer] :user_id The user/owner id of a project. # @return [Gitlab::ObjectifiedHash] Information about created project. def create_project(name, options = {}) url = options[:user_id] ? "/projects/user/#{options[:user_id]}" : '/projects' post(url, body: { name: name }.merge(options)) end # Deletes a project. # # @example # Gitlab.delete_project(4) # # @param [Integer, String] id The ID or path of a project. # @return [Gitlab::ObjectifiedHash] Information about deleted project. def delete_project(id) delete("/projects/#{url_encode id}") end # Gets a list of project team members. # # @example # Gitlab.team_members(42) # Gitlab.team_members('gitlab') # # @param [Integer, String] project The ID or path of a project. # @param [Hash] options A customizable set of options. # @option options [String] :query The search query. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def team_members(project, options = {}) get("/projects/#{url_encode project}/members", query: options) end # Gets a project team member. # # @example # Gitlab.team_member('gitlab', 2) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a project team member. # @return [Gitlab::ObjectifiedHash] def team_member(project, id) get("/projects/#{url_encode project}/members/#{id}") end # Adds a user to project team. # # @example # Gitlab.add_team_member('gitlab', 2, 40) # Gitlab.add_team_member('gitlab', 2, 40, { expires_at: "2018-12-31"}) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a user. # @param [Integer] access_level The access level to project. # @param [Hash] options A customizable set of options. # @option options [String] :expires_at A date string in the format YEAR-MONTH-DAY. # @return [Gitlab::ObjectifiedHash] Information about added team member. def add_team_member(project, id, access_level, options = {}) body = { user_id: id, access_level: access_level }.merge(options) post("/projects/#{url_encode project}/members", body: body) end # Updates a team member's project access level. # # @example # Gitlab.edit_team_member('gitlab', 3, 20) # Gitlab.edit_team_member('gitlab', 3, 20, { expires_at: "2018-12-31"}) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a user. # @param [Integer] access_level The access level to project. # @param [Hash] options A customizable set of options. # @option options [String] :expires_at A date string in the format YEAR-MONTH-DAY. # @return [Array] Information about updated team member. def edit_team_member(project, id, access_level, options = {}) body = { access_level: access_level }.merge(options) put("/projects/#{url_encode project}/members/#{id}", body: body) end # Removes a user from project team. # # @example # Gitlab.remove_team_member('gitlab', 2) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a user. # @param [Hash] options A customizable set of options. # @return [Gitlab::ObjectifiedHash] Information about removed team member. def remove_team_member(project, id) delete("/projects/#{url_encode project}/members/#{id}") end # Gets a list of project hooks. # # @example # Gitlab.project_hooks(42) # Gitlab.project_hooks('gitlab') # # @param [Integer, String] project The ID or path of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def project_hooks(project, options = {}) get("/projects/#{url_encode project}/hooks", query: options) end # Gets a project hook. # # @example # Gitlab.project_hook(42, 5) # Gitlab.project_hook('gitlab', 5) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a hook. # @return [Gitlab::ObjectifiedHash] def project_hook(project, id) get("/projects/#{url_encode project}/hooks/#{id}") end # Adds a new hook to the project. # # @example # Gitlab.add_project_hook(42, 'https://api.example.net/v1/webhooks/ci') # # @param [Integer, String] project The ID or path of a project. # @param [String] url The hook URL. # @param [Hash] options A customizable set of options. # @param option [Boolean] :push_events Trigger hook on push events (0 = false, 1 = true) # @param option [Boolean] :issues_events Trigger hook on issues events (0 = false, 1 = true) # @param option [Boolean] :merge_requests_events Trigger hook on merge_requests events (0 = false, 1 = true) # @param option [Boolean] :tag_push_events Trigger hook on push_tag events (0 = false, 1 = true) # @return [Gitlab::ObjectifiedHash] Information about added hook. def add_project_hook(project, url, options = {}) body = { url: url }.merge(options) post("/projects/#{url_encode project}/hooks", body: body) end # Updates a project hook URL. # # @example # Gitlab.edit_project_hook(42, 1, 'https://api.example.net/v1/webhooks/ci') # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of the hook. # @param [String] url The hook URL. # @param [Hash] options A customizable set of options. # @param option [Boolean] :push_events Trigger hook on push events (0 = false, 1 = true) # @param option [Boolean] :issues_events Trigger hook on issues events (0 = false, 1 = true) # @param option [Boolean] :merge_requests_events Trigger hook on merge_requests events (0 = false, 1 = true) # @param option [Boolean] :tag_push_events Trigger hook on push_tag events (0 = false, 1 = true) # @return [Gitlab::ObjectifiedHash] Information about updated hook. def edit_project_hook(project, id, url, options = {}) body = { url: url }.merge(options) put("/projects/#{url_encode project}/hooks/#{id}", body: body) end # Deletes a hook from project. # # @example # Gitlab.delete_project_hook('gitlab', 4) # # @param [Integer, String] project The ID or path of a project. # @param [String] id The ID of the hook. # @return [Gitlab::ObjectifiedHash] Information about deleted hook. def delete_project_hook(project, id) delete("/projects/#{url_encode project}/hooks/#{id}") end # Gets a project push rule. # @see https://docs.gitlab.com/ee/api/projects.html#show-project-push-rules # # @example # Gitlab.push_rule(42) # # @param [Integer] id The ID of a project. # @return [Gitlab::ObjectifiedHash] def push_rule(id) get("/projects/#{url_encode id}/push_rule") end # Adds a project push rule. # @see https://docs.gitlab.com/ee/api/projects.html#add-project-push-rule # # @example # Gitlab.add_push_rule(42, { deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b' }) # # @param [Integer] id The ID of a project. # @param [Hash] options A customizable set of options. # @param option [Boolean] :deny_delete_tag Do not allow users to remove git tags with git push (0 = false, 1 = true) # @param option [String] :commit_message_regex Commit message regex # @return [Gitlab::ObjectifiedHash] Information about added push rule. def add_push_rule(id, options = {}) post("/projects/#{url_encode id}/push_rule", body: options) end # Updates a project push rule. # @see https://docs.gitlab.com/ee/api/projects.html#edit-project-push-rule # # @example # Gitlab.edit_push_rule(42, { deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b' }) # # @param [Integer] id The ID of a project. # @param [Hash] options A customizable set of options. # @param option [Boolean] :deny_delete_tag Do not allow users to remove git tags with git push (0 = false, 1 = true) # @param option [String] :commit_message_regex Commit message regex # @return [Gitlab::ObjectifiedHash] Information about updated push rule. def edit_push_rule(id, options = {}) put("/projects/#{url_encode id}/push_rule", body: options) end # Deletes a push rule from a project. # @see https://docs.gitlab.com/ee/api/projects.html#delete-project-push-rule # # @example # Gitlab.delete_push_rule(42) # # @param [Integer] id The ID of a project. # @return [Gitlab::ObjectifiedHash] Information about deleted push rule. def delete_push_rule(id) delete("/projects/#{url_encode id}/push_rule") end # Mark this project as forked from the other # # @example # Gitlab.make_forked(42, 24) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of the project it is forked from. # @return [Gitlab::ObjectifiedHash] Information about the forked project. def make_forked_from(project, id) post("/projects/#{url_encode project}/fork/#{id}") end # Remove a forked_from relationship for a project. # # @example # Gitlab.remove_forked(42) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] project The ID of the project it is forked from # @return [Gitlab::ObjectifiedHash] Information about the forked project. def remove_forked(project) delete("/projects/#{url_encode project}/fork") end # Gets a project deploy keys. # # @example # Gitlab.deploy_keys(42) # # @param [Integer, String] project The ID or path of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def deploy_keys(project, options = {}) get("/projects/#{url_encode project}/deploy_keys", query: options) end # Gets a single project deploy key. # # @example # Gitlab.deploy_key(42, 1) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a deploy key. # @return [Gitlab::ObjectifiedHash] def deploy_key(project, id) get("/projects/#{url_encode project}/deploy_keys/#{id}") end # Creates a new deploy key. # # @example # Gitlab.create_deploy_key(42, 'My Key', 'Key contents', can_push: true) # # @param [Integer, String] project The ID or path of a project. # @param [String] title The title of a deploy key. # @param [String] key The content of a deploy key. # @param [Hash] options A customizable set of options. # @return [Gitlab::ObjectifiedHash] Information about created deploy key. def create_deploy_key(project, title, key, options = {}) post("/projects/#{url_encode project}/deploy_keys", body: { title: title, key: key }.merge(options)) end # Enables a deploy key at the project. # # @example # Gitlab.enable_deploy_key(42, 66) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] key The ID of a deploy key. # @return [Gitlab::ObjectifiedHash] Information about the enabled deploy key. def enable_deploy_key(project, key) post("/projects/#{url_encode project}/deploy_keys/#{key}/enable", body: { id: project, key_id: key }) end # Disables a deploy key at the project. # # @example # Gitlab.disable_deploy_key(42, 66) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] key The ID of a deploy key. # @return [Gitlab::ObjectifiedHash] Information about the disabled deploy key. def disable_deploy_key(project, key) post("/projects/#{url_encode project}/deploy_keys/#{key}/disable", body: { id: project, key_id: key }) end # Deletes a deploy key from project. # # @example # Gitlab.delete_deploy_key(42, 1) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a deploy key. # @return [Gitlab::ObjectifiedHash] Information about deleted deploy key. def delete_deploy_key(project, id) delete("/projects/#{url_encode project}/deploy_keys/#{id}") end # Forks a project into the user namespace. # # @example # Gitlab.create_fork(42) # Gitlab.create_fork(42, { sudo: 'another_username' }) # # @param [Integer, String] project The ID or path of a project. # @param [Hash] options A customizable set of options. # @option options [String] :sudo The username the project will be forked for # @return [Gitlab::ObjectifiedHash] Information about the forked project. def create_fork(id, options = {}) post("/projects/#{url_encode id}/fork", body: options) end # Get a list of all visible projects across GitLab for the authenticated user. # When accessed without authentication, only public projects are returned. # # Note: This feature was introduced in GitLab 10.1 # # @example # Gitlab.project_forks(42) # # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @option options [String] :order_by Return requests ordered by id, name, created_at or last_activity_at fields # @option options [String] :sort Return requests sorted in asc or desc order # @return [Array] def project_forks(id, options = {}) get("/projects/#{url_encode id}/forks", query: options) end # Updates an existing project. # # @example # Gitlab.edit_project(42) # Gitlab.edit_project(42, { name: 'Project Name' }) # Gitlab.edit_project('project-name', { name: 'New Project Name', path: 'new-project-patth' }) # # @param [Integer, String] project The ID or path of a project. # @param [Hash] options A customizable set of options # @option options [String] :name The name of a project # @option options [String] :path The project's repository name, also used in Gitlab's URLs # @option options [String] :description The description to show in Gitlab # (Any provided options will be passed to Gitlab. See {https://docs.gitlab.com/ce/api/projects.html#edit-project Gitlab docs} for all valid options) # # @return [Gitlab::ObjectifiedHash] Information about the edited project. def edit_project(id, options = {}) put("/projects/#{url_encode id}", body: options) end # Share project with group. # # @example # Gitlab.share_project_with_group('gitlab', 2, 40) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a group. # @param [Integer] group_access The access level to project. def share_project_with_group(project, id, group_access) post("/projects/#{url_encode project}/share", body: { group_id: id, group_access: group_access }) end # Unshare project with group. # # @example # Gitlab.unshare_project_with_group('gitlab', 2) # # @param [Integer, String] project The ID or path of a project. # @param [Integer] id The ID of a group. # @return [void] This API call returns an empty response body. def unshare_project_with_group(project, id) delete("/projects/#{url_encode project}/share/#{id}") end # Transfer a project to a new namespace. # # @example # Gitlab.transfer_project(42, 'yolo') # # @param [Integer, String] project The ID or path of a project # @param [Integer, String] namespace The ID or path of the namespace to transfer to project to # @return [Gitlab::ObjectifiedHash] Information about transfered project. def transfer_project(project, namespace) put("/projects/#{url_encode project}/transfer", body: { namespace: namespace }) end # Stars a project. # @see https://docs.gitlab.com/ce/api/projects.html#star-a-project # # @example # Gitlab.star_project(42) # Gitlab.star_project('gitlab-org/gitlab-ce') # # @param [Integer, String] id The ID or path of a project. # @return [Gitlab::ObjectifiedHash] Information about starred project. def star_project(id) post("/projects/#{url_encode id}/star") end # Unstars a project. # @see https://docs.gitlab.com/ce/api/projects.html#unstar-a-project # # @example # Gitlab.unstar_project(42) # Gitlab.unstar_project('gitlab-org/gitlab-ce') # # @param [Integer, String] id The ID or path of a project. # @return [Gitlab::ObjectifiedHash] Information about unstarred project. def unstar_project(id) delete("/projects/#{url_encode id}/star") end # Get a list of visible projects for the given user. # @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects # # @example # Gitlab.user_projects(1) # Gitlab.user_projects(1, { order_by: 'last_activity_at' }) # Gitlab.user_projects('username', { order_by: 'name', sort: 'asc' }) # # @param [Integer, String] user_id The ID or username of the user. # @param [Hash] options A customizable set of options. # @option options [String] :per_page Number of projects to return per page # @option options [String] :page The page to retrieve # @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. # @option options [String] :sort Return projects sorted in asc or desc order. # @return [Array] def user_projects(user_id, options = {}) get("/users/#{url_encode user_id}/projects", query: options) end # Uploads a file to the specified project to be used in an issue or # merge request description, or a comment. # @see https://docs.gitlab.com/ee/api/projects.html#upload-a-file # # @example # Gitlab.upload_file(1, File.open(File::NULL, 'r')) # File.open('myfile') { |file| Gitlab.upload_file(1, file) } # # @param [Integer, String] id The ID or path of a project. # @param [File] The file you are interested to upload. # @return [Gitlab::ObjectifiedHash] def upload_file(id, file) post("/projects/#{url_encode id}/uploads", body: { file: file }) end # Get all project templates of a particular type # @see https://docs.gitlab.com/ce/api/project_templates.html # # @example # Gitlab.project_templates(1, 'dockerfiles') # Gitlab.project_templates(1, 'licenses') # # @param [Integer, String] id The ID or URL-encoded path of the project. # @param [String] type The type (dockerfiles|gitignores|gitlab_ci_ymls|licenses) of the template # @return [Array] def project_templates(project, type) get("/projects/#{url_encode project}/templates/#{type}") end # Get one project template of a particular type # @see https://docs.gitlab.com/ce/api/project_templates.html # # @example # Gitlab.project_template(1, 'dockerfiles', 'dockey') # Gitlab.project_template(1, 'licenses', 'gpl', { project: 'some project', fullname: 'Holder Holding' }) # # @param [Integer, String] project The ID or URL-encoded path of the project. # @param [String] type The type (dockerfiles|gitignores|gitlab_ci_ymls|licenses) of the template # @param [String] key The key of the template, as obtained from the collection endpoint # @param [Hash] options A customizable set of options. # @option options [String] project(optional) The project name to use when expanding placeholders in the template. Only affects licenses # @option options [String] fullname(optional) The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses # @return [Gitlab::ObjectifiedHash] def project_template(project, type, key, options = {}) get("/projects/#{url_encode project}/templates/#{type}/#{key}", query: options) end end end gitlab-4.8.0/lib/gitlab/client/protected_tags.rb000066400000000000000000000047251341107427500216230ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to Protected Tags. # @see https://docs.gitlab.com/ce/api/protected_tags.html module ProtectedTags # Gets a list of protected tags from a project # # @example # Gitlab.protected_tags(1) # # @param [Integer, String] project(required) The ID or name of a project. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] List of all protected tags requested def protected_tags(project, options = {}) get("/projects/#{url_encode project}/protected_tags", query: options) end # Gets a single protected tag or wildcard protected tag. # # @example # Gitlab.protected_tag(1, 'release-1-0') # # @param [Integer, String] project(required) The ID or name of a project. # @param [String] name(required) The name of the tag or wildcard # @return ] def runners(options = {}) get('/runners', query: options) end # Get a list of all runners in the GitLab instance (specific and shared). Access is restricted to users with admin privileges. # @see https://docs.gitlab.com/ce/api/runners.html#list-all-runners # # @example # Gitlab.all_runners # # @param [Hash] options A customizable set of options. # @option options [String] :scope The scope of runners to show, one of: specific, shared, active, paused, online; showing all runners if none provided # @return [Array] def all_runners(options = {}) get('/runners/all', query: options) end # Get details of a runner.. # @see https://docs.gitlab.com/ce/api/runners.html#get-runners-details # # @example # Gitlab.runner(42) # # @param [Integer, String] id The ID of a runner # @return def runner(id) get("/runners/#{id}") end # Update details of a runner. # @see https://docs.gitlab.com/ce/api/runners.html#update-runners-details # # @example # Gitlab.update_runner(42, { description: 'Awesome runner' }) # Gitlab.update_runner(42, { active: false }) # Gitlab.update_runner(42, { tag_list: [ 'awesome', 'runner' ] }) # # @param [Integer, String] id The ID of a runner # @param [Hash] options A customizable set of options. # @option options [String] :active The state of a runner; can be set to true or false. # @option options [String] :tag_list The list of tags for a runner; put array of tags, that should be finally assigned to a runner # @return def update_runner(id, options = {}) put("/runners/#{id}", query: options) end # Remove a runner. # @see https://docs.gitlab.com/ce/api/runners.html#remove-a-runner # # @example # Gitlab.delete_runner(42) # # @param [Integer, String] id The ID of a runner # @return def delete_runner(id) delete("/runners/#{id}") end # Gets a list of Jobs for a Runner # # @example # Gitlab.runner_jobs(1) # # @param [Integer] id The ID of a runner. # @return [Array] def runner_jobs(runner_id) get("/runners/#{url_encode runner_id}/jobs") end # List all runners (specific and shared) available in the project. Shared runners are listed if at least one shared runner is defined and shared runners usage is enabled in the project's settings. # @see https://docs.gitlab.com/ce/api/runners.html#list-projects-runners # # @example # Gitlab.project_runners(42) # # @param [Integer, String] id The ID or name of a project. # @return [Array] def project_runners(project_id) get("/projects/#{url_encode project_id}/runners") end # Enable an available specific runner in the project. # @see https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project # # @example # Gitlab.project_enable_runner(2, 42) # # @param [Integer, String] id The ID or name of a project. # @param [Integer, String] id The ID of a runner. # @return def project_enable_runner(project_id, id) body = { runner_id: id } post("/projects/#{url_encode project_id}/runners", body: body) end # Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner. # @see https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project # # @example # Gitlab.project_disable_runner(2, 42) # # @param [Integer, String] id The ID or name of a project. # @param [Integer, String] runner_id The ID of a runner. # @return def project_disable_runner(id, runner_id) delete("/projects/#{url_encode id}/runners/#{runner_id}") end end end gitlab-4.8.0/lib/gitlab/client/services.rb000066400000000000000000000035071341107427500204340ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Third party services connected to a project. # @see https://docs.gitlab.com/ce/api/services.html module Services # Create/Edit service # Full service params documentation: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/services.md # # @example # Gitlab.change_service(42, :redmine, { new_issue_url: 'https://example.com/projects/test_project/issues/new', # project_url: 'https://example.com/projects/test_project/issues', # issues_url: 'https://example.com/issues/:id' }) # # @param [Integer, String] project The ID or name of a project. # @param [String] service A service code name. # @param [Hash] params A service parameters. # @return [Boolean] def change_service(project, service, params) put("/projects/#{url_encode project}/services/#{correct_service_name(service)}", body: params) end # Delete service # # @example # Gitlab.delete_service(42, :redmine) # # @param [Integer, String] project The ID or name of a project. # @param [String] service A service code name. # @return [Boolean] def delete_service(project, service) delete("/projects/#{url_encode project}/services/#{correct_service_name(service)}") end # Get service # # @example # Gitlab.service(42, :redmine) # # @param [Integer, String] project The ID or name of a project. # @param [String] service A service code name. # @return [Gitlab::ObjectifiedHash] def service(project, service) get("/projects/#{url_encode project}/services/#{correct_service_name(service)}") end private def correct_service_name(service) service.to_s.tr('_', '-') end end end gitlab-4.8.0/lib/gitlab/client/sidekiq.rb000066400000000000000000000016071341107427500202410ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to sidekiq metrics. # @see https://docs.gitlab.com/ce/api/sidekiq_metrics.html module Sidekiq # Get the current Queue Metrics # # @example # Gitlab.sidekiq_queue_metrics def sidekiq_queue_metrics get('/sidekiq/queue_metrics') end # Get the current Process Metrics # # @example # Gitlab.sidekiq_process_metrics def sidekiq_process_metrics get('/sidekiq/process_metrics') end # Get the current Job Statistics # # @example # Gitlab.sidekiq_job_stats def sidekiq_job_stats get('/sidekiq/job_stats') end # Get a compound response of all the previously mentioned metrics # # @example # Gitlab.sidekiq_compound_metrics def sidekiq_compound_metrics get('/sidekiq/compound_metrics') end end end gitlab-4.8.0/lib/gitlab/client/snippets.rb000066400000000000000000000072111341107427500204520ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to snippets. # @see https://docs.gitlab.com/ce/api/project_snippets.html module Snippets # Gets a list of project's snippets. # # @example # Gitlab.snippets(42) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Gitlab::ObjectifiedHash] def snippets(project, options = {}) get("/projects/#{url_encode project}/snippets", query: options) end # Gets information about a snippet. # # @example # Gitlab.snippet(2, 14) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a snippet. # @return [Gitlab::ObjectifiedHash] def snippet(project, id) get("/projects/#{url_encode project}/snippets/#{id}") end # Creates a new snippet. # # @example # Gitlab.create_snippet(42, { title: 'REST', file_name: 'api.rb', code: 'some code', visibility: 'public'}) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [String] :title (required) The title of a snippet. # @option options [String] :file_name (required) The name of a snippet file. # @option options [String] :code (required) The content of a snippet. # @option options [String] :lifetime (optional) The expiration date of a snippet. # @option options [String] :visibility (required) The visibility of a snippet # @return [Gitlab::ObjectifiedHash] Information about created snippet. def create_snippet(project, options = {}) post("/projects/#{url_encode project}/snippets", body: options) end # Updates a snippet. # # @example # Gitlab.edit_snippet(42, 34, { file_name: 'README.txt' }) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a snippet. # @param [Hash] options A customizable set of options. # @option options [String] :title The title of a snippet. # @option options [String] :file_name The name of a snippet file. # @option options [String] :code The content of a snippet. # @option options [String] :lifetime The expiration date of a snippet. # @option options [String] :visibility (optional) The visibility of a snippet # @return [Gitlab::ObjectifiedHash] Information about updated snippet. def edit_snippet(project, id, options = {}) put("/projects/#{url_encode project}/snippets/#{id}", body: options) end # Deletes a snippet. # # @example # Gitlab.delete_snippet(2, 14) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a snippet. # @return [Gitlab::ObjectifiedHash] Information about deleted snippet. def delete_snippet(project, id) delete("/projects/#{url_encode project}/snippets/#{id}") end # Returns raw project snippet content as plain text. # # @example # Gitlab.snippet_content(2, 14) # # @param [Integer, String] project The ID or name of a project. # @param [Integer] id The ID of a snippet. # @return [Gitlab::ObjectifiedHash] Information about deleted snippet. def snippet_content(project, id) get("/projects/#{url_encode project}/snippets/#{id}/raw", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser) end end end gitlab-4.8.0/lib/gitlab/client/system_hooks.rb000066400000000000000000000037271341107427500213440ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to system hooks. # @see https://docs.gitlab.com/ce/api/system_hooks.html module SystemHooks # Gets a list of system hooks. # # @example # Gitlab.hooks # Gitlab.system_hooks # # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def hooks(options = {}) get('/hooks', query: options) end alias system_hooks hooks # Adds a new system hook. # # @example # Gitlab.add_hook('http://example.com/hook') # Gitlab.add_system_hook('https://api.example.net/v1/hook') # # @param [String] url The hook URL. # @param [Hash] options Additional options, as allowed by Gitlab API, including but not limited to: # @option options [String] :token A secret token for Gitlab to send in the `X-Gitlab-Token` header for authentication. # @option options [boolean] :enable_ssl_verification `false` will cause Gitlab to ignore invalid/unsigned certificate errors (default is `true`) # @return [Gitlab::ObjectifiedHash] def add_hook(url, options = {}) post('/hooks', body: options.merge(url: url)) end alias add_system_hook add_hook # Tests a system hook. # # @example # Gitlab.hook(3) # Gitlab.system_hook(12) # # @param [Integer] id The ID of a system hook. # @return [Array] def hook(id) get("/hooks/#{id}") end alias system_hook hook # Deletes a new system hook. # # @example # Gitlab.delete_hook(3) # Gitlab.delete_system_hook(12) # # @param [Integer] id The ID of a system hook. # @return [Gitlab::ObjectifiedHash] def delete_hook(id) delete("/hooks/#{id}") end alias delete_system_hook delete_hook end end gitlab-4.8.0/lib/gitlab/client/tags.rb000066400000000000000000000076231341107427500175520ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to tags. # @see https://docs.gitlab.com/ce/api/tags.html module Tags # Gets a list of project repository tags. # # @example # Gitlab.tags(42) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def tags(project, options = {}) get("/projects/#{url_encode project}/repository/tags", query: options) end alias repo_tags tags # Creates a new project repository tag. # # @example # Gitlab.create_tag(42, 'new_tag', 'master') # Gitlab.create_tag(42, 'v1.0', 'master', 'Release 1.0') # # @param [Integer, String] project The ID or name of a project. # @param [String] tag_name The name of the new tag. # @param [String] ref The ref (commit sha, branch name, or another tag) the tag will point to. # @param [String] message Optional message for tag, creates annotated tag if specified. # @param [String] description Optional release notes for tag. # @return [Gitlab::ObjectifiedHash] def create_tag(project, tag_name, ref, message = '', description = nil) post("/projects/#{url_encode project}/repository/tags", body: { tag_name: tag_name, ref: ref, message: message, release_description: description }) end alias repo_create_tag create_tag # Gets information about a repository tag. # # @example # Gitlab.tag(3, 'api') # Gitlab.repo_tag(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] tag The name of the tag. # @return [Gitlab::ObjectifiedHash] def tag(project, tag) get("/projects/#{url_encode project}/repository/tags/#{url_encode tag}") end alias repo_tag tag # Deletes a repository tag. Requires Gitlab >= 6.8.x # # @example # Gitlab.delete_tag(3, 'api') # Gitlab.repo_delete_tag(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] tag The name of the tag to delete # @return [Gitlab::ObjectifiedHash] def delete_tag(project, tag) delete("/projects/#{url_encode project}/repository/tags/#{url_encode tag}") end alias repo_delete_tag delete_tag # Adds release notes to an existing repository tag. Requires Gitlab >= 8.2.0 # # @example # Gitlab.create_release(3, '1.0.0', 'This is ready for production') # Gitlab.repo_create_release(5, '1.0.0', 'This is ready for production') # # @param [Integer, String] project The ID or name of a project. # @param [String] tag The name of the new tag. # @param [String] description Release notes with markdown support # @return [Gitlab::ObjectifiedHash] def create_release(project, tag, description) post("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description }) end alias repo_create_release create_release # Updates the release notes of a given release. Requires Gitlab >= 8.2.0 # # @example # Gitlab.update_release(3, '1.0.0', 'This is even more ready for production') # Gitlab.repo_update_release(5, '1.0.0', 'This is even more ready for production') # # @param [Integer, String] project The ID or name of a project. # @param [String] tag The name of the new tag. # @param [String] description Release notes with markdown support # @return [Gitlab::ObjectifiedHash] def update_release(project, tag, description) put("/projects/#{url_encode project}/repository/tags/#{url_encode tag}/release", body: { description: description }) end alias repo_update_release update_release end end gitlab-4.8.0/lib/gitlab/client/templates.rb000066400000000000000000000056711341107427500206130ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to templates. # @see https://docs.gitlab.com/ce/api/templates/dockerfiles.html # @see https://docs.gitlab.com/ce/api/templates/gitignores.html # @see https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html # @see https://docs.gitlab.com/ce/api/templates/licenses.html module Templates # Get all Dockerfile templates. # # @example # Gitlab.dockerfile_templates # # @return [Array] def dockerfile_templates get('/templates/dockerfiles') end # Get a single Dockerfile template. # # @example # Gitlab.dockerfile_template('Binary') # # @param [String] key The key of the Dockerfile template # @return [Gitlab::ObjectifiedHash] def dockerfile_template(key) get("/templates/dockerfiles/#{key}") end # Get all gitignore templates. # # @example # Gitlab.gitignore_templates # # @return [Array] def gitignore_templates get('/templates/gitignores') end # Get a single gitignore template. # # @example # Gitlab.gitignore_template('Ruby') # # @param [String] key The key of the gitignore template # @return [Gitlab::ObjectifiedHash] def gitignore_template(key) get("/templates/gitignores/#{key}") end # Get all `gitlab_ci.yml` templates. # # @example # Gitlab.gitlab_ci_yml_templates # # @return [Array] def gitlab_ci_yml_templates get('/templates/gitlab_ci_ymls') end # Get a single `gitlab_ci.yml` template. # # @example # Gitlab.gitlab_ci_yml_template('Ruby') # # @param [String] key The key of the gitlab_ci_yml template # @return [Gitlab::ObjectifiedHash] def gitlab_ci_yml_template(key) get("/templates/gitlab_ci_ymls/#{key}") end # Get all license templates. # # @example # Gitlab.license_templates # Gitlab.license_templates(popular: true) # # @param [Hash] options A customizable set of options. # @option options [Boolean] popular(optional) If passed, returns only popular licenses. # @return [Array] def license_templates(options = {}) get('/templates/licenses', query: options) end # Get a single license template. You can pass parameters to replace the license placeholder. # # @example # Gitlab.license_template('Ruby') # # @param [String] key The key of the license template # @param [Hash] options A customizable set of options. # @option options [String] project(optional) The copyrighted project name. # @option options [String] fullname(optional) The full-name of the copyright holder # @return [Gitlab::ObjectifiedHash] def license_template(key, options = {}) get("/templates/licenses/#{key}", query: options) end end end gitlab-4.8.0/lib/gitlab/client/todos.rb000066400000000000000000000027711341107427500177430ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to todos # @see https://docs.gitlab.com/ce/api/todos.html module Todos # Gets a list of todos. # # @example # Gitlab.todos # Gitlab.todos({ action: 'assigned' }) # Gitlab.todos({ state: 'pending' }) # # @param [Hash] options A customizable set of options. # @option options [Integer] :action The action to be filtered. Can be `assigned`, `mentioned`, `build_failed`, `marked`, or `approval_required`. # @option options [Integer] :author_id The ID of an author # @option options [Integer] :project_id The ID of a project # @option options [Integer] :state The state of the todo. Can be either `pending` or `done` # @option options [Integer] :type The type of a todo. Can be either `Issue` or `MergeRequest` # @return [Array] def todos(options = {}) get('/todos', query: options) end # Marks a single pending todo for the current user as done. # # @example # Gitlab.mark_todo_as_done(42) # # @param [Integer] id The ID of the todo. # @return [Gitlab::ObjectifiedHash] def mark_todo_as_done(id) post("/todos/#{id}/mark_as_done") end # Marks all todos for the current user as done # # @example # Gitlab.mark_all_todos_as_done # # @return [void] This API call returns an empty response body. def mark_all_todos_as_done post('/todos/mark_as_done') end end end gitlab-4.8.0/lib/gitlab/client/users.rb000066400000000000000000000207441341107427500177540ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to users. # @see https://docs.gitlab.com/ce/api/users.html # @see https://docs.gitlab.com/ce/api/session.html module Users # Gets a list of users. # # @example # Gitlab.users # # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @return [Array] def users(options = {}) get('/users', query: options) end # Gets information about a user. # Will return information about an authorized user if no ID passed. # # @example # Gitlab.user # Gitlab.user(2) # # @param [Integer] id The ID of a user. # @return [Gitlab::ObjectifiedHash] def user(id = nil) id.to_i.zero? ? get('/user') : get("/users/#{id}") end # Creates a new user. # Requires authentication from an admin account. # # @example # Gitlab.create_user('joe@foo.org', 'secret', 'joe', { name: 'Joe Smith' }) # or # Gitlab.create_user('joe@foo.org', 'secret') # # @param [String] email The email of a user. # @param [String] password The password of a user. # @param [String] username The username of a user. # @param [Hash] options A customizable set of options. # @option options [String] :name The name of a user. Defaults to email. # @option options [String] :skype The skype of a user. # @option options [String] :linkedin The linkedin of a user. # @option options [String] :twitter The twitter of a user. # @option options [Integer] :projects_limit The limit of projects for a user. # @return [Gitlab::ObjectifiedHash] Information about created user. def create_user(*args) options = args.last.is_a?(Hash) ? args.pop : {} body = if args[2] { email: args[0], password: args[1], username: args[2] } else { email: args[0], password: args[1], name: args[0] } end body.merge!(options) post('/users', body: body) end # Updates a user. # # @example # Gitlab.edit_user(15, { email: 'joe.smith@foo.org', projects_limit: 20 }) # # @param [Integer] id The ID of a user. # @param [Hash] options A customizable set of options. # @option options [String] :email The email of a user. # @option options [String] :password The password of a user. # @option options [String] :name The name of a user. Defaults to email. # @option options [String] :skype The skype of a user. # @option options [String] :linkedin The linkedin of a user. # @option options [String] :twitter The twitter of a user. # @option options [Integer] :projects_limit The limit of projects for a user. # @return [Gitlab::ObjectifiedHash] Information about created user. def edit_user(user_id, options = {}) put("/users/#{user_id}", body: options) end # Deletes a user. # # @example # Gitlab.delete_user(1) # # @param [Integer] id The ID of a user. # @return [Gitlab::ObjectifiedHash] Information about deleted user. def delete_user(user_id) delete("/users/#{user_id}") end # Blocks the specified user. Available only for admin. # # @example # Gitlab.block_user(15) # # @param [Integer] user_id The Id of user # @return [Boolean] success or not def block_user(user_id) post("/users/#{user_id}/block") end # Unblocks the specified user. Available only for admin. # # @example # Gitlab.unblock_user(15) # # @param [Integer] user_id The Id of user # @return [Boolean] success or not def unblock_user(user_id) post("/users/#{user_id}/unblock") end # Creates a new user session. # # @example # Gitlab.session('jack@example.com', 'secret12345') # # @param [String] email The email of a user. # @param [String] password The password of a user. # @return [Gitlab::ObjectifiedHash] # @note This method doesn't require private_token to be set. def session(email, password) post('/session', body: { email: email, password: password }, unauthenticated: true) end # Gets a list of user's SSH keys. # # @example # Gitlab.ssh_keys # Gitlab.ssh_keys({ user_id: 2 }) # # @param [Hash] options A customizable set of options. # @option options [Integer] :page The page number. # @option options [Integer] :per_page The number of results per page. # @option options [Integer] :user_id The ID of the user to retrieve the keys for. # @return [Array] def ssh_keys(options = {}) user_id = options.delete :user_id if user_id.to_i.zero? get('/user/keys', query: options) else get("/users/#{user_id}/keys", query: options) end end # Gets information about SSH key. # # @example # Gitlab.ssh_key(1) # # @param [Integer] id The ID of a user's SSH key. # @return [Gitlab::ObjectifiedHash] def ssh_key(id) get("/user/keys/#{id}") end # Creates a new SSH key. # # @example # Gitlab.create_ssh_key('key title', 'key body') # # @param [String] title The title of an SSH key. # @param [String] key The SSH key body. # @param [Hash] options A customizable set of options. # @option options [Integer] :user_id id of the user to associate the key with # @return [Gitlab::ObjectifiedHash] Information about created SSH key. def create_ssh_key(title, key, options = {}) user_id = options.delete :user_id if user_id.to_i.zero? post('/user/keys', body: { title: title, key: key }) else post("/users/#{user_id}/keys", body: { title: title, key: key }) end end # Deletes an SSH key. # # @example # Gitlab.delete_ssh_key(1) # # @param [Integer] id The ID of a user's SSH key. # @param [Hash] options A customizable set of options. # @option options [Integer] :user_id id of the user to associate the key with # @return [Gitlab::ObjectifiedHash] Information about deleted SSH key. def delete_ssh_key(id, options = {}) user_id = options.delete :user_id if user_id.to_i.zero? delete("/user/keys/#{id}") else delete("/users/#{user_id}/keys/#{id}") end end # Gets user emails. # Will return emails an authorized user if no user ID passed. # # @example # Gitlab.emails # Gitlab.emails(2) # # @param [Integer] user_id The ID of a user. # @return [Gitlab::ObjectifiedHash] def emails(user_id = nil) url = user_id.to_i.zero? ? '/user/emails' : "/users/#{user_id}/emails" get(url) end # Get a single email. # # @example # Gitlab.email(3) # # @param [Integer] id The ID of a email. # @return [Gitlab::ObjectifiedHash] def email(id) get("/user/emails/#{id}") end # Creates a new email # Will create a new email an authorized user if no user ID passed. # # @example # Gitlab.add_email('email@example.com') # Gitlab.add_email('email@example.com', 2) # # @param [String] email Email address # @param [Integer] user_id The ID of a user. # @return [Gitlab::ObjectifiedHash] def add_email(email, user_id = nil) url = user_id.to_i.zero? ? '/user/emails' : "/users/#{user_id}/emails" post(url, body: { email: email }) end # Delete email # Will delete a email an authorized user if no user ID passed. # # @example # Gitlab.delete_email(2) # Gitlab.delete_email(3, 2) # # @param [Integer] id Email address ID # @param [Integer] user_id The ID of a user. # @return [Boolean] def delete_email(id, user_id = nil) url = user_id.to_i.zero? ? "/user/emails/#{id}" : "/users/#{user_id}/emails/#{id}" delete(url) end # Search for groups by name # # @example # Gitlab.user_search('gitlab') # # @param [String] search A string to search for in user names and paths. # @param [Hash] options A customizable set of options. # @option options [String] :per_page Number of user to return per page # @option options [String] :page The page to retrieve # @return [Array] def user_search(search, options = {}) options[:search] = search get('/users', query: options) end end end gitlab-4.8.0/lib/gitlab/client/versions.rb000066400000000000000000000006201341107427500204520ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to version # @see https://docs.gitlab.com/ce/api/version.html module Versions # Returns server version. # @see https://docs.gitlab.com/ce/api/version.html # # @example # Gitlab.version # # @return [Array] def version get('/version') end end end gitlab-4.8.0/lib/gitlab/client/wikis.rb000066400000000000000000000064731341107427500177440ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Client # Defines methods related to wikis. # @see https://docs.gitlab.com/ce/api/wikis.html module Wikis # Get all wiki pages for a given project. # # @example # Gitlab.wikis(3) # Gitlab.wikis(3, {with_content: 'Some wiki content'}) # # @param [Integer, String] project The ID or name of a project. # @param [Hash] options A customizable set of options. # @option options [String] with_content(optional) Include pages content # @return [Array] def wikis(project, options = {}) get("/projects/#{url_encode project}/wikis", query: options) end # Get a wiki page for a given project. # # @example # Gitlab.wiki(3, 'home') # # @param [Integer, String] project The ID or name of a project. # @param [String] slug The slug (a unique string) of the wiki page # @return [Gitlab::ObjectifiedHash] def wiki(project, slug) get("/projects/#{url_encode project}/wikis/#{slug}") end # Creates a new wiki page for the given repository with the given title, slug, and content. # # @example # Gitlab.create_wiki(3, 'Some Title', 'Some Content') # Gitlab.create_wiki(3, 'Some Title', 'Some Content', { format: 'rdoc' }) # # @param [Integer, String] project The ID or name of a project. # @param [String] content The content of the wiki page. # @param [String] title The title of the wiki page. # @param [Hash] options A customizable set of options. # @option options [String] format (optional) The format of the wiki page. Available formats are: markdown (default), rdoc, and asciidoc. # @return [Gitlab::ObjectifiedHash] Information about created wiki page. def create_wiki(project, title, content, options = {}) body = { content: content, title: title }.merge(options) post("/projects/#{url_encode project}/wikis", body: body) end # Updates an existing wiki page. At least one parameter is required to update the wiki page. # # @example # Gitlab.update_wiki(6, 'home', { title: 'New title' }) # Gitlab.update_wiki(6, 'home', { title: 'New title', content: 'New Message', format: 'rdoc' }) # # @param [Integer, String] project The ID or name of a project. # @param [String] slug The slug (a unique string) of the wiki page. # @param [Hash] options A customizable set of options. # @option options [String] content The content of the wiki page. # @option options [String] title The title of the wiki page. # @option options [String] format (optional) The format of the wiki page. Available formats are: markdown (default), rdoc, and asciidoc. # @return [Gitlab::ObjectifiedHash] Information about updated wiki page. def update_wiki(project, slug, options = {}) put("/projects/#{url_encode project}/wikis/#{slug}", body: options) end # Deletes a wiki page with a given slug. # # @example # Gitlab.delete_wiki(42, 'foo') # # @param [Integer, String] project The ID or name of a project. # @param [String] slug The slug (a unique string) of the wiki page. # @return [Gitlab::ObjectifiedHash] An empty objectified hash def delete_wiki(project, slug) delete("/projects/#{url_encode project}/wikis/#{slug}") end end end gitlab-4.8.0/lib/gitlab/configuration.rb000066400000000000000000000033561341107427500202040ustar00rootroot00000000000000# frozen_string_literal: true require 'gitlab/cli_helpers' module Gitlab # Defines constants and methods related to configuration. module Configuration # An array of valid keys in the options hash when configuring a Gitlab::API. VALID_OPTIONS_KEYS = %i[endpoint private_token user_agent sudo httparty].freeze # The user agent that will be sent to the API endpoint if none is set. DEFAULT_USER_AGENT = "Gitlab Ruby Gem #{Gitlab::VERSION}" # @private attr_accessor(*VALID_OPTIONS_KEYS) # @private alias auth_token= private_token= # Sets all configuration options to their default values # when this module is extended. def self.extended(base) base.reset end # Convenience method to allow configuration options to be set in a block. def configure yield self end # Creates a hash of options and their values. def options VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end # Resets all configuration options to the defaults. def reset self.endpoint = ENV['GITLAB_API_ENDPOINT'] self.private_token = ENV['GITLAB_API_PRIVATE_TOKEN'] || ENV['GITLAB_API_AUTH_TOKEN'] self.httparty = get_httparty_config(ENV['GITLAB_API_HTTPARTY_OPTIONS']) self.sudo = nil self.user_agent = DEFAULT_USER_AGENT end private # Allows HTTParty config to be specified in ENV using YAML hash. def get_httparty_config(options) return if options.nil? httparty = Gitlab::CLI::Helpers.yaml_load(options) raise ArgumentError, 'HTTParty config should be a Hash.' unless httparty.is_a? Hash Gitlab::CLI::Helpers.symbolize_keys httparty end end end gitlab-4.8.0/lib/gitlab/error.rb000066400000000000000000000062251341107427500164640ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab module Error # Custom error class for rescuing from all Gitlab errors. class Error < StandardError; end # Raised when API endpoint credentials not configured. class MissingCredentials < Error; end # Raised when impossible to parse response body. class Parsing < Error; end # Custom error class for rescuing from HTTP response errors. class ResponseError < Error POSSIBLE_MESSAGE_KEYS = %i[message error_description error].freeze def initialize(response) @response = response super(build_error_message) end # Status code returned in the HTTP response. # # @return [Integer] def response_status @response.code end # Body content returned in the HTTP response # # @return [String] def response_message @response.parsed_response.message end private # Human friendly message. # # @return [String] def build_error_message parsed_response = @response.parsed_response message = check_error_keys(parsed_response) "Server responded with code #{@response.code}, message: " \ "#{handle_message(message)}. " \ "Request URI: #{@response.request.base_uri}#{@response.request.path}" end # Error keys vary across the API, find the first key that the parsed_response # object responds to and return that, otherwise return the original. def check_error_keys(resp) key = POSSIBLE_MESSAGE_KEYS.find { |k| resp.respond_to?(k) } key ? resp.send(key) : resp end # Handle error response message in case of nested hashes def handle_message(message) case message when Gitlab::ObjectifiedHash message.to_h.sort.map do |key, val| "'#{key}' #{(val.is_a?(Hash) ? val.sort.map { |k, v| "(#{k}: #{v.join(' ')})" } : [val].flatten).join(' ')}" end.join(', ') when Array message.join(' ') else message end end end # Raised when API endpoint returns the HTTP status code 400. class BadRequest < ResponseError; end # Raised when API endpoint returns the HTTP status code 401. class Unauthorized < ResponseError; end # Raised when API endpoint returns the HTTP status code 403. class Forbidden < ResponseError; end # Raised when API endpoint returns the HTTP status code 404. class NotFound < ResponseError; end # Raised when API endpoint returns the HTTP status code 405. class MethodNotAllowed < ResponseError; end # Raised when API endpoint returns the HTTP status code 409. class Conflict < ResponseError; end # Raised when API endpoint returns the HTTP status code 422. class Unprocessable < ResponseError; end # Raised when API endpoint returns the HTTP status code 500. class InternalServerError < ResponseError; end # Raised when API endpoint returns the HTTP status code 502. class BadGateway < ResponseError; end # Raised when API endpoint returns the HTTP status code 503. class ServiceUnavailable < ResponseError; end end end gitlab-4.8.0/lib/gitlab/file_response.rb000066400000000000000000000022701341107427500201640ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab # Wrapper class of file response. class FileResponse HEADER_CONTENT_DISPOSITION = 'Content-Disposition' attr_reader :filename def initialize(file) @file = file end # @return [bool] Always false def empty? false end # @return [Hash] A hash consisting of filename and io object def to_hash { filename: @filename, data: @file } end alias to_h to_hash # @return [String] Formatted string with the class name, object id and filename. def inspect "#<#{self.class}:#{object_id} {filename: #{filename.inspect}}>" end def method_missing(name, *args, &block) if @file.respond_to?(name) @file.send(name, *args, &block) else super end end def respond_to_missing?(method_name, include_private = false) super || @file.respond_to?(method_name, include_private) end # Parse filename from the 'Content Disposition' header. def parse_headers!(headers) @filename = headers[HEADER_CONTENT_DISPOSITION].split('filename=')[1] @filename = @filename[1...-1] if @filename[0] == '"' # Unquote filenames end end end gitlab-4.8.0/lib/gitlab/help.rb000066400000000000000000000051621341107427500162620ustar00rootroot00000000000000# frozen_string_literal: true require 'gitlab' require 'gitlab/cli_helpers' module Gitlab::Help extend Gitlab::CLI::Helpers class << self # Returns the (modified) help from the 'ri' command or returns an error. # # @return [String] def get_help(cmd) cmd_namespace = namespace cmd if cmd_namespace ri_output = `#{ri_cmd} -T #{cmd_namespace} 2>&1`.chomp if $CHILD_STATUS == 0 change_help_output! cmd, ri_output yield ri_output if block_given? ri_output else "Ri docs not found for #{cmd}, please install the docs to use 'help'." end else "Unknown command: #{cmd}." end end # Finds the location of 'ri' on a system. # # @return [String] def ri_cmd which_ri = `which ri`.chomp raise "'ri' tool not found in $PATH. Please install it to use the help." if which_ri.empty? which_ri end # A hash map that contains help topics (Branches, Groups, etc.) # and a list of commands that are defined under a topic (create_branch, # branches, protect_branch, etc.). # # @return [Hash] def help_map @help_map ||= begin actions.each_with_object({}) do |action, hsh| key = client.method(action) .owner.to_s.gsub(/Gitlab::(?:Client::)?/, '') hsh[key] ||= [] hsh[key] << action.to_s end end end # Table with available commands. # # @return [Terminal::Table] def actions_table(topic = nil) rows = topic ? help_map[topic] : help_map.keys table do |t| t.title = topic || 'Help Topics' # add_row expects an array and we have strings hence the map. rows.sort.map { |r| [r] }.each_with_index do |row, index| t.add_row row t.add_separator unless rows.size - 1 == index end end end # Returns full namespace of a command (e.g. Gitlab::Client::Branches.cmd) def namespace(cmd) method_owners.select { |method| method[:name] == cmd } .map { |method| method[:owner] + '.' + method[:name] } .shift end # Massage output from 'ri'. def change_help_output!(cmd, output_str) output_str.gsub!(/#{cmd}\((.*?)\)/m, cmd + ' \1') output_str.gsub!(/\,[\s]*/, ' ') # Ensure @option descriptions are on a single line output_str.gsub!(/\n\[/, " \[") output_str.gsub!(/\s(@)/, "\n@") output_str.gsub!(/(\])\n(\:)/, '\1 \2') output_str.gsub!(/(\:.*)(\n)(.*\.)/, '\1 \3') output_str.gsub!(/\{(.+)\}/, '"{\1}"') end end end gitlab-4.8.0/lib/gitlab/objectified_hash.rb000066400000000000000000000016351341107427500206050ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab # Converts hashes to the objects. class ObjectifiedHash # Creates a new ObjectifiedHash object. def initialize(hash) @hash = hash @data = hash.each_with_object({}) do |(key, value), data| value = ObjectifiedHash.new(value) if value.is_a? Hash data[key.to_s] = value end end # @return [Hash] The original hash. def to_hash @hash end alias to_h to_hash # @return [String] Formatted string with the class name, object id and original hash. def inspect "#<#{self.class}:#{object_id} {hash: #{@hash.inspect}}" end # Delegate to ObjectifiedHash. def method_missing(key) @data.key?(key.to_s) ? @data[key.to_s] : super end def respond_to_missing?(method_name, include_private = false) @hash.keys.map(&:to_sym).include?(method_name.to_sym) || super end end end gitlab-4.8.0/lib/gitlab/page_links.rb000066400000000000000000000013771341107427500174520ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab # Parses link header. # # @private class PageLinks HEADER_LINK = 'Link' DELIM_LINKS = ',' LINK_REGEX = /<([^>]+)>; rel=\"([^\"]+)\"/.freeze METAS = %w[last next first prev].freeze attr_accessor(*METAS) def initialize(headers) link_header = headers[HEADER_LINK] extract_links(link_header) if link_header && link_header =~ /(next|first|last|prev)/ end private def extract_links(header) header.split(DELIM_LINKS).each do |link| LINK_REGEX.match(link.strip) do |match| url = match[1] meta = match[2] next if !url || !meta || METAS.index(meta).nil? send("#{meta}=", url) end end end end end gitlab-4.8.0/lib/gitlab/paginated_response.rb000066400000000000000000000042071341107427500212030ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab # Wrapper class of paginated response. class PaginatedResponse attr_accessor :client def initialize(array) @array = array end def ==(other) @array == other end def inspect @array.inspect end def method_missing(name, *args, &block) if @array.respond_to?(name) @array.send(name, *args, &block) else super end end def respond_to_missing?(method_name, include_private = false) super || @array.respond_to?(method_name, include_private) end def parse_headers!(headers) @links = PageLinks.new headers end def each_page current = self yield current while current.has_next_page? current = current.next_page yield current end end def auto_paginate response = block_given? ? nil : [] each_page do |page| if block_given? page.each do |item| yield item end else response += page end end response end def last_page? !(@links.nil? || @links.last.nil?) end alias has_last_page? last_page? def last_page return nil if @client.nil? || !has_last_page? path = @links.last.sub(/#{@client.endpoint}/, '') @client.get(path) end def first_page? !(@links.nil? || @links.first.nil?) end alias has_first_page? first_page? def first_page return nil if @client.nil? || !has_first_page? path = @links.first.sub(/#{@client.endpoint}/, '') @client.get(path) end def next_page? !(@links.nil? || @links.next.nil?) end alias has_next_page? next_page? def next_page return nil if @client.nil? || !has_next_page? path = @links.next.sub(/#{@client.endpoint}/, '') @client.get(path) end def prev_page? !(@links.nil? || @links.prev.nil?) end alias has_prev_page? prev_page? def prev_page return nil if @client.nil? || !has_prev_page? path = @links.prev.sub(/#{@client.endpoint}/, '') @client.get(path) end end end gitlab-4.8.0/lib/gitlab/request.rb000066400000000000000000000070201341107427500170150ustar00rootroot00000000000000# frozen_string_literal: true require 'httparty' require 'json' module Gitlab # @private class Request include HTTParty format :json headers 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded' parser(proc { |body, _| parse(body) }) attr_accessor :private_token, :endpoint # Converts the response body to an ObjectifiedHash. def self.parse(body) body = decode(body) if body.is_a? Hash ObjectifiedHash.new body elsif body.is_a? Array PaginatedResponse.new(body.collect! { |e| ObjectifiedHash.new(e) }) elsif body true elsif !body false elsif body.nil? false else raise Error::Parsing, "Couldn't parse a response body" end end # Decodes a JSON response into Ruby object. def self.decode(response) response ? JSON.load(response) : {} rescue JSON::ParserError raise Error::Parsing, 'The response is not a valid JSON' end %w[get post put delete].each do |method| define_method method do |path, options = {}| httparty_config(options) authorization_header(options) validate self.class.send(method, @endpoint + path, options) end end # Checks the response code for common errors. # Returns parsed response for successful requests. def validate(response) error_klass = case response.code when 400 then Error::BadRequest when 401 then Error::Unauthorized when 403 then Error::Forbidden when 404 then Error::NotFound when 405 then Error::MethodNotAllowed when 409 then Error::Conflict when 422 then Error::Unprocessable when 500 then Error::InternalServerError when 502 then Error::BadGateway when 503 then Error::ServiceUnavailable end raise error_klass, response if error_klass parsed = response.parsed_response parsed.client = self if parsed.respond_to?(:client=) parsed.parse_headers!(response.headers) if parsed.respond_to?(:parse_headers!) parsed end # Sets a base_uri and default_params for requests. # @raise [Error::MissingCredentials] if endpoint not set. def request_defaults(sudo = nil) self.class.default_params sudo: sudo raise Error::MissingCredentials, 'Please set an endpoint to API' unless @endpoint self.class.default_params.delete(:sudo) if sudo.nil? end private # Sets a PRIVATE-TOKEN or Authorization header for requests. # # @param [Hash] options A customizable set of options. # @option options [Boolean] :unauthenticated true if the API call does not require user authentication. # @raise [Error::MissingCredentials] if private_token and auth_token are not set. def authorization_header(options) return if options[:unauthenticated] raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token options[:headers] = if @private_token.size < 21 { 'PRIVATE-TOKEN' => @private_token } else { 'Authorization' => "Bearer #{@private_token}" } end end # Set HTTParty configuration # @see https://github.com/jnunemaker/httparty def httparty_config(options) options.merge!(httparty) if httparty end end end gitlab-4.8.0/lib/gitlab/shell.rb000066400000000000000000000035441341107427500164430ustar00rootroot00000000000000# frozen_string_literal: true require 'gitlab' require 'gitlab/help' require 'gitlab/cli_helpers' require 'gitlab/shell_history' require 'readline' require 'shellwords' class Gitlab::Shell extend Gitlab::CLI::Helpers class << self attr_reader :arguments, :command def start trap('INT') { quit_shell } # capture ctrl-c setup while (buffer = Readline.readline('gitlab> ')) begin parse_input buffer @arguments.map! { |arg| symbolize_keys(yaml_load(arg)) } case buffer when nil, '' next when 'exit' quit_shell when /^\bhelp\b+/ puts help(arguments[0]) { |out| out.gsub!(/Gitlab\./, 'gitlab> ') } else history << buffer data = execute command, arguments output_table command, arguments, data end rescue StandardError => e puts e.message end end quit_shell # save history if user presses ctrl-d end def parse_input(buffer) buf = Shellwords.shellwords(buffer) @command = buf.shift @arguments = buf.count.positive? ? buf : [] end def setup history.load Readline.completion_proc = completion Readline.completion_append_character = ' ' end # Gets called when user hits TAB key to do completion def completion proc { |str| actions.map(&:to_s).grep(/^#{Regexp.escape(str)}/) } end # Execute a given command with arguements def execute(cmd = command, args = arguments) raise "Unknown command: #{cmd}. See the 'help' for a list of valid commands." unless actions.include?(cmd.to_sym) confirm_command(cmd) gitlab_helper(cmd, args) end def quit_shell history.save exit end def history @history ||= History.new end end end gitlab-4.8.0/lib/gitlab/shell_history.rb000066400000000000000000000025261341107427500202230ustar00rootroot00000000000000# frozen_string_literal: true class Gitlab::Shell class History DEFAULT_HISTFILESIZE = 200 DEFAULT_FILE_PATH = File.join(Dir.home, '.gitlab_shell_history') def initialize(options = {}) @file_path = options[:file_path] || DEFAULT_FILE_PATH Readline::HISTORY.clear end def load read_from_file { |line| Readline::HISTORY << line.chomp } end def save lines.each { |line| history_file&.puts line } end def push(line) Readline::HISTORY << line end alias << push def lines Readline::HISTORY.to_a.last(max_lines) end private def history_file if defined?(@history_file) @history_file else @history_file = File.open(history_file_path, 'w', 0o600).tap do |file| file.sync = true end end rescue Errno::EACCES warn 'History not saved; unable to open your history file for writing.' @history_file = false end def history_file_path File.expand_path(@file_path) end def read_from_file path = history_file_path File.foreach(path) { |line| yield(line) } if File.exist?(path) rescue StandardError => error warn "History file not loaded: #{error.message}" end def max_lines (ENV['GITLAB_HISTFILESIZE'] || DEFAULT_HISTFILESIZE).to_i end end end gitlab-4.8.0/lib/gitlab/version.rb000066400000000000000000000001051341107427500170070ustar00rootroot00000000000000# frozen_string_literal: true module Gitlab VERSION = '4.8.0' end gitlab-4.8.0/spec/000077500000000000000000000000001341107427500137235ustar00rootroot00000000000000gitlab-4.8.0/spec/fixtures/000077500000000000000000000000001341107427500155745ustar00rootroot00000000000000gitlab-4.8.0/spec/fixtures/access_request.json000066400000000000000000000002571341107427500215040ustar00rootroot00000000000000{ "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "requested_at": "2012-10-22T14:13:35Z" } gitlab-4.8.0/spec/fixtures/access_requests.json000066400000000000000000000005511341107427500216640ustar00rootroot00000000000000[ { "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "requested_at": "2012-10-22T14:13:35Z" }, { "id": 2, "username": "john_doe", "name": "John Doe", "state": "active", "created_at": "2012-10-22T14:13:35Z", "requested_at": "2012-10-22T14:13:35Z" } ] gitlab-4.8.0/spec/fixtures/approved_access_request.json000066400000000000000000000002331341107427500233760ustar00rootroot00000000000000{ "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "access_level": 20 } gitlab-4.8.0/spec/fixtures/board_list.json000066400000000000000000000001521341107427500206070ustar00rootroot00000000000000{ "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 } gitlab-4.8.0/spec/fixtures/board_lists.json000066400000000000000000000005051341107427500207740ustar00rootroot00000000000000[ { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }, { "id" : 2, "label" : { "name" : "Ready", "color" : "#FF0000", "description" : null }, "position" : 2 }, { "id" : 3, "label" : { "name" : "Production", "color" : "#FF5F00", "description" : null }, "position" : 3 } ] gitlab-4.8.0/spec/fixtures/boards.json000066400000000000000000000005411341107427500177410ustar00rootroot00000000000000[ { "id" : 1, "lists" : [ { "id" : 1, "label" : { "name" : "Testing", "color" : "#F0AD4E", "description" : null }, "position" : 1 }, { "id" : 2, "label" : { "name" : "Ready", "color" : "#FF0000", "description" : null }, "position" : 2 }, { "id" : 3, "label" : { "name" : "Production", "color" : "#FF5F00", "description" : null }, "position" : 3 } ] } ] gitlab-4.8.0/spec/fixtures/branch.json000066400000000000000000000007261341107427500177310ustar00rootroot00000000000000{"name":"api","commit":{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","parents":[{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616"}],"tree":"f8c4b21c036339f92fcc5482aa28a41250553b27","message":"API: expose issues project id","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-07-25T04:22:21-07:00","committed_date":"2012-07-25T04:22:21-07:00"},"protected": true} gitlab-4.8.0/spec/fixtures/branch_delete.json000066400000000000000000000000331341107427500212420ustar00rootroot00000000000000{ "branch_name": "api" } gitlab-4.8.0/spec/fixtures/branches.json000066400000000000000000000045521341107427500202620ustar00rootroot00000000000000[{"name":"api","commit":{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","parents":[{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616"}],"tree":"f8c4b21c036339f92fcc5482aa28a41250553b27","message":"API: expose issues project id","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-07-25T04:22:21-07:00","committed_date":"2012-07-25T04:22:21-07:00"}},{"name":"dashboard-feed","commit":{"id":"f8f6ff065eccc6ede4d35ed87a09bb962b84ca25","parents":[{"id":"2cf8010792c3075824ee27d0f037aeb178cbbf7e"}],"tree":"e17f2157143d550891d4669c10b7446e4739bc6d","message":"add projects atom feed","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-05-31T23:42:02-07:00","committed_date":"2012-05-31T23:42:02-07:00"}},{"name":"master","commit":{"id":"2cf8010792c3075824ee27d0f037aeb178cbbf7e","parents":[{"id":"af226ae9c9af406c8a0e0bbdf364563495c2f432"},{"id":"e851cb07762aa464aae10e8b4b28de87c1a6f925"}],"tree":"6c6845838039f01723d91f395a1d2fa1dcc82522","message":"Merge pull request #868 from SaitoWu/bugfix/encoding\n\nBugfix/encoding","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-05-30T00:24:43-07:00","committed_date":"2012-05-30T00:24:43-07:00"}},{"name":"preview_notes","commit":{"id":"3749e0d99ac6bfbc65889b1b7a5310e14e7fe89a","parents":[{"id":"2483181f2c3d4ea7d2c68147b19bc07fc3937b0c"}],"tree":"f8c56161b0d6561568f088df9961362eb1ece88b","message":"pass project_id to notes preview path","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-08-09T23:46:27-07:00","committed_date":"2012-08-09T23:46:27-07:00"}},{"name":"refactoring","commit":{"id":"7c7761099cae83f59fe5780340e100be890847b2","parents":[{"id":"058d80b3363dd4fc4417ca4f60f76119188a2470"}],"tree":"d7d4a94c700dc0e84ee943019213d2358a49c413","message":"fix deprecation warnings","author":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"committer":{"name":"Nihad Abbasov","email":"narkoz.2008@gmail.com"},"authored_date":"2012-05-29T07:16:28-07:00","committed_date":"2012-05-29T07:16:28-07:00"}}] gitlab-4.8.0/spec/fixtures/broadcast_message.json000066400000000000000000000003121341107427500221310ustar00rootroot00000000000000{ "message":"Deploy in progress", "starts_at":"2016-08-24T23:21:16.078Z", "ends_at":"2016-08-26T23:21:16.080Z", "color":"#cecece", "font":"#FFFFFF", "id":1, "active":false } gitlab-4.8.0/spec/fixtures/broadcast_messages.json000066400000000000000000000003721341107427500223220ustar00rootroot00000000000000[ { "message":"Example broadcast message", "starts_at":"2016-08-24T23:21:16.078Z", "ends_at":"2016-08-26T23:21:16.080Z", "color":"#E75E40", "font":"#FFFFFF", "id":1, "active": false } ] gitlab-4.8.0/spec/fixtures/build.json000066400000000000000000000021641341107427500175710ustar00rootroot00000000000000{ "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.880Z", "download_url": null, "finished_at": "2015-12-24T17:54:31.198Z", "id": 8, "name": "rubocop", "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:30.733Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "is_admin": true, "linkedin": "", "name": "John Smith", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/u/root", "website_url": "" } }gitlab-4.8.0/spec/fixtures/build_artifacts.json000066400000000000000000000002641341107427500216300ustar00rootroot00000000000000PK å ÂH‹« example.txtUT  OW OWux õExample PK å ÂH‹« ¤example.txtUT OWux õPKQMgitlab-4.8.0/spec/fixtures/build_cancel.json000066400000000000000000000012351341107427500210740ustar00rootroot00000000000000{ "commit": { "author_email": "admin@example.com", "author_name": "John Smith", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2016-01-11T10:13:33.506Z", "download_url": null, "finished_at": "2016-01-11T10:14:09.526Z", "id": 69, "name": "rubocop", "ref": "master", "runner": null, "stage": "test", "started_at": null, "status": "canceled", "tag": false, "user": null }gitlab-4.8.0/spec/fixtures/build_erase.json000066400000000000000000000012621341107427500207460ustar00rootroot00000000000000{ "commit": { "author_email": "admin@example.com", "author_name": "John Smith", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "download_url": null, "id": 69, "name": "rubocop", "ref": "master", "runner": null, "stage": "test", "created_at": "2016-01-11T10:13:33.506Z", "started_at": "2016-01-11T10:13:33.506Z", "finished_at": "2016-01-11T10:15:10.506Z", "status": "failed", "tag": false, "user": null } gitlab-4.8.0/spec/fixtures/build_retry.json000066400000000000000000000012061341107427500210120ustar00rootroot00000000000000{ "commit": { "author_email": "admin@example.com", "author_name": "John Smith", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2016-01-11T10:13:33.506Z", "download_url": null, "finished_at": null, "id": 69, "name": "rubocop", "ref": "master", "runner": null, "stage": "test", "started_at": null, "status": "pending", "tag": false, "user": null }gitlab-4.8.0/spec/fixtures/builds.json000066400000000000000000000050531341107427500177540ustar00rootroot00000000000000[ { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.802Z", "download_url": null, "finished_at": "2015-12-24T17:54:27.895Z", "id": 7, "name": "teaspoon", "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:27.722Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "is_admin": true, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/u/root", "website_url": "" } }, { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.727Z", "download_url": null, "finished_at": "2015-12-24T17:54:24.921Z", "id": 6, "name": "spinach:other", "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:24.729Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "is_admin": true, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/u/root", "website_url": "" } } ]gitlab-4.8.0/spec/fixtures/builds_commits.json000066400000000000000000000040261341107427500215060ustar00rootroot00000000000000[ { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2016-01-11T10:13:33.506Z", "download_url": null, "finished_at": "2016-01-11T10:14:09.526Z", "id": 69, "name": "rubocop", "ref": "master", "runner": null, "stage": "test", "started_at": null, "status": "canceled", "tag": false, "user": null }, { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.957Z", "download_url": null, "finished_at": "2015-12-24T17:54:33.913Z", "id": 9, "name": "brakeman", "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:33.727Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "is_admin": true, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/u/root", "website_url": "" } } ]gitlab-4.8.0/spec/fixtures/compare_merge_request_diff.json000066400000000000000000000022141341107427500240330ustar00rootroot00000000000000 { "commit": { "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", "short_id": "12d65c8dd2b", "title": "JS fix", "author_name": "Dmitriy Zaporozhets", "author_email": "dmitriy.zaporozhets@gmail.com", "created_at": "2014-02-27T10:27:00+02:00" }, "commits": [{ "id": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", "short_id": "12d65c8dd2b", "title": "JS fix", "author_name": "Dmitriy Zaporozhets", "author_email": "dmitriy.zaporozhets@gmail.com", "created_at": "2014-02-27T10:27:00+02:00" }], "diffs": [{ "old_path": "files/js/application.js", "new_path": "files/js/application.js", "a_mode": null, "b_mode": "100644", "diff": "--- a/files/js/application.js\n+++ b/files/js/application.js\n@@ -24,8 +24,10 @@\n //= require g.raphael-min\n //= require g.bar-min\n //= require branch-graph\n-//= require highlightjs.min\n-//= require ace/ace\n //= require_tree .\n //= require d3\n //= require underscore\n+\n+function fix() { \n+ alert(\"Fixed\")\n+}", "new_file": false, "renamed_file": false, "deleted_file": false }], "compare_timeout": false, "compare_same_ref": false } gitlab-4.8.0/spec/fixtures/default_approved_access_request.json000066400000000000000000000002331341107427500251020ustar00rootroot00000000000000{ "id": 1, "username": "raymond_smith", "name": "Raymond Smith", "state": "active", "created_at": "2012-10-22T14:13:35Z", "access_level": 30 } gitlab-4.8.0/spec/fixtures/deployment.json000066400000000000000000000032201341107427500206440ustar00rootroot00000000000000{ "id": 42, "iid": 2, "ref": "master", "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "created_at": "2016-08-11T11:32:35.444Z", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "environment": { "id": 9, "name": "production", "external_url": "https://about.gitlab.com" }, "deployable": { "id": 664, "status": "success", "stage": "deploy", "name": "deploy", "ref": "master", "tag": false, "coverage": null, "created_at": "2016-08-11T11:32:24.456Z", "started_at": null, "finished_at": "2016-08-11T11:32:35.145Z", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root", "created_at": "2016-08-11T07:09:20.351Z", "bio": null, "location": null, "skype": "", "linkedin": "", "twitter": "", "website_url": "" }, "commit": { "id": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "short_id": "a91957a8", "title": "Merge branch 'rename-readme' into 'master'\r", "author_name": "Administrator", "author_email": "admin@example.com", "created_at": "2016-08-11T13:28:26.000+02:00", "message": "Merge branch 'rename-readme' into 'master'\r\n\r\nRename README\r\n\r\n\r\n\r\nSee merge request !2" }, "runner": null } }gitlab-4.8.0/spec/fixtures/deployments.json000066400000000000000000000070021341107427500210310ustar00rootroot00000000000000[ { "created_at": "2016-08-11T07:36:40.222Z", "deployable": { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2016-08-11T09:36:01.000+02:00", "id": "99d03678b90d914dbb1b109132516d71a4a03ea8", "message": "Merge branch 'new-title' into 'master'\r\n\r\nUpdate README\r\n\r\n\r\n\r\nSee merge request !1", "short_id": "99d03678", "title": "Merge branch 'new-title' into 'master'\r" }, "coverage": null, "created_at": "2016-08-11T07:36:27.357Z", "finished_at": "2016-08-11T07:36:39.851Z", "id": 657, "name": "deploy", "ref": "master", "runner": null, "stage": "deploy", "started_at": null, "status": "success", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2016-08-11T07:09:20.351Z", "id": 1, "linkedin": "", "location": null, "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://localhost:3000/root", "website_url": "" } }, "environment": { "external_url": "https://about.gitlab.com", "id": 9, "name": "production" }, "id": 41, "iid": 1, "ref": "master", "sha": "99d03678b90d914dbb1b109132516d71a4a03ea8", "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "id": 1, "name": "Administrator", "state": "active", "username": "root", "web_url": "http://localhost:3000/root" } }, { "created_at": "2016-08-11T11:32:35.444Z", "deployable": { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2016-08-11T13:28:26.000+02:00", "id": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "message": "Merge branch 'rename-readme' into 'master'\r\n\r\nRename README\r\n\r\n\r\n\r\nSee merge request !2", "short_id": "a91957a8", "title": "Merge branch 'rename-readme' into 'master'\r" }, "coverage": null, "created_at": "2016-08-11T11:32:24.456Z", "finished_at": "2016-08-11T11:32:35.145Z", "id": 664, "name": "deploy", "ref": "master", "runner": null, "stage": "deploy", "started_at": null, "status": "success", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2016-08-11T07:09:20.351Z", "id": 1, "linkedin": "", "location": null, "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://localhost:3000/root", "website_url": "" } }, "environment": { "external_url": "https://about.gitlab.com", "id": 9, "name": "production" }, "id": 42, "iid": 2, "ref": "master", "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "id": 1, "name": "Administrator", "state": "active", "username": "root", "web_url": "http://localhost:3000/root" } } ]gitlab-4.8.0/spec/fixtures/dockerfile_project_template.json000066400000000000000000000007261341107427500242240ustar00rootroot00000000000000{ "name": "Binary", "content": "# This file is a template, and might need editing before it works on your project.\n# This Dockerfile installs a compiled binary into a bare system.\n# You must either commit your compiled binary into source control (not recommended)\n# or build the binary first as part of a CI/CD pipeline.\n\nFROM buildpack-deps:jessie\n\nWORKDIR /usr/local/bin\n\n# Change `app` to whatever your binary is called\nAdd app .\nCMD [\"./app\"]\n" } gitlab-4.8.0/spec/fixtures/dockerfile_templates.json000066400000000000000000000017101341107427500226530ustar00rootroot00000000000000[ { "key": "Binary", "name": "Binary" }, { "key": "Binary-alpine", "name": "Binary-alpine" }, { "key": "Binary-scratch", "name": "Binary-scratch" }, { "key": "Golang", "name": "Golang" }, { "key": "Golang-alpine", "name": "Golang-alpine" }, { "key": "Golang-scratch", "name": "Golang-scratch" }, { "key": "HTTPd", "name": "HTTPd" }, { "key": "Node", "name": "Node" }, { "key": "Node-alpine", "name": "Node-alpine" }, { "key": "OpenJDK", "name": "OpenJDK" }, { "key": "OpenJDK-alpine", "name": "OpenJDK-alpine" }, { "key": "PHP", "name": "PHP" }, { "key": "Python", "name": "Python" }, { "key": "Python-alpine", "name": "Python-alpine" }, { "key": "Python2", "name": "Python2" }, { "key": "Ruby", "name": "Ruby" }, { "key": "Ruby-alpine", "name": "Ruby-alpine" } ] gitlab-4.8.0/spec/fixtures/empty.json000066400000000000000000000000001341107427500176130ustar00rootroot00000000000000gitlab-4.8.0/spec/fixtures/environment.json000066400000000000000000000001701341107427500210310ustar00rootroot00000000000000{ "id": 12, "name": "staging", "slug": "staging-cb247rv", "external_url": "https://staging.example.gitlab.com" }gitlab-4.8.0/spec/fixtures/environments.json000066400000000000000000000005031341107427500212140ustar00rootroot00000000000000[ { "id": 1, "name": "review/fix-foo", "slug": "review-fix-foo-dfjre3", "external_url": "https://review-fix-foo-dfjre3.example.gitlab.com" }, { "id": 12, "name": "review/fix-bar", "slug": "review-fix-bar-dbwr18", "external_url": "https://review-fix-bar-dbwr18.example.gitlab.com" } ]gitlab-4.8.0/spec/fixtures/error_already_exists.json000066400000000000000000000000411341107427500227130ustar00rootroot00000000000000{"message": "409 Already exists"}gitlab-4.8.0/spec/fixtures/error_project_not_found.json000066400000000000000000000000451341107427500234200ustar00rootroot00000000000000{"message": "404 Project Not Found"} gitlab-4.8.0/spec/fixtures/get_repository_file.json000066400000000000000000000003771341107427500225530ustar00rootroot00000000000000{"file_name":"README.md", "file_path":"README.md", "size":"19", "encoding":"base64", "content":"VGhpcyBpcyBhICpSRUFETUUqIQ==\n", "ref":"master", "blob_id":"0eba9dff767611060181e0423a1de2941d27efc8", "commit_id":"eb38397cb6ae669219e6bc18ad19981fff18ea29"} gitlab-4.8.0/spec/fixtures/gitignore_template.json000066400000000000000000000021621341107427500223520ustar00rootroot00000000000000{ "name": "Ruby", "content": "*.gem\n*.rbc\n/.config\n/coverage/\n/InstalledFiles\n/pkg/\n/spec/reports/\n/spec/examples.txt\n/test/tmp/\n/test/version_tmp/\n/tmp/\n\n# Used by dotenv library to load environment variables.\n# .env\n\n## Specific to RubyMotion:\n.dat*\n.repl_history\nbuild/\n*.bridgesupport\nbuild-iPhoneOS/\nbuild-iPhoneSimulator/\n\n## Specific to RubyMotion (use of CocoaPods):\n#\n# We recommend against adding the Pods directory to your .gitignore. However\n# you should judge for yourself, the pros and cons are mentioned at:\n# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control\n#\n# vendor/Pods/\n\n## Documentation cache and generated files:\n/.yardoc/\n/_yardoc/\n/doc/\n/rdoc/\n\n## Environment normalization:\n/.bundle/\n/vendor/bundle\n/lib/bundler/man/\n\n# for a library or gem, you might want to ignore these files since the code is\n# intended to run in multiple environments; otherwise, check them in:\n# Gemfile.lock\n# .ruby-version\n# .ruby-gemset\n\n# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:\n.rvmrc\n" } gitlab-4.8.0/spec/fixtures/gitignore_templates.json000066400000000000000000000021331341107427500225330ustar00rootroot00000000000000[ { "key": "Actionscript", "name": "Actionscript" }, { "key": "Ada", "name": "Ada" }, { "key": "Agda", "name": "Agda" }, { "key": "Android", "name": "Android" }, { "key": "AppEngine", "name": "AppEngine" }, { "key": "AppceleratorTitanium", "name": "AppceleratorTitanium" }, { "key": "ArchLinuxPackages", "name": "ArchLinuxPackages" }, { "key": "Autotools", "name": "Autotools" }, { "key": "C", "name": "C" }, { "key": "C++", "name": "C++" }, { "key": "CFWheels", "name": "CFWheels" }, { "key": "CMake", "name": "CMake" }, { "key": "CUDA", "name": "CUDA" }, { "key": "CakePHP", "name": "CakePHP" }, { "key": "ChefCookbook", "name": "ChefCookbook" }, { "key": "Clojure", "name": "Clojure" }, { "key": "CodeIgniter", "name": "CodeIgniter" }, { "key": "CommonLisp", "name": "CommonLisp" }, { "key": "Composer", "name": "Composer" }, { "key": "Concrete5", "name": "Concrete5" } ] gitlab-4.8.0/spec/fixtures/gitlab_ci_yml_template.json000066400000000000000000000027171341107427500231670ustar00rootroot00000000000000{ "name": "Ruby", "content": "# This file is a template, and might need editing before it works on your project.\n# Official language image. Look for the different tagged releases at:\n# https://hub.docker.com/r/library/ruby/tags/\nimage: \"ruby:2.3\"\n\n# Pick zero or more services to be used on all builds.\n# Only needed when using a docker container to run your tests in.\n# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service\nservices:\n - mysql:latest\n - redis:latest\n - postgres:latest\n\nvariables:\n POSTGRES_DB: database_name\n\n# Cache gems in between builds\ncache:\n paths:\n - vendor/ruby\n\n# This is a basic example for a gem or script which doesn't use\n# services such as redis or postgres\nbefore_script:\n - ruby -v # Print out ruby version for debugging\n # Uncomment next line if your rails app needs a JS runtime:\n # - apt-get update -q && apt-get install nodejs -yqq\n - gem install bundler --no-ri --no-rdoc # Bundler is not installed with the image\n - bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby\n\n# Optional - Delete if not using `rubocop`\nrubocop:\n script:\n - rubocop\n\nrspec:\n script:\n - rspec spec\n\nrails:\n variables:\n DATABASE_URL: \"postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB\"\n script:\n - bundle exec rake db:migrate\n - bundle exec rake db:seed\n - bundle exec rake test\n" } gitlab-4.8.0/spec/fixtures/gitlab_ci_yml_templates.json000066400000000000000000000017671341107427500233560ustar00rootroot00000000000000[ { "key": "Android", "name": "Android" }, { "key": "Auto-DevOps", "name": "Auto-DevOps" }, { "key": "Bash", "name": "Bash" }, { "key": "C++", "name": "C++" }, { "key": "Chef", "name": "Chef" }, { "key": "Clojure", "name": "Clojure" }, { "key": "Crystal", "name": "Crystal" }, { "key": "Django", "name": "Django" }, { "key": "Docker", "name": "Docker" }, { "key": "Elixir", "name": "Elixir" }, { "key": "Go", "name": "Go" }, { "key": "Gradle", "name": "Gradle" }, { "key": "Grails", "name": "Grails" }, { "key": "Julia", "name": "Julia" }, { "key": "LaTeX", "name": "LaTeX" }, { "key": "Laravel", "name": "Laravel" }, { "key": "Maven", "name": "Maven" }, { "key": "Mono", "name": "Mono" }, { "key": "Nodejs", "name": "Nodejs" }, { "key": "OpenShift", "name": "OpenShift" } ] gitlab-4.8.0/spec/fixtures/group.json000066400000000000000000000034401341107427500176240ustar00rootroot00000000000000{"id": 10, "name": "GitLab-Group", "path": "gitlab-group", "owner_id": 6, "projects": [ { "id": 9, "name": "mojito", "description": null, "default_branch": "master", "owner": { "id": 6, "username": "jose", "email": "jose@abc.com", "name": "Jose Jose", "blocked": false, "created_at": "2013-02-06T06:54:06Z" }, "path": "mojito", "path_with_namespace": "gitlab-group/mojito", "issues_enabled": true, "merge_requests_enabled": true, "wall_enabled": true, "wiki_enabled": true, "created_at": "2013-02-06T16:59:15Z", "namespace": { "created_at": "2013-02-06T16:58:22Z", "id": 10, "name": "GitLab-Group", "owner_id": 6, "path": "gitlab-group", "updated_at": "2013-02-06T16:58:22Z" } }, { "id": 10, "name": "gitlabhq", "description": null, "default_branch": null, "owner": { "id": 6, "username": "randx", "email": "randx@github.com", "name": "Dmitry Z", "blocked": false, "created_at": "2013-02-06T06:54:06Z" }, "path": "gitlabhq", "path_with_namespace": "gitlab-group/gitlabhq", "issues_enabled": true, "merge_requests_enabled": true, "wall_enabled": true, "wiki_enabled": true, "created_at": "2013-02-06T17:02:31Z", "namespace": { "created_at": "2013-02-06T16:58:22Z", "id": 10, "name": "GitLab-Group", "owner_id": 6, "path": "gitlab-group", "updated_at": "2013-02-06T16:58:22Z" } } ]}gitlab-4.8.0/spec/fixtures/group_create.json000066400000000000000000000001011341107427500211360ustar00rootroot00000000000000{"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1}gitlab-4.8.0/spec/fixtures/group_create_with_description.json000066400000000000000000000001521341107427500246020ustar00rootroot00000000000000{"id":3,"name":"Gitlab-Group","path":"gitlab-group","owner_id":1,"description":"gitlab group description"}gitlab-4.8.0/spec/fixtures/group_delete.json000066400000000000000000000002061341107427500211430ustar00rootroot00000000000000{"id":42,"name":"Gitlab-Group","path":"gitlab-group","created_at":"2016-02-24T20:16:42.906Z","updated_at":"2016-02-24T20:16:42.906Z"} gitlab-4.8.0/spec/fixtures/group_edit.json000066400000000000000000000006141341107427500206310ustar00rootroot00000000000000{ "id": 1, "name": "Foobar Group", "path": "foo-bar", "description": "An interesting group", "visibility": "public", "lfs_enabled": true, "avatar_url": "http://gitlab.example.com/uploads/group/avatar/1/foo.jpg", "web_url": "http://gitlab.example.com/groups/foo-bar", "request_access_enabled": false, "full_name": "Foobar Group", "full_path": "foo-bar", "parent_id": 123 } gitlab-4.8.0/spec/fixtures/group_member.json000066400000000000000000000002231341107427500211470ustar00rootroot00000000000000{"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":10}gitlab-4.8.0/spec/fixtures/group_member_delete.json000066400000000000000000000002221341107427500224700ustar00rootroot00000000000000{"created_at":"2013-09-04T18:18:15Z","group_access":10,"group_id":3,"id":2,"notification_level":3,"updated_at":"2013-09-04T18:18:15Z","user_id":2}gitlab-4.8.0/spec/fixtures/group_member_edit.json000066400000000000000000000002231341107427500221540ustar00rootroot00000000000000{"id":2,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-09-04T18:15:30Z","access_level":50}gitlab-4.8.0/spec/fixtures/group_members.json000066400000000000000000000004611341107427500213360ustar00rootroot00000000000000[{"id":1,"username":"eraymond","email":"eraymond@local.host","name":"Edward Raymond","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50},{"id":1,"username":"jsmith","email":"jsmith@local.host","name":"John Smith","state":"active","created_at":"2013-08-30T16:16:22Z","access_level":50}]gitlab-4.8.0/spec/fixtures/group_milestone.json000066400000000000000000000002441341107427500217020ustar00rootroot00000000000000{"id":1,"group_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"} gitlab-4.8.0/spec/fixtures/group_milestone_issues.json000066400000000000000000000054351341107427500233040ustar00rootroot00000000000000[{"id":1,"project_id":3,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":3,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":3,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":3,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]gitlab-4.8.0/spec/fixtures/group_milestone_merge_requests.json000066400000000000000000000037771341107427500250320ustar00rootroot00000000000000[{"id":1,"iid":1,"project_id":1,"title":"lorem ipsum","description":"","state":"opened","created_at":"2017-03-24T12:23:53.918Z","updated_at":"2017-03-24T12:23:53.918Z","target_branch":"master","source_branch":"def","upvotes":0,"downvotes":0,"author":{"name":"John Doe","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoen"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"aec123d1775790b2347fdd684b5ba613fdeb994b","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/2"},{"id":2,"iid":2,"project_id":1,"title":"ipsum lorem","description":"","state":"opened","created_at":"2017-03-24T12:23:24.662Z","updated_at":"2017-03-24T12:23:33.522Z","target_branch":"master","source_branch":"test1","upvotes":0,"downvotes":0,"author":{"name":"Joren","username":"jdoe","id":1,"state":"active","":"","web_url":"https://gitlab.com/jdoe"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"3ee44c9b40deddae596f838b97523c6f010fd80d","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/1"}] gitlab-4.8.0/spec/fixtures/group_milestones.json000066400000000000000000000002461341107427500220670ustar00rootroot00000000000000[{"id":1,"group_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}] gitlab-4.8.0/spec/fixtures/group_projects.json000066400000000000000000000024061341107427500215360ustar00rootroot00000000000000[ { "id": 4, "description": null, "default_branch": "master", "public": false, "visibility_level": 0, "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "web_url": "http://example.com/diaspora/diaspora-client", "tag_list": [ "example", "disapora client" ], "owner": { "id": 3, "name": "Diaspora", "created_at": "2013-09-30T13: 46: 02Z" }, "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "issues_enabled": true, "merge_requests_enabled": true, "builds_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "created_at": "2013-09-30T13: 46: 02Z", "last_activity_at": "2013-09-30T13: 46: 02Z", "creator_id": 3, "namespace": { "created_at": "2013-09-30T13: 46: 02Z", "description": "", "id": 3, "name": "Diaspora", "owner_id": 1, "path": "diaspora", "updated_at": "2013-09-30T13: 46: 02Z" }, "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png" } ] gitlab-4.8.0/spec/fixtures/group_search.json000066400000000000000000000002111341107427500211420ustar00rootroot00000000000000[{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6} ] gitlab-4.8.0/spec/fixtures/group_subgroups.json000066400000000000000000000006541341107427500217410ustar00rootroot00000000000000[ { "id": 1, "name": "Foobar Group", "path": "foo-bar", "description": "An interesting group", "visibility": "public", "lfs_enabled": true, "avatar_url": "http://gitlab.example.com/uploads/group/avatar/1/foo.jpg", "web_url": "http://gitlab.example.com/groups/foo-bar", "request_access_enabled": false, "full_name": "Foobar Group", "full_path": "foo-bar", "parent_id": 123 } ] gitlab-4.8.0/spec/fixtures/groups.json000066400000000000000000000003121341107427500200020ustar00rootroot00000000000000[{"id": 3,"name": "ThreeGroup","path": "threegroup","owner_id": 1},{"id": 5,"name": "Five-Group","path": "five-group","owner_id": 2},{"id": 8,"name": "Eight Group","path": "eight-group","owner_id": 6} ]gitlab-4.8.0/spec/fixtures/issue.json000066400000000000000000000007661341107427500176300ustar00rootroot00000000000000{"id":33,"project_id":3,"title":"Beatae possimus nostrum nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}gitlab-4.8.0/spec/fixtures/issue_award_emoji.json000066400000000000000000000006561341107427500221670ustar00rootroot00000000000000{ "id": 4, "name": "blowfish", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "created_at": "2016-06-15T10:09:34.206Z", "updated_at": "2016-06-15T10:09:34.206Z", "awardable_id": 80, "awardable_type": "Issue" }gitlab-4.8.0/spec/fixtures/issue_award_emojis.json000066400000000000000000000016341341107427500223470ustar00rootroot00000000000000[ { "id": 4, "name": "1234", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "created_at": "2016-06-15T10:09:34.206Z", "updated_at": "2016-06-15T10:09:34.206Z", "awardable_id": 80, "awardable_type": "Issue" }, { "id": 1, "name": "microphone", "user": { "name": "User 4", "username": "user4", "id": 26, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", "web_url": "http://gitlab.example.com/user4" }, "created_at": "2016-06-15T10:09:34.177Z", "updated_at": "2016-06-15T10:09:34.177Z", "awardable_id": 80, "awardable_type": "Issue" } ]gitlab-4.8.0/spec/fixtures/issues.json000066400000000000000000000053771341107427500200160ustar00rootroot00000000000000[{"id":1,"project_id":1,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":2,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":1,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":2,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]gitlab-4.8.0/spec/fixtures/job.json000066400000000000000000000021701341107427500172410ustar00rootroot00000000000000{ "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.880Z", "artifacts_file": null, "finished_at": "2015-12-24T17:54:31.198Z", "id": 8, "name": "rubocop", "pipeline": { "id": 6, "ref": "master", "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "status": "pending" }, "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:30.733Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/root", "website_url": "" } } gitlab-4.8.0/spec/fixtures/job_trace.json000066400000000000000000000000071341107427500204140ustar00rootroot00000000000000asdasd gitlab-4.8.0/spec/fixtures/jobs.json000066400000000000000000000047411341107427500174320ustar00rootroot00000000000000[ { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.802Z", "artifacts_file": { "filename": "artifacts.zip", "size": 1000 }, "finished_at": "2015-12-24T17:54:27.895Z", "id": 7, "name": "teaspoon", "pipeline": { "id": 6, "ref": "master", "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "status": "pending" }, "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:27.722Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/root", "website_url": "" } }, { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.727Z", "artifacts_file": null, "finished_at": "2015-12-24T17:54:24.921Z", "id": 6, "name": "spinach:other", "pipeline": { "id": 6, "ref": "master", "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "status": "pending" }, "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:24.729Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/root", "website_url": "" } } ] gitlab-4.8.0/spec/fixtures/key.json000066400000000000000000000006641341107427500172650ustar00rootroot00000000000000{"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"} gitlab-4.8.0/spec/fixtures/keys.json000066400000000000000000000006661341107427500174520ustar00rootroot00000000000000[{"id":1,"title":"narkoz@helium","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkUsh42Nh1yefGd1jbSELn5XsY8p5Oxmau0/1HqHnjuYOaj5X+kHccFDwtmtg9Ox8ua/+WptNsiE8IUwsD3zKgEjajgwq3gMeeFdxfXwM+tEvHOOMV9meRrgRWGYCToPbT6sR7/YMAYa7cPqWSpx/oZhYfz4XtoMv3ZZT1fZMmx3MY3HwXwW8j+obJyN2K4LN0TFi9RPgWWYn0DCyb9OccmABimt3i74WoJ/OT8r6/7swce8+OSe0Q2wBhyTtvxg2vtUcoek8Af+EZaUMBwSEzEsocOCzwQvjF5XUk5o7dJ8nP8W3RE60JWX57t16eQm7lBmumLYfszpn2isd6W7a1 narkoz@helium"}] gitlab-4.8.0/spec/fixtures/label.json000066400000000000000000000000741341107427500175470ustar00rootroot00000000000000{"name": "Backlog", "color": "#DD10AA", "subscribed": true} gitlab-4.8.0/spec/fixtures/label_unsubscribe.json000066400000000000000000000000751341107427500221540ustar00rootroot00000000000000{"name": "Backlog", "color": "#DD10AA", "subscribed": false} gitlab-4.8.0/spec/fixtures/labels.json000066400000000000000000000001301341107427500177230ustar00rootroot00000000000000[{"name": "Backlog", "color": "#DD10AA"},{"name": "Documentation", "color": "#1E80DD"}] gitlab-4.8.0/spec/fixtures/license_project_template.json000066400000000000000000000033411341107427500235330ustar00rootroot00000000000000{ "key": "mit", "name": "MIT License", "nickname": null, "popular": true, "html_url": "http://choosealicense.com/licenses/mit/", "source_url": "https://opensource.org/licenses/MIT", "description": "A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.", "conditions": [ "include-copyright" ], "permissions": [ "commercial-use", "modifications", "distribution", "private-use" ], "limitations": [ "liability", "warranty" ], "content": "MIT License\n\nCopyright (c) 2018 [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" }gitlab-4.8.0/spec/fixtures/license_template.json000066400000000000000000000012501341107427500220020ustar00rootroot00000000000000{ "key": "mit", "name": "MIT License", "nickname": null, "featured": true, "html_url": "http://choosealicense.com/licenses/mit/", "source_url": "http://opensource.org/licenses/MIT", "description": "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty.", "conditions": [ "include-copyright" ], "permissions": [ "commercial-use", "modifications", "distribution", "private-use" ], "limitations": [ "no-liability" ], "content": "The MIT License (MIT)\n\nCopyright (c) 2016 John Doe\n [...]" } gitlab-4.8.0/spec/fixtures/license_templates.json000066400000000000000000000052241341107427500221720ustar00rootroot00000000000000[ { "key": "apache-2.0", "name": "Apache License 2.0", "nickname": null, "featured": true, "html_url": "http://choosealicense.com/licenses/apache-2.0/", "source_url": "http://www.apache.org/licenses/LICENSE-2.0.html", "description": "A permissive license that also provides an express grant of patent rights from contributors to users.", "conditions": [ "include-copyright", "document-changes" ], "permissions": [ "commercial-use", "modifications", "distribution", "patent-use", "private-use" ], "limitations": [ "trademark-use", "no-liability" ], "content": " Apache License\n Version 2.0, January 2004\n [...]" }, { "key": "gpl-3.0", "name": "GNU General Public License v3.0", "nickname": "GNU GPLv3", "featured": true, "html_url": "http://choosealicense.com/licenses/gpl-3.0/", "source_url": "http://www.gnu.org/licenses/gpl-3.0.txt", "description": "The GNU GPL is the most widely used free software license and has a strong copyleft requirement. When distributing derived works, the source code of the work must be made available under the same license.", "conditions": [ "include-copyright", "document-changes", "disclose-source", "same-license" ], "permissions": [ "commercial-use", "modifications", "distribution", "patent-use", "private-use" ], "limitations": [ "no-liability" ], "content": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n [...]" }, { "key": "mit", "name": "MIT License", "nickname": null, "featured": true, "html_url": "http://choosealicense.com/licenses/mit/", "source_url": "http://opensource.org/licenses/MIT", "description": "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty.", "conditions": [ "include-copyright" ], "permissions": [ "commercial-use", "modifications", "distribution", "private-use" ], "limitations": [ "no-liability" ], "content": "The MIT License (MIT)\n\nCopyright (c) [year] [fullname]\n [...]" } ] gitlab-4.8.0/spec/fixtures/merge_base.json000066400000000000000000000010021341107427500205510ustar00rootroot00000000000000{ "id": "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863", "short_id": "1a0b36b3", "title": "Initial commit", "created_at": "2014-02-27T08:03:18.000Z", "parent_ids": [], "message": "Initial commit\n", "author_name": "Dmitriy Zaporozhets", "author_email": "dmitriy.zaporozhets@gmail.com", "authored_date": "2014-02-27T08:03:18.000Z", "committer_name": "Dmitriy Zaporozhets", "committer_email": "dmitriy.zaporozhets@gmail.com", "committed_date": "2014-02-27T08:03:18.000Z" } gitlab-4.8.0/spec/fixtures/merge_request.json000066400000000000000000000005461341107427500213430ustar00rootroot00000000000000{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}gitlab-4.8.0/spec/fixtures/merge_request_approvals.json000066400000000000000000000021471341107427500234310ustar00rootroot00000000000000{ "id": 5, "iid": 5, "project_id": 1, "title": "Approvals API", "description": "Test", "state": "opened", "created_at": "2016-06-08T00:19:52.638Z", "updated_at": "2016-06-08T21:20:42.470Z", "merge_status": "can_be_merged", "approvals_required": 2, "approvals_missing": 2, "approved_by": [], "approvers": [ { "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", "web_url": "http://localhost:3000/u/root" } } ], "approver_groups": [ { "group": { "id": 5, "name": "group1", "path": "group1", "description": "", "visibility": "public", "lfs_enabled": false, "avatar_url": null, "web_url": "http://localhost/groups/group1", "request_access_enabled": false, "full_name": "group1", "full_path": "group1", "parent_id": null, "ldap_cn": null, "ldap_access": null } } ] } gitlab-4.8.0/spec/fixtures/merge_request_award_emoji.json000066400000000000000000000006651341107427500237060ustar00rootroot00000000000000{ "id": 4, "name": "blowfish", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "created_at": "2016-06-15T10:09:34.206Z", "updated_at": "2016-06-15T10:09:34.206Z", "awardable_id": 80, "awardable_type": "MergeRequest" }gitlab-4.8.0/spec/fixtures/merge_request_award_emojis.json000066400000000000000000000016521341107427500240660ustar00rootroot00000000000000[ { "id": 4, "name": "1234", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "created_at": "2016-06-15T10:09:34.206Z", "updated_at": "2016-06-15T10:09:34.206Z", "awardable_id": 80, "awardable_type": "MergeRequest" }, { "id": 1, "name": "microphone", "user": { "name": "User 4", "username": "user4", "id": 26, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", "web_url": "http://gitlab.example.com/user4" }, "created_at": "2016-06-15T10:09:34.177Z", "updated_at": "2016-06-15T10:09:34.177Z", "awardable_id": 80, "awardable_type": "MergeRequest" } ]gitlab-4.8.0/spec/fixtures/merge_request_changes.json000066400000000000000000000020731341107427500230300ustar00rootroot00000000000000{"id":2,"iid":5,"project_id":3,"title":"Uncovered","description":"","state":"opened","created_at":"2015-03-15T23:15:13.292+01:00","updated_at":"2015-03-15T23:15:14.132+01:00","target_branch":"master","source_branch":"uncovered","upvotes":0,"downvotes":0,"author":{"name":"Dominik Sander","username":"dsander","id":1,"state":"active","avatar_url":"https://secure.gravatar.com/avatar/7f01734389dd6730d076ddee04838bd3?s=40\u0026d=identicon"},"assignee":null,"source_project_id":6,"target_project_id":6,"labels":[],"milestone":null,"changes":[{"old_path":"lib/omniauth/builder.rb","new_path":"lib/omniauth/builder.rb","a_mode":"100644","b_mode":"100644","diff":"--- a/lib/omniauth/builder.rb\n+++ b/lib/omniauth/builder.rb\n@@ -7,11 +7,13 @@ module OmniAuth\n else\n @app = app\n super(\u0026block)\n+ two = 1 # woah! uncovered\n @ins \u003c\u003c @app\n end\n end\n \n def rack14?\n+ one = 2 # thats oke!\n Rack.release.split('.')[1].to_i \u003e= 4\n end\n ","new_file":false,"renamed_file":false,"deleted_file":false}]}gitlab-4.8.0/spec/fixtures/merge_request_closes_issues.json000066400000000000000000000020211341107427500242740ustar00rootroot00000000000000[{"id":1,"iid":1,"project_id":5,"title":"Merge request 1 issue 1","description":"","state":"opened","created_at":"2017-04-06T08:03:36.163Z","updated_at":"2017-04-06T08:03:57.087Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/1"},{"id":2,"iid":2,"project_id":5,"title":"Merge request 1 issue 2","description":"","state":"opened","created_at":"2017-04-06T08:03:44.023Z","updated_at":"2017-04-06T08:03:44.023Z","labels":[],"milestone":null,"assignee":null,"author":{"name":"John","username":"jdoe","id":426047,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoe"},"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/issues/2"}] gitlab-4.8.0/spec/fixtures/merge_request_comment.json000066400000000000000000000002471341107427500230630ustar00rootroot00000000000000{"note":"Cool Merge Request!","author":{"id":1,"username":"jsmith","email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-07-11T01:32:18Z"}}gitlab-4.8.0/spec/fixtures/merge_request_comments.json000066400000000000000000000006211341107427500232420ustar00rootroot00000000000000[{"note":"this is the 1st comment on the 2merge merge request","author":{"id":11,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}},{"note":"another discussion point on the 2merge request","author":{"id":12,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}}] gitlab-4.8.0/spec/fixtures/merge_request_commits.json000066400000000000000000000006471341107427500231000ustar00rootroot00000000000000[{"id":"a2da7552f26d5b46a6a09bb8b7b066e3a102be7d","short_id":"a2da7552","title": "piyo","author_name":"example","author_email":"example@example.com","created_at":"2015-12-19T18:02:31.000+09:00","message":"fuga"},{"id":"3ce509590f37dbce5b877c3e1c78bd3903493170","short_id":"3ce50959","title":"hoge","author_name":"example","author_email":"example@example.com","created_at":"2015-12-19T17:53:46.000+09:00","message":"Hoge"}] gitlab-4.8.0/spec/fixtures/merge_request_diff_version.json000066400000000000000000000050101341107427500240670ustar00rootroot00000000000000{ "id": 110, "head_commit_sha": "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30", "base_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd", "start_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd", "created_at": "2016-07-26T14:44:48.926Z", "merge_request_id": 105, "state": "collected", "real_size": "1", "commits": [{ "id": "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30", "short_id": "33e2ee85", "title": "Change year to 2018", "author_name": "Administrator", "author_email": "admin@example.com", "created_at": "2016-07-26T17:44:29.000+03:00", "message": "Change year to 2018" }, { "id": "aa24655de48b36335556ac8a3cd8bb521f977cbd", "short_id": "aa24655d", "title": "Update LICENSE", "author_name": "Administrator", "author_email": "admin@example.com", "created_at": "2016-07-25T17:21:53.000+03:00", "message": "Update LICENSE" }, { "id": "3eed087b29835c48015768f839d76e5ea8f07a24", "short_id": "3eed087b", "title": "Add license", "author_name": "Administrator", "author_email": "admin@example.com", "created_at": "2016-07-25T17:21:20.000+03:00", "message": "Add license" }], "diffs": [{ "old_path": "LICENSE", "new_path": "LICENSE", "a_mode": "0", "b_mode": "100644", "diff": "--- /dev/null\n+++ b/LICENSE\n@@ -0,0 +1,21 @@\n+The MIT License (MIT)\n+\n+Copyright (c) 2018 Administrator\n+\n+Permission is hereby granted, free of charge, to any person obtaining a copy\n+of this software and associated documentation files (the \"Software\"), to deal\n+in the Software without restriction, including without limitation the rights\n+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+copies of the Software, and to permit persons to whom the Software is\n+furnished to do so, subject to the following conditions:\n+\n+The above copyright notice and this permission notice shall be included in all\n+copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+SOFTWARE.\n", "new_file": true, "renamed_file": false, "deleted_file": false }] } gitlab-4.8.0/spec/fixtures/merge_request_diff_versions.json000066400000000000000000000012211341107427500242520ustar00rootroot00000000000000[{ "id": 110, "head_commit_sha": "33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30", "base_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd", "start_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd", "created_at": "2016-07-26T14:44:48.926Z", "merge_request_id": 105, "state": "collected", "real_size": "1" }, { "id": 108, "head_commit_sha": "3eed087b29835c48015768f839d76e5ea8f07a24", "base_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd", "start_commit_sha": "eeb57dffe83deb686a60a71c16c32f71046868fd", "created_at": "2016-07-25T14:21:33.028Z", "merge_request_id": 105, "state": "collected", "real_size": "1" }] gitlab-4.8.0/spec/fixtures/merge_request_discussion.json000066400000000000000000000022601341107427500236010ustar00rootroot00000000000000{ "id": "7d66bf19bf835e6a4666130544ba1b5c343fc705", "individual_note": false, "notes": [ { "id": 1758, "type": "DiffNote", "body": "test test", "attachment": null, "author": { "id": 1, "name": "Dominik Sander", "username": "dsander", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/7f017343sf43896ddee04838bd3?s=80&d=identicon", "web_url": "https://example.com/dsander" }, "created_at": "2018-05-22T22:00:18.858+02:00", "updated_at": "2018-05-22T22:00:18.858+02:00", "system": false, "noteable_id": 208, "noteable_type": "MergeRequest", "position": { "base_sha": "fb60b1f9e3005a4ec8e039c4ec16b6d36f8e75c9", "start_sha": "3c14868ce2ffbf3294ff8c0de828fd1a0e545aae", "head_sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", "old_path": "spec/omniauth/form_spec.rb", "new_path": "spec/omniauth/form_spec.rb", "position_type": "text", "old_line": 5, "new_line": null }, "resolvable": true, "resolved": false, "resolved_by": null, "noteable_iid": 13 } ] } gitlab-4.8.0/spec/fixtures/merge_request_discussion_note.json000066400000000000000000000017071341107427500246330ustar00rootroot00000000000000{ "id": 1775, "type": "DiffNote", "body": "much note", "attachment": null, "author": { "id": 1, "name": "Dominik Sander", "username": "dsander", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/7f017343sf43896ddee04838bd3?s=80&d=identicon", "web_url": "https://example.com/dsander" }, "created_at": "2018-05-23T22:21:46.993+02:00", "updated_at": "2018-05-23T22:21:46.993+02:00", "system": false, "noteable_id": 208, "noteable_type": "MergeRequest", "position": { "base_sha": "fb60b1f9e3005a4ec8e039c4ec16b6d36f8e75c9", "start_sha": "3c14868ce2ffbf3294ff8c0de828fd1a0e545aae", "head_sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", "old_path": "spec/omniauth/form_spec.rb", "new_path": "spec/omniauth/form_spec.rb", "position_type": "text", "old_line": 9, "new_line": null }, "resolvable": true, "resolved": false, "resolved_by": null, "noteable_iid": 13 } gitlab-4.8.0/spec/fixtures/merge_request_discussions.json000066400000000000000000000024021341107427500237620ustar00rootroot00000000000000[ { "id": "7d66bf19bf835e6a4666130544ba1b5c343fc705", "individual_note": false, "notes": [ { "id": 1758, "type": "DiffNote", "body": "test test", "attachment": null, "author": { "id": 1, "name": "Dominik Sander", "username": "dsander", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/7f017343sf43896ddee04838bd3?s=80&d=identicon", "web_url": "https://example.com/dsander" }, "created_at": "2018-05-22T22:00:18.858+02:00", "updated_at": "2018-05-22T22:00:18.858+02:00", "system": false, "noteable_id": 208, "noteable_type": "MergeRequest", "position": { "base_sha": "fb60b1f9e3005a4ec8e039c4ec16b6d36f8e75c9", "start_sha": "3c14868ce2ffbf3294ff8c0de828fd1a0e545aae", "head_sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", "old_path": "spec/omniauth/form_spec.rb", "new_path": "spec/omniauth/form_spec.rb", "position_type": "text", "old_line": 5, "new_line": null }, "resolvable": true, "resolved": false, "resolved_by": null, "noteable_iid": 13 } ] } ] gitlab-4.8.0/spec/fixtures/merge_requests.json000066400000000000000000000005511341107427500215220ustar00rootroot00000000000000[{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}] gitlab-4.8.0/spec/fixtures/merge_requests_closing_issue_on_merge.json000066400000000000000000000013271341107427500263250ustar00rootroot00000000000000[{"id":1,"target_branch":"master","source_branch":"api","project_id":3,"title":"New feature","closed":false,"merged":false,"author":{"id":2,"email":"john2@example.com","name":"John Smith 2","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith 2","blocked":false,"created_at":"2012-10-19T05:56:14Z"}},{"id":2,"target_branch":"master","source_branch":"api","project_id":2,"title":"New feature 2","closed":false,"merged":false,"author":{"id":2,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-10-19T05:56:05Z"},"assignee":{"id":4,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-10-19T05:56:14Z"}}] gitlab-4.8.0/spec/fixtures/milestone.json000066400000000000000000000002451341107427500204670ustar00rootroot00000000000000{"id":1,"project_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}gitlab-4.8.0/spec/fixtures/milestone_issues.json000066400000000000000000000054351341107427500220700ustar00rootroot00000000000000[{"id":1,"project_id":3,"title":"Culpa eius recusandae suscipit autem distinctio dolorum.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":6,"project_id":3,"title":"Ut in dolorum omnis sed sit aliquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":21,"project_id":3,"title":"Vitae ea aliquam et quo eligendi sapiente voluptatum labore hic nihil culpa.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":26,"project_id":3,"title":"Quo enim est nihil atque placeat voluptas neque eos voluptas.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":{"id": 1},"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]gitlab-4.8.0/spec/fixtures/milestone_merge_requests.json000066400000000000000000000037771341107427500236160ustar00rootroot00000000000000[{"id":1,"iid":1,"project_id":1,"title":"lorem ipsum","description":"","state":"opened","created_at":"2017-03-24T12:23:53.918Z","updated_at":"2017-03-24T12:23:53.918Z","target_branch":"master","source_branch":"def","upvotes":0,"downvotes":0,"author":{"name":"John Doe","username":"jdoe","id":1,"state":"active","avatar_url":"","web_url":"https://gitlab.com/jdoen"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"aec123d1775790b2347fdd684b5ba613fdeb994b","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/2"},{"id":2,"iid":2,"project_id":1,"title":"ipsum lorem","description":"","state":"opened","created_at":"2017-03-24T12:23:24.662Z","updated_at":"2017-03-24T12:23:33.522Z","target_branch":"master","source_branch":"test1","upvotes":0,"downvotes":0,"author":{"name":"Joren","username":"jdoe","id":1,"state":"active","":"","web_url":"https://gitlab.com/jdoe"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":{"id":1,"iid":1,"project_id":1,"title":"Test","description":"","state":"active","created_at":"2017-03-24T12:23:00.560Z","updated_at":"2017-03-24T12:23:00.560Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"3ee44c9b40deddae596f838b97523c6f010fd80d","merge_commit_sha":null,"user_notes_count":0,"approvals_before_merge":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"squash":false,"web_url":"https://gitlab.com/jdoe/milestone_merge_requests_test/merge_requests/1"}] gitlab-4.8.0/spec/fixtures/milestones.json000066400000000000000000000002471341107427500206540ustar00rootroot00000000000000[{"id":1,"project_id":3,"title":"3.0","description":"","due_date":"2012-10-22","closed":false,"updated_at":"2012-09-17T10:15:31Z","created_at":"2012-09-17T10:15:31Z"}]gitlab-4.8.0/spec/fixtures/namespaces.json000066400000000000000000000000541341107427500206050ustar00rootroot00000000000000[{"id": 1, "path": "john", "kind": "user"}] gitlab-4.8.0/spec/fixtures/note.json000066400000000000000000000003141341107427500174320ustar00rootroot00000000000000{"id":1201,"body":"The solution is rather tricky","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"created_at":"2012-11-27T19:16:44Z"} gitlab-4.8.0/spec/fixtures/note_award_emoji.json000066400000000000000000000006661341107427500220050ustar00rootroot00000000000000{ "id": 4, "name": "mood_bubble_lightning", "user": { "name": "User 4", "username": "user4", "id": 26, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", "web_url": "http://gitlab.example.com/user4" }, "created_at": "2016-06-15T10:09:34.197Z", "updated_at": "2016-06-15T10:09:34.197Z", "awardable_id": 1, "awardable_type": "Note" } gitlab-4.8.0/spec/fixtures/note_award_emojis.json000066400000000000000000000007311341107427500221610ustar00rootroot00000000000000[ { "id": 2, "name": "mood_bubble_lightning", "user": { "name": "User 4", "username": "user4", "id": 26, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", "web_url": "http://gitlab.example.com/user4" }, "created_at": "2016-06-15T10:09:34.197Z", "updated_at": "2016-06-15T10:09:34.197Z", "awardable_id": 1, "awardable_type": "Note" } ]gitlab-4.8.0/spec/fixtures/notes.json000066400000000000000000000006131341107427500176170ustar00rootroot00000000000000[{"id":1201,"body":"The solution is rather tricky","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"created_at":"2012-11-27T19:16:44Z"},{"id":1207,"body":"I know, right?","author":{"id":1,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"created_at":"2012-11-27T19:58:21Z"}] gitlab-4.8.0/spec/fixtures/participants_on_issue.json000066400000000000000000000007351341107427500231010ustar00rootroot00000000000000[ { "id": 1, "name": "John Doe1", "username": "user1", "state": "active", "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon", "web_url": "http://localhost/user1" }, { "id": 5, "name": "John Doe5", "username": "user5", "state": "active", "avatar_url": "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon", "web_url": "http://localhost/user5" } ] gitlab-4.8.0/spec/fixtures/pipeline.json000066400000000000000000000012231341107427500202720ustar00rootroot00000000000000{ "id": 46, "status": "success", "ref": "master", "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "tag": false, "yaml_errors": null, "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "created_at": "2016-08-11T11:28:34.085Z", "updated_at": "2016-08-11T11:32:35.169Z", "started_at": null, "finished_at": "2016-08-11T11:32:35.145Z", "committed_at": null, "duration": null }gitlab-4.8.0/spec/fixtures/pipeline_cancel.json000066400000000000000000000012241341107427500216000ustar00rootroot00000000000000{ "id": 46, "status": "canceled", "ref": "master", "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "tag": false, "yaml_errors": null, "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "created_at": "2016-08-11T11:28:34.085Z", "updated_at": "2016-08-11T11:32:35.169Z", "started_at": null, "finished_at": "2016-08-11T11:32:35.145Z", "committed_at": null, "duration": null }gitlab-4.8.0/spec/fixtures/pipeline_create.json000066400000000000000000000011751341107427500216230ustar00rootroot00000000000000{ "id": 61, "sha": "384c444e840a515b23f21915ee5766b87068a70d", "ref": "master", "status": "pending", "before_sha": "0000000000000000000000000000000000000000", "tag": false, "yaml_errors": null, "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "created_at": "2016-11-04T09:36:13.747Z", "updated_at": "2016-11-04T09:36:13.977Z", "started_at": null, "finished_at": null, "committed_at": null, "duration": null }gitlab-4.8.0/spec/fixtures/pipeline_jobs.json000066400000000000000000000047411341107427500213170ustar00rootroot00000000000000[ { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.802Z", "artifacts_file": { "filename": "artifacts.zip", "size": 1000 }, "finished_at": "2015-12-24T17:54:27.895Z", "id": 7, "name": "teaspoon", "pipeline": { "id": 6, "ref": "master", "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "status": "pending" }, "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:27.722Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/root", "website_url": "" } }, { "commit": { "author_email": "admin@example.com", "author_name": "Administrator", "created_at": "2015-12-24T16:51:14.000+01:00", "id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "message": "Test the CI integration.", "short_id": "0ff3ae19", "title": "Test the CI integration." }, "coverage": null, "created_at": "2015-12-24T15:51:21.727Z", "artifacts_file": null, "finished_at": "2015-12-24T17:54:24.921Z", "id": 6, "name": "spinach:other", "pipeline": { "id": 6, "ref": "master", "sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd", "status": "pending" }, "ref": "master", "runner": null, "stage": "test", "started_at": "2015-12-24T17:54:24.729Z", "status": "failed", "tag": false, "user": { "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "bio": null, "created_at": "2015-12-21T13:14:24.077Z", "id": 1, "linkedin": "", "name": "Administrator", "skype": "", "state": "active", "twitter": "", "username": "root", "web_url": "http://gitlab.dev/root", "website_url": "" } } ] gitlab-4.8.0/spec/fixtures/pipeline_retry.json000066400000000000000000000012231341107427500215170ustar00rootroot00000000000000{ "id": 46, "status": "pending", "ref": "master", "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "tag": false, "yaml_errors": null, "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "created_at": "2016-08-11T11:28:34.085Z", "updated_at": "2016-08-11T11:32:35.169Z", "started_at": null, "finished_at": "2016-08-11T11:32:35.145Z", "committed_at": null, "duration": null }gitlab-4.8.0/spec/fixtures/pipeline_schedule.json000066400000000000000000000014061341107427500221510ustar00rootroot00000000000000{ "id": 13, "description": "Test schedule pipeline", "ref": "master", "cron": "* * * * *", "cron_timezone": "Asia/Tokyo", "next_run_at": "2017-05-19T13:41:00.000Z", "active": true, "created_at": "2017-05-19T13:31:08.849Z", "updated_at": "2017-05-19T13:40:17.727Z", "last_pipeline": { "id": 332, "sha": "0e788619d0b5ec17388dffb973ecd505946156db", "ref": "master", "status": "pending" }, "owner": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "variables": [ { "key": "TEST_VARIABLE_1", "value": "TEST_1" } ] } gitlab-4.8.0/spec/fixtures/pipeline_schedule_create.json000066400000000000000000000010511341107427500234700ustar00rootroot00000000000000{ "id": 14, "description": "Build packages", "ref": "master", "cron": "0 1 * * 5", "cron_timezone": "UTC", "next_run_at": "2017-05-26T01:00:00.000Z", "active": true, "created_at": "2017-05-19T13:43:08.169Z", "updated_at": "2017-05-19T13:43:08.169Z", "last_pipeline": null, "owner": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" } } gitlab-4.8.0/spec/fixtures/pipeline_schedule_update.json000066400000000000000000000012541341107427500235140ustar00rootroot00000000000000{ "id": 13, "description": "Test schedule pipeline", "ref": "master", "cron": "0 2 * * *", "cron_timezone": "Asia/Tokyo", "next_run_at": "2017-05-19T17:00:00.000Z", "active": true, "created_at": "2017-05-19T13:31:08.849Z", "updated_at": "2017-05-19T13:44:16.135Z", "last_pipeline": { "id": 332, "sha": "0e788619d0b5ec17388dffb973ecd505946156db", "ref": "master", "status": "pending" }, "owner": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" } } gitlab-4.8.0/spec/fixtures/pipeline_schedule_variable.json000066400000000000000000000000651341107427500240160ustar00rootroot00000000000000{ "key": "NEW_VARIABLE", "value": "new value" } gitlab-4.8.0/spec/fixtures/pipeline_schedule_variable_update.json000066400000000000000000000000701341107427500253540ustar00rootroot00000000000000{ "key": "NEW_VARIABLE", "value": "update value" } gitlab-4.8.0/spec/fixtures/pipeline_schedules.json000066400000000000000000000011111341107427500223250ustar00rootroot00000000000000[ { "id": 13, "description": "Test schedule pipeline", "ref": "master", "cron": "* * * * *", "cron_timezone": "Asia/Tokyo", "next_run_at": "2017-05-19T13:41:00.000Z", "active": true, "created_at": "2017-05-19T13:31:08.849Z", "updated_at": "2017-05-19T13:40:17.727Z", "owner": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" } } ] gitlab-4.8.0/spec/fixtures/pipelines.json000066400000000000000000000025501341107427500204610ustar00rootroot00000000000000[ { "id": 47, "status": "pending", "ref": "new-pipeline", "sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a", "tag": false, "yaml_errors": null, "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "created_at": "2016-08-16T10:23:19.007Z", "updated_at": "2016-08-16T10:23:19.216Z", "started_at": null, "finished_at": null, "committed_at": null, "duration": null }, { "id": 48, "status": "pending", "ref": "new-pipeline", "sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a", "before_sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a", "tag": false, "yaml_errors": null, "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://localhost:3000/root" }, "created_at": "2016-08-16T10:23:21.184Z", "updated_at": "2016-08-16T10:23:21.314Z", "started_at": null, "finished_at": null, "committed_at": null, "duration": null } ]gitlab-4.8.0/spec/fixtures/preview_project_badge.json000066400000000000000000000004621341107427500230220ustar00rootroot00000000000000{ "link_url": "http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}", "image_url": "https://shields.io/my/badge", "rendered_link_url": "http://example.com/ci_status.svg?project=example-org/example-project&ref=master", "rendered_image_url": "https://shields.io/my/badge" } gitlab-4.8.0/spec/fixtures/project.json000066400000000000000000000005441341107427500201400ustar00rootroot00000000000000{"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"public":false,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}gitlab-4.8.0/spec/fixtures/project_badge.json000066400000000000000000000005221341107427500212560ustar00rootroot00000000000000{ "id": 1, "link_url": "http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}", "image_url": "https://shields.io/my/badge", "rendered_link_url": "http://example.com/ci_status.svg?project=example-org/example-project&ref=master", "rendered_image_url": "https://shields.io/my/badge", "kind": "project" } gitlab-4.8.0/spec/fixtures/project_badges.json000066400000000000000000000013071341107427500214430ustar00rootroot00000000000000[ { "id": 1, "link_url": "http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}", "image_url": "https://shields.io/my/badge", "rendered_link_url": "http://example.com/ci_status.svg?project=example-org/example-project&ref=master", "rendered_image_url": "https://shields.io/my/badge", "kind": "project" }, { "id": 2, "link_url": "http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}", "image_url": "https://shields.io/my/badge", "rendered_link_url": "http://example.com/ci_status.svg?project=example-org/example-project&ref=master", "rendered_image_url": "https://shields.io/my/badge", "kind": "group" } ] gitlab-4.8.0/spec/fixtures/project_commit.json000066400000000000000000000006661341107427500215150ustar00rootroot00000000000000{ "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", "short_id": "6104942438c", "title": "Sanitize for network graph", "author_name": "randx", "author_email": "dmitriy.zaporozhets@gmail.com", "created_at": "2012-09-20T09:06:12+03:00", "committed_date": "2012-09-20T09:06:12+03:00", "authored_date": "2012-09-20T09:06:12+03:00", "parent_ids": [ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" ] } gitlab-4.8.0/spec/fixtures/project_commit_comment.json000066400000000000000000000002371341107427500232310ustar00rootroot00000000000000{"note":"Nice code!","author":{"id":1,"username":"jsmith","email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-07-11T01:32:18Z"}} gitlab-4.8.0/spec/fixtures/project_commit_comments.json000066400000000000000000000007051341107427500234140ustar00rootroot00000000000000[{"note":"this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6","author":{"id":11,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}},{"note":"another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6","author":{"id":12,"username":"admin","email":"admin@example.com","name":"A User","state":"active","created_at":"2014-03-06T08:17:35.000Z"}}] gitlab-4.8.0/spec/fixtures/project_commit_create.json000066400000000000000000000012361341107427500230320ustar00rootroot00000000000000{ "id": "ed899a2f4b50b4370feeea94676502b42383c746", "short_id": "ed899a2f4b5", "title": "some commit message", "author_name": "Dmitriy Zaporozhets", "author_email": "dzaporozhets@sphereconsultinginc.com", "committer_name": "Dmitriy Zaporozhets", "committer_email": "dzaporozhets@sphereconsultinginc.com", "created_at": "2016-09-20T09:26:24.000-07:00", "message": "some commit message", "parent_ids": [ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" ], "committed_date": "2016-09-20T09:26:24.000-07:00", "authored_date": "2016-09-20T09:26:24.000-07:00", "stats": { "additions": 2, "deletions": 2, "total": 4 }, "status": null }gitlab-4.8.0/spec/fixtures/project_commit_diff.json000066400000000000000000000010721341107427500224750ustar00rootroot00000000000000{ "diff": "--- a/doc/update/5.4-to-6.0.md\n+++ b/doc/update/5.4-to-6.0.md\n@@ -71,6 +71,8 @@\n sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production\n sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production\n \n+sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production\n+\n ```\n \n ### 6. Update config files", "new_path": "doc/update/5.4-to-6.0.md", "old_path": "doc/update/5.4-to-6.0.md", "a_mode": null, "b_mode": "100644", "new_file": false, "renamed_file": false, "deleted_file": false } gitlab-4.8.0/spec/fixtures/project_commit_merge_requests.json000066400000000000000000000041621341107427500246220ustar00rootroot00000000000000[{"id":1,"iid":1,"project_id":1,"title":"Title","description":"","state":"merged","created_at":"2018-05-15T18:38:47.192Z","updated_at":"2018-05-15T18:39:19.621Z","target_branch":"a","source_branch":"b","upvotes":0,"downvotes":0,"author":{"id":1,"name":"admin","username":"admin","state":"active","avatar_url":"https://gitlab.example.com/uploads/-/system/user/avatar/1/avatar.png","web_url":"https://gitlab.example.com/admin"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"8d35ce134dc1dc52b8060c413a8a47964e1d5c92","merge_commit_sha":"ca0eedb9ca03107d1bb62a4c98498bc35b2e17eb","user_notes_count":0,"discussion_locked":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"web_url":"https://gitlab.example.com/example-group/example-project/merge_requests/1","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"approvals_before_merge":null,"squash":false},{"id":2,"iid":2,"project_id":1,"title":"Title","description":"","state":"merged","created_at":"2018-05-15T18:39:39.528Z","updated_at":"2018-05-15T18:39:47.013Z","target_branch":"master","source_branch":"a","upvotes":0,"downvotes":0,"author":{"id":2,"name":"admin2","username":"admin2","state":"active","avatar_url":"https://gitlab.example.com/uploads/-/system/user/avatar/2/avatar.png","web_url":"https://gitlab.example.com/admin2"},"assignee":null,"source_project_id":1,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"ca0eedb9ca03107d1bb62a4c98498bc35b2e17eb","merge_commit_sha":"a5d1608991cec904a63c95eeed59d14caef43336","user_notes_count":0,"discussion_locked":null,"should_remove_source_branch":null,"force_remove_source_branch":true,"web_url":"https://gitlab.example.com/example-group/example-project/merge_requests/2","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"approvals_before_merge":null,"squash":false}] gitlab-4.8.0/spec/fixtures/project_commit_status.json000066400000000000000000000023231341107427500231100ustar00rootroot00000000000000[ { "id": 496, "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", "ref": "decreased-spec", "status": "failed", "name": "test", "target_url": null, "description": null, "created_at": "2015-10-23T23:35:48.693+02:00", "started_at": null, "finished_at": "2015-10-23T23:35:48.716+02:00", "author": { "name": "Dominik Sander", "username": "dsander", "id": 1, "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/xxxxx?s=40&d=identicon", "web_url": "https://github.com/u/dsander" } }, { "id": 493, "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", "ref": "decreased-spec", "status": "success", "name": "specs", "target_url": "https://github.com/dsander/omniauth/builds/493", "description": null, "created_at": "2015-10-23T21:39:19.384+02:00", "started_at": "2015-10-23T21:39:21.900+02:00", "finished_at": "2015-10-23T21:39:35.215+02:00", "author": { "name": "Dominik Sander", "username": "dsander", "id": 1, "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/xxxxx?s=40&d=identicon", "web_url": "https://github.com/u/dsander" } } ]gitlab-4.8.0/spec/fixtures/project_commits.json000066400000000000000000000112101341107427500216630ustar00rootroot00000000000000[{"id":"f7dd067490fe57505f7226c3b54d3127d2f7fd46","short_id":"f7dd067490f","title":"API: expose issues project id","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-25T04:22:21-07:00"},{"id":"949b1df930bedace1dbd755aaa4a82e8c451a616","short_id":"949b1df930b","title":"API: update docs","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-25T02:35:41-07:00"},{"id":"1b95c8bff351f6718ec31ac1de1e48c57bc95d44","short_id":"1b95c8bff35","title":"API: ability to get project by id","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-25T02:18:30-07:00"},{"id":"92d98f5a0c28bffd7b070cda190b07ab72667d58","short_id":"92d98f5a0c2","title":"Merge pull request #1118 from patthoyts/pt/ldap-missing-password","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-25T01:51:06-07:00"},{"id":"60d3e94874964a626f105d3598e1c122addcf43e","short_id":"60d3e948749","title":"Merge pull request #1122 from patthoyts/pt/missing-log","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-25T01:50:34-07:00"},{"id":"b683a71aa1230f17f9df47661c77dfeae27027de","short_id":"b683a71aa12","title":"Merge pull request #1135 from NARKOZ/api","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-25T01:48:00-07:00"},{"id":"fbb41100db35cf2def2c8b4d896b7015d56bd15b","short_id":"fbb41100db3","title":"update help section with issues API docs","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:52:43-07:00"},{"id":"eca823c1c7cef45cc18c6ab36d2327650c85bfc3","short_id":"eca823c1c7c","title":"Merge branch 'master' into api","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:46:36-07:00"},{"id":"024e0348904179a8dea81c01e27a5f014cf57499","short_id":"024e0348904","title":"update API docs","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:25:01-07:00"},{"id":"7b33d8cbcab3b0ee5789ec607455ab62130db69f","short_id":"7b33d8cbcab","title":"add issues API","author_name":"Nihad Abbasov","author_email":"narkoz.2008@gmail.com","created_at":"2012-07-24T05:19:51-07:00"},{"id":"6035ad7e1fe519d0c6a42731790183889e3ba31d","short_id":"6035ad7e1fe","title":"Create the githost.log file if necessary.","author_name":"Pat Thoyts","author_email":"patthoyts@users.sourceforge.net","created_at":"2012-07-21T07:32:04-07:00"},{"id":"a2d244ec062f3348f6cd1c5218c6097402c5f562","short_id":"a2d244ec062","title":"Handle LDAP missing credentials error with a flash message.","author_name":"Pat Thoyts","author_email":"patthoyts@users.sourceforge.net","created_at":"2012-07-21T01:04:05-07:00"},{"id":"8b7e404b5b6944e9c92cc270b2e5d0005781d49d","short_id":"8b7e404b5b6","title":"Up to 2.7.0","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:53:55-07:00"},{"id":"11721b0dbe82c35789be3e4fa8e14663934b2ff5","short_id":"11721b0dbe8","title":"Help section for system hooks completed","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:47:57-07:00"},{"id":"9c8a1e651716212cf50a623d98e03b8dbdb2c64a","short_id":"9c8a1e65171","title":"Fix system hook example","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:32:42-07:00"},{"id":"4261acda90ff4c61326d80cba026ae76e8551f8f","short_id":"4261acda90f","title":"move SSH keys tab closer to begining","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:27:09-07:00"},{"id":"a69fc5dd23bd502fd36892a80eec21a4c53891f8","short_id":"a69fc5dd23b","title":"Endless event loading for dsahboard","author_name":"randx","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-21T00:23:05-07:00"},{"id":"860fa1163a5fbdfec2bb01ff2d584351554dee29","short_id":"860fa1163a5","title":"Merge pull request #1117 from patthoyts/pt/user-form","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-20T14:23:49-07:00"},{"id":"787e5e94acf5e20280416c9fda105ef5b77576b3","short_id":"787e5e94acf","title":"Fix english on the edit user form.","author_name":"Pat Thoyts","author_email":"patthoyts@users.sourceforge.net","created_at":"2012-07-20T14:18:42-07:00"},{"id":"9267cb04b0b3fdf127899c4b7e636dc27fac06d3","short_id":"9267cb04b0b","title":"Merge branch 'refactoring_controllers' of dev.gitlabhq.com:gitlabhq","author_name":"Dmitriy Zaporozhets","author_email":"dmitriy.zaporozhets@gmail.com","created_at":"2012-07-20T07:24:56-07:00"}]gitlab-4.8.0/spec/fixtures/project_edit.json000066400000000000000000000007061341107427500211450ustar00rootroot00000000000000{ "id":3, "code":"gitlab", "name":"Gitlab-edit", "description":null, "path":"gitlab", "default_branch":null, "owner":{ "id":1, "email":"john@example.com", "name":"John Smith", "blocked":false, "created_at":"2012-09-17T09:41:56Z" }, "public":false, "issues_enabled":true, "merge_requests_enabled":true, "wall_enabled":true, "wiki_enabled":true, "created_at":"2012-09-17T09:41:58Z" } gitlab-4.8.0/spec/fixtures/project_events.json000066400000000000000000000043331341107427500215240ustar00rootroot00000000000000[ { "title":null, "project_id":1, "action_name":"opened", "target_id":160, "target_iid":160, "target_type":"Issue", "author_id":25, "target_title":"Qui natus eos odio tempore et quaerat consequuntur ducimus cupiditate quis.", "created_at":"2017-02-09T10:43:19.667Z", "author":{ "name":"User 3", "username":"user3", "id":25, "state":"active", "avatar_url":"http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80\u0026d=identicon", "web_url":"https://gitlab.example.com/user3" }, "author_username":"user3" }, { "title":null, "project_id":1, "action_name":"opened", "target_id":159, "target_iid":159, "target_type":"Issue", "author_id":21, "target_title":"Nostrum enim non et sed optio illo deleniti non.", "created_at":"2017-02-09T10:43:19.426Z", "author":{ "name":"Test User", "username":"ted", "id":21, "state":"active", "avatar_url":"http://www.gravatar.com/avatar/80fb888c9a48b9a3f87477214acaa63f?s=80\u0026d=identicon", "web_url":"https://gitlab.example.com/ted" }, "author_username":"ted" }, { "title": null, "project_id": 1, "action_name": "commented on", "target_id": 1312, "target_iid": 1312, "target_type": "Note", "author_id": 1, "data": null, "target_title": null, "created_at": "2015-12-04T10:33:58.089Z", "note": { "id": 1312, "body": "What an awesome day!", "attachment": null, "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "created_at": "2015-12-04T10:33:56.698Z", "system": false, "noteable_id": 377, "noteable_type": "Issue", "noteable_iid": 377 }, "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "author_username": "root" } ] gitlab-4.8.0/spec/fixtures/project_for_user.json000066400000000000000000000005421341107427500220420ustar00rootroot00000000000000{"id":1,"code":"brute","name":"Brute","description":null,"path":"brute","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Owner","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:56Z"} gitlab-4.8.0/spec/fixtures/project_fork.json000066400000000000000000000024461341107427500211640ustar00rootroot00000000000000{ "id":20, "description":"desc", "default_branch":"master", "tag_list":[ ], "public":false, "archived":false, "visibility_level":10, "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", "web_url":"http://git.gitlab.com/root/gitlab", "owner":{ "name":"Administrator", "username":"root", "id":1, "state":"active", "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg" }, "name":"gitlab", "name_with_namespace":"Administrator / gitlab", "path":"gitlab", "path_with_namespace":"root/gitlab", "issues_enabled":true, "merge_requests_enabled":true, "wiki_enabled":true, "snippets_enabled":false, "created_at":"2015-06-08T01:29:17.190Z", "last_activity_at":"2015-06-08T01:29:17.190Z", "creator_id":1, "namespace":{ "id":1, "name":"root", "path":"root", "owner_id":1, "created_at":"2015-05-28T19:23:40.445Z", "updated_at":"2015-05-28T19:23:40.445Z", "description":"", "avatar":null }, "forked_from_project":{ "id":3, "name":"Gitlab", "name_with_namespace":"Root / gitlab", "path":"gitlab", "path_with_namespace":"root/gitlab" }, "avatar_url":null } gitlab-4.8.0/spec/fixtures/project_fork_link.json000066400000000000000000000002061341107427500221710ustar00rootroot00000000000000{"created_at":"2013-07-03T13:51:48Z","forked_from_project_id":24,"forked_to_project_id":42,"id":1,"updated_at":"2013-07-03T13:51:48Z"}gitlab-4.8.0/spec/fixtures/project_forked_for_user.json000066400000000000000000000024701341107427500233760ustar00rootroot00000000000000{ "id":20, "description":"desc", "default_branch":"master", "tag_list":[ ], "public":false, "archived":false, "visibility_level":10, "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", "web_url":"http://git.gitlab.com/root/gitlab", "owner":{ "name":"Jack Smith", "username":"jack.smith", "id":2, "state":"active", "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg" }, "name":"gitlab", "name_with_namespace":"Jack Smith / gitlab", "path":"gitlab", "path_with_namespace":"jack.smith/gitlab", "issues_enabled":true, "merge_requests_enabled":true, "wiki_enabled":true, "snippets_enabled":false, "created_at":"2015-06-08T01:29:17.190Z", "last_activity_at":"2015-06-08T01:29:17.190Z", "creator_id":1, "namespace":{ "id":1, "name":"jack.smith", "path":"jack.smith", "owner_id":2, "created_at":"2015-05-28T19:23:40.445Z", "updated_at":"2015-05-28T19:23:40.445Z", "description":"", "avatar":null }, "forked_from_project":{ "id":3, "name":"Gitlab", "name_with_namespace":"Root / gitlab", "path":"gitlab", "path_with_namespace":"root/gitlab" }, "avatar_url":null } gitlab-4.8.0/spec/fixtures/project_forks.json000066400000000000000000000024501341107427500213420ustar00rootroot00000000000000[{ "id":20, "description":"desc", "default_branch":"master", "tag_list":[ ], "public":false, "archived":false, "visibility_level":10, "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", "web_url":"http://git.gitlab.com/root/gitlab", "owner":{ "name":"Administrator", "username":"root", "id":1, "state":"active", "avatar_url":"http://git.gitlab.com/uploads/user/avatar/1/12586377.jpeg" }, "name":"gitlab", "name_with_namespace":"Administrator / gitlab", "path":"gitlab", "path_with_namespace":"root/gitlab", "issues_enabled":true, "merge_requests_enabled":true, "wiki_enabled":true, "snippets_enabled":false, "created_at":"2015-06-08T01:29:17.190Z", "last_activity_at":"2015-06-08T01:29:17.190Z", "creator_id":1, "namespace":{ "id":1, "name":"root", "path":"root", "owner_id":1, "created_at":"2015-05-28T19:23:40.445Z", "updated_at":"2015-05-28T19:23:40.445Z", "description":"", "avatar":null }, "forked_from_project":{ "id":3, "name":"Gitlab", "name_with_namespace":"Root / gitlab", "path":"gitlab", "path_with_namespace":"root/gitlab" }, "avatar_url":null }] gitlab-4.8.0/spec/fixtures/project_hook.json000066400000000000000000000000701341107427500211520ustar00rootroot00000000000000{"id":1,"url":"https://api.example.net/v1/webhooks/ci"} gitlab-4.8.0/spec/fixtures/project_hooks.json000066400000000000000000000000711341107427500213360ustar00rootroot00000000000000[{"id":1,"url":"https://api.example.net/v1/webhooks/ci"}]gitlab-4.8.0/spec/fixtures/project_issues.json000066400000000000000000000113001341107427500215230ustar00rootroot00000000000000[{"id":36,"project_id":3,"title":"Eos ut modi et laudantium quasi porro voluptas sed.","description":null,"labels":[],"milestone":null,"assignee":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":35,"project_id":3,"title":"Ducimus illo in iure voluptatem dolores labore.","description":null,"labels":[],"milestone":null,"assignee":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":34,"project_id":3,"title":"Rem tempora voluptatum atque eum sit nihil neque.","description":null,"labels":[],"milestone":null,"assignee":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":33,"project_id":3,"title":"Beatae possimus nostrum nihil reiciendis laboriosam nihil delectus alias accusantium dolor unde.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":32,"project_id":3,"title":"Deserunt tenetur impedit est beatae voluptas voluptas quaerat quisquam.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":16,"project_id":3,"title":"Numquam earum aut laudantium reprehenderit voluptatem aut.","description":null,"labels":[],"milestone":null,"assignee":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":15,"project_id":3,"title":"Qui veritatis voluptas fuga voluptate voluptas cupiditate.","description":null,"labels":[],"milestone":null,"assignee":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":14,"project_id":3,"title":"In assumenda et ipsa qui debitis voluptatem incidunt.","description":null,"labels":[],"milestone":null,"assignee":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":13,"project_id":3,"title":"Illo eveniet consequatur enim iste provident facilis rerum voluptatem et architecto aut.","description":null,"labels":[],"milestone":null,"assignee":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"author":{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"},{"id":12,"project_id":3,"title":"Veniam et tempore quidem eum reprehenderit cupiditate non aut velit eaque.","description":null,"labels":[],"milestone":null,"assignee":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"closed":false,"updated_at":"2012-09-17T09:42:20Z","created_at":"2012-09-17T09:42:20Z"}]gitlab-4.8.0/spec/fixtures/project_key.json000066400000000000000000000001731341107427500210060ustar00rootroot00000000000000{ "id": 2, "title": "Key Title", "key": "ssh-rsa ...", "can_push": false, "created_at": "2013-09-22T18:34:32Z" } gitlab-4.8.0/spec/fixtures/project_keys.json000066400000000000000000000001751341107427500211730ustar00rootroot00000000000000[{ "id": 2, "title": "Key Title", "key": "ssh-rsa ...", "can_push": false, "created_at": "2013-09-22T18:34:32Z" }] gitlab-4.8.0/spec/fixtures/project_merge_request_approvals.json000066400000000000000000000016161341107427500251570ustar00rootroot00000000000000{ "approvers": [ { "user": { "id": 5, "name": "John Doe6", "username": "user5", "state":"active","avatar_url":"https://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80\u0026d=identicon","web_url":"http://localhost/user5" } } ], "approver_groups": [ { "group": { "id": 1, "name": "group1", "path": "group1", "description": "", "visibility": "public", "lfs_enabled": false, "avatar_url": null, "web_url": "http://localhost/groups/group1", "request_access_enabled": false, "full_name": "group1", "full_path": "group1", "parent_id": null, "ldap_cn": null, "ldap_access": null } } ], "approvals_before_merge": 3, "reset_approvals_on_push": false, "disable_overriding_approvers_per_merge_request": true } gitlab-4.8.0/spec/fixtures/project_runner_enable.json000066400000000000000000000001641341107427500230350ustar00rootroot00000000000000{ "active": true, "description": "test-2016-02-01", "id": 9, "is_shared": false, "name": null } gitlab-4.8.0/spec/fixtures/project_runners.json000066400000000000000000000004471341107427500217160ustar00rootroot00000000000000[ { "active": true, "description": "test-2-20150125", "id": 8, "is_shared": false, "name": null }, { "active": true, "description": "development_runner", "id": 5, "is_shared": true, "name": null } ] gitlab-4.8.0/spec/fixtures/project_search.json000066400000000000000000000005471341107427500214700ustar00rootroot00000000000000[{"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}] gitlab-4.8.0/spec/fixtures/project_star.json000066400000000000000000000023571341107427500211750ustar00rootroot00000000000000{ "id": 3, "description": null, "default_branch": "master", "public": false, "visibility_level": 10, "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", "web_url":"http://git.gitlab.com/root/gitlab", "tag_list": [ ], "name": "GitLab Community Edition", "name_with_namespace": "GitLab / GitLab Community Edition", "path": "gitlab-ce", "path_with_namespace": "gitlab/gitlab-ce", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "builds_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "created_at": "2013-09-30T13:46:02Z", "description": "", "id": 3, "name": "GitLab", "owner_id": 1, "path": "gitlab", "updated_at": "2013-09-30T13:46:02Z" }, "archived": true, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 1, "public_builds": true, "shared_with_groups": [], "only_allow_merge_if_build_succeeds": false } gitlab-4.8.0/spec/fixtures/project_tag_annotated.json000066400000000000000000000005641341107427500230320ustar00rootroot00000000000000{"name": "v1.1.0","message": "Release 1.1.0","commit": {"id": "2695effb5807a22ff3d138d593fd856244e155e7","parents": [],"message": "Initial commit","authored_date": "2012-05-28T04:42:42-07:00","author_name": "John Smith","author email": "john@example.com","committer_name": "Jack Smith","committed_date": "2012-05-28T04:42:42-07:00","committer_email": "jack@example.com"}} gitlab-4.8.0/spec/fixtures/project_tag_lightweight.json000066400000000000000000000005511341107427500233700ustar00rootroot00000000000000{"name": "v1.0.0","message": null,"commit": {"id": "2695effb5807a22ff3d138d593fd856244e155e7","parents": [],"message": "Initial commit","authored_date": "2012-05-28T04:42:42-07:00","author_name": "John Smith","author email": "john@example.com","committer_name": "Jack Smith","committed_date": "2012-05-28T04:42:42-07:00","committer_email": "jack@example.com"}} gitlab-4.8.0/spec/fixtures/project_tags.json000066400000000000000000000347011341107427500211600ustar00rootroot00000000000000[{"name":"v2.8.2","commit":{"id":"a502f67c0b358cc6b391df0c5dca48375c21fcad","parents":[{"id":"4381084af341684240b1a671d368511afcf5774a"}],"tree":"1612068bdd20de5d14b3096cfa4c621e2051ed4c","message":"Up to 2.8.2","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-24T02:03:48-07:00","committed_date":"2012-08-24T02:03:48-07:00"}},{"name":"v2.8.1","commit":{"id":"ed2b53cd1c34c421b23208eeb502a141a6829f9d","parents":[{"id":"7ab587a47791e371f5c109c14097a5d1d7776ea5"}],"tree":"b7393b0b33b777583b285e85b423c4e5ab7f859f","message":"Up to 2.8.1","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-22T23:17:18-07:00","committed_date":"2012-08-22T23:17:18-07:00"}},{"name":"v2.8.0pre","commit":{"id":"b2c6ba97a25d299e83c51493d7bc770c13b8ed1a","parents":[{"id":"05da3801f53f06fdc529b4f3820af1380039f245"},{"id":"66399d558da45fb9cd3ea972a47a4f7bb12bfc8d"}],"tree":"36ad53f35bce1fe3f2a4a5f840e7b1bdbfed9c82","message":"Merge pull request #1230 from tsigo/hooray_apostrophes\n\nCorrect usage of \"Can't\"","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-16T14:11:08-07:00","committed_date":"2012-08-16T14:11:08-07:00"}},{"name":"v2.8.0","commit":{"id":"5c7ed6fa26b47ac71ff6ba04720d85df6d74b200","parents":[{"id":"d1daeba1736ba145fe525ce08a91f29495a3abf1"}],"tree":"4fc230ff2dbc0e75f27321eac2976aba5a6d323d","message":"Up to 2.8","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-08-21T15:15:26-07:00","committed_date":"2012-08-21T15:15:26-07:00"}},{"name":"v2.7.0pre","commit":{"id":"72a571724d84d112f98a5543c971e9b3b9da1383","parents":[{"id":"3ac840ff06e0ee5b349c52b5a8c02e803a17eec3"},{"id":"990b9217d9a55e26a53d4143d4a3c89123384327"}],"tree":"64b104df5d956e21e0749dc8e70849d1989de36f","message":"Merge pull request #1096 from moregeek/show-flash-note-when-destroying-a-project\n\nshow flash notice after deletion of a project","author":{"name":"Valeriy Sizov","email":"vsv2711@gmail.com"},"committer":{"name":"Valeriy Sizov","email":"vsv2711@gmail.com"},"authored_date":"2012-07-18T05:35:42-07:00","committed_date":"2012-07-18T05:35:42-07:00"}},{"name":"v2.7.0","commit":{"id":"8b7e404b5b6944e9c92cc270b2e5d0005781d49d","parents":[{"id":"11721b0dbe82c35789be3e4fa8e14663934b2ff5"}],"tree":"89fe8c5ff58daaedea07a910cffb14b04ebcc828","message":"Up to 2.7.0","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-07-21T00:53:55-07:00","committed_date":"2012-07-21T00:53:55-07:00"}},{"name":"v2.6.3","commit":{"id":"666cdb22792dd955a286b9993d6235b4cdd68b4b","parents":[{"id":"d92446df1fdba87101c92c90b1c34eb2f1eebef4"}],"tree":"888173aa4c12a4920d318c35b950095d3505673d","message":"up to 2.6.3","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-26T09:20:47-07:00","committed_date":"2012-06-26T09:21:28-07:00"}},{"name":"v2.6.2","commit":{"id":"39fecb554f172a0c8ea00316e612e1d37efc7200","parents":[{"id":"68389588d664100590b1a6ca7eedd50860b7e9bc"}],"tree":"53accb25e0b9d038d550cf387753bde15fe4ad19","message":"Up to 2.6.2","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-22T13:50:58-07:00","committed_date":"2012-06-22T13:50:58-07:00"}},{"name":"v2.6.1","commit":{"id":"d92a22c9e627268eca697bbd9b660d8c335df953","parents":[{"id":"193804516b8b0783c850981456e947f888ff51bb"}],"tree":"4ac1b5225f597ab55372cb5e950b121d6f55e386","message":"Up to 2.6.1","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-22T12:49:03-07:00","committed_date":"2012-06-22T12:49:03-07:00"}},{"name":"v2.6.0","commit":{"id":"b32465712becfbcf83d63b1e6eff7d1483fdabea","parents":[{"id":"1903f6ade027df0f10ef96b9439495eeda07482c"}],"tree":"ffbc05fd0f1771c1602c956df9556260048c7167","message":"Up to 2.6","author":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"randx","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-06-21T10:25:23-07:00","committed_date":"2012-06-21T10:25:23-07:00"}},{"name":"v2.5.0","commit":{"id":"cc8369144db2147d2956e8dd7d314e9a7dfd4fbb","parents":[{"id":"1b2068eaa91e5002d01a220c65da21dad8ccb071"}],"tree":"666a442e00689911169e8cc336c5ce60d014854c","message":"Prevent app crash in case if encoding failed","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-05-22T04:57:04-07:00","committed_date":"2012-05-22T04:57:04-07:00"}},{"name":"v2.4.2","commit":{"id":"f18339c26d673c5f8b4c19776036fd42a0de30aa","parents":[{"id":"c937d06c3c98e9ffce8ec1132203eaff6bf7b231"},{"id":"35e602f19c83585d64aa2043ed26eeb8cd7b40e2"}],"tree":"5101f0cd8e395fee1996764298a202437757e85b","message":"Merge branch 'master' of github.com:gitlabhq/gitlabhq","author":{"name":"Zevs","email":"vsv2711@gmail.com"},"committer":{"name":"Zevs","email":"vsv2711@gmail.com"},"authored_date":"2012-04-29T14:24:59-07:00","committed_date":"2012-04-29T14:24:59-07:00"}},{"name":"v2.4.1","commit":{"id":"d97a9aa4a44ff9f452144fad348fd9d7e3b48260","parents":[{"id":"21f3da23589d50038728393f0badc6255b5762ca"}],"tree":"905c33874b064778199f806749d5688e33d64be3","message":"fixed email markdown","author":{"name":"gitlabhq","email":"m@gitlabhq.com"},"committer":{"name":"gitlabhq","email":"m@gitlabhq.com"},"authored_date":"2012-04-23T05:32:56-07:00","committed_date":"2012-04-23T05:32:56-07:00"}},{"name":"v2.4.0pre","commit":{"id":"1845429268364e75bffdeb1075de8f1606e157ec","parents":[{"id":"45b18365d5f409f196a02a4e6e2b77b8ebef909b"}],"tree":"423c70246fa7ffd8804b26628fea34bdb2b22846","message":"Use try for commit prev_commit_id detection","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-04-19T13:35:35-07:00","committed_date":"2012-04-19T13:35:35-07:00"}},{"name":"v2.4.0","commit":{"id":"204c66461ed519eb0078be7e8ac8a6cb56834753","parents":[{"id":"511d07c47c9bf3a18bfa276d452c899369432a22"}],"tree":"9416c777cccf87d348f5705078e82f3f97485e19","message":"corrected exception for automerge","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-04-22T06:49:45-07:00","committed_date":"2012-04-22T06:49:45-07:00"}},{"name":"v2.3.1","commit":{"id":"fa8219e0a753e642a6f1dbdfc010d01ae8a949ee","parents":[{"id":"81da8e46f24913ccf42d3e2644962cbcbc0f9c2e"}],"tree":"5debfcd6d17f9d582aace6ac9b80db27d5c1fe36","message":"better MR list, dashboard pollished","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-03-22T13:57:04-07:00","committed_date":"2012-03-22T13:57:04-07:00"}},{"name":"v2.3.0pre","commit":{"id":"cadf12c60cc27c5b0b8273c1de4b190a0e88bd7d","parents":[{"id":"724ea16c348bc61cf7cb3dbe362c6f30cff1b2c7"}],"tree":"6f4c22761fd2dee405d3fbf38f9dd835bb3c8694","message":"Merged activities & projects pages","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-03-19T15:05:35-07:00","committed_date":"2012-03-19T15:05:35-07:00"}},{"name":"v2.3.0","commit":{"id":"b57faf9282d7df6cdd62953d474652a0ae2e6896","parents":[{"id":"cadf12c60cc27c5b0b8273c1de4b190a0e88bd7d"}],"tree":"f0d5b826df373191b4681452fc2ae4c5970cef4a","message":"Push events polished","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-03-20T14:59:35-07:00","committed_date":"2012-03-20T14:59:35-07:00"}},{"name":"v2.2.0pre","commit":{"id":"6a445b42003007cbb6c06f477c4d7a0b175688c1","parents":[{"id":"22f4c1908d0fc2dbce02e74ed03bf65f028d78d6"}],"tree":"9c60577833f6ca717acdebfa66140124c88e8471","message":"fixed forgot password form","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-02-20T10:37:37-08:00","committed_date":"2012-02-20T10:37:37-08:00"}},{"name":"v2.2.0","commit":{"id":"9e6d0710e927aa8ea834b8a9ae9f277be617ac7d","parents":[{"id":"8c40aab120dbc5507ab9cc8d7ad8e2519d6e9f25"},{"id":"6ea87c47f0f8a24ae031c3fff17bc913889ecd00"}],"tree":"86c831ab21236f21ffa5b97c752369612ce41b39","message":"Merge pull request #443 from CedricGatay/fix/incorrectLineNumberingInDiff\n\nIncorrect line numbering in diff","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-02-22T07:14:54-08:00","committed_date":"2012-02-22T07:14:54-08:00"}},{"name":"v2.1.0","commit":{"id":"98d6492582d232ed86525aa31ccbf280f4cbdaef","parents":[{"id":"611c5a87ab0c083a43785323b09cc47f554c3ba4"}],"tree":"1689b3cad580a18fd9b429ee0b33dac21c9f5a48","message":"removed broken migration","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2012-01-22T10:52:06-08:00","committed_date":"2012-01-22T10:52:06-08:00"}},{"name":"v2.0.0","commit":{"id":"9a2a8612769d472503b367fa35e99f6fb2876704","parents":[{"id":"2f7b67161952fc9ab322eba6878511b5f2dd5cf1"}],"tree":"26cdb4e66b5e664fe4bcd57d011c54c9c9c26ded","message":"Design tab for profile. Colorscheme as db value","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2011-12-20T12:47:09-08:00","committed_date":"2011-12-20T12:47:09-08:00"}},{"name":"v1.2.2","commit":{"id":"139a332293b9d8c4e5436619036e093483d8347f","parents":[{"id":"ade12da9488bea19d12505c371ead35686a1436e"}],"tree":"365d57f4df5c5dcac69b666cf6d2bfd8ef058008","message":"updated readme","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-11-25T14:30:51-08:00","committed_date":"2011-11-25T14:30:51-08:00"}},{"name":"v1.2.1","commit":{"id":"7ebba27db21719c0035bab65fea92a4780051c73","parents":[{"id":"b56024100d40457a998f83adae3cdc830c997cda"},{"id":"a4fbe13fce87cb6ff2a27a2574ae25bf1dad145c"}],"tree":"b121a7576af1503a96954ce9a94598a68579e053","message":"Merge branch 'master' of dev.gitlabhq.com:gitlabhq","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-11-22T13:15:09-08:00","committed_date":"2011-11-22T13:15:09-08:00"}},{"name":"v1.2.0pre","commit":{"id":"86829cae50857b5edf74b935380c6f68a19c2282","parents":[{"id":"a6b99319381c2d62ec4b92d64805e8de8965859e"}],"tree":"6aab9d13000584fa96fb3cb34d94f3b122bd1143","message":"fixed min height for menu","author":{"name":"gitlabhq","email":"m@gitlabhq.com"},"committer":{"name":"gitlabhq","email":"m@gitlabhq.com"},"authored_date":"2011-11-22T06:03:27-08:00","committed_date":"2011-11-22T06:03:27-08:00"}},{"name":"v1.2.0","commit":{"id":"b56024100d40457a998f83adae3cdc830c997cda","parents":[{"id":"4451b8df8ad6d4b6d79fbce77687c6c2fd37d0a9"}],"tree":"f402cbb6d54526a32b30968c98410bae97b27c8d","message":"lil style fixes","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-11-22T09:57:25-08:00","committed_date":"2011-11-22T09:57:25-08:00"}},{"name":"v1.1.0pre","commit":{"id":"6b030fd41d697e327d2935b406cba70b6a460504","parents":[{"id":"3a2b273316fb29d63b489906f85d9b5329377258"}],"tree":"63b1fdb2a0f135f7074f6a94da14543b8450dd71","message":"1.1pre1","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-10-21T10:04:41-07:00","committed_date":"2011-10-21T10:04:41-07:00"}},{"name":"v1.1.0","commit":{"id":"ba8048d71019b5aaa1f92ee5c3415bfddaa9babb","parents":[{"id":"6b030fd41d697e327d2935b406cba70b6a460504"}],"tree":"4db2b5f4f9b374dd1be3579459bc5947c225c9ba","message":"v1.1.0","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-10-22T06:07:26-07:00","committed_date":"2011-10-22T06:07:26-07:00"}},{"name":"v1.0.2","commit":{"id":"3a2b273316fb29d63b489906f85d9b5329377258","parents":[{"id":"757ea634665e475bf69c1ec962040a0511ee8aeb"},{"id":"c374eb80ff9fb71d37faffc15714bf98b632d3e5"}],"tree":"e0d8170e61a9468a7bb5d4e63305171ec1efa6bf","message":"Merge pull request #40 from vslinko/patch-1\n\nIncrease max key length. Some keys has comment after key string.","author":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dmitriy.zaporozhets@gmail.com"},"authored_date":"2011-10-18T23:30:06-07:00","committed_date":"2011-10-18T23:30:06-07:00"}},{"name":"v1.0.1","commit":{"id":"7b5799a97998b68416f1b6233ce427135c99165a","parents":[{"id":"0541b3f3c5dcd291d144c83d9731c75ee811b4e0"},{"id":"7b67480c76db8b9a9ccdc80015cc500dc6d26892"}],"tree":"e052185e9dd72a1b1a04d59a5f9efbf3c0369601","message":"Merge branch '1x' of github.com:gitlabhq/gitlabhq into 1x","author":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"committer":{"name":"Dmitriy Zaporozhets","email":"dzaporozhets@sphereconsultinginc.com"},"authored_date":"2011-10-14T15:16:44-07:00","committed_date":"2011-10-14T15:16:44-07:00"}}]gitlab-4.8.0/spec/fixtures/project_templates.json000066400000000000000000000016251341107427500222170ustar00rootroot00000000000000[ { "key": "epl-1.0", "name": "Eclipse Public License 1.0" }, { "key": "lgpl-3.0", "name": "GNU Lesser General Public License v3.0" }, { "key": "unlicense", "name": "The Unlicense" }, { "key": "agpl-3.0", "name": "GNU Affero General Public License v3.0" }, { "key": "gpl-3.0", "name": "GNU General Public License v3.0" }, { "key": "bsd-3-clause", "name": "BSD 3-clause \"New\" or \"Revised\" License" }, { "key": "lgpl-2.1", "name": "GNU Lesser General Public License v2.1" }, { "key": "mit", "name": "MIT License" }, { "key": "apache-2.0", "name": "Apache License 2.0" }, { "key": "bsd-2-clause", "name": "BSD 2-clause \"Simplified\" License" }, { "key": "mpl-2.0", "name": "Mozilla Public License 2.0" }, { "key": "gpl-2.0", "name": "GNU General Public License v2.0" } ] gitlab-4.8.0/spec/fixtures/project_unstar.json000066400000000000000000000023531341107427500215340ustar00rootroot00000000000000{ "id": 3, "description": null, "default_branch": "master", "public": false, "visibility_level": 10, "ssh_url_to_repo":"git@git.gitlab.com:root/gitlab.git", "http_url_to_repo":"http://git.gitlab.com/root/gitlab.git", "web_url":"http://git.gitlab.com/root/gitlab", "tag_list": [ ], "name": "GitLab Community Edition", "name_with_namespace": "GitLab / GitLab Community Edition", "path": "gitlab-ce", "path_with_namespace": "gitlab/gitlab-ce", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "builds_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "created_at": "2013-09-30T13:46:02Z", "description": "", "id": 3, "name": "GitLab", "owner_id": 1, "path": "gitlab", "updated_at": "2013-09-30T13:46:02Z" }, "archived": true, "avatar_url": "http://example.com/uploads/project/avatar/3/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "public_builds": true, "shared_with_groups": [], "only_allow_merge_if_build_succeeds": false } gitlab-4.8.0/spec/fixtures/project_update_commit_status.json000066400000000000000000000010301341107427500244440ustar00rootroot00000000000000{ "id": 498, "sha": "7d938cb8ac15788d71f4b67c035515a160ea76d8", "ref": "decreased-spec", "status": "failed", "name": "test", "target_url": null, "description": null, "created_at": "2015-10-23T23:56:49.499+02:00", "started_at": null, "finished_at": "2015-10-23T23:56:49.534+02:00", "author": { "name": "Dominik Sander", "username": "dsander", "id": 1, "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/xxx?s=40&d=identicon", "web_url": "https://github.com/u/dsander" } }gitlab-4.8.0/spec/fixtures/projects.json000066400000000000000000000020551341107427500203220ustar00rootroot00000000000000[{"id":1,"code":"brute","name":"Brute","description":null,"path":"brute","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:56Z"},{"id":2,"code":"mozart","name":"Mozart","description":null,"path":"mozart","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:57Z"},{"id":3,"code":"gitlab","name":"Gitlab","description":null,"path":"gitlab","default_branch":null,"owner":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"private":true,"issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":true,"wiki_enabled":true,"created_at":"2012-09-17T09:41:58Z"}]gitlab-4.8.0/spec/fixtures/protected_branch.json000066400000000000000000000004021341107427500217710ustar00rootroot00000000000000{ "name": "master", "push_access_levels": [ { "access_level": 40, "access_level_description": "Maintainers" } ], "merge_access_levels": [ { "access_level": 40, "access_level_description": "Maintainers" } ] } gitlab-4.8.0/spec/fixtures/protected_branches.json000066400000000000000000000004441341107427500223270ustar00rootroot00000000000000[ { "name": "master", "push_access_levels": [ { "access_level": 40, "access_level_description": "Maintainers" } ], "merge_access_levels": [ { "access_level": 40, "access_level_description": "Maintainers" } ] } ] gitlab-4.8.0/spec/fixtures/protected_tag.json000066400000000000000000000002231341107427500213100ustar00rootroot00000000000000{ "name": "release-1-0", "create_access_levels": [ { "access_level": 40, "access_level_description": "Maintainers" } ] } gitlab-4.8.0/spec/fixtures/protected_tags.json000066400000000000000000000002511341107427500214740ustar00rootroot00000000000000[ { "name": "release-1-0", "create_access_levels": [ { "access_level": 40, "access_level_description": "Maintainers" } ] } ] gitlab-4.8.0/spec/fixtures/push_rule.json000066400000000000000000000002201341107427500204670ustar00rootroot00000000000000{"id": 1, "project_id": 1, "created_at": "2016-05-25T20:27:15.545Z", "commit_message_regex": "\\b[A-Z]{3}-[0-9]+\\b", "deny_delete_tag": false} gitlab-4.8.0/spec/fixtures/raw_file.json000066400000000000000000000000631341107427500202560ustar00rootroot00000000000000source 'https://rubygems.org' gem 'rails', '4.1.2' gitlab-4.8.0/spec/fixtures/release_create.json000066400000000000000000000000721341107427500214310ustar00rootroot00000000000000{"tag_name":"0.0.1","description":"Amazing release. Wow"} gitlab-4.8.0/spec/fixtures/release_update.json000066400000000000000000000000721341107427500214500ustar00rootroot00000000000000{"tag_name":"0.0.1","description":"Amazing release. Wow"} gitlab-4.8.0/spec/fixtures/repository_file.json000066400000000000000000000001731341107427500217060ustar00rootroot00000000000000{"file_path":"path","branch_name":"branch","encoding":"base64","content":"Y29udGVudA==","commit_message":"commit message"} gitlab-4.8.0/spec/fixtures/repository_submodule.json000066400000000000000000000013321341107427500227640ustar00rootroot00000000000000{ "id": "ed899a2f4b50b4370feeea94676502b42383c746", "short_id": "ed899a2f4b5", "title": "Updated submodule example_submodule with oid 3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88", "author_name": "Dmitriy Zaporozhets", "author_email": "dzaporozhets@sphereconsultinginc.com", "committer_name": "Dmitriy Zaporozhets", "committer_email": "dzaporozhets@sphereconsultinginc.com", "created_at": "2018-09-20T09:26:24.000-07:00", "message": "Updated submodule example_submodule with oid 3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88", "parent_ids": [ "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" ], "committed_date": "2018-09-20T09:26:24.000-07:00", "authored_date": "2018-09-20T09:26:24.000-07:00", "status": null } gitlab-4.8.0/spec/fixtures/run_trigger.json000066400000000000000000000000401341107427500210100ustar00rootroot00000000000000{"id":8,"variables":{"a":"10"}} gitlab-4.8.0/spec/fixtures/runner.json000066400000000000000000000012001341107427500177710ustar00rootroot00000000000000{ "active": true, "architecture": null, "description": "test-1-20150125", "id": 6, "is_shared": false, "contacted_at": "2016-01-25T16:39:48.066Z", "name": null, "platform": null, "projects": [ { "id": 1, "name": "GitLab Community Edition", "name_with_namespace": "GitLab.org / GitLab Community Edition", "path": "gitlab-ce", "path_with_namespace": "gitlab-org/gitlab-ce" } ], "token": "205086a8e3b9a2b818ffac9b89d102", "revision": null, "tag_list": [ "ruby", "mysql" ], "version": null } gitlab-4.8.0/spec/fixtures/runner_delete.json000066400000000000000000000001711341107427500213210ustar00rootroot00000000000000{ "active": true, "description": "test-1-20150125-test", "id": 6, "is_shared": false, "name": null } gitlab-4.8.0/spec/fixtures/runner_edit.json000066400000000000000000000011671341107427500210120ustar00rootroot00000000000000{ "active": true, "architecture": null, "description": "abcefg", "id": 6, "is_shared": false, "contacted_at": "2016-01-25T16:39:48.066Z", "name": null, "platform": null, "projects": [ { "id": 1, "name": "GitLab Community Edition", "name_with_namespace": "GitLab.org / GitLab Community Edition", "path": "gitlab-ce", "path_with_namespace": "gitlab-org/gitlab-ce" } ], "token": "205086a8e3b9a2b818ffac9b89d102", "revision": null, "tag_list": [ "ruby", "mysql" ], "version": null } gitlab-4.8.0/spec/fixtures/runner_jobs.json000066400000000000000000000041531341107427500210200ustar00rootroot00000000000000[ { "id": 2, "status": "running", "stage": "test", "name": "test", "ref": "master", "tag": false, "coverage": null, "created_at": "2017-11-16T08:50:29.000Z", "started_at": "2017-11-16T08:51:29.000Z", "finished_at": "2017-11-16T08:53:29.000Z", "duration": 120, "user": { "id": 1, "name": "John Doe2", "username": "user2", "state": "active", "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon", "web_url": "http://localhost/user2", "created_at": "2017-11-16T18:38:46.000Z", "bio": null, "location": null, "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": null }, "commit": { "id": "97de212e80737a608d939f648d959671fb0a0142", "short_id": "97de212e", "title": "Update configuration\r", "created_at": "2017-11-16T08:50:28.000Z", "parent_ids": [ "1b12f15a11fc6e62177bef08f47bc7b5ce50b141", "498214de67004b1da3d820901307bed2a68a8ef6" ], "message": "See merge request !123", "author_name": "John Doe2", "author_email": "user2@example.org", "authored_date": "2017-11-16T08:50:27.000Z", "committer_name": "John Doe2", "committer_email": "user2@example.org", "committed_date": "2017-11-16T08:50:27.000Z" }, "pipeline": { "id": 2, "sha": "97de212e80737a608d939f648d959671fb0a0142", "ref": "master", "status": "running" }, "project": { "id": 1, "description": null, "name": "project1", "name_with_namespace": "John Doe2 / project1", "path": "project1", "path_with_namespace": "namespace1/project1", "created_at": "2017-11-16T18:38:46.620Z" } } ] gitlab-4.8.0/spec/fixtures/runners.json000066400000000000000000000004451341107427500201660ustar00rootroot00000000000000[ { "active": true, "description": "test-1-20150125", "id": 6, "is_shared": false, "name": null }, { "active": true, "description": "test-2-20150125", "id": 8, "is_shared": false, "name": null } ] gitlab-4.8.0/spec/fixtures/runners_all.json000066400000000000000000000011051341107427500210100ustar00rootroot00000000000000[ { "active": true, "description": "shared-runner-1", "id": 1, "is_shared": true, "name": null }, { "active": true, "description": "shared-runner-2", "id": 3, "is_shared": true, "name": null }, { "active": true, "description": "test-1-20150125", "id": 6, "is_shared": false, "name": null }, { "active": true, "description": "test-2-20150125", "id": 8, "is_shared": false, "name": null } ] gitlab-4.8.0/spec/fixtures/service.json000066400000000000000000000007441341107427500201340ustar00rootroot00000000000000{"id":38,"title":"Redmine","created_at":"2015-12-18T14:17:17.592+03:00","updated_at":"2015-12-18T17:55:09.594+03:00","active":true,"push_events":true,"issues_events":true,"merge_requests_events":true,"tag_push_events":true,"note_events":true,"build_events":false,"properties":{"description":"Redmine","project_url":"https://example.com/projects/test_project/issue","issues_url":"https://example.com/issues/:id","new_issue_url":"'https://example.com/projects/test_project/issues/new"}}gitlab-4.8.0/spec/fixtures/session.json000066400000000000000000000002221341107427500201460ustar00rootroot00000000000000{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","private_token":"qEsq1pt6HJPaNciie3MG"}gitlab-4.8.0/spec/fixtures/shell_history.json000066400000000000000000000000531341107427500213550ustar00rootroot00000000000000party on, dudes be excellent to each other gitlab-4.8.0/spec/fixtures/sidekiq_compound_metrics.json000066400000000000000000000011731341107427500235540ustar00rootroot00000000000000{ "queues": { "default": { "backlog": 0, "latency": 0 } }, "processes": [ { "hostname": "gitlab.example.com", "pid": 5649, "tag": "gitlab", "started_at": "2016-06-14T10:45:07.159-05:00", "queues": [ "post_receive", "mailers", "archive_repo", "system_hook", "project_web_hook", "gitlab_shell", "incoming_email", "runner", "common", "default" ], "labels": [], "concurrency": 25, "busy": 0 } ], "jobs": { "processed": 2, "failed": 0, "enqueued": 0 } } gitlab-4.8.0/spec/fixtures/sidekiq_job_stats.json000066400000000000000000000001131341107427500221630ustar00rootroot00000000000000{ "jobs": { "processed": 2, "failed": 0, "enqueued": 0 } } gitlab-4.8.0/spec/fixtures/sidekiq_process_metrics.json000066400000000000000000000007421341107427500234070ustar00rootroot00000000000000{ "processes": [ { "hostname": "gitlab.example.com", "pid": 5649, "tag": "gitlab", "started_at": "2016-06-14T10:45:07.159-05:00", "queues": [ "post_receive", "mailers", "archive_repo", "system_hook", "project_web_hook", "gitlab_shell", "incoming_email", "runner", "common", "default" ], "labels": [], "concurrency": 25, "busy": 0 } ] } gitlab-4.8.0/spec/fixtures/sidekiq_queue_metrics.json000066400000000000000000000001241341107427500230470ustar00rootroot00000000000000{ "queues": { "default": { "backlog": 0, "latency": 0 } } } gitlab-4.8.0/spec/fixtures/snippet.json000066400000000000000000000004531341107427500201530ustar00rootroot00000000000000{"id":1,"title":"Rails Console ActionMailer","file_name":"mailer_test.rb","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"expires_at":"2012-09-24T00:00:00Z","updated_at":"2012-09-17T09:51:42Z","created_at":"2012-09-17T09:51:42Z"}gitlab-4.8.0/spec/fixtures/snippet_award_emoji.json000066400000000000000000000006601341107427500225140ustar00rootroot00000000000000{ "id": 4, "name": "blowfish", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "created_at": "2016-06-15T10:09:34.206Z", "updated_at": "2016-06-15T10:09:34.206Z", "awardable_id": 80, "awardable_type": "Snippet" }gitlab-4.8.0/spec/fixtures/snippet_award_emojis.json000066400000000000000000000016401341107427500226760ustar00rootroot00000000000000[ { "id": 4, "name": "1234", "user": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "http://gitlab.example.com/root" }, "created_at": "2016-06-15T10:09:34.206Z", "updated_at": "2016-06-15T10:09:34.206Z", "awardable_id": 80, "awardable_type": "Snippet" }, { "id": 1, "name": "microphone", "user": { "name": "User 4", "username": "user4", "id": 26, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7e65550957227bd38fe2d7fbc6fd2f7b?s=80&d=identicon", "web_url": "http://gitlab.example.com/user4" }, "created_at": "2016-06-15T10:09:34.177Z", "updated_at": "2016-06-15T10:09:34.177Z", "awardable_id": 80, "awardable_type": "Snippet" } ]gitlab-4.8.0/spec/fixtures/snippet_content.json000066400000000000000000000000521341107427500217000ustar00rootroot00000000000000#!/usr/bin/env ruby puts "Cool snippet!" gitlab-4.8.0/spec/fixtures/snippets.json000066400000000000000000000004561341107427500203410ustar00rootroot00000000000000[{"id":1,"title":"Rails Console ActionMailer","file_name":"mailer_test.rb","author":{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z"},"expires_at":"2012-09-24T00:00:00Z","updated_at":"2012-09-17T09:51:42Z","created_at":"2012-09-17T09:51:42Z"}] gitlab-4.8.0/spec/fixtures/system_hook.json000066400000000000000000000001221341107427500210260ustar00rootroot00000000000000{"id": 3, "url": "http://example.com/hook", "created_at": "2013-10-02T10:15:31Z"} gitlab-4.8.0/spec/fixtures/system_hooks.json000066400000000000000000000001241341107427500212130ustar00rootroot00000000000000[{"id": 3, "url": "http://example.com/hook", "created_at": "2013-10-02T10:15:31Z"}] gitlab-4.8.0/spec/fixtures/tag.json000066400000000000000000000006421341107427500172440ustar00rootroot00000000000000{"name":"0.0.1","message":null,"commit":{"id":"c260c39f4d73d9087482d29b4d7a88bec834a3d1","message":"rubocop 100%","parent_ids":["b55be4dc5c052fb0058ef1ea96acd5e4e37f1bed"],"authored_date":"2016-04-29T16:11:32.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-04-29T16:11:32.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null} gitlab-4.8.0/spec/fixtures/tag_create.json000066400000000000000000000007111341107427500205640ustar00rootroot00000000000000{"name":"0.0.1","message":"this tag is annotated","commit":{"id":"3d3f9288d70f75aa55ea495a3ed5948a628fce11","message":"Added README.md\n","parent_ids":[],"authored_date":"2016-05-25T11:23:07.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-05-25T11:23:07.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":{"tag_name":"0.0.1","description":"and it has release notes"}} gitlab-4.8.0/spec/fixtures/tag_create_with_description.json000066400000000000000000000006671341107427500242340ustar00rootroot00000000000000{"name":"0.0.1","message":"this tag is annotated","commit":{"id":"7225ddbe28add8d168e3175266830ab8e6aabdcc","message":"Readme updated","parent_ids":["c3f101968138aa9b09a92c8b6399b3269d17865e"],"authored_date":"2016-03-07T13:38:07.000+00:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-03-07T13:38:07.000+00:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null} gitlab-4.8.0/spec/fixtures/tag_delete.json000066400000000000000000000000251341107427500205610ustar00rootroot00000000000000{"tag_name":"0.0.1"} gitlab-4.8.0/spec/fixtures/tags.json000066400000000000000000000015061341107427500174270ustar00rootroot00000000000000[{"name":"0.0.2","message":null,"commit":{"id":"c260c39f4d73d9087482d29b4d7a88bec834a3d1","message":"rubocop 100%","parent_ids":["b55be4dc5c052fb0058ef1ea96acd5e4e37f1bed"],"authored_date":"2016-04-29T16:11:32.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-04-29T16:11:32.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null},{"name":"0.0.1","message":null,"commit":{"id":"c260c39f4d73d9087482d29b4d7a88bec834a3d1","message":"rubocop 100%","parent_ids":["b55be4dc5c052fb0058ef1ea96acd5e4e37f1bed"],"authored_date":"2016-04-29T16:11:32.000+01:00","author_name":"Bob Bloggs","author_email":"bob.bloggs@nowhere","committed_date":"2016-04-29T16:11:32.000+01:00","committer_name":"Bob Bloggs","committer_email":"bob.bloggs@nowhere"},"release":null}] gitlab-4.8.0/spec/fixtures/team_member.json000066400000000000000000000004461341107427500207500ustar00rootroot00000000000000{ "id": 1, "username": "john_smith", "name": "John Smith", "state": "active", "avatar_url": "https://www.gravatar.com/avatar/c2525a7f58ae3776070e44c106c48e15?s=80&d=identicon", "web_url": "http://192.168.1.8:3000/root", "expires_at": "2018-12-31T00:00:00Z", "access_level": 40 }gitlab-4.8.0/spec/fixtures/team_members.json000066400000000000000000000014341341107427500211310ustar00rootroot00000000000000[{"id":1,"email":"john@example.com","name":"John Smith","blocked":false,"created_at":"2012-09-17T09:41:56Z","access_level":40},{"id":2,"email":"jack@example.com","name":"Jack Smith","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":20},{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":40},{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":40},{"id":6,"email":"faye.watsica@rohanwalter.com","name":"Ambrose Hansen","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":40},{"id":7,"email":"maida@walshtorp.name","name":"Alana Hahn","blocked":false,"created_at":"2012-09-17T09:42:03Z","access_level":20}]gitlab-4.8.0/spec/fixtures/todo.json000066400000000000000000000050531341107427500174370ustar00rootroot00000000000000{ "id": 102, "project": { "id": 2, "name": "Gitlab Ce", "name_with_namespace": "Gitlab Org / Gitlab Ce", "path": "gitlab-ce", "path_with_namespace": "gitlab-org/gitlab-ce" }, "author": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "action_name": "marked", "target_type": "MergeRequest", "target": { "id": 34, "iid": 7, "project_id": 2, "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.", "state": "opened", "created_at": "2016-06-17T07:49:24.419Z", "updated_at": "2016-06-17T07:52:43.484Z", "target_branch": "tutorials_git_tricks", "source_branch": "DNSBL_docs", "upvotes": 0, "downvotes": 0, "author": { "name": "Maxie Medhurst", "username": "craig_rutherford", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", "web_url": "https://gitlab.example.com/craig_rutherford" }, "assignee": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "source_project_id": 2, "target_project_id": 2, "labels": [], "work_in_progress": false, "milestone": { "id": 32, "iid": 2, "project_id": 2, "title": "v1.0", "description": "Assumenda placeat ea voluptatem voluptate qui.", "state": "active", "created_at": "2016-06-17T07:47:34.163Z", "updated_at": "2016-06-17T07:47:34.163Z", "due_date": null }, "merge_when_pipeline_succeeds": false, "merge_status": "cannot_be_merged", "subscribed": true, "user_notes_count": 7 }, "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7", "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", "state": "done", "created_at": "2016-06-17T07:52:35.225Z" }gitlab-4.8.0/spec/fixtures/todos.json000066400000000000000000000122051341107427500176170ustar00rootroot00000000000000[ { "id": 102, "project": { "id": 2, "name": "Gitlab Ce", "name_with_namespace": "Gitlab Org / Gitlab Ce", "path": "gitlab-ce", "path_with_namespace": "gitlab-org/gitlab-ce" }, "author": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "action_name": "marked", "target_type": "MergeRequest", "target": { "id": 34, "iid": 7, "project_id": 2, "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.", "state": "opened", "created_at": "2016-06-17T07:49:24.419Z", "updated_at": "2016-06-17T07:52:43.484Z", "target_branch": "tutorials_git_tricks", "source_branch": "DNSBL_docs", "upvotes": 0, "downvotes": 0, "author": { "name": "Maxie Medhurst", "username": "craig_rutherford", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", "web_url": "https://gitlab.example.com/craig_rutherford" }, "assignee": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "source_project_id": 2, "target_project_id": 2, "labels": [], "work_in_progress": false, "milestone": { "id": 32, "iid": 2, "project_id": 2, "title": "v1.0", "description": "Assumenda placeat ea voluptatem voluptate qui.", "state": "active", "created_at": "2016-06-17T07:47:34.163Z", "updated_at": "2016-06-17T07:47:34.163Z", "due_date": null }, "merge_when_pipeline_succeeds": false, "merge_status": "cannot_be_merged", "subscribed": true, "user_notes_count": 7 }, "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7", "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", "state": "pending", "created_at": "2016-06-17T07:52:35.225Z" }, { "id": 98, "project": { "id": 2, "name": "Gitlab Ce", "name_with_namespace": "Gitlab Org / Gitlab Ce", "path": "gitlab-ce", "path_with_namespace": "gitlab-org/gitlab-ce" }, "author": { "name": "Maxie Medhurst", "username": "craig_rutherford", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", "web_url": "https://gitlab.example.com/craig_rutherford" }, "action_name": "assigned", "target_type": "MergeRequest", "target": { "id": 34, "iid": 7, "project_id": 2, "title": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", "description": "Et ea et omnis illum cupiditate. Dolor aspernatur tenetur ducimus facilis est nihil. Quo esse cupiditate molestiae illo corrupti qui quidem dolor.", "state": "opened", "created_at": "2016-06-17T07:49:24.419Z", "updated_at": "2016-06-17T07:52:43.484Z", "target_branch": "tutorials_git_tricks", "source_branch": "DNSBL_docs", "upvotes": 0, "downvotes": 0, "author": { "name": "Maxie Medhurst", "username": "craig_rutherford", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", "web_url": "https://gitlab.example.com/craig_rutherford" }, "assignee": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "source_project_id": 2, "target_project_id": 2, "labels": [], "work_in_progress": false, "milestone": { "id": 32, "iid": 2, "project_id": 2, "title": "v1.0", "description": "Assumenda placeat ea voluptatem voluptate qui.", "state": "active", "created_at": "2016-06-17T07:47:34.163Z", "updated_at": "2016-06-17T07:47:34.163Z", "due_date": null }, "merge_when_pipeline_succeeds": false, "merge_status": "cannot_be_merged", "subscribed": true, "user_notes_count": 7 }, "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ce/merge_requests/7", "body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.", "state": "pending", "created_at": "2016-06-17T07:49:24.624Z" } ]gitlab-4.8.0/spec/fixtures/transfer_project.json000066400000000000000000000035071341107427500220460ustar00rootroot00000000000000{ "id": 1, "description": null, "name": "test", "name_with_namespace": "Yolo / test", "path": "test", "path_with_namespace": "yolo/test", "created_at": "2018-10-26T21:14:12.851Z", "default_branch": "master", "tag_list": [], "ssh_url_to_repo": "git@gitlab.com:yolo/test.git", "http_url_to_repo": "https://gitlab.com/yolo/test.git", "web_url": "https://gitlab.com/yolo/test", "readme_url": null, "avatar_url": null, "star_count": 0, "forks_count": 0, "last_activity_at": "2018-10-26T21:14:12.851Z", "namespace": { "id": 2, "name": "Yolo", "path": "yolo", "kind": "group", "full_path": "yolo", "parent_id": null }, "_links": { "self": "https://gitlab.com/api/v4/projects/1", "issues": "https://gitlab.com/api/v4/projects/1/issues", "merge_requests": "https://gitlab.com/api/v4/projects/1/merge_requests", "repo_branches": "https://gitlab.com/api/v4/projects/1/repository/branches", "labels": "https://gitlab.com/api/v4/projects/1/labels", "events": "https://gitlab.com/api/v4/projects/1/events", "members": "https://gitlab.com/api/v4/projects/1/members" }, "archived": false, "visibility": "private", "resolve_outdated_diff_discussions": false, "container_registry_enabled": true, "issues_enabled": true, "merge_requests_enabled": true, "wiki_enabled": true, "jobs_enabled": true, "snippets_enabled": true, "shared_runners_enabled": true, "lfs_enabled": true, "creator_id": 42, "import_status": "none", "open_issues_count": 0, "public_jobs": true, "ci_config_path": null, "shared_with_groups": [], "only_allow_merge_if_pipeline_succeeds": false, "request_access_enabled": false, "only_allow_merge_if_all_discussions_are_resolved": false, "printing_merge_request_link_enabled": true, "merge_method": "merge", "mirror": false } gitlab-4.8.0/spec/fixtures/tree.json000066400000000000000000000034501341107427500174300ustar00rootroot00000000000000[{"id":"a2cc3b0ffc1c7d06fab5642eb99ea387b57f22f8","name":"app","type":"tree","mode":"040000"},{"id":"63164bdfbc11b69f1032fbe35da0f1e9c18af2fd","name":"bin","type":"tree","mode":"040000"},{"id":"2cf682191722f20f00a371d7da58f6a35701c11d","name":"config","type":"tree","mode":"040000"},{"id":"2e76c8c1bbc46bcc762788a432d802d65a534a28","name":"db","type":"tree","mode":"040000"},{"id":"767cfc8360b50c50bb5bdde288b96a84e3efa66e","name":"doc","type":"tree","mode":"040000"},{"id":"3fa0d1024f5e372bf9e43d1dac47bd1e95ab0858","name":"lib","type":"tree","mode":"040000"},{"id":"4e79d0ac6225844602a1b9273b26d8996f777bf2","name":"log","type":"tree","mode":"040000"},{"id":"7cb7f593c6914d20fa6cc4ab5a7c34337a50e97c","name":"public","type":"tree","mode":"040000"},{"id":"d97169eef778f3cd1d4d94cbe3415b3166d15c71","name":"spec","type":"tree","mode":"040000"},{"id":"97c97da29fa97e2158cfdcdcb042af9da0bc3de4","name":"vendor","type":"tree","mode":"040000"},{"id":"d316760e4746059c117007507594a1d75b47df38","name":".gitignore","type":"blob","mode":"100644"},{"id":"f2e7cd477536f18d8e939faf452930b59a27063d","name":".travis.yml","type":"blob","mode":"100644"},{"id":"d5c68bda5f0fe703a80906f66cfe537ca807a5a6","name":"Capfile","type":"blob","mode":"100644"},{"id":"8f46eac03c6cd7ce03cda7ec3d78afdc6971e4c0","name":"Gemfile","type":"blob","mode":"100644"},{"id":"5e260573173b51eaa073661d7914fb0e935ee27f","name":"Gemfile.lock","type":"blob","mode":"100644"},{"id":"e57032f682b69f14243c09d66a0892a03b4c6045","name":"Procfile","type":"blob","mode":"100644"},{"id":"905e96da839dad683dfcf4e202bf1e030390b964","name":"README.md","type":"blob","mode":"100644"},{"id":"24a16769fd94926350a59f7b1cbd78e9e2674c57","name":"Rakefile","type":"blob","mode":"100644"},{"id":"b384d6d57c6a775a9b6bc35d79ad7f03e673a233","name":"config.ru","type":"blob","mode":"100644"}] gitlab-4.8.0/spec/fixtures/trigger.json000066400000000000000000000003771341107427500201410ustar00rootroot00000000000000{ "id": 10, "description": "my trigger", "created_at": "2016-01-07T09:53:58.235Z", "deleted_at": null, "last_used": null, "token": "6d056f63e50fe6f8c5f8f4aa10edb7", "updated_at": "2016-01-07T09:53:58.235Z", "owner": null } gitlab-4.8.0/spec/fixtures/triggers.json000066400000000000000000000004531341107427500203170ustar00rootroot00000000000000[ { "id": 10, "description": "my trigger", "created_at": "2016-01-07T09:53:58.235Z", "deleted_at": null, "last_used": null, "token": "6d056f63e50fe6f8c5f8f4aa10edb7", "updated_at": "2016-01-07T09:53:58.235Z", "owner": null } ] gitlab-4.8.0/spec/fixtures/upload_file.json000066400000000000000000000002271341107427500207530ustar00rootroot00000000000000{ "alt": "null", "url": "/uploads/f22e67e35e1bcb339058212c54bb8772/null", "markdown": "[null](/uploads/f22e67e35e1bcb339058212c54bb8772/null)" } gitlab-4.8.0/spec/fixtures/user.json000066400000000000000000000003311341107427500174420ustar00rootroot00000000000000{"id":1,"email":"john@example.com","name":"John Smith","username":"john.smith","bio":null,"skype":"","linkedin":"","twitter":"john","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:41:56Z"}gitlab-4.8.0/spec/fixtures/user_block_unblock.json000066400000000000000000000000041341107427500223260ustar00rootroot00000000000000truegitlab-4.8.0/spec/fixtures/user_contribution_events.json000066400000000000000000000053171341107427500236360ustar00rootroot00000000000000[ { "title": null, "project_id": 15, "action_name": "closed", "target_id": 830, "target_type": "Issue", "author_id": 1, "target_title": "Public project search field", "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "author_username": "root" }, { "title": null, "project_id": 15, "action_name": "pushed", "target_id": null, "target_type": null, "author_id": 1, "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "author_username": "john", "push_data": { "commit_count": 1, "action": "pushed", "ref_type": "branch", "commit_from": "50d4420237a9de7be1304607147aec22e4a14af7", "commit_to": "c5feabde2d8cd023215af4d2ceeb7a64839fc428", "ref": "master", "commit_title": "Add simple search to projects in public area" }, "target_title": null }, { "title": null, "project_id": 15, "action_name": "closed", "target_id": 840, "target_type": "Issue", "author_id": 1, "target_title": "Finish & merge Code search PR", "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "author_username": "root" }, { "title": null, "project_id": 15, "action_name": "commented on", "target_id": 1312, "target_type": "Note", "author_id": 1, "target_title": null, "created_at": "2015-12-04T10:33:58.089Z", "note": { "id": 1312, "body": "What an awesome day!", "attachment": null, "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "created_at": "2015-12-04T10:33:56.698Z", "system": false, "noteable_id": 377, "noteable_type": "Issue" }, "author": { "name": "Dmitriy Zaporozhets", "username": "root", "id": 1, "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png", "web_url": "http://localhost:3000/root" }, "author_username": "root" } ] gitlab-4.8.0/spec/fixtures/user_email.json000066400000000000000000000000441341107427500206120ustar00rootroot00000000000000{"id":1,"email":"email@example.com"}gitlab-4.8.0/spec/fixtures/user_emails.json000066400000000000000000000001141341107427500207730ustar00rootroot00000000000000[{"id":1,"email":"email@example.com"},{"id":3,"email":"email2@example.com"}]gitlab-4.8.0/spec/fixtures/user_events.json000066400000000000000000000021671341107427500210370ustar00rootroot00000000000000[ { "title":null, "project_id":1, "action_name":"opened", "target_id":160, "target_type":"Issue", "author_id":25, "target_title":"Qui natus eos odio tempore et quaerat consequuntur ducimus cupiditate quis.", "created_at":"2017-02-09T10:43:19.667Z", "author":{ "name":"User 3", "username":"user3", "id":25, "state":"active", "avatar_url":"http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80\u0026d=identicon", "web_url":"https://gitlab.example.com/user3" }, "author_username":"user3" }, { "title":null, "project_id":1, "action_name":"opened", "target_id":159, "target_type":"Issue", "author_id":21, "target_title":"Nostrum enim non et sed optio illo deleniti non.", "created_at":"2017-02-09T10:43:19.426Z", "author":{ "name":"Test User", "username":"ted", "id":21, "state":"active", "avatar_url":"http://www.gravatar.com/avatar/80fb888c9a48b9a3f87477214acaa63f?s=80\u0026d=identicon", "web_url":"https://gitlab.example.com/ted" }, "author_username":"ted" } ] gitlab-4.8.0/spec/fixtures/user_projects.json000066400000000000000000000125551341107427500213660ustar00rootroot00000000000000[ { "id": 1, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:diaspora/diaspora-client.git", "http_url_to_repo": "http://example.com/diaspora/diaspora-client.git", "web_url": "http://example.com/diaspora/diaspora-client", "tag_list": [ "example", "disapora client" ], "owner": { "id": 1, "name": "Diaspora", "created_at": "2013-09-30T13:46:02Z" }, "name": "Diaspora Client", "name_with_namespace": "Diaspora / Diaspora Client", "path": "diaspora-client", "path_with_namespace": "diaspora/diaspora-client", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 3, "name": "Diaspora", "path": "diaspora", "kind": "group", "full_path": "diaspora" }, "import_status": "none", "archived": false, "avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png", "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "public_jobs": true, "shared_with_groups": [ ], "only_allow_merge_if_pipeline_succeeds": false, "only_allow_merge_if_all_discussions_are_resolved": false, "request_access_enabled": false, "statistics": { "commit_count": 37, "storage_size": 1038090, "repository_size": 1038090, "lfs_objects_size": 0, "job_artifacts_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } }, { "id": 6, "description": null, "default_branch": "master", "visibility": "private", "ssh_url_to_repo": "git@example.com:brightbox/puppet.git", "http_url_to_repo": "http://example.com/brightbox/puppet.git", "web_url": "http://example.com/brightbox/puppet", "tag_list": [ "example", "puppet" ], "owner": { "id": 1, "name": "Brightbox", "created_at": "2013-09-30T13:46:02Z" }, "name": "Puppet", "name_with_namespace": "Brightbox / Puppet", "path": "puppet", "path_with_namespace": "brightbox/puppet", "issues_enabled": true, "open_issues_count": 1, "merge_requests_enabled": true, "jobs_enabled": true, "wiki_enabled": true, "snippets_enabled": false, "resolve_outdated_diff_discussions": false, "container_registry_enabled": false, "created_at": "2013-09-30T13:46:02Z", "last_activity_at": "2013-09-30T13:46:02Z", "creator_id": 3, "namespace": { "id": 4, "name": "Brightbox", "path": "brightbox", "kind": "group", "full_path": "brightbox" }, "import_status": "none", "import_error": null, "permissions": { "project_access": { "access_level": 10, "notification_level": 3 }, "group_access": { "access_level": 50, "notification_level": 3 } }, "archived": false, "avatar_url": null, "shared_runners_enabled": true, "forks_count": 0, "star_count": 0, "runners_token": "b8547b1dc37721d05889db52fa2f02", "public_jobs": true, "shared_with_groups": [ ], "only_allow_merge_if_pipeline_succeeds": false, "only_allow_merge_if_all_discussions_are_resolved": false, "request_access_enabled": false, "statistics": { "commit_count": 12, "storage_size": 2066080, "repository_size": 2066080, "lfs_objects_size": 0, "job_artifacts_size": 0 }, "_links": { "self": "http://example.com/api/v4/projects", "issues": "http://example.com/api/v4/projects/1/issues", "merge_requests": "http://example.com/api/v4/projects/1/merge_requests", "repo_branches": "http://example.com/api/v4/projects/1/repository_branches", "labels": "http://example.com/api/v4/projects/1/labels", "events": "http://example.com/api/v4/projects/1/events", "members": "http://example.com/api/v4/projects/1/members" } } ] gitlab-4.8.0/spec/fixtures/user_search.json000066400000000000000000000006771341107427500210040ustar00rootroot00000000000000[{"id":1,"email":"john1@example.com","name":"John Smith 1","username":"john.smith1","bio":null,"skype":"","linkedin":"","twitter":"john1","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:41:56Z"},{"id":2,"email":"john2@example.com","name":"John Smith 2","username":"john.smith2","bio":null,"skype":"","linkedin":"","twitter":"john2","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:56Z"}]gitlab-4.8.0/spec/fixtures/users.json000066400000000000000000000030241341107427500176270ustar00rootroot00000000000000[{"id":1,"email":"john@example.com","name":"John Smith","username":"john.smith","bio":null,"skype":"","linkedin":"","twitter":"john","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:41:56Z"},{"id":2,"email":"jack@example.com","name":"Jack Smith","username":"jack.smith","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":3,"email":"wilma@mayerblanda.ca","name":"Beatrice Jewess","username":"beatrice.jewess","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":4,"email":"nicole@mertz.com","name":"Felipe Davis","username":"felipe.davis","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":5,"email":"aliza_stark@schmeler.info","name":"Michale Von","username":"michale.von","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":6,"email":"faye.watsica@rohanwalter.com","name":"Ambrose Hansen","username":"ambrose.hansen","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"},{"id":7,"email":"maida@walshtorp.name","name":"Alana Hahn","username":"alana.hahn","bio":null,"skype":"","linkedin":"","twitter":"","dark_scheme":false,"theme_id":1,"blocked":false,"created_at":"2012-09-17T09:42:03Z"}]gitlab-4.8.0/spec/fixtures/variable.json000066400000000000000000000000641341107427500202540ustar00rootroot00000000000000{ "key": "VARIABLE", "value": "the value" } gitlab-4.8.0/spec/fixtures/variables.json000066400000000000000000000002251341107427500204360ustar00rootroot00000000000000[ { "key": "TEST_VARIABLE_1", "value": "TEST_1" }, { "key": "TEST_VARIABLE_2", "value": "TEST_2" } ] gitlab-4.8.0/spec/fixtures/version.json000066400000000000000000000000671341107427500201570ustar00rootroot00000000000000{ "version": "8.13.0-pre", "revision": "4e963fe" } gitlab-4.8.0/spec/fixtures/wiki.json000066400000000000000000000001371341107427500174330ustar00rootroot00000000000000{ "content" : "home page", "format" : "markdown", "slug" : "home", "title" : "home" } gitlab-4.8.0/spec/fixtures/wiki_attachment.json000066400000000000000000000004221341107427500216400ustar00rootroot00000000000000{ "file_name" : "dk.png", "file_path" : "uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png", "branch" : "master", "link" : { "url" : "uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png", "markdown" : "![dk](uploads/6a061c4cf9f1c28cb22c384b4b8d4e3c/dk.png)" } } gitlab-4.8.0/spec/fixtures/wikis.json000066400000000000000000000007061341107427500176200ustar00rootroot00000000000000[ { "content" : "Here is an instruction how to deploy this project.", "format" : "markdown", "slug" : "deploy", "title" : "deploy" }, { "content" : "Our development process is described here.", "format" : "markdown", "slug" : "development", "title" : "development" },{ "content" : "* [Deploy](deploy)\n* [Development](development)", "format" : "markdown", "slug" : "home", "title" : "home" } ] gitlab-4.8.0/spec/gitlab/000077500000000000000000000000001341107427500151655ustar00rootroot00000000000000gitlab-4.8.0/spec/gitlab/api_spec.rb000066400000000000000000000005211341107427500172730ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::API do let(:default_headers) { subject.class.default_options[:headers] } describe '.default_options[:headers]' do it "has 'User-Agent'" do expect(default_headers).to include('User-Agent' => Gitlab::Configuration::DEFAULT_USER_AGENT) end end end gitlab-4.8.0/spec/gitlab/cli_helpers_spec.rb000066400000000000000000000033711341107427500210210ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::CLI::Helpers do describe '.method_owners' do let(:methods) { described_class.method_owners } it 'returns Array of Hashes containing method names and owners' do expect(methods).to be_a Array expect(methods.all? { |m| m.is_a? Hash }).to be true expect(methods.all? { |m| m.keys.sort == %i[name owner] }).to be true end end describe '.valid_command?' do it 'returns true when command is valid' do expect(described_class).to be_valid_command('merge_requests') end it 'returns false when command is NOT valid' do expect(described_class).not_to be_valid_command('mmmmmerge_requests') end end describe '.symbolize_keys' do context 'when input is a Hash' do it 'returns a Hash with symbols for keys' do hash = { 'key1' => 'val1', 'key2' => 'val2' } symbolized_hash = described_class.symbolize_keys(hash) expect(symbolized_hash).to eq(key1: 'val1', key2: 'val2') end end context 'when input is NOT a Hash' do it 'returns input untouched' do array = [1, 2, 3] new_array = described_class.symbolize_keys(array) expect(new_array).to eq([1, 2, 3]) end end end describe '.yaml_load' do context 'when argument is a YAML string' do it 'returns Ruby objects' do argument = '{foo: bar, sna: fu}' output = described_class.yaml_load argument expect(output).to eq('foo' => 'bar', 'sna' => 'fu') end end context 'when input is NOT valid YAML' do it 'raises a TypeError' do ruby_array = [1, 2, 3, 4] expect { described_class.yaml_load ruby_array }.to raise_error TypeError end end end end gitlab-4.8.0/spec/gitlab/cli_spec.rb000066400000000000000000000077341341107427500173060ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' require 'json' describe Gitlab::CLI do describe '.run' do context 'when command is version' do it 'shows gem version' do output = capture_output { described_class.run('-v') } expect(output).to eq("Gitlab Ruby Gem #{Gitlab::VERSION}\n") end end context 'when command is info' do it 'shows environment info' do output = capture_output { described_class.run('info') } expect(output).to include('Gitlab endpoint is') expect(output).to include('Gitlab private token is') expect(output).to include('Ruby Version is') expect(output).to include('Gitlab Ruby Gem') end end context 'when command is help' do it 'shows available actions' do output = capture_output { described_class.run('help') } expect(output).to include('Help Topics') expect(output).to include('MergeRequests') end end context 'when command is user' do before do stub_get('/user', 'user') @output = capture_output { described_class.run('user') } end it 'shows executed command' do expect(@output).to include('Gitlab.user') end it 'shows user data' do expect(@output).to include('name') expect(@output).to include('John Smith') end end context 'when command is users' do before do stub_get('/users', 'users') @output = capture_output { described_class.run('users') } end it 'shows executed command' do expect(@output).to include('Gitlab.users') end it 'shows users data' do expect(@output).to include('name') expect(@output).to include('John Smith') expect(@output).to include('Jack Smith') end end context 'when command is create_label' do before do stub_post('/projects/Project/labels', 'label') args = ['Project', 'Backlog', '#DD10AA'] @output = capture_output { described_class.run('create_label', args) } end it 'shows executed command' do expect(@output).to include('Gitlab.create_label Project, Backlog, #DD10AA') end end end describe '.start' do context 'when command with excluded fields' do before do stub_get('/user', 'user') args = ['user', '--except=id,email,name'] @output = capture_output { described_class.start(args) } end it 'shows user data with excluded fields' do expect(@output).not_to include('John Smith') expect(@output).to include('bio') expect(@output).to include('created_at') end end context 'when command with json output' do before do stub_get('/user', 'user') args = ['user', '--json'] @output = capture_output { described_class.start(args) } end it 'renders output as json' do expect(JSON.parse(@output)['result']).to eq(JSON.parse(File.read(File.dirname(__FILE__) + '/../fixtures/user.json'))) expect(JSON.parse(@output)['cmd']).to eq('Gitlab.user') end end context 'when command with required fields' do before do stub_get('/user', 'user') args = ['user', '--only=id,email,name'] @output = capture_output { described_class.start(args) } end it 'shows user data with required fields' do expect(@output).to include('id') expect(@output).to include('name') expect(@output).to include('email') expect(@output).to include('John Smith') expect(@output).not_to include('bio') expect(@output).not_to include('created_at') end end context 'fetch project with namespace/repo' do it 'encodes delimiter' do stub_get('/projects/gitlab-org%2Fgitlab-ce', 'project') args = ['project', 'gitlab-org/gitlab-ce'] @output = capture_output { described_class.start(args) } expect(@output).to include('id') end end end end gitlab-4.8.0/spec/gitlab/client/000077500000000000000000000000001341107427500164435ustar00rootroot00000000000000gitlab-4.8.0/spec/gitlab/client/access_requests_spec.rb000066400000000000000000000107161341107427500232030ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.project_access_requests' do before do stub_get('/projects/1/access_requests', 'access_requests') @access_requests = Gitlab.project_access_requests(1) end it 'gets the correct resources' do expect(a_get('/projects/1/access_requests')).to have_been_made end it 'returns a paginated response of project access requests' do expect(@access_requests).to be_a Gitlab::PaginatedResponse end end describe '.group_access_requests' do before do stub_get('/groups/1/access_requests', 'access_requests') @access_requests = Gitlab.group_access_requests(1) end it 'gets the correct resources' do expect(a_get('/groups/1/access_requests')).to have_been_made end it 'returns a paginated response of group access requests' do expect(@access_requests).to be_a Gitlab::PaginatedResponse end end describe '.request_project_access' do before do stub_post('/projects/1/access_requests', 'access_request') @access_request = Gitlab.request_project_access(1) end it 'gets the correct resource' do expect(a_post('/projects/1/access_requests')).to have_been_made end end describe '.request_group_access' do before do stub_post('/groups/1/access_requests', 'access_request') @access_request = Gitlab.request_group_access(1) end it 'gets the correct resource' do expect(a_post('/groups/1/access_requests')).to have_been_made end end describe '.approve_project_access_request' do context 'When no access level is given' do before do stub_put('/projects/1/access_requests/1/approve', 'default_approved_access_request') @access_request = Gitlab.approve_project_access_request(1, 1) end it 'gets the correct resource' do expect(a_put('/projects/1/access_requests/1/approve')).to have_been_made end it 'returns information about the project access request' do expect(@access_request.access_level).to eq(30) end end context 'When access level is given' do before do stub_put('/projects/1/access_requests/1/approve', 'approved_access_request').with(body: { access_level: '20' }) @access_request = Gitlab.approve_project_access_request(1, 1, access_level: '20') end it 'gets the correct resource' do expect(a_put('/projects/1/access_requests/1/approve') .with(body: { access_level: '20' })).to have_been_made end it 'returns information about the project access request' do expect(@access_request.access_level).to eq(20) end end end describe '.approve_group_access_request' do context 'When no access level is given' do before do stub_put('/groups/1/access_requests/1/approve', 'default_approved_access_request') @access_request = Gitlab.approve_group_access_request(1, 1) end it 'gets the correct resource' do expect(a_put('/groups/1/access_requests/1/approve')).to have_been_made end it 'returns information about the group access request' do expect(@access_request.access_level).to eq(30) end end context 'When access level is given' do before do stub_put('/groups/1/access_requests/1/approve', 'approved_access_request').with(body: { access_level: '20' }) @access_request = Gitlab.approve_group_access_request(1, 1, access_level: '20') end it 'gets the correct resource' do expect(a_put('/groups/1/access_requests/1/approve') .with(body: { access_level: '20' })).to have_been_made end it 'returns information about the group access request' do expect(@access_request.access_level).to eq(20) end end end describe '.deny_project_access_request' do before do stub_delete('/projects/1/access_requests/1', 'access_request') @access_request = Gitlab.deny_project_access_request(1, 1) end it 'gets the correct resource' do expect(a_delete('/projects/1/access_requests/1')).to have_been_made end end describe '.deny_group_access_request' do before do stub_delete('/groups/1/access_requests/1', 'access_request') @access_request = Gitlab.deny_group_access_request(1, 1) end it 'gets the correct resource' do expect(a_delete('/groups/1/access_requests/1')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/award_emojis_spec.rb000066400000000000000000000330541341107427500224530ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.award_emojis' do context 'when issue award emojis' do before do stub_get('/projects/1/issues/80/award_emoji', 'issue_award_emojis') @emojis = Gitlab.award_emojis(1, 80, 'issue') end it 'gets the correct resources' do expect(a_get('/projects/1/issues/80/award_emoji')).to have_been_made end it 'returns a paginated response of issue award emojis' do expect(@emojis).to be_a Gitlab::PaginatedResponse expect(@emojis.first.awardable_id).to eq(80) expect(@emojis.first.awardable_type).to eq('Issue') end end context 'when merge request award emojis' do before do stub_get('/projects/1/merge_requests/80/award_emoji', 'merge_request_award_emojis') @emojis = Gitlab.award_emojis(1, 80, 'merge_request') end it 'gets the correct resources' do expect(a_get('/projects/1/merge_requests/80/award_emoji')).to have_been_made end it 'returns a paginated response of merge request award emojis' do expect(@emojis).to be_a Gitlab::PaginatedResponse expect(@emojis.first.awardable_id).to eq(80) expect(@emojis.first.awardable_type).to eq('MergeRequest') end end context 'when snippet award emojis' do before do stub_get('/projects/1/snippets/80/award_emoji', 'snippet_award_emojis') @emojis = Gitlab.award_emojis(1, 80, 'snippet') end it 'gets the correct resources' do expect(a_get('/projects/1/snippets/80/award_emoji')).to have_been_made end it 'returns a paginated response of snippet award emojis' do expect(@emojis).to be_a Gitlab::PaginatedResponse expect(@emojis.first.awardable_id).to eq(80) expect(@emojis.first.awardable_type).to eq('Snippet') end end end describe '.note_award_emojis' do context 'when issue note award emojis' do before do stub_get('/projects/1/issues/80/notes/1/award_emoji', 'note_award_emojis') @note_emojis = Gitlab.note_award_emojis(1, 80, 'issue', 1) end it 'gets the correct resources' do expect(a_get('/projects/1/issues/80/notes/1/award_emoji')).to have_been_made end it 'returns a paginated response of issue note award emojis' do expect(@note_emojis).to be_a Gitlab::PaginatedResponse expect(@note_emojis.first.awardable_id).to eq(1) expect(@note_emojis.first.awardable_type).to eq('Note') end end context 'when merge request note award emojis' do before do stub_get('/projects/1/merge_requests/80/notes/1/award_emoji', 'note_award_emojis') @note_emojis = Gitlab.note_award_emojis(1, 80, 'merge_request', 1) end it 'gets the correct resources' do expect(a_get('/projects/1/merge_requests/80/notes/1/award_emoji')).to have_been_made end it 'returns a paginated response of merge request note award emojis' do expect(@note_emojis).to be_a Gitlab::PaginatedResponse expect(@note_emojis.first.awardable_id).to eq(1) expect(@note_emojis.first.awardable_type).to eq('Note') end end context 'when snippet note award emojis' do before do stub_get('/projects/1/snippets/80/notes/1/award_emoji', 'note_award_emojis') @note_emojis = Gitlab.note_award_emojis(1, 80, 'snippet', 1) end it 'gets the correct resources' do expect(a_get('/projects/1/snippets/80/notes/1/award_emoji')).to have_been_made end it 'returns a paginated response of snippet note award emojis' do expect(@note_emojis).to be_a Gitlab::PaginatedResponse expect(@note_emojis.first.awardable_id).to eq(1) expect(@note_emojis.first.awardable_type).to eq('Note') end end end describe '.award_emoji' do context 'when issue award emoji' do before do stub_get('/projects/1/issues/80/award_emoji/4', 'issue_award_emoji') @emoji = Gitlab.award_emoji(1, 80, 'issue', 4) end it 'gets the correct resource' do expect(a_get('/projects/1/issues/80/award_emoji/4')).to have_been_made end it 'returns information about an issue award emoji' do expect(@emoji.id).to eq(4) expect(@emoji.awardable_type).to eq('Issue') expect(@emoji.awardable_id).to eq(80) end end context 'when merge request award emoji' do before do stub_get('/projects/1/merge_requests/80/award_emoji/4', 'merge_request_award_emoji') @emoji = Gitlab.award_emoji(1, 80, 'merge_request', 4) end it 'gets the correct resource' do expect(a_get('/projects/1/merge_requests/80/award_emoji/4')).to have_been_made end it 'returns information about a merge request award emoji' do expect(@emoji.id).to eq(4) expect(@emoji.awardable_type).to eq('MergeRequest') expect(@emoji.awardable_id).to eq(80) end end context 'when snippet award emoji' do before do stub_get('/projects/1/snippets/80/award_emoji/4', 'snippet_award_emoji') @emoji = Gitlab.award_emoji(1, 80, 'snippet', 4) end it 'gets the correct resource' do expect(a_get('/projects/1/snippets/80/award_emoji/4')).to have_been_made end it 'returns information about a snippet award emoji' do expect(@emoji.id).to eq(4) expect(@emoji.awardable_type).to eq('Snippet') expect(@emoji.awardable_id).to eq(80) end end end describe '.note_award_emoji' do context 'when issue note award emoji' do before do stub_get('/projects/1/issues/80/notes/1/award_emoji/4', 'note_award_emoji') @note_emoji = Gitlab.note_award_emoji(1, 80, 'issue', 1, 4) end it 'gets the correct resource' do expect(a_get('/projects/1/issues/80/notes/1/award_emoji/4')).to have_been_made end it 'returns information about an issue note award emoji' do expect(@note_emoji.id).to eq(4) expect(@note_emoji.awardable_type).to eq('Note') expect(@note_emoji.awardable_id).to eq(1) end end context 'when merge request note award emoji' do before do stub_get('/projects/1/merge_requests/80/notes/1/award_emoji/4', 'note_award_emoji') @note_emoji = Gitlab.note_award_emoji(1, 80, 'merge_request', 1, 4) end it 'gets the correct resource' do expect(a_get('/projects/1/merge_requests/80/notes/1/award_emoji/4')).to have_been_made end it 'returns information about a merge request note award emoji' do expect(@note_emoji.id).to eq(4) expect(@note_emoji.awardable_type).to eq('Note') expect(@note_emoji.awardable_id).to eq(1) end end context 'when snippet note award emoji' do before do stub_get('/projects/1/snippets/80/notes/1/award_emoji/4', 'note_award_emoji') @note_emoji = Gitlab.note_award_emoji(1, 80, 'snippet', 1, 4) end it 'gets the correct resource' do expect(a_get('/projects/1/snippets/80/notes/1/award_emoji/4')).to have_been_made end it 'returns information about a snippet note award emoji' do expect(@note_emoji.id).to eq(4) expect(@note_emoji.awardable_type).to eq('Note') expect(@note_emoji.awardable_id).to eq(1) end end end describe '.create_award_emoji' do context 'when issue award emoji' do before do stub_post('/projects/1/issues/80/award_emoji', 'issue_award_emoji') @emoji = Gitlab.create_award_emoji(1, 80, 'issue', 'blowfish') end it 'gets the correct resource' do expect(a_post('/projects/1/issues/80/award_emoji') .with(body: { name: 'blowfish' })).to have_been_made end it 'returns correct information about the created issue award emoji' do expect(@emoji.name).to eq('blowfish') expect(@emoji.awardable_type).to eq('Issue') end end context 'when merge request award emoji' do before do stub_post('/projects/1/merge_requests/80/award_emoji', 'merge_request_award_emoji') @emoji = Gitlab.create_award_emoji(1, 80, 'merge_request', 'blowfish') end it 'gets the correct resource' do expect(a_post('/projects/1/merge_requests/80/award_emoji') .with(body: { name: 'blowfish' })).to have_been_made end it 'returns correct information about the created merge request award emoji' do expect(@emoji.name).to eq('blowfish') expect(@emoji.awardable_type).to eq('MergeRequest') end end context 'when snippet award emoji' do before do stub_post('/projects/1/snippets/80/award_emoji', 'snippet_award_emoji') @emoji = Gitlab.create_award_emoji(1, 80, 'snippet', 'blowfish') end it 'gets the correct resource' do expect(a_post('/projects/1/snippets/80/award_emoji') .with(body: { name: 'blowfish' })).to have_been_made end it 'returns correct information about the created snippet award emoji' do expect(@emoji.name).to eq('blowfish') expect(@emoji.awardable_type).to eq('Snippet') end end end describe '.create_note_award_emoji' do context 'when issue note award emoji' do before do stub_post('/projects/1/issues/80/notes/1/award_emoji', 'note_award_emoji') @note_emoji = Gitlab.create_note_award_emoji(1, 80, 'issue', 1, 'mood_bubble_lightning') end it 'gets the correct resource' do expect(a_post('/projects/1/issues/80/notes/1/award_emoji') .with(body: { name: 'mood_bubble_lightning' })).to have_been_made end it 'returns correct information about the created issue note award emoji' do expect(@note_emoji.name).to eq('mood_bubble_lightning') expect(@note_emoji.awardable_type).to eq('Note') end end context 'when merge request note award emoji' do before do stub_post('/projects/1/merge_requests/80/notes/1/award_emoji', 'note_award_emoji') @note_emoji = Gitlab.create_note_award_emoji(1, 80, 'merge_request', 1, 'mood_bubble_lightning') end it 'gets the correct resource' do expect(a_post('/projects/1/merge_requests/80/notes/1/award_emoji') .with(body: { name: 'mood_bubble_lightning' })).to have_been_made end it 'returns correct information about the created merge request note award emoji' do expect(@note_emoji.name).to eq('mood_bubble_lightning') expect(@note_emoji.awardable_type).to eq('Note') end end context 'when snippet note award emoji' do before do stub_post('/projects/1/snippets/80/notes/1/award_emoji', 'note_award_emoji') @note_emoji = Gitlab.create_note_award_emoji(1, 80, 'snippet', 1, 'mood_bubble_lightning') end it 'gets the correct resource' do expect(a_post('/projects/1/snippets/80/notes/1/award_emoji') .with(body: { name: 'mood_bubble_lightning' })).to have_been_made end it 'returns correct information about the created snippet note award emoji' do expect(@note_emoji.name).to eq('mood_bubble_lightning') expect(@note_emoji.awardable_type).to eq('Note') end end end describe '.delete_award_emoji' do context 'when issue award emoji' do before do stub_delete('/projects/1/issues/80/award_emoji/4', 'issue_award_emoji') @emoji = Gitlab.delete_award_emoji(1, 80, 'issue', 4) end it 'gets the correct resource' do expect(a_delete('/projects/1/issues/80/award_emoji/4')).to have_been_made end end context 'when merge request award emoji' do before do stub_delete('/projects/1/merge_requests/80/award_emoji/4', 'merge_request_award_emoji') @emoji = Gitlab.delete_award_emoji(1, 80, 'merge_request', 4) end it 'gets the correct resource' do expect(a_delete('/projects/1/merge_requests/80/award_emoji/4')).to have_been_made end end context 'when snippet award emoji' do before do stub_delete('/projects/1/snippets/80/award_emoji/4', 'snippet_award_emoji') @emoji = Gitlab.delete_award_emoji(1, 80, 'snippet', 4) end it 'gets the correct resource' do expect(a_delete('/projects/1/snippets/80/award_emoji/4')).to have_been_made end end end describe '.delete_note_award_emoji' do context 'when issue note award emoji' do before do stub_delete('/projects/1/issues/80/notes/1/award_emoji/4', 'note_award_emoji') @note_emoji = Gitlab.delete_note_award_emoji(1, 80, 'issue', 1, 4) end it 'gets the correct resource' do expect(a_delete('/projects/1/issues/80/notes/1/award_emoji/4')).to have_been_made end end context 'when merge request note award emoji' do before do stub_delete('/projects/1/merge_requests/80/notes/1/award_emoji/4', 'note_award_emoji') @note_emoji = Gitlab.delete_note_award_emoji(1, 80, 'merge_request', 1, 4) end it 'gets the correct resource' do expect(a_delete('/projects/1/merge_requests/80/notes/1/award_emoji/4')).to have_been_made end end context 'when snippet note award emoji' do before do stub_delete('/projects/1/snippets/80/notes/1/award_emoji/4', 'note_award_emoji') @note_emoji = Gitlab.delete_note_award_emoji(1, 80, 'snippet', 1, 4) end it 'gets the correct resource' do expect(a_delete('/projects/1/snippets/80/notes/1/award_emoji/4')).to have_been_made end end end end gitlab-4.8.0/spec/gitlab/client/boards_spec.rb000066400000000000000000000046651341107427500212670ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.boards' do before do stub_get('/projects/3/boards', 'boards') @boards = Gitlab.boards(3) end it 'gets the correct resource' do expect(a_get('/projects/3/boards')).to have_been_made end it "returns a paginated response of project's boards" do expect(@boards).to be_a Gitlab::PaginatedResponse end end describe '.board_lists' do before do stub_get('/projects/3/boards/1/lists', 'board_lists') @board_lists = Gitlab.board_lists(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/boards/1/lists')).to have_been_made end it "returns a paginated response of board's lists" do expect(@board_lists).to be_a Gitlab::PaginatedResponse expect(@board_lists.first.id).to eq(1) end end describe '.board_list' do before do stub_get('/projects/3/boards/1/lists/1', 'board_list') @board_list = Gitlab.board_list(3, 1, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/boards/1/lists/1')).to have_been_made end it 'returns information about the list' do expect(@board_list.id).to eq(1) end end describe '.create_board_list' do before do stub_post('/projects/3/boards/1/lists', 'board_list') @board_list = Gitlab.create_board_list(3, 1, 4) end it 'gets the correct resource' do expect(a_post('/projects/3/boards/1/lists')).to have_been_made end it 'returns information about a created board' do expect(@board_list.position).to eq(1) end end describe '.edit_board_list' do before do stub_put('/projects/3/boards/1/lists/1', 'board_list') @board_list = Gitlab.edit_board_list(3, 1, 1, 3) end it 'gets the correct resource' do expect(a_put('/projects/3/boards/1/lists/1')).to have_been_made end it 'returns information about an edited board' do expect(@board_list.id).to eq(1) end end describe '.delete_board_list' do before do stub_delete('/projects/3/boards/1/lists/1', 'board_list') @board_list = Gitlab.delete_board_list(3, 1, 1) end it 'gets the correct resource' do expect(a_delete('/projects/3/boards/1/lists/1')).to have_been_made end it 'returns information about the deleted board list' do expect(@board_list.id).to eq(1) end end end gitlab-4.8.0/spec/gitlab/client/branches_spec.rb000066400000000000000000000117421341107427500215740ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :repo_branches } it { is_expected.to respond_to :repo_branch } it { is_expected.to respond_to :repo_protect_branch } it { is_expected.to respond_to :repo_unprotect_branch } it { is_expected.to respond_to :repo_create_branch } it { is_expected.to respond_to :repo_delete_branch } it { is_expected.to respond_to :repo_delete_merged_branches } it { is_expected.to respond_to :repo_protected_branches } it { is_expected.to respond_to :repo_protected_branch } describe '.branches' do before do stub_get('/projects/3/repository/branches', 'branches') @branches = Gitlab.branches(3) end it 'gets the correct resource' do expect(a_get('/projects/3/repository/branches')).to have_been_made end it 'returns a paginated response of repository branches' do expect(@branches).to be_a Gitlab::PaginatedResponse expect(@branches.first.name).to eq('api') end end describe '.branch' do before do stub_get('/projects/3/repository/branches/api', 'branch') @branch = Gitlab.branch(3, 'api') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/branches/api')).to have_been_made end it 'returns information about a repository branch' do expect(@branch.name).to eq('api') end end describe '.protect_branch' do before do stub_post('/projects/3/protected_branches', 'branch') end context 'without options' do before do @branch = Gitlab.protect_branch(3, 'api') end it 'updates the correct resource' do expect(a_post('/projects/3/protected_branches')).to have_been_made end it 'returns information about a protected repository branch' do expect(@branch.name).to eq('api') end end context 'with options' do before do @branch = Gitlab.protect_branch(3, 'api', developers_can_push: true) end it 'updates the correct resource with the correct options' do expect( a_post('/projects/3/protected_branches').with(body: { name: 'api', developers_can_push: 'true' }) ).to have_been_made end end end describe '.unprotect_branch' do before do stub_delete('/projects/3/protected_branches/api', 'branch') @branch = Gitlab.unprotect_branch(3, 'api') end it 'gets the correct resource' do expect(a_delete('/projects/3/protected_branches/api')).to have_been_made end it 'returns information about an unprotected repository branch' do expect(@branch.name).to eq('api') end end describe '.create_branch' do before do stub_post('/projects/3/repository/branches', 'branch').with(query: { branch: 'api', ref: 'master' }) @branch = Gitlab.create_branch(3, 'api', 'master') end it 'gets the correct resource' do expect( a_post('/projects/3/repository/branches').with(query: { branch: 'api', ref: 'master' }) ).to have_been_made end it 'returns information about a new repository branch' do expect(@branch.name).to eq('api') end end describe '.delete_branch' do before do stub_delete('/projects/3/repository/branches/api', 'branch_delete') @branch = Gitlab.delete_branch(3, 'api') end it 'gets the correct resource' do expect(a_delete('/projects/3/repository/branches/api')).to have_been_made end it 'returns information about the deleted repository branch' do expect(@branch.branch_name).to eq('api') end end describe '.delete_merged_branches' do before do stub_delete('/projects/3/repository/merged_branches', 'empty') @branch = Gitlab.delete_merged_branches(3) end it 'gets the correct resource' do expect(a_delete('/projects/3/repository/merged_branches')).to have_been_made end end describe '.protected_branches' do before do stub_get('/projects/3/protected_branches', 'protected_branches') @branches = Gitlab.protected_branches(3) end it 'gets the correct resource' do expect(a_get('/projects/3/protected_branches')).to have_been_made end it 'returns information about the protected_branches' do expect(@branches).to be_a Gitlab::PaginatedResponse expect(@branches.first.merge_access_levels).to be_a Array expect(@branches.first.push_access_levels).to be_a Array end end describe '.protected_branch' do before do stub_get('/projects/3/protected_branches/master', 'protected_branch') @branch = Gitlab.protected_branch(3, 'master') end it 'gets the correct resource' do expect(a_get('/projects/3/protected_branches/master')).to have_been_made end it 'returns correct information about the protected_branch' do expect(@branch.name).to eq 'master' expect(@branch.merge_access_levels).to be_a Array expect(@branch.push_access_levels).to be_a Array end end end gitlab-4.8.0/spec/gitlab/client/broadcast_messages_spec.rb000066400000000000000000000044401341107427500236350ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.broadcast_messages' do before do stub_get('/broadcast_messages', 'broadcast_messages') @broadcast_messages = Gitlab.broadcast_messages end it 'gets the correct resource' do expect(a_get('/broadcast_messages')).to have_been_made end it 'returns a paginated response of broadcast messages' do expect(@broadcast_messages).to be_a Gitlab::PaginatedResponse end end describe '.broadcast_message' do before do stub_get('/broadcast_messages/1', 'broadcast_message') @broadcast_message = Gitlab.broadcast_message(1) end it 'gets the correct resource' do expect(a_get('/broadcast_messages/1')).to have_been_made end it 'returns correct information about the broadcast message' do expect(@broadcast_message.id).to eq 1 end end describe '.create_broadcast_message' do before do stub_post('/broadcast_messages', 'broadcast_message') @broadcast_message = Gitlab.create_broadcast_message('Deploy in progress', color: '#cecece') end it 'gets the correct resource' do expect(a_post('/broadcast_messages') .with(body: { message: 'Deploy in progress', color: '#cecece' })).to have_been_made end it 'returns correct information about the broadcast message created' do expect(@broadcast_message.message).to eq 'Deploy in progress' expect(@broadcast_message.color).to eq '#cecece' end end describe '.edit_broadcast_message' do before do stub_put('/broadcast_messages/1', 'broadcast_message') @broadcast_message = Gitlab.edit_broadcast_message(1, font: '#FFFFFF') end it 'gets the correct resource' do expect(a_put('/broadcast_messages/1') .with(body: { font: '#FFFFFF' })).to have_been_made end it 'returns correct information about the edited broadcast message' do expect(@broadcast_message.font).to eq '#FFFFFF' end end describe '.delete_broadcast_message' do before do stub_delete('/broadcast_messages/1', 'empty') @broadcast_message = Gitlab.delete_broadcast_message(1) end it 'gets the correct resource' do expect(a_delete('/broadcast_messages/1')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/build_variables_spec.rb000066400000000000000000000117341341107427500231370ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.variables' do before do stub_get('/projects/3/variables', 'variables') @variables = Gitlab.variables(3) end it 'gets the correct resource' do expect(a_get('/projects/3/variables')).to have_been_made end it "returns an array of project's variables" do expect(@variables).to be_a Gitlab::PaginatedResponse expect(@variables.first.key).to eq('TEST_VARIABLE_1') expect(@variables.first.value).to eq('TEST_1') end end describe '.variable' do before do stub_get('/projects/3/variables/VARIABLE', 'variable') @variable = Gitlab.variable(3, 'VARIABLE') end it 'gets the correct resource' do expect(a_get('/projects/3/variables/VARIABLE')).to have_been_made end it 'returns information about a variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.create_variable' do before do stub_post('/projects/3/variables', 'variable') @variable = Gitlab.create_variable(3, 'NEW_VARIABLE', 'new value') end it 'gets the correct resource' do body = { key: 'NEW_VARIABLE', value: 'new value' } expect(a_post('/projects/3/variables').with(body: body)).to have_been_made end it 'returns information about a new variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.update_variable' do before do stub_put('/projects/3/variables/UPD_VARIABLE', 'variable') @variable = Gitlab.update_variable(3, 'UPD_VARIABLE', 'updated value') end it 'puts the correct resource' do body = { value: 'updated value' } expect(a_put('/projects/3/variables/UPD_VARIABLE').with(body: body)).to have_been_made end it 'returns information about an updated variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.remove_variable' do before do stub_delete('/projects/3/variables/DEL_VARIABLE', 'variable') @variable = Gitlab.remove_variable(3, 'DEL_VARIABLE') end it 'gets the correct resource' do expect(a_delete('/projects/3/variables/DEL_VARIABLE')).to have_been_made end it 'returns information about a deleted variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.group_variables' do before do stub_get('/groups/3/variables', 'variables') @variables = Gitlab.group_variables(3) end it 'gets the correct resource' do expect(a_get('/groups/3/variables')).to have_been_made end it "returns an array of group's variables" do expect(@variables).to be_a Gitlab::PaginatedResponse expect(@variables.first.key).to eq('TEST_VARIABLE_1') expect(@variables.first.value).to eq('TEST_1') end end describe '.group_variable' do before do stub_get('/groups/3/variables/VARIABLE', 'variable') @variable = Gitlab.group_variable(3, 'VARIABLE') end it 'gets the correct resource' do expect(a_get('/groups/3/variables/VARIABLE')).to have_been_made end it 'returns information about a variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.create_group_variable' do before do stub_post('/groups/3/variables', 'variable') @variable = Gitlab.create_group_variable(3, 'NEW_VARIABLE', 'new value') end it 'gets the correct resource' do body = { key: 'NEW_VARIABLE', value: 'new value' } expect(a_post('/groups/3/variables').with(body: body)).to have_been_made end it 'returns information about a new variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.update_group_variable' do before do stub_put('/groups/3/variables/UPD_VARIABLE', 'variable') @variable = Gitlab.update_group_variable(3, 'UPD_VARIABLE', 'updated value') end it 'puts the correct resource' do body = { value: 'updated value' } expect(a_put('/groups/3/variables/UPD_VARIABLE').with(body: body)).to have_been_made end it 'returns information about an updated variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end describe '.remove_group_variable' do before do stub_delete('/groups/3/variables/DEL_VARIABLE', 'variable') @variable = Gitlab.remove_group_variable(3, 'DEL_VARIABLE') end it 'gets the correct resource' do expect(a_delete('/groups/3/variables/DEL_VARIABLE')).to have_been_made end it 'returns information about a deleted variable' do expect(@variable.key).to eq('VARIABLE') expect(@variable.value).to eq('the value') end end end gitlab-4.8.0/spec/gitlab/client/builds_spec.rb000066400000000000000000000104651341107427500212720ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.builds' do before do stub_get('/projects/3/builds', 'builds') @builds = Gitlab.builds(3) end it 'gets the correct resource' do expect(a_get('/projects/3/builds')).to have_been_made end it "returns a paginated response of project's builds" do expect(@builds).to be_a Gitlab::PaginatedResponse end end describe '.build' do before do stub_get('/projects/3/builds/8', 'build') @build = Gitlab.build(3, 8) end it 'gets the correct resource' do expect(a_get('/projects/3/builds/8')).to have_been_made end it 'returns a single build' do expect(@build).to be_a Gitlab::ObjectifiedHash end it 'returns information about a build' do expect(@build.id).to eq(8) expect(@build.user.name).to eq('John Smith') end end describe '.build_artifacts' do context 'when successful request' do before do fixture = load_fixture('build_artifacts') fixture.set_encoding(Encoding::ASCII_8BIT) stub_request(:get, "#{Gitlab.endpoint}/projects/3/builds/8/artifacts") .with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) .to_return(body: fixture.read, headers: { 'Content-Disposition' => 'attachment; filename=artifacts.zip' }) @build_artifacts = Gitlab.build_artifacts(3, 8) end it 'gets the correct resource' do expect(a_get('/projects/3/builds/8/artifacts')).to have_been_made end it 'returns a FileResponse' do expect(@build_artifacts).to be_a Gitlab::FileResponse end it 'returns a file with filename' do expect(@build_artifacts.filename).to eq 'artifacts.zip' end end context 'when bad request' do it 'throws an exception' do stub_get('/projects/3/builds/8/artifacts', 'error_project_not_found', 404) expect { Gitlab.build_artifacts(3, 8) }.to raise_error(Gitlab::Error::NotFound, "Server responded with code 404, message: 404 Project Not Found. Request URI: #{Gitlab.endpoint}/projects/3/builds/8/artifacts") end end end describe '.builds_commits' do before do stub_get('/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds', 'builds_commits') @builds_commits = Gitlab.commit_builds(3, '0ff3ae198f8601a285adcf5c0fff204ee6fba5fd') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds')).to have_been_made end it 'returns a paginated response of commit builds' do expect(@builds_commits).to be_a Gitlab::PaginatedResponse end it 'returns information about the builds' do expect(@builds_commits.count).to eq(2) end end describe '.build_cancel' do before do stub_post('/projects/3/builds/8/cancel', 'build_cancel') @build_cancel = Gitlab.build_cancel(3, 8) end it 'gets the correct resource' do expect(a_post('/projects/3/builds/8/cancel')).to have_been_made end it 'returns a single build' do expect(@build_cancel).to be_a Gitlab::ObjectifiedHash end it 'returns information about a build' do expect(@build_cancel.commit.author_name).to eq('John Smith') end end describe '.build_retry' do before do stub_post('/projects/3/builds/69/retry', 'build_retry') @build_retry = Gitlab.build_retry(3, 69) end it 'gets the correct resource' do expect(a_post('/projects/3/builds/69/retry')).to have_been_made end it 'returns a single build' do expect(@build_retry).to be_a Gitlab::ObjectifiedHash end it 'returns information about a build' do expect(@build_retry.commit.author_name).to eq('John Smith') end end describe '.build_erase' do before do stub_post('/projects/3/builds/69/erase', 'build_erase') @build_retry = Gitlab.build_erase(3, 69) end it 'gets the correct resource' do expect(a_post('/projects/3/builds/69/erase')).to have_been_made end it 'returns a single build' do expect(@build_retry).to be_a Gitlab::ObjectifiedHash end it 'returns information about a build' do expect(@build_retry.commit.author_name).to eq('John Smith') end end end gitlab-4.8.0/spec/gitlab/client/client_spec.rb000066400000000000000000000005071341107427500212620ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '#inspect' do it 'masks tokens on inspect' do client = described_class.new(private_token: 'ui3gIYf4MMzTx-Oh5cEBx') inspected = client.inspect expect(inspected).to include('****************cEBx') end end end gitlab-4.8.0/spec/gitlab/client/commits_spec.rb000066400000000000000000000175151341107427500214660ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :repo_commits } it { is_expected.to respond_to :repo_commit } it { is_expected.to respond_to :repo_commit_diff } it { is_expected.to respond_to :repo_commit_comments } it { is_expected.to respond_to :repo_create_commit_comment } it { is_expected.to respond_to :repo_commit_status } it { is_expected.to respond_to :repo_update_commit_status } it { is_expected.to respond_to :repo_commit_merge_requests } describe '.commits' do before do stub_get('/projects/3/repository/commits', 'project_commits') .with(query: { ref_name: 'api' }) @commits = Gitlab.commits(3, ref_name: 'api') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits') .with(query: { ref_name: 'api' })).to have_been_made end it 'returns a paginated response of repository commits' do expect(@commits).to be_a Gitlab::PaginatedResponse expect(@commits.first.id).to eq('f7dd067490fe57505f7226c3b54d3127d2f7fd46') end end describe '.commit' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6', 'project_commit') @commit = Gitlab.commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6')) .to have_been_made end it 'returns a repository commit' do expect(@commit.id).to eq('6104942438c14ec7bd21c6cd5bd995272b3faff6') end end describe '.cherry_pick_commit' do before do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick', 'project_commit').with(body: { branch: 'master' }) @cherry_pick_commit = Gitlab.cherry_pick_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick') .with(body: { branch: 'master' })) .to have_been_made end it 'returns the correct response' do expect(@cherry_pick_commit).to be_a Gitlab::ObjectifiedHash expect(@cherry_pick_commit.id).to eq('6104942438c14ec7bd21c6cd5bd995272b3faff6') end end describe '.commit_diff' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff', 'project_commit_diff') @diff = Gitlab.commit_diff(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff')) .to have_been_made end it 'returns a diff of a commit' do expect(@diff.new_path).to eq('doc/update/5.4-to-6.0.md') end end describe '.commit_comments' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments', 'project_commit_comments') @commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments')) .to have_been_made end it "returns commit's comments" do expect(@commit_comments).to be_a Gitlab::PaginatedResponse expect(@commit_comments.length).to eq(2) expect(@commit_comments[0].note).to eq('this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6') expect(@commit_comments[0].author.id).to eq(11) expect(@commit_comments[1].note).to eq('another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6') expect(@commit_comments[1].author.id).to eq(12) end end describe '.create_commit_comment' do before do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments', 'project_commit_comment') @merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!') end it 'returns information about the newly created comment' do expect(@merge_request.note).to eq('Nice code!') expect(@merge_request.author.id).to eq(1) end end describe '.commit_status' do before do stub_get('/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses', 'project_commit_status') .with(query: { all: 'true' }) @statuses = Gitlab.commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', all: true) end it 'gets the correct resource' do expect(a_get('/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses') .with(query: { all: true })) end it 'gets statuses of a commit' do expect(@statuses).to be_kind_of Gitlab::PaginatedResponse expect(@statuses.first.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') expect(@statuses.first.ref).to eq('decreased-spec') expect(@statuses.first.status).to eq('failed') expect(@statuses.last.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') expect(@statuses.last.status).to eq('success') end end describe '.update_commit_status' do before do stub_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8', 'project_update_commit_status') .with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' }) @status = Gitlab.update_commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', 'failed', name: 'test', ref: 'decreased-spec') end it 'gets the correct resource' do expect(a_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8') .with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' })) end it 'returns information about the newly created status' do expect(@status).to be_kind_of Gitlab::ObjectifiedHash expect(@status.id).to eq(498) expect(@status.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') expect(@status.status).to eq('failed') expect(@status.ref).to eq('decreased-spec') end end describe '.create_commit' do let(:actions) do [ { action: 'create', file_path: 'foo/bar', content: 'some content' } ] end let(:query) do { branch: 'dev', commit_message: 'refactors everything', actions: actions, author_email: 'joe@sample.org', author_name: 'Joe Sample' } end before do stub_post('/projects/6/repository/commits', 'project_commit_create').with(body: query) @commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, author_email: 'joe@sample.org', author_name: 'Joe Sample') end it 'returns id of a created commit' do expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746') end end describe '.repo_commit_merge_requests' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/merge_requests', 'project_commit_merge_requests') @commit_merge_requests = Gitlab.commit_merge_requests(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/merge_requests')) .to have_been_made end it "returns commit's associated merge_requests" do expect(@commit_merge_requests).to be_a Gitlab::PaginatedResponse expect(@commit_merge_requests.length).to eq(2) expect(@commit_merge_requests[0].iid).to eq(1) expect(@commit_merge_requests[0].author.id).to eq(1) expect(@commit_merge_requests[1].iid).to eq(2) expect(@commit_merge_requests[1].author.id).to eq(2) end end end gitlab-4.8.0/spec/gitlab/client/deployments_spec.rb000066400000000000000000000020561341107427500223500ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.deployments' do before do stub_get('/projects/3/deployments', 'deployments') @deployments = Gitlab.deployments(3) end it 'gets the correct resource' do expect(a_get('/projects/3/deployments')).to have_been_made end it "returns a paginated response of project's deployments" do expect(@deployments).to be_a Gitlab::PaginatedResponse end end describe '.deployment' do before do stub_get('/projects/3/deployments/42', 'deployment') @deployment = Gitlab.deployment(3, 42) end it 'gets the correct resource' do expect(a_get('/projects/3/deployments/42')).to have_been_made end it 'returns a single deployment' do expect(@deployment).to be_a Gitlab::ObjectifiedHash end it 'returns information about an deployment' do expect(@deployment.id).to eq(42) expect(@deployment.deployable.commit.id).to eq('a91957a858320c0e17f3a0eca7cfacbff50ea29a') end end end gitlab-4.8.0/spec/gitlab/client/environments_spec.rb000066400000000000000000000075361341107427500225440ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.environments' do before do stub_get('/projects/3/environments', 'environments') @environments = Gitlab.environments(3) end it 'gets the correct resource' do expect(a_get('/projects/3/environments')).to have_been_made end it "returns a paginated response of project's environments" do expect(@environments).to be_a Gitlab::PaginatedResponse end end describe '.environment' do before do stub_get('/projects/3/environments/12', 'environment') @environment = Gitlab.environment(3, 12) end it 'gets the correct resource' do expect(a_get('/projects/3/environments/12')).to have_been_made end it 'returns a single environment' do expect(@environment).to be_a Gitlab::ObjectifiedHash end it 'returns information about an environment' do expect(@environment.id).to eq(12) expect(@environment.name).to eq('staging') end end describe '.create_environment' do context 'without external_url' do before do stub_post('/projects/3/environments', 'environment') @environment = Gitlab.create_environment(3, 'staging') end it 'gets the correct resource' do expect(a_post('/projects/3/environments').with(body: { name: 'staging' })).to have_been_made end it 'returns a single environment' do expect(@environment).to be_a Gitlab::ObjectifiedHash end it 'returns information about an environment' do expect(@environment.name).to eq('staging') end end context 'with external_url' do before do stub_post('/projects/3/environments', 'environment') @environment = Gitlab.create_environment(3, 'staging', external_url: 'https://staging.example.gitlab.com') end it 'gets the correct resource' do expect(a_post('/projects/3/environments') .with(body: { name: 'staging', external_url: 'https://staging.example.gitlab.com' })).to have_been_made end end end describe '.edit_environment' do before do stub_put('/projects/3/environments/12', 'environment') @environment = Gitlab.edit_environment(3, 12, name: 'staging', external_url: 'https://staging.example.gitlab.com') end it 'gets the correct resource' do expect(a_put('/projects/3/environments/12') .with(body: { name: 'staging', external_url: 'https://staging.example.gitlab.com' })).to have_been_made end it 'returns a single environment' do expect(@environment).to be_a Gitlab::ObjectifiedHash end it 'returns information about an environment' do expect(@environment.name).to eq('staging') end end describe '.delete_environment' do before do stub_delete('/projects/3/environments/12', 'environment') @environment = Gitlab.delete_environment(3, 12) end it 'gets the correct resource' do expect(a_delete('/projects/3/environments/12')).to have_been_made end it 'returns a single pipeline' do expect(@environment).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline' do expect(@environment.name).to eq('staging') end end describe '.stop_environment' do before do stub_post('/projects/3/environments/12/stop', 'environment') @environment = Gitlab.stop_environment(3, 12) end it 'gets the correct resource' do expect(a_post('/projects/3/environments/12/stop')).to have_been_made end it 'returns a single pipeline' do expect(@environment).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline' do expect(@environment.name).to eq('staging') end end end gitlab-4.8.0/spec/gitlab/client/events_spec.rb000066400000000000000000000022341341107427500213070ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.events' do before do stub_get('/events', 'user_events') @events = Gitlab.events end it 'gets the correct resource' do expect(a_get('/events')).to have_been_made end it "returns a response of user's events" do expect(@events).to be_a Gitlab::PaginatedResponse end end describe '.user_events' do before do stub_get('/users/1/events', 'user_events') @events = Gitlab.user_events(1) end it 'gets the correct resource' do expect(a_get('/users/1/events')).to have_been_made end it "returns a response of user's contribution events" do expect(@events).to be_a Gitlab::PaginatedResponse end end describe '.project_events' do before do stub_get('/projects/1/events', 'project_events') @events = Gitlab.project_events(1) end it 'gets the correct resource' do expect(a_get('/projects/1/events')).to have_been_made end it "returns a response of project's visible events" do expect(@events).to be_a Gitlab::PaginatedResponse end end end gitlab-4.8.0/spec/gitlab/client/group_milestones_spec.rb000066400000000000000000000056061341107427500234070ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.group_milestones' do before do stub_get('/groups/3/milestones', 'group_milestones') @milestones = Gitlab.group_milestones(3) end it 'gets the correct resource' do expect(a_get('/groups/3/milestones')).to have_been_made end it "returns a paginated response of group's milestones" do expect(@milestones).to be_a Gitlab::PaginatedResponse expect(@milestones.first.group_id).to eq(3) end end describe '.group_milestone' do before do stub_get('/groups/3/milestones/1', 'group_milestone') @milestone = Gitlab.group_milestone(3, 1) end it 'gets the correct resource' do expect(a_get('/groups/3/milestones/1')).to have_been_made end it 'returns information about a milestone' do expect(@milestone.group_id).to eq(3) end end describe '.create_group_milestone' do before do stub_post('/groups/3/milestones', 'group_milestone') @milestone = Gitlab.create_group_milestone(3, 'title') end it 'gets the correct resource' do expect(a_post('/groups/3/milestones') .with(body: { title: 'title' })).to have_been_made end it 'returns information about a created milestone' do expect(@milestone.group_id).to eq(3) end end describe '.edit_group_milestone' do before do stub_put('/groups/3/milestones/33', 'group_milestone') @milestone = Gitlab.edit_group_milestone(3, 33, title: 'title') end it 'gets the correct resource' do expect(a_put('/groups/3/milestones/33') .with(body: { title: 'title' })).to have_been_made end it 'returns information about an edited milestone' do expect(@milestone.group_id).to eq(3) end end describe '.group_milestone_issues' do before do stub_get('/groups/3/milestones/1/issues', 'group_milestone_issues') @milestone_issues = Gitlab.group_milestone_issues(3, 1) end it 'gets the correct resource' do expect(a_get('/groups/3/milestones/1/issues')).to have_been_made end it "returns a paginated response of milestone's issues" do expect(@milestone_issues).to be_a Gitlab::PaginatedResponse expect(@milestone_issues.first.milestone.id).to eq(1) end end describe '.group_milestone_merge_requests' do before do stub_get('/groups/3/milestones/1/merge_requests', 'group_milestone_merge_requests') @milestone_merge_requests = Gitlab.group_milestone_merge_requests(3, 1) end it 'gets the correct resource' do expect(a_get('/groups/3/milestones/1/merge_requests')).to have_been_made end it "returns a paginated response of milestone's merge_requests" do expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse expect(@milestone_merge_requests.first.milestone.id).to eq(1) end end end gitlab-4.8.0/spec/gitlab/client/groups_spec.rb000066400000000000000000000162301341107427500213230ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.groups' do before do stub_get('/groups', 'groups') stub_get('/groups/3', 'group') @group = Gitlab.group(3) @groups = Gitlab.groups end it 'gets the correct resource' do expect(a_get('/groups')).to have_been_made expect(a_get('/groups/3')).to have_been_made end it 'returns a paginated response of groups' do expect(@groups).to be_a Gitlab::PaginatedResponse expect(@groups.first.path).to eq('threegroup') end end describe '.create_group' do context 'without description' do before do stub_post('/groups', 'group_create') @group = Gitlab.create_group('GitLab-Group', 'gitlab-path') end it 'gets the correct resource' do expect(a_post('/groups') .with(body: { path: 'gitlab-path', name: 'GitLab-Group' })).to have_been_made end it 'returns information about a created group' do expect(@group.name).to eq('Gitlab-Group') expect(@group.path).to eq('gitlab-group') end end context 'with description' do before do stub_post('/groups', 'group_create_with_description') @group = Gitlab.create_group('GitLab-Group', 'gitlab-path', description: 'gitlab group description') end it 'gets the correct resource' do expect(a_post('/groups') .with(body: { path: 'gitlab-path', name: 'GitLab-Group', description: 'gitlab group description' })).to have_been_made end it 'returns information about a created group' do expect(@group.name).to eq('Gitlab-Group') expect(@group.path).to eq('gitlab-group') expect(@group.description).to eq('gitlab group description') end end end describe '.delete_group' do before do stub_delete('/groups/42', 'group_delete') @group = Gitlab.delete_group(42) end it 'gets the correct resource' do expect(a_delete('/groups/42')).to have_been_made end it 'returns information about a deleted group' do expect(@group.name).to eq('Gitlab-Group') expect(@group.path).to eq('gitlab-group') end end describe '.transfer_project_to_group' do before do stub_post('/projects', 'project') @project = Gitlab.create_project('Gitlab') stub_post('/groups', 'group_create') @group = Gitlab.create_group('GitLab-Group', 'gitlab-path') stub_post("/groups/#{@group.id}/projects/#{@project.id}", 'group_create') @group_transfer = Gitlab.transfer_project_to_group(@group.id, @project.id) end it 'posts to the correct resource' do expect(a_post("/groups/#{@group.id}/projects/#{@project.id}").with(body: { id: @group.id.to_s, project_id: @project.id.to_s })).to have_been_made end it 'returns information about the group' do expect(@group_transfer.name).to eq(@group.name) expect(@group_transfer.path).to eq(@group.path) expect(@group_transfer.id).to eq(@group.id) end end describe '.group_members' do before do stub_get('/groups/3/members', 'group_members') @members = Gitlab.group_members(3) end it 'gets the correct resource' do expect(a_get('/groups/3/members')).to have_been_made end it "returns information about a group's members" do expect(@members).to be_a Gitlab::PaginatedResponse expect(@members.size).to eq(2) expect(@members[1].name).to eq('John Smith') end end describe '.group_member' do before do stub_get('/groups/3/members/2', 'group_member') @member = Gitlab.group_member(3, 2) end it 'gets the correct resource' do expect(a_get('/groups/3/members/2')).to have_been_made end it 'returns information about a group member' do expect(@member).to be_a Gitlab::ObjectifiedHash expect(@member.access_level).to eq(10) expect(@member.name).to eq('John Smith') end end describe '.add_group_member' do before do stub_post('/groups/3/members', 'group_member') @member = Gitlab.add_group_member(3, 1, 40) end it 'gets the correct resource' do expect(a_post('/groups/3/members') .with(body: { user_id: '1', access_level: '40' })).to have_been_made end it 'returns information about the added member' do expect(@member.name).to eq('John Smith') end end describe '.edit_group_member' do before do stub_put('/groups/3/members/1', 'group_member_edit') @member = Gitlab.edit_group_member(3, 1, 50) end it 'gets the correct resource' do expect(a_put('/groups/3/members/1') .with(body: { access_level: '50' })).to have_been_made end it 'returns information about the edited member' do expect(@member.access_level).to eq(50) end end describe '.remove_group_member' do before do stub_delete('/groups/3/members/1', 'group_member_delete') @group = Gitlab.remove_group_member(3, 1) end it 'gets the correct resource' do expect(a_delete('/groups/3/members/1')).to have_been_made end it 'returns information about the group the member was removed from' do expect(@group.group_id).to eq(3) end end describe '.group_projects' do before do stub_get('/groups/4/projects', 'group_projects') @projects = Gitlab.group_projects(4) end it 'gets the list of projects' do expect(a_get('/groups/4/projects')).to have_been_made end it 'returns a list of of projects under a group' do expect(@projects).to be_a Gitlab::PaginatedResponse expect(@projects.size).to eq(1) expect(@projects[0].name).to eq('Diaspora Client') end end describe '.group_search' do before do stub_get('/groups?search=Group', 'group_search') @groups = Gitlab.group_search('Group') end it 'gets the correct resource' do expect(a_get('/groups?search=Group')).to have_been_made end it 'returns an array of groups found' do expect(@groups.first.id).to eq(5) expect(@groups.last.id).to eq(8) end end describe '.group_subgroups' do before do stub_get('/groups/4/subgroups', 'group_subgroups') @subgroups = Gitlab.group_subgroups(4) end it 'gets the list of subroups' do expect(a_get('/groups/4/subgroups')).to have_been_made end it 'returns an array of subgroups under a group' do expect(@subgroups).to be_a Gitlab::PaginatedResponse expect(@subgroups.size).to eq(1) expect(@subgroups[0].name).to eq('Foobar Group') end end describe '.edit_group' do context 'using group ID' do before do stub_put('/groups/1', 'group_edit').with(body: { description: 'An interesting group' }) @edited_project = Gitlab.edit_group(1, description: 'An interesting group') end it 'gets the correct resource' do expect(a_put('/groups/1').with(body: { description: 'An interesting group' })).to have_been_made end it 'returns information about an edited group' do expect(@edited_project.description).to eq('An interesting group') end end end end gitlab-4.8.0/spec/gitlab/client/issues_spec.rb000066400000000000000000000220111341107427500213110ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.issues' do context 'with project ID passed' do before do stub_get('/projects/3/issues', 'project_issues') @issues = Gitlab.issues(3) end it 'gets the correct resource' do expect(a_get('/projects/3/issues')).to have_been_made end it "returns a paginated response of project's issues" do expect(@issues).to be_a Gitlab::PaginatedResponse expect(@issues.first.project_id).to eq(3) end end context 'with literal project ID passed' do before do stub_get('/projects/gitlab-org%2Fgitlab-ce/issues', 'project_issues') @issues = Gitlab.issues('gitlab-org/gitlab-ce') end it 'gets the correct resource' do expect(a_get('/projects/gitlab-org%2Fgitlab-ce/issues')).to have_been_made end it "returns a paginated response of project's issues" do expect(@issues).to be_a Gitlab::PaginatedResponse expect(@issues.first.project_id).to eq(3) end end context 'without project ID passed' do before do stub_get('/issues', 'issues') @issues = Gitlab.issues end it 'gets the correct resource' do expect(a_get('/issues')).to have_been_made end it "returns a paginated response of user's issues" do expect(@issues).to be_a Gitlab::PaginatedResponse expect(@issues.first.closed).to be_falsey expect(@issues.first.author.name).to eq('John Smith') end end end describe '.issue' do before do stub_get('/projects/3/issues/33', 'issue') @issue = Gitlab.issue(3, 33) end it 'gets the correct resource' do expect(a_get('/projects/3/issues/33')).to have_been_made end it 'returns information about an issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.create_issue' do before do stub_post('/projects/3/issues', 'issue') @issue = Gitlab.create_issue(3, 'title') end it 'gets the correct resource' do expect(a_post('/projects/3/issues') .with(body: { title: 'title' })).to have_been_made end it 'returns information about a created issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.edit_issue' do before do stub_put('/projects/3/issues/33', 'issue') @issue = Gitlab.edit_issue(3, 33, title: 'title') end it 'gets the correct resource' do expect(a_put('/projects/3/issues/33') .with(body: { title: 'title' })).to have_been_made end it 'returns information about an edited issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.close_issue' do before do stub_put('/projects/3/issues/33', 'issue') @issue = Gitlab.close_issue(3, 33) end it 'gets the correct resource' do expect(a_put('/projects/3/issues/33') .with(body: { state_event: 'close' })).to have_been_made end it 'returns information about an closed issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.reopen_issue' do before do stub_put('/projects/3/issues/33', 'issue') @issue = Gitlab.reopen_issue(3, 33) end it 'gets the correct resource' do expect(a_put('/projects/3/issues/33') .with(body: { state_event: 'reopen' })).to have_been_made end it 'returns information about an reopened issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.subscribe_to_issue' do before do stub_post('/projects/3/issues/33/subscribe', 'issue') @issue = Gitlab.subscribe_to_issue(3, 33) end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/subscribe')).to have_been_made end it 'returns information about the subscribed issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.unsubscribe_from_issue' do before do stub_post('/projects/3/issues/33/unsubscribe', 'issue') @issue = Gitlab.unsubscribe_from_issue(3, 33) end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/unsubscribe')).to have_been_made end it 'returns information about the unsubscribed issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.delete_issue' do before do stub_delete('/projects/3/issues/33', 'issue') @issue = Gitlab.delete_issue(3, 33) end it 'gets the correct resource' do expect(a_delete('/projects/3/issues/33')).to have_been_made end it 'returns information about a deleted issue' do expect(@issue.project_id).to eq(3) expect(@issue.id).to eq(33) end end describe '.move_issue' do before do stub_post('/projects/3/issues/33/move', 'issue') @issue = Gitlab.move_issue(3, 33, to_project_id: '4') end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/move') .with(body: { to_project_id: '4' })).to have_been_made end it 'returns information about the moved issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.estimate_time_of_issue' do before do stub_post('/projects/3/issues/33/time_estimate', 'issue') @issue = Gitlab.estimate_time_of_issue(3, 33, '3h30m') end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/time_estimate') .with(body: { duration: '3h30m' })).to have_been_made end it 'returns information about the estimated issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.reset_time_estimate_of_issue' do before do stub_post('/projects/3/issues/33/reset_time_estimate', 'issue') @issue = Gitlab.reset_time_estimate_of_issue(3, 33) end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/reset_time_estimate')).to have_been_made end it 'returns information about the estimated issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.add_time_spent_on_issue' do before do stub_post('/projects/3/issues/33/add_spent_time', 'issue') @issue = Gitlab.add_time_spent_on_issue(3, 33, '3h30m') end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/add_spent_time') .with(body: { duration: '3h30m' })).to have_been_made end it 'returns information about the estimated issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.reset_time_spent_on_issue' do before do stub_post('/projects/3/issues/33/reset_spent_time', 'issue') @issue = Gitlab.reset_time_spent_on_issue(3, 33) end it 'gets the correct resource' do expect(a_post('/projects/3/issues/33/reset_spent_time')).to have_been_made end it 'returns information about the estimated issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.time_stats_for_issue' do before do stub_get('/projects/3/issues/33/time_stats', 'issue') @issue = Gitlab.time_stats_for_issue(3, 33) end it 'gets the correct resource' do expect(a_get('/projects/3/issues/33/time_stats')).to have_been_made end it 'returns information about the issue' do expect(@issue.project_id).to eq(3) expect(@issue.assignee.name).to eq('Jack Smith') end end describe '.participants_on_issue' do before do stub_get('/projects/3/issues/33/participants', 'participants_on_issue') @participants = Gitlab.participants_on_issue(3, 33) end it 'gets the correct resource' do expect(a_get('/projects/3/issues/33/participants')).to have_been_made end it 'returns information about the participants on issue' do expect(@participants.first.name).to eq('John Doe1') expect(@participants.size).to eq(2) end end describe '.merge_requests_closing_issue_on_merge' do before do stub_get('/projects/3/issues/33/closed_by', 'merge_requests_closing_issue_on_merge') @merge_requests = Gitlab.merge_requests_closing_issue_on_merge(3, 33) end it 'gets the correct resource' do expect(a_get('/projects/3/issues/33/closed_by')).to have_been_made end it 'returns list of merge requests closing issue on merge' do expect(@merge_requests.first.title).to eq('New feature') expect(@merge_requests.size).to eq(2) end end end gitlab-4.8.0/spec/gitlab/client/jobs_spec.rb000066400000000000000000000074011341107427500207410ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.jobs' do before do stub_get('/projects/1/jobs', 'jobs') @projects = Gitlab.jobs(1) end it 'gets the correct resource' do expect(a_get('/projects/1/jobs')).to have_been_made end end describe '.jobs - with scopes' do before do stub_get('/projects/1/jobs?scope[]=created&scope[]=running', 'jobs') @projects = Gitlab.jobs(1, scope: %w[created running]) end it 'gets the correct resource' do expect(a_get('/projects/1/jobs?scope[]=created&scope[]=running')).to have_been_made end end describe '.pipeline_jobs' do before do stub_get('/projects/1/pipelines/1/jobs', 'pipeline_jobs') @projects = Gitlab.pipeline_jobs(1, 1) end it 'gets the correct resource' do expect(a_get('/projects/1/pipelines/1/jobs')).to have_been_made end end describe '.pipeline_jobs - with scope' do before do stub_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created', 'pipeline_jobs') @projects = Gitlab.pipeline_jobs(1, 1, scope: %w[running created]) end it 'gets the correct resource' do expect(a_get('/projects/1/pipelines/1/jobs?scope[]=running&scope[]=created')).to have_been_made end end describe '.job' do before do stub_get('/projects/1/jobs/1', 'job') @projects = Gitlab.job(1, 1) end it 'gets the correct resource' do expect(a_get('/projects/1/jobs/1')).to have_been_made end end describe '.job_artifacts' do before do stub_get('/projects/1/jobs/1/artifacts', 'job') @projects = Gitlab.job_artifacts(1, 1) end it 'gets the correct resource' do expect(a_get('/projects/1/jobs/1/artifacts')).to have_been_made end end describe '.job_artifacts_download' do before do stub_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build', 'job') @projects = Gitlab.job_artifacts_download(1, 'master', 'Release Build') end it 'gets the correct resource' do expect(a_get('/projects/1/jobs/artifacts/master/download?job=Release%20Build')).to have_been_made end end describe '.job_trace' do before do stub_get('/projects/1/jobs/1/trace', 'job_trace') @projects = Gitlab.job_trace(1, 1) end it 'gets the correct resource' do expect(a_get('/projects/1/jobs/1/trace')).to have_been_made end end describe '.job_cancel' do before do stub_post('/projects/1/jobs/1/cancel', 'job') @projects = Gitlab.job_cancel(1, 1) end it 'gets the correct resource' do expect(a_post('/projects/1/jobs/1/cancel')).to have_been_made end end describe '.job_retry' do before do stub_post('/projects/1/jobs/1/retry', 'job') @projects = Gitlab.job_retry(1, 1) end it 'gets the correct resource' do expect(a_post('/projects/1/jobs/1/retry')).to have_been_made end end describe '.job_erase' do before do stub_post('/projects/1/jobs/1/erase', 'job') @projects = Gitlab.job_erase(1, 1) end it 'gets the correct resource' do expect(a_post('/projects/1/jobs/1/erase')).to have_been_made end end describe '.job_play' do before do stub_post('/projects/1/jobs/1/play', 'job') @projects = Gitlab.job_play(1, 1) end it 'gets the correct resource' do expect(a_post('/projects/1/jobs/1/play')).to have_been_made end end describe '.job_artifacts_keep' do before do stub_post('/projects/1/jobs/1/artifacts/keep', 'job') @projects = Gitlab.job_artifacts_keep(1, 1) end it 'gets the correct resource' do expect(a_post('/projects/1/jobs/1/artifacts/keep')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/keys_spec.rb000066400000000000000000000006461341107427500207630ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.key' do before do stub_get('/keys/1', 'key') @key = Gitlab.key(1) end it 'gets the correct resource' do expect(a_get('/keys/1')).to have_been_made end it 'returns information about a key' do expect(@key.id).to eq(1) expect(@key.title).to eq('narkoz@helium') end end end gitlab-4.8.0/spec/gitlab/client/labels_spec.rb000066400000000000000000000053731341107427500212540ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.labels' do before do stub_get('/projects/3/labels', 'labels') @labels = Gitlab.labels(3) end it 'gets the correct resource' do expect(a_get('/projects/3/labels')).to have_been_made end it "returns a paginated response of project's labels" do expect(@labels).to be_a Gitlab::PaginatedResponse expect(@labels.first.name).to eq('Backlog') end end describe '.delete' do before do stub_delete('/projects/3/labels', 'label') @label = Gitlab.delete_label(3, 'Backlog') end it 'gets the correct resource' do expect(a_delete('/projects/3/labels') .with(body: { name: 'Backlog' })).to have_been_made end it 'returns information about a deleted snippet' do expect(@label.name).to eq('Backlog') end end describe '.edit_label' do before do stub_put('/projects/3/labels', 'label') @label = Gitlab.edit_label(3, 'TODO', new_name: 'Backlog') end it 'gets the correct resource' do expect(a_put('/projects/3/labels') .with(body: { name: 'TODO', new_name: 'Backlog' })).to have_been_made end it 'returns information about an edited label' do expect(@label.name).to eq('Backlog') end end describe '.create_label' do before do stub_post('/projects/3/labels', 'label') @label = Gitlab.create_label(3, 'Backlog', '#DD10AA') end it 'gets the correct resource' do expect(a_post('/projects/3/labels') .with(body: { name: 'Backlog', color: '#DD10AA' })).to have_been_made end it 'returns information about a created label' do expect(@label.name).to eq('Backlog') expect(@label.color).to eq('#DD10AA') end end describe '.subscribe_to_label' do before do stub_post('/projects/3/labels/Backlog/subscribe', 'label') @label = Gitlab.subscribe_to_label(3, 'Backlog') end it 'gets the correct resource' do expect(a_post('/projects/3/labels/Backlog/subscribe')).to have_been_made end it 'returns information about the label subscribed to' do expect(@label.name).to eq('Backlog') expect(@label.subscribed).to eq(true) end end describe '.unsubscribe_from_label' do before do stub_post('/projects/3/labels/Backlog/unsubscribe', 'label_unsubscribe') @label = Gitlab.unsubscribe_from_label(3, 'Backlog') end it 'gets the correct resource' do expect(a_post('/projects/3/labels/Backlog/unsubscribe')).to have_been_made end it 'returns information about the label subscribed to' do expect(@label.name).to eq('Backlog') expect(@label.subscribed).to eq(false) end end end gitlab-4.8.0/spec/gitlab/client/merge_request_approvals_spec.rb000066400000000000000000000131031341107427500247360ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.project_merge_request_approvals' do before do stub_get('/projects/1/approvals', 'project_merge_request_approvals') @project_mr_approvals = Gitlab.project_merge_request_approvals(1) end it 'gets the correct resource' do expect(a_get('/projects/1/approvals')).to have_been_made end it 'returns the correct objectified hash' do expect(@project_mr_approvals).to be_a Gitlab::ObjectifiedHash end end describe '.edit_project_merge_request_approvals' do before do body = { approvals_before_merge: '3', reset_approvals_on_push: 'false', disable_overriding_approvers_per_merge_request: 'true' } stub_post('/projects/1/approvals', 'project_merge_request_approvals').with(body: body) @project_mr_approvals = Gitlab.edit_project_merge_request_approvals(1, approvals_before_merge: 3, reset_approvals_on_push: false, disable_overriding_approvers_per_merge_request: true) end it 'gets the correct resource' do body = { approvals_before_merge: '3', reset_approvals_on_push: 'false', disable_overriding_approvers_per_merge_request: 'true' } expect(a_post('/projects/1/approvals') .with(body: body)).to have_been_made end it 'returns the correct updated configuration' do expect(@project_mr_approvals).to be_a Gitlab::ObjectifiedHash expect(@project_mr_approvals.approvals_before_merge).to eq 3 expect(@project_mr_approvals.reset_approvals_on_push).to eq false expect(@project_mr_approvals.disable_overriding_approvers_per_merge_request).to eq true end end describe '.edit_project_approvers' do before do body = { "approver_ids": ['5'], "approver_group_ids": ['1'] } stub_put('/projects/1/approvals', 'project_merge_request_approvals').with(body: body) @project_mr_approvals = Gitlab.edit_project_approvers(1, approver_ids: [5], approver_group_ids: [1]) end it 'gets the correct resource' do body = { "approver_ids": ['5'], "approver_group_ids": ['1'] } expect(a_put('/projects/1/approvals') .with(body: body)).to have_been_made end it 'returns the correct updated configuration' do expect(@project_mr_approvals).to be_a Gitlab::ObjectifiedHash expect(@project_mr_approvals.approvers.map { |approver| approver['user']['id'] }).to eq [5] expect(@project_mr_approvals.approver_groups.map { |approver_group| approver_group['group']['id'] }).to eq [1] end end describe '.merge_request_approvals' do before do stub_get('/projects/1/merge_requests/5/approvals', 'merge_request_approvals') @merge_request_approvals = Gitlab.merge_request_approvals(1, 5) end it 'gets the correct resource' do expect(a_get('/projects/1/merge_requests/5/approvals')).to have_been_made end it 'returns the correct objectified hash' do expect(@merge_request_approvals).to be_a Gitlab::ObjectifiedHash expect(@merge_request_approvals.project_id).to eq 1 expect(@merge_request_approvals.iid).to eq 5 end end describe '.edit_merge_request_approvals' do before do body = { approvals_required: '2' } stub_post('/projects/1/merge_requests/5/approvals', 'merge_request_approvals').with(body: body) @merge_request_approvals = Gitlab.edit_merge_request_approvals(1, 5, approvals_required: 2) end it 'gets the correct resource' do body = { approvals_required: '2' } expect(a_post('/projects/1/merge_requests/5/approvals').with(body: body)).to have_been_made end it 'returns the correct objectified hash' do expect(@merge_request_approvals).to be_a Gitlab::ObjectifiedHash expect(@merge_request_approvals.approvals_required).to eq 2 end end describe '.edit_merge_request_approvers' do before do body = { "approver_ids": ['1'], "approver_group_ids": ['5'] } stub_put('/projects/1/merge_requests/5/approvals', 'merge_request_approvals').with(body: body) @merge_request_approvals = Gitlab.edit_merge_request_approvers(1, 5, approver_ids: [1], approver_group_ids: [5]) end it 'gets the correct resource' do body = { "approver_ids": ['1'], "approver_group_ids": ['5'] } expect(a_put('/projects/1/merge_requests/5/approvals') .with(body: body)).to have_been_made end it 'returns the correct updated configuration' do expect(@merge_request_approvals).to be_a Gitlab::ObjectifiedHash expect(@merge_request_approvals.approvers.map { |approver| approver['user']['id'] }).to eq [1] expect(@merge_request_approvals.approver_groups.map { |approver_group| approver_group['group']['id'] }).to eq [5] end end describe '.approve_merge_request' do before do stub_post('/projects/1/merge_requests/5/approve', 'merge_request_approvals') @merge_request_approvals = Gitlab.approve_merge_request(1, 5) end it 'gets the correct resource' do expect(a_post('/projects/1/merge_requests/5/approve')).to have_been_made end it 'returns the correct updated configuration' do expect(@merge_request_approvals).to be_a Gitlab::ObjectifiedHash expect(@merge_request_approvals.merge_status).to eq 'can_be_merged' end end describe '.unapprove_merge_request' do before do stub_post('/projects/1/merge_requests/5/unapprove', 'merge_request_approvals') @merge_request_approvals = Gitlab.unapprove_merge_request(1, 5) end it 'gets the correct resource' do expect(a_post('/projects/1/merge_requests/5/unapprove')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/merge_requests_spec.rb000066400000000000000000000323501341107427500230370ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.user_merge_requests' do before do stub_get('/merge_requests', 'merge_requests') @user_merge_requests = Gitlab.user_merge_requests end it 'gets the correct resource' do expect(a_get('/merge_requests')).to have_been_made end it 'returns a paginated response of user merge requests' do expect(@user_merge_requests).to be_a Gitlab::PaginatedResponse end end describe '.merge_requests' do before do stub_get('/projects/3/merge_requests', 'merge_requests') @merge_requests = Gitlab.merge_requests(3) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests')).to have_been_made end it "returns a paginated response of project's merge requests" do expect(@merge_requests).to be_a Gitlab::PaginatedResponse expect(@merge_requests.first.project_id).to eq(3) end end describe '.merge_request' do before do stub_get('/projects/3/merge_requests/1', 'merge_request') @merge_request = Gitlab.merge_request(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/1')).to have_been_made end it 'returns information about a merge request' do expect(@merge_request.project_id).to eq(3) expect(@merge_request.assignee.name).to eq('Jack Smith') end end describe '.merge_request_pipelines' do before do stub_get('/projects/3/merge_requests/1/pipelines', 'pipelines') @pipelines = Gitlab.merge_request_pipelines(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/1/pipelines')).to have_been_made end it 'returns information about all pipelines in merge request' do expect(@pipelines.first.id).to eq(47) expect(@pipelines.first.status).to eq('pending') end end describe '.create_merge_request' do before do stub_post('/projects/3/merge_requests', 'merge_request') end it 'returns information about a merge request' do @merge_request = Gitlab.create_merge_request(3, 'New feature', source_branch: 'api', target_branch: 'master') expect(@merge_request.project_id).to eq(3) expect(@merge_request.assignee.name).to eq('Jack Smith') end end describe '.update_merge_request' do before do stub_put('/projects/3/merge_requests/2', 'merge_request') .with(body: { assignee_id: '1', target_branch: 'master', title: 'A different new feature' }) @merge_request = Gitlab.update_merge_request(3, 2, assignee_id: '1', target_branch: 'master', title: 'A different new feature') end it 'gets the correct resource' do expect(a_put('/projects/3/merge_requests/2') .with(body: { assignee_id: '1', target_branch: 'master', title: 'A different new feature' })).to have_been_made end it 'returns information about a merge request' do expect(@merge_request.project_id).to eq(3) expect(@merge_request.assignee.name).to eq('Jack Smith') end end describe '.accept_merge_request' do before do stub_put('/projects/5/merge_requests/42/merge', 'merge_request') .with(body: { merge_commit_message: 'Nice!' }) @merge_request = Gitlab.accept_merge_request(5, 42, merge_commit_message: 'Nice!') end it 'gets the correct resource' do expect(a_put('/projects/5/merge_requests/42/merge') .with(body: { merge_commit_message: 'Nice!' })).to have_been_made end it 'returns information about merged merge request' do expect(@merge_request.project_id).to eq(3) expect(@merge_request.assignee.name).to eq('Jack Smith') end end describe '.merge_request_comments' do before do stub_get('/projects/3/merge_requests/2/notes', 'merge_request_comments') @merge_request = Gitlab.merge_request_comments(3, 2) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/2/notes')).to have_been_made end it "returns merge request's comments" do expect(@merge_request).to be_an Gitlab::PaginatedResponse expect(@merge_request.length).to eq(2) expect(@merge_request[0].note).to eq('this is the 1st comment on the 2merge merge request') expect(@merge_request[0].author.id).to eq(11) expect(@merge_request[1].note).to eq('another discussion point on the 2merge request') expect(@merge_request[1].author.id).to eq(12) end end describe '.create_merge_request_comment' do before do stub_post('/projects/3/merge_requests/2/notes', 'merge_request_comment') @merge_request = Gitlab.create_merge_request_comment(3, 2, 'Cool Merge Request!') end it 'gets the correct resource' do expect(a_post('/projects/3/merge_requests/2/notes')).to have_been_made end it 'returns information about a merge request' do expect(@merge_request.note).to eq('Cool Merge Request!') expect(@merge_request.author.id).to eq(1) end end describe '.merge_request_changes' do before do stub_get('/projects/3/merge_requests/2/changes', 'merge_request_changes') @mr_changes = Gitlab.merge_request_changes(3, 2) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/2/changes')).to have_been_made end it 'returns the merge request changes' do expect(@mr_changes.changes).to be_a Array expect(@mr_changes.changes.first['old_path']).to eq('lib/omniauth/builder.rb') expect(@mr_changes.id).to eq(2) expect(@mr_changes.project_id).to eq(3) expect(@mr_changes.source_branch).to eq('uncovered') expect(@mr_changes.target_branch).to eq('master') end end describe '.merge_request_commits' do before do stub_get('/projects/3/merge_requests/2/commits', 'merge_request_commits') @mr_commits = Gitlab.merge_request_commits(3, 2) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/2/commits')).to have_been_made end it 'returns the merge request commits' do expect(@mr_commits).to be_a Gitlab::PaginatedResponse expect(@mr_commits.size).to eq 2 expect(@mr_commits.first.id).to eq 'a2da7552f26d5b46a6a09bb8b7b066e3a102be7d' expect(@mr_commits.first.short_id).to eq 'a2da7552' expect(@mr_commits.first.title).to eq 'piyo' expect(@mr_commits.first.author_name).to eq 'example' expect(@mr_commits.first.author_email).to eq 'example@example.com' expect(@mr_commits[1].short_id).to eq '3ce50959' expect(@mr_commits[1].title).to eq 'hoge' end end describe '.merge_request_closes_issues' do before do stub_get('/projects/5/merge_requests/1/closes_issues', 'merge_request_closes_issues') @issues = Gitlab.merge_request_closes_issues(5, 1) end it 'gets the correct resource' do expect(a_get('/projects/5/merge_requests/1/closes_issues')).to have_been_made end it 'returns a paginated response of the issues the merge_request will close' do expect(@issues).to be_a(Gitlab::PaginatedResponse) expect(@issues.first.title).to eq('Merge request 1 issue 1') expect(@issues.size).to eq(2) end end describe '.subscribe_to_merge_request' do before do stub_post('/projects/3/merge_requests/2/subscribe', 'merge_request') @merge_request = Gitlab.subscribe_to_merge_request(3, 2) end it 'gets the correct resource' do expect(a_post('/projects/3/merge_requests/2/subscribe')).to have_been_made end it 'returns information about a merge request' do expect(@merge_request.project_id).to eq(3) end end describe '.unsubscribe_from_merge_request' do before do stub_post('/projects/3/merge_requests/2/unsubscribe', 'merge_request') @merge_request = Gitlab.unsubscribe_from_merge_request(3, 2) end it 'gets the correct resource' do expect(a_post('/projects/3/merge_requests/2/unsubscribe')).to have_been_made end it 'returns information about a merge request' do expect(@merge_request.project_id).to eq(3) end end describe '.merge_request_discussions' do before do stub_get('/projects/3/merge_requests/2/discussions', 'merge_request_discussions') @discussions = Gitlab.merge_request_discussions(3, 2) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/2/discussions')).to have_been_made end it 'returns information about the discussions' do expect(@discussions.length).to eq(1) expect(@discussions.first.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705') end end describe '.merge_request_discussion' do before do stub_get('/projects/3/merge_requests/2/discussions/1', 'merge_request_discussion') @discussion = Gitlab.merge_request_discussion(3, 2, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/2/discussions/1')).to have_been_made end it 'returns information about the discussions' do expect(@discussion.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705') end end describe '.create_merge_request_discussion' do before do stub_post('/projects/3/merge_requests/2/discussions', 'merge_request_discussion') @discussion = Gitlab.create_merge_request_discussion(3, 2, body: 'Discussion', position: { old_line: 1 }) end it 'posts the correct resource' do expect(a_post('/projects/3/merge_requests/2/discussions') .with(body: 'body=Discussion&position[old_line]=1')).to have_been_made end it 'returns information about the discussions' do expect(@discussion.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705') end end describe '.resolve_merge_request_discussion' do before do stub_put('/projects/3/merge_requests/2/discussions/1', 'merge_request_discussion') @discussion = Gitlab.resolve_merge_request_discussion(3, 2, 1, resolved: true) end it 'puts the correct resource' do expect(a_put('/projects/3/merge_requests/2/discussions/1') .with(body: 'resolved=true')).to have_been_made end it 'returns information about the discussions' do expect(@discussion.id).to eq('7d66bf19bf835e6a4666130544ba1b5c343fc705') note = @discussion.notes.first expect(note['id']).to eq(1758) end end describe '.create_merge_request_discussion_note' do before do stub_post('/projects/3/merge_requests/2/discussions/1/notes', 'merge_request_discussion_note') @note = Gitlab.create_merge_request_discussion_note(3, 2, 1, body: 'note') end it 'posts the correct resource' do expect(a_post('/projects/3/merge_requests/2/discussions/1/notes') .with(body: 'body=note')).to have_been_made end it 'returns information about the note' do expect(@note.id).to eq(1775) end end describe '.update_merge_request_discussion_note' do before do stub_put('/projects/3/merge_requests/2/discussions/1/notes/1', 'merge_request_discussion_note') @note = Gitlab.update_merge_request_discussion_note(3, 2, 1, 1, body: 'note2') end it 'puts the correct resource' do expect(a_put('/projects/3/merge_requests/2/discussions/1/notes/1') .with(body: 'body=note2')).to have_been_made end it 'returns information about the note' do expect(@note.id).to eq(1775) end end describe '.delete_merge_request_discussion_note' do before do stub_request(:delete, 'https://api.example.com/projects/3/merge_requests/2/discussions/1/notes/1').to_return(body: '') @note = Gitlab.delete_merge_request_discussion_note(3, 2, 1, 1) end it 'deletes the correct resource' do expect(a_delete('/projects/3/merge_requests/2/discussions/1/notes/1')).to have_been_made end it 'returns nothing' do expect(@note).to be_falsy end end describe '.merge_request_diff_versions' do before do stub_get('/projects/3/merge_requests/105/versions', 'merge_request_diff_versions') @versions = Gitlab.merge_request_diff_versions(3, 105) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/105/versions')).to have_been_made end it 'returns an array of the versions' do expect(@versions.length).to eq(2) expect(@versions.first.head_commit_sha).to eq('33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30') end end describe '.merge_request_diff_version' do before do stub_get('/projects/3/merge_requests/105/versions/1', 'merge_request_diff_version') @diff = Gitlab.merge_request_diff_version(3, 105, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/105/versions/1')).to have_been_made end it 'returns diff, with array of diffs in version' do expect(@diff.diffs).to be_a Array expect(@diff.diffs.first['old_path']).to eq('LICENSE') end end end gitlab-4.8.0/spec/gitlab/client/milestones_spec.rb000066400000000000000000000061321341107427500221660ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.milestones' do before do stub_get('/projects/3/milestones', 'milestones') @milestones = Gitlab.milestones(3) end it 'gets the correct resource' do expect(a_get('/projects/3/milestones')).to have_been_made end it "returns a paginated response of project's milestones" do expect(@milestones).to be_a Gitlab::PaginatedResponse expect(@milestones.first.project_id).to eq(3) end end describe '.milestone' do before do stub_get('/projects/3/milestones/1', 'milestone') @milestone = Gitlab.milestone(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/milestones/1')).to have_been_made end it 'returns information about a milestone' do expect(@milestone.project_id).to eq(3) end end describe '.milestone_issues' do before do stub_get('/projects/3/milestones/1/issues', 'milestone_issues') @milestone_issues = Gitlab.milestone_issues(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/milestones/1/issues')).to have_been_made end it "returns a paginated response of milestone's issues" do expect(@milestone_issues).to be_a Gitlab::PaginatedResponse expect(@milestone_issues.first.milestone.id).to eq(1) end end describe '.milestone_merge_requests' do before do stub_get('/projects/3/milestones/1/merge_requests', 'milestone_merge_requests') @milestone_merge_requests = Gitlab.milestone_merge_requests(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/milestones/1/merge_requests')).to have_been_made end it "returns a paginated response of milestone's merge_requests" do expect(@milestone_merge_requests).to be_a Gitlab::PaginatedResponse expect(@milestone_merge_requests.first.milestone.id).to eq(1) end end describe '.create_milestone' do before do stub_post('/projects/3/milestones', 'milestone') @milestone = Gitlab.create_milestone(3, 'title') end it 'gets the correct resource' do expect(a_post('/projects/3/milestones') .with(body: { title: 'title' })).to have_been_made end it 'returns information about a created milestone' do expect(@milestone.project_id).to eq(3) end end describe '.edit_milestone' do before do stub_put('/projects/3/milestones/33', 'milestone') @milestone = Gitlab.edit_milestone(3, 33, title: 'title') end it 'gets the correct resource' do expect(a_put('/projects/3/milestones/33') .with(body: { title: 'title' })).to have_been_made end it 'returns information about an edited milestone' do expect(@milestone.project_id).to eq(3) end end describe '.delete_milestone' do before do stub_delete('/projects/3/milestones/33', 'empty') @milestone = Gitlab.delete_milestone(3, 33) end it 'gets the correct resource' do expect(a_delete('/projects/3/milestones/33')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/namespaces_spec.rb000066400000000000000000000011251341107427500221200ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :namespaces } describe '.namespaces' do before do stub_get('/namespaces', 'namespaces') @namespaces = Gitlab.namespaces end it 'gets the correct resource' do expect(a_get('/namespaces')).to have_been_made end it 'returns a paginated response of namespaces' do expect(@namespaces).to be_a Gitlab::PaginatedResponse expect(@namespaces.first.path).to eq('john') expect(@namespaces.first.kind).to eq('user') end end end gitlab-4.8.0/spec/gitlab/client/notes_spec.rb000066400000000000000000000236151341107427500211410ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe 'notes' do context 'when wall notes' do before do stub_get('/projects/3/notes', 'notes') @notes = Gitlab.notes(3) end it 'gets the correct resource' do expect(a_get('/projects/3/notes')).to have_been_made end it 'returns a paginated response of notes' do expect(@notes).to be_a Gitlab::PaginatedResponse expect(@notes.first.author.name).to eq('John Smith') end end context 'when issue notes' do before do stub_get('/projects/3/issues/7/notes', 'notes') @notes = Gitlab.issue_notes(3, 7) end it 'gets the correct resource' do expect(a_get('/projects/3/issues/7/notes')).to have_been_made end it 'returns a paginated response of notes' do expect(@notes).to be_a Gitlab::PaginatedResponse expect(@notes.first.author.name).to eq('John Smith') end end context 'when snippet notes' do before do stub_get('/projects/3/snippets/7/notes', 'notes') @notes = Gitlab.snippet_notes(3, 7) end it 'gets the correct resource' do expect(a_get('/projects/3/snippets/7/notes')).to have_been_made end it 'returns a paginated response of notes' do expect(@notes).to be_a Gitlab::PaginatedResponse expect(@notes.first.author.name).to eq('John Smith') end end context 'when merge_request notes' do before do stub_get('/projects/3/merge_requests/7/notes', 'notes') @notes = Gitlab.merge_request_notes(3, 7) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/7/notes')).to have_been_made end it 'returns a paginated response of notes' do expect(@notes).to be_a Gitlab::PaginatedResponse expect(@notes.first.author.name).to eq('John Smith') end end end describe 'note' do context 'when wall note' do before do stub_get('/projects/3/notes/1201', 'note') @note = Gitlab.note(3, 1201) end it 'gets the correct resource' do expect(a_get('/projects/3/notes/1201')).to have_been_made end it 'returns information about a note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end context 'when issue note' do before do stub_get('/projects/3/issues/7/notes/1201', 'note') @note = Gitlab.issue_note(3, 7, 1201) end it 'gets the correct resource' do expect(a_get('/projects/3/issues/7/notes/1201')).to have_been_made end it 'returns information about a note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end context 'when snippet note' do before do stub_get('/projects/3/snippets/7/notes/1201', 'note') @note = Gitlab.snippet_note(3, 7, 1201) end it 'gets the correct resource' do expect(a_get('/projects/3/snippets/7/notes/1201')).to have_been_made end it 'returns information about a note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end context 'when merge request note' do before do stub_get('/projects/3/merge_requests/7/notes/1201', 'note') @note = Gitlab.merge_request_note(3, 7, 1201) end it 'gets the correct resource' do expect(a_get('/projects/3/merge_requests/7/notes/1201')).to have_been_made end it 'returns information about a note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end end describe 'create note' do context 'when wall note' do before do stub_post('/projects/3/notes', 'note') @note = Gitlab.create_note(3, 'The solution is rather tricky') end it 'gets the correct resource' do expect(a_post('/projects/3/notes') .with(body: { body: 'The solution is rather tricky' })).to have_been_made end it 'returns information about a created note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end context 'when issue note' do before do stub_post('/projects/3/issues/7/notes', 'note') @note = Gitlab.create_issue_note(3, 7, 'The solution is rather tricky') end it 'gets the correct resource' do expect(a_post('/projects/3/issues/7/notes') .with(body: { body: 'The solution is rather tricky' })).to have_been_made end it 'returns information about a created note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end context 'when snippet note' do before do stub_post('/projects/3/snippets/7/notes', 'note') @note = Gitlab.create_snippet_note(3, 7, 'The solution is rather tricky') end it 'gets the correct resource' do expect(a_post('/projects/3/snippets/7/notes') .with(body: { body: 'The solution is rather tricky' })).to have_been_made end it 'returns information about a created note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end context 'when merge_request note' do before do stub_post('/projects/3/merge_requests/7/notes', 'note') @note = Gitlab.create_merge_request_note(3, 7, 'The solution is rather tricky') end it 'gets the correct resource' do expect(a_post('/projects/3/merge_requests/7/notes') .with(body: { body: 'The solution is rather tricky' })).to have_been_made end it 'returns information about a created note' do expect(@note.body).to eq('The solution is rather tricky') expect(@note.author.name).to eq('John Smith') end end end describe 'delete note' do context 'when wall note' do before do stub_delete('/projects/3/notes/1201', 'note') @note = Gitlab.delete_note(3, 1201) end it 'gets the correct resource' do expect(a_delete('/projects/3/notes/1201')).to have_been_made end it 'returns information about a deleted note' do expect(@note.id).to eq(1201) end end context 'when issue note' do before do stub_delete('/projects/3/issues/7/notes/1201', 'note') @note = Gitlab.delete_issue_note(3, 7, 1201) end it 'gets the correct resource' do expect(a_delete('/projects/3/issues/7/notes/1201')).to have_been_made end it 'returns information about a deleted issue note' do expect(@note.id).to eq(1201) end end context 'when snippet note' do before do stub_delete('/projects/3/snippets/7/notes/1201', 'note') @note = Gitlab.delete_snippet_note(3, 7, 1201) end it 'gets the correct resource' do expect(a_delete('/projects/3/snippets/7/notes/1201')).to have_been_made end it 'returns information about a deleted snippet note' do expect(@note.id).to eq(1201) end end context 'when merge request note' do before do stub_delete('/projects/3/merge_requests/7/notes/1201', 'note') @note = Gitlab.delete_merge_request_note(3, 7, 1201) end it 'gets the correct resource' do expect(a_delete('/projects/3/merge_requests/7/notes/1201')).to have_been_made end it 'returns information about a deleted merge request note' do expect(@note.id).to eq(1201) end end end describe 'modify note' do context 'when wall note' do before do stub_put('/projects/3/notes/1201', 'note') @note = Gitlab.edit_note(3, 1201, 'edited wall note content') end it 'gets the correct resource' do expect(a_put('/projects/3/notes/1201') .with(body: { body: 'edited wall note content' })).to have_been_made end it 'returns information about a modified note' do expect(@note.id).to eq(1201) end end context 'when issue note' do before do stub_put('/projects/3/issues/7/notes/1201', 'note') @note = Gitlab.edit_issue_note(3, 7, 1201, 'edited issue note content') end it 'gets the correct resource' do expect(a_put('/projects/3/issues/7/notes/1201') .with(body: { body: 'edited issue note content' })).to have_been_made end it 'returns information about a modified issue note' do expect(@note.id).to eq(1201) end end context 'when snippet note' do before do stub_put('/projects/3/snippets/7/notes/1201', 'note') @note = Gitlab.edit_snippet_note(3, 7, 1201, 'edited snippet note content') end it 'gets the correct resource' do expect(a_put('/projects/3/snippets/7/notes/1201') .with(body: { body: 'edited snippet note content' })).to have_been_made end it 'returns information about a modified snippet note' do expect(@note.id).to eq(1201) end end context 'when merge request note' do before do stub_put('/projects/3/merge_requests/7/notes/1201', 'note') @note = Gitlab.edit_merge_request_note(3, 7, 1201, 'edited merge request note content') end it 'gets the correct resource' do expect(a_put('/projects/3/merge_requests/7/notes/1201') .with(body: { body: 'edited merge request note content' })).to have_been_made end it 'returns information about a modified request note' do expect(@note.id).to eq(1201) end end end end gitlab-4.8.0/spec/gitlab/client/pipeline_schedules_spec.rb000066400000000000000000000124021341107427500236450ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.pipeline_schedules' do before do stub_get('/projects/3/pipeline_schedules', 'pipeline_schedules') @pipeline_schedules = Gitlab.pipeline_schedules(3) end it 'gets the correct resource' do expect(a_get('/projects/3/pipeline_schedules')).to have_been_made end it "returns a response of project's pipeline schedules" do expect(@pipeline_schedules).to be_a Gitlab::PaginatedResponse end end describe '.pipeline_schedule' do before do stub_get('/projects/3/pipeline_schedules/5', 'pipeline_schedule') @pipeline_schedule = Gitlab.pipeline_schedule(3, 5) end it 'gets the correct resource' do expect(a_get('/projects/3/pipeline_schedules/5')).to have_been_made end it "returns a response of project's pipeline schedules" do expect(@pipeline_schedule).to be_a Gitlab::ObjectifiedHash end end describe '.create_pipeline_schedule' do before do stub_post('/projects/3/pipeline_schedules', 'pipeline_schedule_create') @pipeline_schedule_create = Gitlab.create_pipeline_schedule(3) end it 'gets the correct resource' do expect(a_post('/projects/3/pipeline_schedules')).to have_been_made end it 'returns a single pipeline schedule' do expect(@pipeline_schedule_create).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline schedule' do expect(@pipeline_schedule_create.owner.name).to eq('Administrator') end end describe '.edit_pipeline_schedule' do before do stub_put('/projects/3/pipeline_schedules/13', 'pipeline_schedule_update') @pipeline_schedule_update = Gitlab.edit_pipeline_schedule(3, 13) end it 'gets the correct resource' do expect(a_put('/projects/3/pipeline_schedules/13')).to have_been_made end it 'returns a single pipeline schedule' do expect(@pipeline_schedule_update).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline schedule' do expect(@pipeline_schedule_update.owner.name).to eq('Administrator') end end describe '.pipeline_schedule_take_ownership' do before do stub_post('/projects/3/pipeline_schedules/13/take_ownership', 'pipeline_schedule') @pipeline_schedule = Gitlab.pipeline_schedule_take_ownership(3, 13) end it 'gets the correct resource' do expect(a_post('/projects/3/pipeline_schedules/13/take_ownership')).to have_been_made end it 'returns information about the pipeline schedule' do expect(@pipeline_schedule.created_at).to eq('2017-05-19T13:31:08.849Z') expect(@pipeline_schedule.description).to eq('Test schedule pipeline') end end describe '.delete_pipeline_schedule' do before do stub_delete('/projects/3/pipeline_schedules/13', 'pipeline_schedule') @pipeline_schedule = Gitlab.delete_pipeline_schedule(3, 13) end it 'gets the correct resource' do expect(a_delete('/projects/3/pipeline_schedules/13')).to have_been_made end it 'returns a single pipeline' do expect(@pipeline_schedule).to be_a Gitlab::ObjectifiedHash end it 'returns information about the deleted pipeline' do # expect(@pipeline_schedule.id).to eq(13) end end describe '.create_pipeline_schedule_variable' do before do stub_post('/projects/3/pipeline_schedules/13/variables?key=NEW%20VARIABLE&value=new%20value', 'pipeline_schedule_variable') @pipeline_schedule_variable = Gitlab.create_pipeline_schedule_variable(3, 13, key: 'NEW VARIABLE', value: 'new value') end it 'gets the correct resource' do expect(a_post('/projects/3/pipeline_schedules/13/variables?key=NEW%20VARIABLE&value=new%20value')).to have_been_made end it 'returns a single variable' do expect(@pipeline_schedule_variable).to be_a Gitlab::ObjectifiedHash end it 'returns the created variable' do expect(@pipeline_schedule_variable.value).to eq('new value') end end describe '.edit_pipeline_schedule_variable' do before do stub_put('/projects/3/pipeline_schedules/13/variables/NEW%20VARIABLE?value=update%20value', 'pipeline_schedule_variable_update') @pipeline_schedule_variable = Gitlab.edit_pipeline_schedule_variable(3, 13, 'NEW VARIABLE', value: 'update value') end it 'returns a single variable' do expect(@pipeline_schedule_variable).to be_a Gitlab::ObjectifiedHash end it 'has the updated value' do expect(@pipeline_schedule_variable.value).to eq('update value') end end describe '.delete_pipeline_schedule_variable' do before do stub_delete('/projects/3/pipeline_schedules/13/variables/NEW%20VARIABLE', 'pipeline_schedule_variable') @pipeline_schedule_variable = Gitlab.delete_pipeline_schedule_variable(3, 13, 'NEW VARIABLE') end it 'returns a single variable' do expect(@pipeline_schedule_variable).to be_a Gitlab::ObjectifiedHash end it 'has the value of the deleted variable' do expect(@pipeline_schedule_variable.value).to eq('new value') end end end gitlab-4.8.0/spec/gitlab/client/pipeline_triggers_spec.rb000066400000000000000000000110731341107427500235170ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :delete_trigger } describe '.triggers' do before do stub_get('/projects/3/triggers', 'triggers') @triggers = Gitlab.triggers(3) end it 'gets the correct resource' do expect(a_get('/projects/3/triggers')).to have_been_made end it "returns an array of project's triggers" do expect(@triggers).to be_a Gitlab::PaginatedResponse expect(@triggers.first.token).to eq('6d056f63e50fe6f8c5f8f4aa10edb7') end end describe '.trigger' do before do stub_get('/projects/3/triggers/10', 'trigger') @trigger = Gitlab.trigger(3, 10) end it 'gets the correct resource' do expect(a_get('/projects/3/triggers/10')).to have_been_made end it 'returns information about a trigger' do expect(@trigger.created_at).to eq('2016-01-07T09:53:58.235Z') expect(@trigger.token).to eq('6d056f63e50fe6f8c5f8f4aa10edb7') end end describe '.create_trigger' do before do stub_post('/projects/3/triggers', 'trigger') @trigger = Gitlab.create_trigger(3, 'my description') end it 'gets the correct resource' do expect(a_post('/projects/3/triggers') .with(body: { description: 'my description' })).to have_been_made end it 'returns information about a new trigger' do expect(@trigger.created_at).to eq('2016-01-07T09:53:58.235Z') expect(@trigger.token).to eq('6d056f63e50fe6f8c5f8f4aa10edb7') end end describe '.update_trigger' do before do stub_put('/projects/3/triggers/1', 'trigger') @trigger = Gitlab.update_trigger(3, 1, description: 'my description') end it 'gets the correct resource' do expect(a_put('/projects/3/triggers/1') .with(body: { description: 'my description' })).to have_been_made end it 'returns information about the trigger' do expect(@trigger.created_at).to eq('2016-01-07T09:53:58.235Z') expect(@trigger.token).to eq('6d056f63e50fe6f8c5f8f4aa10edb7') end end describe '.trigger_take_ownership' do before do stub_post('/projects/3/triggers/1/take_ownership', 'trigger') @trigger = Gitlab.trigger_take_ownership(3, 1) end it 'gets the correct resource' do expect(a_post('/projects/3/triggers/1/take_ownership')).to have_been_made end it 'returns information about the trigger' do expect(@trigger.created_at).to eq('2016-01-07T09:53:58.235Z') expect(@trigger.token).to eq('6d056f63e50fe6f8c5f8f4aa10edb7') end end describe '.remove_trigger' do before do stub_delete('/projects/3/triggers/10', 'empty') @trigger = Gitlab.remove_trigger(3, 10) end it 'gets the correct resource' do expect(a_delete('/projects/3/triggers/10')).to have_been_made end end describe '.run_trigger' do before do stub_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline") .to_return(body: load_fixture('run_trigger'), status: 200) end context 'when private_token is not set' do before do Gitlab.private_token = nil end it 'does not raise Error::MissingCredentials' do expect { Gitlab.run_trigger(3, '7b9148c158980bbd9bcea92c17522d', 'master', a: 10) }.not_to raise_error end after do Gitlab.private_token = 'secret' end end context 'without variables' do before do @trigger = Gitlab.run_trigger(3, '7b9148c158980bbd9bcea92c17522d', 'master') end it 'gets the correct resource' do expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline") .with(body: { token: '7b9148c158980bbd9bcea92c17522d', ref: 'master' })).to have_been_made end it 'returns information about the triggered build' do expect(@trigger.id).to eq(8) end end context 'with variables' do before do @trigger = Gitlab.run_trigger(3, '7b9148c158980bbd9bcea92c17522d', 'master', a: 10) end it 'gets the correct resource' do expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline") .with(body: { token: '7b9148c158980bbd9bcea92c17522d', ref: 'master', variables: { a: '10' } })).to have_been_made end it 'returns information about the triggered build' do expect(@trigger.id).to eq(8) expect(@trigger.variables.a).to eq('10') end end end end gitlab-4.8.0/spec/gitlab/client/pipelines_spec.rb000066400000000000000000000061151341107427500217750ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.pipelines' do before do stub_get('/projects/3/pipelines', 'pipelines') @pipelines = Gitlab.pipelines(3) end it 'gets the correct resource' do expect(a_get('/projects/3/pipelines')).to have_been_made end it "returns a paginated response of project's pipelines" do expect(@pipelines).to be_a Gitlab::PaginatedResponse end end describe '.pipeline' do before do stub_get('/projects/3/pipelines/46', 'pipeline') @pipeline = Gitlab.pipeline(3, 46) end it 'gets the correct resource' do expect(a_get('/projects/3/pipelines/46')).to have_been_made end it 'returns a single pipeline' do expect(@pipeline).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline' do expect(@pipeline.id).to eq(46) expect(@pipeline.user.name).to eq('Administrator') end end describe '.create_pipeline' do let(:pipeline_path) { '/projects/3/pipeline?ref=master' } before do stub_post(pipeline_path, 'pipeline_create') @pipeline_create = Gitlab.create_pipeline(3, 'master') end it 'gets the correct resource' do expect(a_post(pipeline_path)).to have_been_made end it 'returns a single pipeline' do expect(@pipeline_create).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline' do expect(@pipeline_create.user.name).to eq('Administrator') end context 'when variables are passed' do before do stub_post(pipeline_path, 'pipeline_create') variables = { 'VAR1' => 'value', VAR2: :value } @pipeline_create = Gitlab.create_pipeline(3, 'master', variables) end it 'calls with the correct body' do expected_body = 'variables[][key]=VAR1&variables[][value]=value&variables[][key]=VAR2&variables[][value]=value' expect(a_post(pipeline_path).with(body: expected_body)).to have_been_made end end end describe '.cancel_pipeline' do before do stub_post('/projects/3/pipelines/46/cancel', 'pipeline_cancel') @pipeline_cancel = Gitlab.cancel_pipeline(3, 46) end it 'gets the correct resource' do expect(a_post('/projects/3/pipelines/46/cancel')).to have_been_made end it 'returns a single pipeline' do expect(@pipeline_cancel).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline' do expect(@pipeline_cancel.user.name).to eq('Administrator') end end describe '.retry_pipeline' do before do stub_post('/projects/3/pipelines/46/retry', 'pipeline_retry') @pipeline_retry = Gitlab.retry_pipeline(3, 46) end it 'gets the correct resource' do expect(a_post('/projects/3/pipelines/46/retry')).to have_been_made end it 'returns a single pipeline' do expect(@pipeline_retry).to be_a Gitlab::ObjectifiedHash end it 'returns information about a pipeline' do expect(@pipeline_retry.user.name).to eq('Administrator') end end end gitlab-4.8.0/spec/gitlab/client/project_badges_spec.rb000066400000000000000000000075271341107427500227700ustar00rootroot00000000000000# frozen_string_literal: true # rubocop:disable Style/FormatStringToken require 'spec_helper' describe Gitlab::Client do describe '.project_badges' do before do stub_get('/projects/3/badges', 'project_badges') @project_badges = Gitlab.project_badges(3) end it 'gets the correct resource' do expect(a_get('/projects/3/badges')).to have_been_made end it "returns a paginated response of project's badges" do expect(@project_badges).to be_a Gitlab::PaginatedResponse end end describe '.project_badge' do before do stub_get('/projects/3/badges/3', 'project_badge') @project_badge = Gitlab.project_badge(3, 3) end it 'gets the correct resource' do expect(a_get('/projects/3/badges/3')).to have_been_made end it 'returns information about a badge' do expect(@project_badge.id).to eq(1) end end describe '.add_project_badge' do before do stub_post('/projects/3/badges', 'project_badge') @project_badge = Gitlab.add_project_badge(3, link_url: 'http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}', image_url: 'https://shields.io/my/badge') end it 'gets the correct resource' do expect(a_post('/projects/3/badges') .with(body: { link_url: 'http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}', image_url: 'https://shields.io/my/badge' })).to have_been_made end it 'returns information about an added project badge' do expect(@project_badge.link_url).to eq('http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}') expect(@project_badge.image_url).to eq('https://shields.io/my/badge') end end describe '.edit_project_badge' do before do stub_put('/projects/3/badges/1', 'project_badge') @project_badge = Gitlab.edit_project_badge(3, 1, link_url: 'http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}', image_url: 'https://shields.io/my/badge') end it 'gets the correct resource' do expect(a_put('/projects/3/badges/1') .with(body: { link_url: 'http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}', image_url: 'https://shields.io/my/badge' })).to have_been_made end it 'returns information about an edited project badge' do expect(@project_badge.link_url).to eq('http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}') expect(@project_badge.image_url).to eq('https://shields.io/my/badge') end end describe '.remove_project_badge' do before do stub_delete('/projects/3/badges/3', 'empty') @project_badge = Gitlab.remove_project_badge(3, 3) end it 'gets the correct resource' do expect(a_delete('/projects/3/badges/3')).to have_been_made end end describe '.preview_project_badge' do before do stub_get('/projects/3/badges/render?image_url=https://shields.io/my/badge&link_url=http://example.com/ci_status.svg?project=%25%7Bproject_path%7D%26ref=%25%7Bdefault_branch%7D', 'preview_project_badge') @preview_project_badge = Gitlab.preview_project_badge(3, 'http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}', 'https://shields.io/my/badge') end it 'gets the correct resource' do expect(a_get('/projects/3/badges/render?image_url=https://shields.io/my/badge&link_url=http://example.com/ci_status.svg?project=%25%7Bproject_path%7D%26ref=%25%7Bdefault_branch%7D')).to have_been_made end it 'returns information about the rendered values of a badge' do expect(@preview_project_badge.link_url).to eq('http://example.com/ci_status.svg?project=%{project_path}&ref=%{default_branch}') expect(@preview_project_badge.image_url).to eq('https://shields.io/my/badge') end end end # rubocop:enable Style/FormatStringToken gitlab-4.8.0/spec/gitlab/client/project_templates_spec.rb000066400000000000000000000024321341107427500235270ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.project_templates' do before do stub_get('/projects/3/templates/licenses', 'project_templates') @project_templates = Gitlab.project_templates(3, 'licenses') end it 'gets the correct resource' do expect(a_get('/projects/3/templates/licenses')).to have_been_made end it "returns a paginated response of project's templates" do expect(@project_templates).to be_a Gitlab::PaginatedResponse end end describe '.project_template' do context 'when dockerfiles' do before do stub_get('/projects/3/templates/dockerfiles/dock', 'dockerfile_project_template') @project_template = Gitlab.project_template(3, 'dockerfiles', 'dock') end it 'gets the correct resource' do expect(a_get('/projects/3/templates/dockerfiles/dock')).to have_been_made end end context 'when licenses' do before do stub_get('/projects/3/templates/licenses/mit', 'license_project_template') @project_template = Gitlab.project_template(3, 'licenses', 'mit') end it 'gets the correct resource' do expect(a_get('/projects/3/templates/licenses/mit')).to have_been_made end end end end gitlab-4.8.0/spec/gitlab/client/projects_spec.rb000066400000000000000000000533431341107427500216430ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :search_projects } describe '.projects' do before do stub_get('/projects', 'projects') @projects = Gitlab.projects end it 'gets the correct resource' do expect(a_get('/projects')).to have_been_made end it 'returns a paginated response of projects' do expect(@projects).to be_a Gitlab::PaginatedResponse expect(@projects.first.name).to eq('Brute') expect(@projects.first.owner.name).to eq('John Smith') end end describe '.project_search' do before do stub_get('/projects?search=Gitlab', 'project_search') @project_search = Gitlab.project_search('Gitlab') end it 'gets the correct resource' do expect(a_get('/projects?search=Gitlab')).to have_been_made end it 'returns a paginated response of projects found' do expect(@project_search).to be_a Gitlab::PaginatedResponse expect(@project_search.first.name).to eq('Gitlab') expect(@project_search.first.owner.name).to eq('John Smith') end end describe '.project' do before do stub_get('/projects/3', 'project') @project = Gitlab.project(3) end it 'gets the correct resource' do expect(a_get('/projects/3')).to have_been_made end it 'returns information about a project' do expect(@project.name).to eq('Gitlab') expect(@project.owner.name).to eq('John Smith') end end describe '.create_project' do before do stub_post('/projects', 'project') @project = Gitlab.create_project('Gitlab') end it 'gets the correct resource' do expect(a_post('/projects')).to have_been_made end it 'returns information about a created project' do expect(@project.name).to eq('Gitlab') expect(@project.owner.name).to eq('John Smith') end end describe '.create_project for user' do before do stub_post('/users', 'user') @owner = Gitlab.create_user('john@example.com', 'pass', name: 'John Owner') stub_post("/projects/user/#{@owner.id}", 'project_for_user') @project = Gitlab.create_project('Brute', user_id: @owner.id) end it 'returns information about a created project' do expect(@project.name).to eq('Brute') expect(@project.owner.name).to eq('John Owner') end end describe '.delete_project' do before do stub_delete('/projects/Gitlab', 'project') @project = Gitlab.delete_project('Gitlab') end it 'gets the correct resource' do expect(a_delete('/projects/Gitlab')).to have_been_made end it 'returns information about a deleted project' do expect(@project.name).to eq('Gitlab') expect(@project.owner.name).to eq('John Smith') end end describe '.create_fork' do context 'without sudo option' do before do stub_post('/projects/3/fork', 'project_fork') @project = Gitlab.create_fork(3) end it 'posts to the correct resource' do expect(a_post('/projects/3/fork')).to have_been_made end it 'returns information about the forked project' do expect(@project.forked_from_project.id).to eq(3) expect(@project.id).to eq(20) end end context 'with the sudo option' do before do stub_post('/projects/3/fork', 'project_forked_for_user') @sudoed_username = 'jack.smith' @project = Gitlab.create_fork(3, sudo: @sudoed_username) end it 'posts to the correct resource' do expect(a_post('/projects/3/fork')).to have_been_made end it 'returns information about the forked project' do expect(@project.forked_from_project.id).to eq(3) expect(@project.id).to eq(20) expect(@project.owner.username).to eq(@sudoed_username) end end end describe '.project_forks' do before do stub_get('/projects/3/forks', 'project_forks') @project_forks = Gitlab.project_forks(3) end it 'gets the correct resource' do expect(a_get('/projects/3/forks')).to have_been_made end it 'returns a paginated response of projects found' do expect(@project_forks).to be_a Gitlab::PaginatedResponse expect(@project_forks.first.name).to eq('gitlab') expect(@project_forks.first.owner.name).to eq('Administrator') end end describe '.team_members' do before do stub_get('/projects/3/members', 'team_members') @team_members = Gitlab.team_members(3) end it 'gets the correct resource' do expect(a_get('/projects/3/members')).to have_been_made end it 'returns a paginated response of team members' do expect(@team_members).to be_a Gitlab::PaginatedResponse expect(@team_members.first.name).to eq('John Smith') end end describe '.team_member' do before do stub_get('/projects/3/members/1', 'team_member') @team_member = Gitlab.team_member(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/members/1')).to have_been_made end it 'returns information about a team member' do expect(@team_member.name).to eq('John Smith') end end describe '.add_team_member' do before do stub_post('/projects/3/members', 'team_member') @team_member = Gitlab.add_team_member(3, 1, 40, expires_at: '2018-12-31') end it 'gets the correct resource' do expect(a_post('/projects/3/members') .with(body: { user_id: '1', access_level: '40', expires_at: '2018-12-31' })).to have_been_made end it 'returns information about an added team member' do expect(@team_member.name).to eq('John Smith') expect(@team_member.expires_at).to eq('2018-12-31T00:00:00Z') end end describe '.edit_team_member' do before do stub_put('/projects/3/members/1', 'team_member') @team_member = Gitlab.edit_team_member(3, 1, 40, expires_at: '2018-12-31') end it 'gets the correct resource' do expect(a_put('/projects/3/members/1') .with(body: { access_level: '40', expires_at: '2018-12-31' })).to have_been_made end it 'returns information about an edited team member' do expect(@team_member.name).to eq('John Smith') expect(@team_member.expires_at).to eq('2018-12-31T00:00:00Z') end end describe '.remove_team_member' do before do stub_delete('/projects/3/members/1', 'team_member') @team_member = Gitlab.remove_team_member(3, 1) end it 'gets the correct resource' do expect(a_delete('/projects/3/members/1')).to have_been_made end it 'returns information about a removed team member' do expect(@team_member.name).to eq('John Smith') end end describe '.project_hooks' do before do stub_get('/projects/1/hooks', 'project_hooks') @hooks = Gitlab.project_hooks(1) end it 'gets the correct resource' do expect(a_get('/projects/1/hooks')).to have_been_made end it 'returns a paginated response of hooks' do expect(@hooks).to be_a Gitlab::PaginatedResponse expect(@hooks.first.url).to eq('https://api.example.net/v1/webhooks/ci') end end describe '.project_hook' do before do stub_get('/projects/1/hooks/1', 'project_hook') @hook = Gitlab.project_hook(1, 1) end it 'gets the correct resource' do expect(a_get('/projects/1/hooks/1')).to have_been_made end it 'returns information about a hook' do expect(@hook.url).to eq('https://api.example.net/v1/webhooks/ci') end end describe '.add_project_hook' do context 'without specified events' do before do stub_post('/projects/1/hooks', 'project_hook') @hook = Gitlab.add_project_hook(1, 'https://api.example.net/v1/webhooks/ci') end it 'gets the correct resource' do body = { url: 'https://api.example.net/v1/webhooks/ci' } expect(a_post('/projects/1/hooks').with(body: body)).to have_been_made end it 'returns information about an added hook' do expect(@hook.url).to eq('https://api.example.net/v1/webhooks/ci') end end context 'with specified events' do before do stub_post('/projects/1/hooks', 'project_hook') @hook = Gitlab.add_project_hook(1, 'https://api.example.net/v1/webhooks/ci', push_events: true, merge_requests_events: true) end it 'gets the correct resource' do body = { url: 'https://api.example.net/v1/webhooks/ci', push_events: 'true', merge_requests_events: 'true' } expect(a_post('/projects/1/hooks').with(body: body)).to have_been_made end it 'returns information about an added hook' do expect(@hook.url).to eq('https://api.example.net/v1/webhooks/ci') end end end describe '.edit_project_hook' do before do stub_put('/projects/1/hooks/1', 'project_hook') @hook = Gitlab.edit_project_hook(1, 1, 'https://api.example.net/v1/webhooks/ci') end it 'gets the correct resource' do body = { url: 'https://api.example.net/v1/webhooks/ci' } expect(a_put('/projects/1/hooks/1').with(body: body)).to have_been_made end it 'returns information about an edited hook' do expect(@hook.url).to eq('https://api.example.net/v1/webhooks/ci') end end describe '.edit_project' do context 'using project ID' do before do stub_put('/projects/3', 'project_edit').with(body: { name: 'Gitlab-edit' }) @edited_project = Gitlab.edit_project(3, name: 'Gitlab-edit') end it 'gets the correct resource' do expect(a_put('/projects/3').with(body: { name: 'Gitlab-edit' })).to have_been_made end it 'returns information about an edited project' do expect(@edited_project.name).to eq('Gitlab-edit') end end context 'using namespaced project path' do it 'encodes the path properly' do stub = stub_put('/projects/namespace%2Fpath', 'project_edit').with(body: { name: 'Gitlab-edit' }) Gitlab.edit_project('namespace/path', name: 'Gitlab-edit') expect(stub).to have_been_requested end end end describe '.delete_project_hook' do context 'when empty response' do before do stub_request(:delete, "#{Gitlab.endpoint}/projects/1/hooks/1") .with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) .to_return(body: '') @hook = Gitlab.delete_project_hook(1, 1) end it 'gets the correct resource' do expect(a_delete('/projects/1/hooks/1')).to have_been_made end it 'returns false' do expect(@hook).to be(false) end end context 'when JSON response' do before do stub_delete('/projects/1/hooks/1', 'project_hook') @hook = Gitlab.delete_project_hook(1, 1) end it 'gets the correct resource' do expect(a_delete('/projects/1/hooks/1')).to have_been_made end it 'returns information about a deleted hook' do expect(@hook.url).to eq('https://api.example.net/v1/webhooks/ci') end end end describe '.push_rule' do before do stub_get('/projects/1/push_rule', 'push_rule') @push_rule = Gitlab.push_rule(1) end it 'gets the correct resource' do expect(a_get('/projects/1/push_rule')).to have_been_made end it 'returns information about a push rule' do expect(@push_rule.commit_message_regex).to eq('\\b[A-Z]{3}-[0-9]+\\b') end end describe '.add_push_rule' do before do stub_post('/projects/1/push_rule', 'push_rule') @push_rule = Gitlab.add_push_rule(1, deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b') end it 'gets the correct resource' do expect(a_post('/projects/1/push_rule')).to have_been_made end it 'returns information about an added push rule' do expect(@push_rule.commit_message_regex).to eq('\\b[A-Z]{3}-[0-9]+\\b') end end describe '.edit_push_rule' do before do stub_put('/projects/1/push_rule', 'push_rule') @push_rule = Gitlab.edit_push_rule(1, deny_delete_tag: false, commit_message_regex: '\\b[A-Z]{3}-[0-9]+\\b') end it 'gets the correct resource' do expect(a_put('/projects/1/push_rule')).to have_been_made end it 'returns information about an edited push rule' do expect(@push_rule.commit_message_regex).to eq('\\b[A-Z]{3}-[0-9]+\\b') end end describe '.delete_push_rule' do context 'when empty response' do before do stub_request(:delete, "#{Gitlab.endpoint}/projects/1/push_rule") .with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) .to_return(body: '') @push_rule = Gitlab.delete_push_rule(1) end it 'gets the correct resource' do expect(a_delete('/projects/1/push_rule')).to have_been_made end it 'returns false' do expect(@push_rule).to be(false) end end context 'when JSON response' do before do stub_delete('/projects/1/push_rule', 'push_rule') @push_rule = Gitlab.delete_push_rule(1) end it 'gets the correct resource' do expect(a_delete('/projects/1/push_rule')).to have_been_made end it 'returns information about a deleted push rule' do expect(@push_rule.commit_message_regex).to eq('\\b[A-Z]{3}-[0-9]+\\b') end end end describe '.make_forked_from' do before do stub_post('/projects/42/fork/24', 'project_fork_link') @forked_project_link = Gitlab.make_forked_from(42, 24) end it 'gets the correct resource' do expect(a_post('/projects/42/fork/24')).to have_been_made end it 'returns information about a forked project' do expect(@forked_project_link.forked_from_project_id).to eq(24) expect(@forked_project_link.forked_to_project_id).to eq(42) end end describe '.remove_forked' do before do stub_delete('/projects/42/fork', 'project_fork_link') @forked_project_link = Gitlab.remove_forked(42) end it 'gets the correct resource' do expect(a_delete('/projects/42/fork')).to have_been_made end it 'returns information about an unforked project' do expect(@forked_project_link.forked_to_project_id).to eq(42) end end describe '.deploy_keys' do before do stub_get('/projects/42/deploy_keys', 'project_keys') @deploy_keys = Gitlab.deploy_keys(42) end it 'gets the correct resource' do expect(a_get('/projects/42/deploy_keys')).to have_been_made end it 'returns project deploy keys' do expect(@deploy_keys).to be_a Gitlab::PaginatedResponse expect(@deploy_keys.first.id).to eq 2 expect(@deploy_keys.first.title).to eq 'Key Title' expect(@deploy_keys.first.key).to match(/ssh-rsa/) end end describe '.deploy_key' do before do stub_get('/projects/42/deploy_keys/2', 'project_key') @deploy_key = Gitlab.deploy_key(42, 2) end it 'gets the correct resource' do expect(a_get('/projects/42/deploy_keys/2')).to have_been_made end it 'returns project deploy key' do expect(@deploy_key.id).to eq 2 expect(@deploy_key.title).to eq 'Key Title' expect(@deploy_key.key).to match(/ssh-rsa/) end end describe '.create_deploy_key' do context 'no options' do before do stub_post('/projects/42/deploy_keys', 'project_key') @deploy_key = Gitlab.create_deploy_key(42, 'My Key', 'Key contents') end it 'gets the correct resource' do expect(a_post('/projects/42/deploy_keys') .with(body: { title: 'My Key', key: 'Key contents' })).to have_been_made end it 'returns information about a created key' do expect(@deploy_key.id).to eq(2) end end context 'some options' do before do stub_post('/projects/42/deploy_keys', 'project_key') @deploy_key = Gitlab.create_deploy_key(42, 'My Key', 'Key contents', can_push: true) end it 'gets the correct resource' do expect(a_post('/projects/42/deploy_keys') .with(body: { title: 'My Key', key: 'Key contents', can_push: true })).to have_been_made end it 'returns information about a created key' do expect(@deploy_key.id).to eq(2) end end end describe '.delete_deploy_key' do before do stub_delete('/projects/42/deploy_keys/2', 'project_key') @deploy_key = Gitlab.delete_deploy_key(42, 2) end it 'gets the correct resource' do expect(a_delete('/projects/42/deploy_keys/2')).to have_been_made end it 'returns information about a deleted key' do expect(@deploy_key.id).to eq(2) end end describe '.enable_deploy_key' do before do stub_post('/projects/42/deploy_keys/2/enable', 'project_key') @deploy_key = Gitlab.enable_deploy_key(42, 2) end it 'gets the correct resource' do expect(a_post('/projects/42/deploy_keys/2/enable') .with(body: { id: '42', key_id: '2' })).to have_been_made end it 'returns information about an enabled key' do expect(@deploy_key.id).to eq(2) end end describe '.disable_deploy_key' do before do stub_post('/projects/42/deploy_keys/2/disable', 'project_key') @deploy_key = Gitlab.disable_deploy_key(42, 2) end it 'gets the correct resource' do expect(a_post('/projects/42/deploy_keys/2/disable') .with(body: { id: '42', key_id: '2' })).to have_been_made end it 'returns information about a disabled key' do expect(@deploy_key.id).to eq(2) end end describe '.share_project_with_group' do before do stub_post('/projects/3/share', 'group') @group = Gitlab.share_project_with_group(3, 10, 40) end it 'gets the correct resource' do expect(a_post('/projects/3/share') .with(body: { group_id: '10', group_access: '40' })).to have_been_made end it 'returns information about an added group' do expect(@group.id).to eq(10) end end describe '.unshare_project_with_group' do before do stub_delete('/projects/3/share/10', 'group') @group = Gitlab.unshare_project_with_group(3, 10) end it 'gets the correct resource' do expect(a_delete('/projects/3/share/10')).to have_been_made end end describe '.transfer_project' do before do stub_put('/projects/3/transfer', 'transfer_project') @transfered_project = Gitlab.transfer_project(3, 'yolo') end it 'gets the correct resource' do expect(a_put('/projects/3/transfer') .with(body: { namespace: 'yolo' })).to have_been_made end it 'returns information about the transfered project' do expect(@transfered_project.id).to eq(1) end end describe '.star_project' do before do stub_post('/projects/3/star', 'project_star') @starred_project = Gitlab.star_project(3) end it 'gets the correct resource' do expect(a_post('/projects/3/star')).to have_been_made end it 'returns information about the starred project' do expect(@starred_project.id).to eq(3) end end describe '.unstar_project' do before do stub_delete('/projects/3/star', 'project_unstar') @unstarred_project = Gitlab.unstar_project(3) end it 'gets the correct resource' do expect(a_delete('/projects/3/star')).to have_been_made end it 'returns information about the unstarred project' do expect(@unstarred_project.id).to eq(3) end end describe '.user_projects' do let(:user_id) { 1 } let(:project_id) { 1 } before do stub_get("/users/#{user_id}/projects", 'user_projects') @user_projects = Gitlab.user_projects(user_id) end it 'gets the correct resource' do expect(a_get("/users/#{user_id}/projects")).to have_been_made end it 'returns a paginated response of projects' do expect(@user_projects).to be_a Gitlab::PaginatedResponse expect(@user_projects.first.id).to eq(project_id) expect(@user_projects.first.owner.id).to eq(user_id) end end describe '.upload_file' do let(:id) { 1 } let(:file) { File.open(File::NULL, 'r') } before do stub_post("/projects/#{id}/uploads", 'upload_file') @file = Gitlab.upload_file(id, file) end it 'gets the correct resource' do expect(a_post("/projects/#{id}/uploads")).to have_been_made end it 'returns information about the uploaded file' do expect(@file.alt).to eq('null') expect(@file.url).to eq('/uploads/f22e67e35e1bcb339058212c54bb8772/null') expect(@file.markdown).to eq('[null](/uploads/f22e67e35e1bcb339058212c54bb8772/null)') end end describe '.project_templates' do before do stub_get('/projects/3/templates/licenses', 'project_templates') @project_templates = Gitlab.project_templates(3, 'licenses') end it 'gets the correct resource' do expect(a_get('/projects/3/templates/licenses')).to have_been_made end it "returns a paginated response of project's templates" do expect(@project_templates).to be_a Gitlab::PaginatedResponse end end describe '.project_template' do context 'when dockerfiles' do before do stub_get('/projects/3/templates/dockerfiles/dock', 'dockerfile_project_template') @project_template = Gitlab.project_template(3, 'dockerfiles', 'dock') end it 'gets the correct resource' do expect(a_get('/projects/3/templates/dockerfiles/dock')).to have_been_made end end context 'when licenses' do before do stub_get('/projects/3/templates/licenses/mit', 'license_project_template') @project_template = Gitlab.project_template(3, 'licenses', 'mit') end it 'gets the correct resource' do expect(a_get('/projects/3/templates/licenses/mit')).to have_been_made end end end end gitlab-4.8.0/spec/gitlab/client/protected_tags_spec.rb000066400000000000000000000033701341107427500230140ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.protected_tags' do before do stub_get('/projects/1/protected_tags', 'protected_tags') @protected_tags = Gitlab.protected_tags(1) end it 'gets the correct resource' do expect(a_get('/projects/1/protected_tags')).to have_been_made end it "returns a response of a project's protected_tags" do expect(@protected_tags).to be_a Gitlab::PaginatedResponse end end describe '.protected_tag' do before do stub_get('/projects/1/protected_tags/release-1-0', 'protected_tag') @protected_tag = Gitlab.protected_tag(1, 'release-1-0') end it 'gets the correct resource' do expect(a_get('/projects/1/protected_tags/release-1-0')).to have_been_made end it 'returns correct information about the protected_tag' do expect(@protected_tag.name).to eq 'release-1-0' end end describe '.protect_repository_tag' do before do stub_post('/projects/1/protected_tags', 'protected_tag') @protected_tag = Gitlab.protect_repository_tag(1, 'release-1-0') end it 'gets the correct resource' do expect(a_post('/projects/1/protected_tags') .with(body: { name: 'release-1-0' })).to have_been_made end it 'returns correct information about the protected repository tag' do expect(@protected_tag.name).to eq 'release-1-0' end end describe '.unprotect_repository_tag' do before do stub_delete('/projects/1/protected_tags/release-1-0', 'empty') Gitlab.unprotect_repository_tag(1, 'release-1-0') end it 'gets the correct resource' do expect(a_delete('/projects/1/protected_tags/release-1-0')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/repositories_spec.rb000066400000000000000000000066721341107427500225440ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :repo_tags } it { is_expected.to respond_to :repo_create_tag } it { is_expected.to respond_to :repo_branches } it { is_expected.to respond_to :repo_branch } it { is_expected.to respond_to :repo_tree } it { is_expected.to respond_to :repo_compare } describe '.tags' do before do stub_get('/projects/3/repository/tags', 'project_tags') @tags = Gitlab.tags(3) end it 'gets the correct resource' do expect(a_get('/projects/3/repository/tags')).to have_been_made end it 'returns a paginated response of repository tags' do expect(@tags).to be_a Gitlab::PaginatedResponse expect(@tags.first.name).to eq('v2.8.2') end end describe '.create_tag' do context 'when lightweight' do before do stub_post('/projects/3/repository/tags', 'project_tag_lightweight') @tag = Gitlab.create_tag(3, 'v1.0.0', '2695effb5807a22ff3d138d593fd856244e155e7') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/tags')).to have_been_made end it 'returns information about a new repository tag' do expect(@tag.name).to eq('v1.0.0') expect(@tag.message).to eq(nil) end end context 'when annotated' do before do stub_post('/projects/3/repository/tags', 'project_tag_annotated') @tag = Gitlab.create_tag(3, 'v1.1.0', '2695effb5807a22ff3d138d593fd856244e155e7', 'Release 1.1.0') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/tags')).to have_been_made end it 'returns information about a new repository tag' do expect(@tag.name).to eq('v1.1.0') expect(@tag.message).to eq('Release 1.1.0') end end end describe '.tree' do before do stub_get('/projects/3/repository/tree', 'tree') @tree = Gitlab.tree(3) end it 'gets the correct resource' do expect(a_get('/projects/3/repository/tree')).to have_been_made end it 'returns a paginated response of repository tree files (root level)' do expect(@tree).to be_a Gitlab::PaginatedResponse expect(@tree.first.name).to eq('app') end end describe '.compare' do before do stub_get('/projects/3/repository/compare', 'compare_merge_request_diff') .with(query: { from: 'master', to: 'feature' }) @diff = Gitlab.compare(3, 'master', 'feature') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/compare') .with(query: { from: 'master', to: 'feature' })).to have_been_made end it 'gets diffs of a merge request' do expect(@diff.diffs).to be_kind_of Array expect(@diff.diffs.last['new_path']).to eq 'files/js/application.js' end end describe '.merge_base' do before do stub_get('/projects/3/repository/merge_base', 'merge_base') .with(query: { refs: %w[master feature] }) @response = Gitlab.merge_base(3, %w[master feature]) end it 'gets the correct resource' do expect(a_get('/projects/3/repository/merge_base') .with(query: { refs: %w[master feature] })).to have_been_made end it 'gets common ancestor of the two refs' do expect(@response).to be_kind_of Gitlab::ObjectifiedHash expect(@response.id).to eq '1a0b36b3cdad1d2ee32457c102a8c0b7056fa863' end end end gitlab-4.8.0/spec/gitlab/client/repository_files_spec.rb000066400000000000000000000061721341107427500234110ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.file_contents' do before do stub_get('/projects/3/repository/files/Gemfile/raw?ref=master', 'raw_file') @file_contents = Gitlab.file_contents(3, 'Gemfile') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/files/Gemfile/raw?ref=master')).to have_been_made end it 'returns file contents' do expect(@file_contents).to eq("source 'https://rubygems.org'\ngem 'rails', '4.1.2'\n") end end describe '.get_file' do before do stub_get('/projects/3/repository/files/README%2Emd?ref=master', 'get_repository_file') @file = Gitlab.get_file(3, 'README.md', 'master') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/files/README%2Emd?ref=master')).to have_been_made end it 'returns the base64 encoded file' do expect(@file.file_path).to eq 'README.md' expect(@file.ref).to eq 'master' expect(@file.content).to eq "VGhpcyBpcyBhICpSRUFETUUqIQ==\n" end end describe '.create_file' do let(:api_path) { '/projects/3/repository/files/path' } let!(:request_stub) { stub_post(api_path, 'repository_file') } let!(:file) { Gitlab.create_file(3, 'path', 'branch', 'content', 'commit message', author_name: 'joe') } it 'creates the correct resource' do expected_parameters = { author_name: 'joe', branch: 'branch', commit_message: 'commit message' } expect(a_post(api_path).with(body: hash_including(expected_parameters))).to have_been_made end it 'returns information about the new file' do expect(file.file_path).to eq 'path' expect(file.branch_name).to eq 'branch' end end describe '.edit_file' do let(:api_path) { '/projects/3/repository/files/path' } let!(:request_stub) { stub_put(api_path, 'repository_file') } let!(:file) { Gitlab.edit_file(3, 'path', 'branch', 'content', 'commit message', author_name: 'joe') } it 'updates the correct resource' do expected_parameters = { author_name: 'joe', branch: 'branch', commit_message: 'commit message' } expect(a_put(api_path).with(body: hash_including(expected_parameters))).to have_been_made end it 'returns information about the new file' do expect(file.file_path).to eq 'path' expect(file.branch_name).to eq 'branch' end end describe '.remove_file' do let(:api_path) { '/projects/3/repository/files/path' } let!(:request_stub) { stub_delete(api_path, 'repository_file') } let!(:file) { Gitlab.remove_file(3, 'path', 'branch', 'commit message', author_name: 'joe') } it 'updates the correct resource' do expected_parameters = { author_name: 'joe', branch: 'branch', commit_message: 'commit message' } expect(a_delete(api_path).with(body: hash_including(expected_parameters))).to have_been_made end it 'returns information about the new file' do expect(file.file_path).to eq 'path' expect(file.branch_name).to eq 'branch' end end end gitlab-4.8.0/spec/gitlab/client/repository_submodules_spec.rb000066400000000000000000000014451341107427500244670ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.edit_submodule' do let(:api_path) { '/projects/3/repository/submodules/submodule' } let(:options) do { branch: 'branch', commit_sha: '3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88', commit_message: 'commit message' } end before do stub_put(api_path, 'repository_submodule') @submodule = Gitlab.edit_submodule(3, 'submodule', options) end it 'updates the correct resource' do expect(a_put(api_path).with(body: hash_including(options))).to have_been_made end it 'returns information about the updated submodule' do expect(@submodule.short_id).to eq 'ed899a2f4b5' expect(@submodule.status).to be_nil end end end gitlab-4.8.0/spec/gitlab/client/runners_spec.rb000066400000000000000000000122521341107427500215000ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.runners' do before do stub_get('/runners', 'runners') end context 'without scope' do before do @runner = Gitlab.runners end it 'gets the correct resource' do expect(a_get('/runners')).to have_been_made end it 'returns a paginated response of runners' do expect(@runner).to be_a Gitlab::PaginatedResponse expect(@runner.first.id).to eq(6) expect(@runner.first.description).to eq('test-1-20150125') end end context 'with scope' do before do stub_get('/runners?scope=online', 'runners') @runner = Gitlab.runners(scope: :online) end it 'gets the correct resource' do expect(a_get('/runners').with(query: { scope: :online })).to have_been_made end it 'returns a paginated response of runners' do expect(@runner).to be_a Gitlab::PaginatedResponse expect(@runner.first.id).to eq(6) expect(@runner.first.description).to eq('test-1-20150125') end end end describe '.all_runners' do before do stub_get('/runners/all', 'runners') end context 'without scope' do before do @runner = Gitlab.all_runners end it 'gets the correct resource' do expect(a_get('/runners/all')).to have_been_made end it 'returns a paginated response of runners' do expect(@runner).to be_a Gitlab::PaginatedResponse expect(@runner.first.id).to eq(6) expect(@runner.first.description).to eq('test-1-20150125') end end context 'with scope' do before do stub_get('/runners/all?scope=online', 'runners') @runner = Gitlab.all_runners(scope: :online) end it 'gets the correct resource' do expect(a_get('/runners/all').with(query: { scope: :online })).to have_been_made end it 'returns a paginated response of runners' do expect(@runner).to be_a Gitlab::PaginatedResponse expect(@runner.first.id).to eq(6) expect(@runner.first.description).to eq('test-1-20150125') end end end describe '.runner' do before do stub_get('/runners/6', 'runner') @runners = Gitlab.runner(6) end it 'gets the correct resource' do expect(a_get('/runners/6')).to have_been_made end it 'returns a response of a runner' do expect(@runners).to be_a Gitlab::ObjectifiedHash expect(@runners.id).to eq(6) expect(@runners.description).to eq('test-1-20150125') end end describe '.update_runner' do before do stub_put('/runners/6', 'runner_edit').with(query: { description: 'abcefg' }) @runner = Gitlab.update_runner(6, description: 'abcefg') end it 'gets the correct resource' do expect(a_put('/runners/6').with(query: { description: 'abcefg' })).to have_been_made end it 'returns an updated response of a runner' do expect(@runner).to be_a Gitlab::ObjectifiedHash expect(@runner.description).to eq('abcefg') end end describe '.delete_runner' do before do stub_delete('/runners/6', 'runner_delete') @runner = Gitlab.delete_runner(6) end it 'gets the correct resource' do expect(a_delete('/runners/6')).to have_been_made end it 'returns a response of the deleted runner' do expect(@runner).to be_a Gitlab::ObjectifiedHash expect(@runner.id).to eq(6) end end describe '.runner_jobs' do before do stub_get('/runners/1/jobs', 'runner_jobs') @jobs = Gitlab.runner_jobs(1) end it 'gets the correct resource' do expect(a_get('/runners/1/jobs')).to have_been_made end end describe '.project_runners' do before do stub_get('/projects/1/runners', 'project_runners') @runners = Gitlab.project_runners(1) end it 'gets the correct resource' do expect(a_get('/projects/1/runners')).to have_been_made end it 'returns a paginated response of runners' do expect(@runners).to be_a Gitlab::PaginatedResponse expect(@runners.first.id).to eq(8) expect(@runners.first.description).to eq('test-2-20150125') end end describe '.project_enable_runner' do before do stub_post('/projects/1/runners', 'runner') @runner = Gitlab.project_enable_runner(1, 6) end it 'gets the correct resource' do expect(a_post('/projects/1/runners')).to have_been_made end it 'returns a response of the enabled runner' do expect(@runner).to be_a Gitlab::ObjectifiedHash expect(@runner.id).to eq(6) expect(@runner.description).to eq('test-1-20150125') end end describe '.project_disable_runner' do before do stub_delete('/projects/1/runners/6', 'runner') @runner = Gitlab.project_disable_runner(1, 6) end it 'gets the correct resource' do expect(a_delete('/projects/1/runners/6')).to have_been_made end it 'returns a response of the disabled runner' do expect(@runner).to be_a Gitlab::ObjectifiedHash expect(@runner.id).to eq(6) expect(@runner.description).to eq('test-1-20150125') end end end gitlab-4.8.0/spec/gitlab/client/services_spec.rb000066400000000000000000000036031341107427500216270ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.service' do before do stub_get('/projects/3/services/redmine', 'service') @service = Gitlab.service(3, :redmine) end it 'gets the correct resource' do expect(a_get('/projects/3/services/redmine')).to have_been_made end it 'returns a information about a service of project' do expect(@service.id).to eq 38 expect(@service.title).to eq('Redmine') expect(@service.properties.project_url).to eq('https://example.com/projects/test_project/issue') end end describe '.change_service' do before do stub_put('/projects/3/services/redmine', 'service') @service = Gitlab.change_service(3, :redmine, new_issue_url: 'https://example.com/projects/test_project/issues/new', project_url: 'https://example.com/projects/test_project/issues', issues_url: 'https://example.com/issues/:id') end it 'gets the correct resource' do body = { new_issue_url: 'https://example.com/projects/test_project/issues/new', project_url: 'https://example.com/projects/test_project/issues', issues_url: 'https://example.com/issues/:id' } expect(a_put('/projects/3/services/redmine').with(body: body)).to have_been_made end it 'returns information about a new service' do expect(@service).to be_truthy end end describe '.delete_servoce' do before do stub_delete('/projects/3/services/redmine', 'service') @service = Gitlab.delete_service(3, :redmine) end it 'gets the correct resource' do expect(a_delete('/projects/3/services/redmine')).to have_been_made end it 'returns information about a deleted service' do expect(@service).to be_truthy end end end gitlab-4.8.0/spec/gitlab/client/sidekiq_spec.rb000066400000000000000000000036161341107427500214410ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.sidekiq_queue_metrics' do before do stub_get('/sidekiq/queue_metrics', 'sidekiq_queue_metrics') @sidekiq_queue_metrics = Gitlab.sidekiq_queue_metrics end it 'gets the correct resource' do expect(a_get('/sidekiq/queue_metrics')).to have_been_made end it 'returns a information about a sidekiq default queue' do expect(@sidekiq_queue_metrics.queues.default.backlog).to eq 0 expect(@sidekiq_queue_metrics.queues.default.latency).to eq 0 end end describe '.sidekiq_process_metrics' do before do stub_get('/sidekiq/process_metrics', 'sidekiq_process_metrics') @sidekiq_process_metrics = Gitlab.sidekiq_process_metrics end it 'gets the correct resource' do expect(a_get('/sidekiq/process_metrics')).to have_been_made end it 'returns a information about a sidekiq process metrics' do expect(@sidekiq_process_metrics.processes.first['busy']).to eq 0 end end describe '.sidekiq_job_stats' do before do stub_get('/sidekiq/job_stats', 'sidekiq_job_stats') @sidekiq_job_stats = Gitlab.sidekiq_job_stats end it 'gets the correct resource' do expect(a_get('/sidekiq/job_stats')).to have_been_made end it 'returns a information about a sidekiq process metrics' do expect(@sidekiq_job_stats.jobs.processed).to eq 2 end end describe '.sidekiq_compound_metrics' do before do stub_get('/sidekiq/compound_metrics', 'sidekiq_compound_metrics') @sidekiq_compound_metrics = Gitlab.sidekiq_compound_metrics end it 'gets the correct resource' do expect(a_get('/sidekiq/compound_metrics')).to have_been_made end it 'returns a information about a sidekiq process metrics' do expect(@sidekiq_compound_metrics.jobs.processed).to eq 2 end end end gitlab-4.8.0/spec/gitlab/client/snippets_spec.rb000066400000000000000000000056431341107427500216570ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.snippets' do before do stub_get('/projects/3/snippets', 'snippets') @snippets = Gitlab.snippets(3) end it 'gets the correct resource' do expect(a_get('/projects/3/snippets')).to have_been_made end it "returns a paginated response of project's snippets" do expect(@snippets).to be_a Gitlab::PaginatedResponse expect(@snippets.first.file_name).to eq('mailer_test.rb') end end describe '.snippet' do before do stub_get('/projects/3/snippets/1', 'snippet') @snippet = Gitlab.snippet(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/snippets/1')).to have_been_made end it 'returns information about a snippet' do expect(@snippet.file_name).to eq('mailer_test.rb') expect(@snippet.author.name).to eq('John Smith') end end describe '.create_snippet' do before do stub_post('/projects/3/snippets', 'snippet') @snippet = Gitlab.create_snippet(3, title: 'API', file_name: 'api.rb', code: 'code', visibility: 'public') end it 'gets the correct resource' do body = { title: 'API', file_name: 'api.rb', code: 'code', visibility: 'public' } expect(a_post('/projects/3/snippets').with(body: body)).to have_been_made end it 'returns information about a new snippet' do expect(@snippet.file_name).to eq('mailer_test.rb') expect(@snippet.author.name).to eq('John Smith') end end describe '.edit_snippet' do before do stub_put('/projects/3/snippets/1', 'snippet') @snippet = Gitlab.edit_snippet(3, 1, file_name: 'mailer_test.rb') end it 'gets the correct resource' do expect(a_put('/projects/3/snippets/1') .with(body: { file_name: 'mailer_test.rb' })).to have_been_made end it 'returns information about an edited snippet' do expect(@snippet.file_name).to eq('mailer_test.rb') expect(@snippet.author.name).to eq('John Smith') end end describe '.delete_snippet' do before do stub_delete('/projects/3/snippets/1', 'snippet') @snippet = Gitlab.delete_snippet(3, 1) end it 'gets the correct resource' do expect(a_delete('/projects/3/snippets/1')).to have_been_made end it 'returns information about a deleted snippet' do expect(@snippet.file_name).to eq('mailer_test.rb') expect(@snippet.author.name).to eq('John Smith') end end describe '.snippet_content' do before do stub_get('/projects/3/snippets/1/raw', 'snippet_content') @snippet_content = Gitlab.snippet_content(3, 1) end it 'gets the correct resource' do expect(a_get('/projects/3/snippets/1/raw')).to have_been_made end it 'returns raw content of a snippet' do expect(@snippet_content).to eq("#!/usr/bin/env ruby\n\nputs \"Cool snippet!\"\n") end end end gitlab-4.8.0/spec/gitlab/client/system_hooks_spec.rb000066400000000000000000000034641341107427500225400ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :system_hooks } it { is_expected.to respond_to :add_system_hook } it { is_expected.to respond_to :system_hook } it { is_expected.to respond_to :delete_system_hook } describe '.hooks' do before do stub_get('/hooks', 'system_hooks') @hooks = Gitlab.hooks end it 'gets the correct resource' do expect(a_get('/hooks')).to have_been_made end it 'returns a paginated response of system hooks' do expect(@hooks).to be_a Gitlab::PaginatedResponse expect(@hooks.first.url).to eq('http://example.com/hook') end end describe '.add_hook' do before do stub_post('/hooks', 'system_hook') @hook = Gitlab.add_hook('http://example.com/hook', token: 'secret-token') end it 'gets the correct resource' do expect(a_post('/hooks').with(body: hash_including(token: 'secret-token'))).to have_been_made end it 'returns information about a added system hook' do expect(@hook.url).to eq('http://example.com/hook') end end describe '.hook' do before do stub_get('/hooks/3', 'system_hook') @hook = Gitlab.hook(3) end it 'gets the correct resource' do expect(a_get('/hooks/3')).to have_been_made end it 'returns information about a added system hook' do expect(@hook.url).to eq('http://example.com/hook') end end describe '.delete_hook' do before do stub_delete('/hooks/3', 'system_hook') @hook = Gitlab.delete_hook(3) end it 'gets the correct resource' do expect(a_delete('/hooks/3')).to have_been_made end it 'returns information about a deleted system hook' do expect(@hook.url).to eq('http://example.com/hook') end end end gitlab-4.8.0/spec/gitlab/client/tags_spec.rb000066400000000000000000000110661341107427500207440ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :repo_tags } it { is_expected.to respond_to :repo_tag } it { is_expected.to respond_to :repo_create_tag } it { is_expected.to respond_to :repo_delete_tag } it { is_expected.to respond_to :repo_create_release } it { is_expected.to respond_to :repo_update_release } describe '.tags' do before do stub_get('/projects/3/repository/tags', 'tags') @tags = Gitlab.tags(3) end it 'gets the correct resource' do expect(a_get('/projects/3/repository/tags')).to have_been_made end it 'returns a paginated response of repository tags' do expect(@tags).to be_a Gitlab::PaginatedResponse expect(@tags.map(&:name)).to eq(%w[0.0.2 0.0.1]) end end describe '.tag' do before do stub_get('/projects/3/repository/tags/0.0.1', 'tag') @tag = Gitlab.tag(3, '0.0.1') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/tags/0.0.1')).to have_been_made end it 'returns information about a repository tag' do expect(@tag.name).to eq('0.0.1') end context 'tag with special character' do before do stub_get('/projects/3/repository/tags/test%2Fme', 'tag') @tag = Gitlab.tag(3, 'test/me') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/tags/test%2Fme')).to have_been_made end end end describe '.create_tag' do before do stub_post('/projects/3/repository/tags', 'tag_create') @tag = Gitlab.create_tag(3, '0.0.1', 'master', 'this tag is annotated', 'and it has release notes') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/tags')).to have_been_made end it 'returns information about a new repository tag' do expect(@tag.name).to eq('0.0.1') expect(@tag.message).to eq('this tag is annotated') end it 'returns detailed information' do expect(@tag.release.description).to eq('and it has release notes') end end describe '.delete_tag' do before do stub_delete('/projects/3/repository/tags/0.0.1', 'tag_delete') @tag = Gitlab.delete_tag(3, '0.0.1') end it 'gets the correct resource' do expect(a_delete('/projects/3/repository/tags/0.0.1')).to have_been_made end it 'returns information about the deleted repository tag' do expect(@tag.tag_name).to eq('0.0.1') end context 'tag with special character' do before do stub_delete('/projects/3/repository/tags/test%2Fme', 'tag_delete') @tag = Gitlab.delete_tag(3, 'test/me') end it 'gets the correct resource' do expect(a_delete('/projects/3/repository/tags/test%2Fme')).to have_been_made end end end describe '.create_release' do before do stub_post('/projects/3/repository/tags/0.0.1/release', 'release_create') @tag = Gitlab.create_release(3, '0.0.1', 'Amazing release. Wow') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/tags/0.0.1/release')).to have_been_made end it 'returns information about the tag and the release' do expect(@tag.tag_name).to eq('0.0.1') expect(@tag.description).to eq('Amazing release. Wow') end context 'tag with special character' do before do stub_post('/projects/3/repository/tags/test%2Fme/release', 'release_create') @tag = Gitlab.create_release(3, 'test/me', 'Amazing release. Wow') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/tags/test%2Fme/release')).to have_been_made end end end describe '.update_release' do before do stub_put('/projects/3/repository/tags/0.0.1/release', 'release_update') @tag = Gitlab.update_release(3, '0.0.1', 'Amazing release. Wow') end it 'updates the correct resource' do expect(a_put('/projects/3/repository/tags/0.0.1/release')).to have_been_made end it 'returns information about the tag' do expect(@tag.tag_name).to eq('0.0.1') expect(@tag.description).to eq('Amazing release. Wow') end context 'tag with special character' do before do stub_put('/projects/3/repository/tags/test%2Fme/release', 'release_update') @tag = Gitlab.update_release(3, 'test/me', 'Amazing release. Wow') end it 'updates the correct resource' do expect(a_put('/projects/3/repository/tags/test%2Fme/release')).to have_been_made end end end end gitlab-4.8.0/spec/gitlab/client/templates_spec.rb000066400000000000000000000071171341107427500220060ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.dockerfile_templates' do before do stub_get('/templates/dockerfiles', 'dockerfile_templates') @dockerfile_templates = Gitlab.dockerfile_templates end it 'gets the correct resource' do expect(a_get('/templates/dockerfiles')).to have_been_made end it 'returns a paginated response of dockerfile templates' do expect(@dockerfile_templates).to be_a Gitlab::PaginatedResponse end end describe '.dockerfile_template' do before do stub_get('/templates/dockerfiles/Binary', 'dockerfile_project_template') @dockerfile_template = Gitlab.dockerfile_template('Binary') end it 'gets the correct resource' do expect(a_get('/templates/dockerfiles/Binary')).to have_been_made end it 'returns the correct information about the dockerfile template' do expect(@dockerfile_template.name).to eq 'Binary' end end describe '.gitignore_templates' do before do stub_get('/templates/gitignores', 'gitignore_templates') @gitignore_templates = Gitlab.gitignore_templates end it 'gets the correct resource' do expect(a_get('/templates/gitignores')).to have_been_made end it 'returns a paginated response of gitignore templates' do expect(@gitignore_templates).to be_a Gitlab::PaginatedResponse end end describe '.gitignore_template' do before do stub_get('/templates/gitignores/Ruby', 'gitignore_template') @gitignore_template = Gitlab.gitignore_template('Ruby') end it 'gets the correct resource' do expect(a_get('/templates/gitignores/Ruby')).to have_been_made end it 'returns the correct information about the gitignore template' do expect(@gitignore_template.name).to eq 'Ruby' end end describe '.gitlab_ci_yml_templates' do before do stub_get('/templates/gitlab_ci_ymls', 'gitlab_ci_yml_templates') @gitlab_ci_yml_templates = Gitlab.gitlab_ci_yml_templates end it 'gets the correct resource' do expect(a_get('/templates/gitlab_ci_ymls')).to have_been_made end it 'returns a paginated response of gitlab_ci_yml templates' do expect(@gitlab_ci_yml_templates).to be_a Gitlab::PaginatedResponse end end describe '.gitlab_ci_yml_template' do before do stub_get('/templates/gitlab_ci_ymls/Ruby', 'gitlab_ci_yml_template') @gitlab_ci_yml_template = Gitlab.gitlab_ci_yml_template('Ruby') end it 'gets the correct resource' do expect(a_get('/templates/gitlab_ci_ymls/Ruby')).to have_been_made end it 'returns the correct information about the gitlab_ci_yml template' do expect(@gitlab_ci_yml_template.name).to eq 'Ruby' end end describe '.license_templates' do before do stub_get('/templates/licenses', 'license_templates') @license_templates = Gitlab.license_templates end it 'gets the correct resource' do expect(a_get('/templates/licenses')).to have_been_made end it 'returns a paginated response of license templates' do expect(@license_templates).to be_a Gitlab::PaginatedResponse end end describe '.license_template' do before do stub_get('/templates/licenses/mit', 'license_template') @license_template = Gitlab.license_template('mit') end it 'gets the correct resource' do expect(a_get('/templates/licenses/mit')).to have_been_made end it 'returns the correct information about the license template' do expect(@license_template.key).to eq 'mit' end end end gitlab-4.8.0/spec/gitlab/client/todos_spec.rb000066400000000000000000000021201341107427500211250ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.todos' do before do stub_get('/todos', 'todos') @todos = Gitlab.todos end it 'gets the correct resources' do expect(a_get('/todos')).to have_been_made end it "returns a paginated response of user's todos" do expect(@todos).to be_a Gitlab::PaginatedResponse end end describe '.mark_todo_as_done' do before do stub_post('/todos/102/mark_as_done', 'todo') @todo = Gitlab.mark_todo_as_done(102) end it 'gets the correct resource' do expect(a_post('/todos/102/mark_as_done')).to have_been_made end it 'returns information about the todo marked as done' do expect(@todo.id).to eq(102) expect(@todo.state).to eq('done') end end describe '.mark_all_todos_as_done' do before do stub_post('/todos/mark_as_done', 'todos') @todos = Gitlab.mark_all_todos_as_done end it 'gets the correct resources' do expect(a_post('/todos/mark_as_done')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/client/users_spec.rb000066400000000000000000000275321341107427500211540ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.users' do before do stub_get('/users', 'users') @users = Gitlab.users end it 'gets the correct resource' do expect(a_get('/users')).to have_been_made end it 'returns a paginated response of users' do expect(@users).to be_a Gitlab::PaginatedResponse expect(@users.first.email).to eq('john@example.com') end end describe '.user' do context 'with user ID passed' do before do stub_get('/users/1', 'user') @user = Gitlab.user(1) end it 'gets the correct resource' do expect(a_get('/users/1')).to have_been_made end it 'returns information about a user' do expect(@user.email).to eq('john@example.com') end end context 'without user ID passed' do before do stub_get('/user', 'user') @user = Gitlab.user end it 'gets the correct resource' do expect(a_get('/user')).to have_been_made end it 'returns information about an authorized user' do expect(@user.email).to eq('john@example.com') end end end describe '.create_user' do context 'when successful request' do before do stub_post('/users', 'user') @user = Gitlab.create_user('email', 'pass') end it 'gets the correct resource' do body = { email: 'email', password: 'pass', name: 'email' } expect(a_post('/users').with(body: body)).to have_been_made end it 'returns information about a created user' do expect(@user.email).to eq('john@example.com') end end context 'when bad request' do it 'throws an exception' do stub_post('/users', 'error_already_exists', 409) expect do Gitlab.create_user('email', 'pass') end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users") end end end describe '.create_user_with_userame' do context 'when successful request' do before do stub_post('/users', 'user') @user = Gitlab.create_user('email', 'pass', 'username') end it 'gets the correct resource' do body = { email: 'email', password: 'pass', username: 'username' } expect(a_post('/users').with(body: body)).to have_been_made end it 'returns information about a created user' do expect(@user.email).to eq('john@example.com') end end context 'when bad request' do it 'throws an exception' do stub_post('/users', 'error_already_exists', 409) expect do Gitlab.create_user('email', 'pass', 'username') end.to raise_error(Gitlab::Error::Conflict, "Server responded with code 409, message: 409 Already exists. Request URI: #{Gitlab.endpoint}/users") end end end describe '.edit_user' do before do @options = { name: 'Roberto' } stub_put('/users/1', 'user').with(body: @options) @user = Gitlab.edit_user(1, @options) end it 'gets the correct resource' do expect(a_put('/users/1').with(body: @options)).to have_been_made end end describe '.delete_user' do before do stub_delete('/users/1', 'user') @user = Gitlab.delete_user(1) end it 'gets the correct resource' do expect(a_delete('/users/1')).to have_been_made end it 'returns information about a deleted user' do expect(@user.email).to eq('john@example.com') end end describe '.block_user' do before do stub_post('/users/1/block', 'user_block_unblock') @result = Gitlab.block_user(1) end it 'gets the correct resource' do expect(a_post('/users/1/block')).to have_been_made end it 'returns boolean' do expect(@result).to eq(true) end end describe '.unblock_user' do before do stub_post('/users/1/unblock', 'user_block_unblock') @result = Gitlab.unblock_user(1) end it 'gets the correct resource' do expect(a_post('/users/1/unblock')).to have_been_made end it 'returns boolean' do expect(@result).to eq(true) end end describe '.session' do after do Gitlab.endpoint = 'https://api.example.com' Gitlab.private_token = 'secret' end before do stub_request(:post, "#{Gitlab.endpoint}/session") .to_return(body: load_fixture('session'), status: 200) @session = Gitlab.session('email', 'pass') end context 'when endpoint is not set' do it 'raises Error::MissingCredentials' do Gitlab.endpoint = nil expect do Gitlab.session('email', 'pass') end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API') end end context 'when private_token is not set' do it 'does not raise Error::MissingCredentials' do Gitlab.private_token = nil expect { Gitlab.session('email', 'pass') }.not_to raise_error end end context 'when endpoint is set' do it 'gets the correct resource' do expect(a_request(:post, "#{Gitlab.endpoint}/session")).to have_been_made end it 'returns information about a created session' do expect(@session.email).to eq('john@example.com') expect(@session.private_token).to eq('qEsq1pt6HJPaNciie3MG') end end end describe '.ssh_keys' do context 'with user ID passed' do before do stub_get('/users/1/keys', 'keys') @keys = Gitlab.ssh_keys(user_id: 1) end it 'gets the correct resource' do expect(a_get('/users/1/keys')).to have_been_made end it 'returns a paginated response of SSH keys' do expect(@keys).to be_a Gitlab::PaginatedResponse expect(@keys.first.title).to eq('narkoz@helium') end end context 'without user ID passed' do before do stub_get('/user/keys', 'keys') @keys = Gitlab.ssh_keys end it 'gets the correct resource' do expect(a_get('/user/keys')).to have_been_made end it 'returns a paginated response of SSH keys' do expect(@keys).to be_a Gitlab::PaginatedResponse expect(@keys.first.title).to eq('narkoz@helium') end end end describe '.ssh_key' do before do stub_get('/user/keys/1', 'key') @key = Gitlab.ssh_key(1) end it 'gets the correct resource' do expect(a_get('/user/keys/1')).to have_been_made end it 'returns information about an SSH key' do expect(@key.title).to eq('narkoz@helium') end end describe '.create_ssh_key' do describe 'without user ID' do before do stub_post('/user/keys', 'key') @key = Gitlab.create_ssh_key('title', 'body') end it 'gets the correct resource' do body = { title: 'title', key: 'body' } expect(a_post('/user/keys').with(body: body)).to have_been_made end it 'returns information about a created SSH key' do expect(@key.title).to eq('narkoz@helium') end end describe 'with user ID' do before do stub_post('/users/1/keys', 'key') @options = { user_id: 1 } @key = Gitlab.create_ssh_key('title', 'body', @options) end it 'gets the correct resource' do body = { title: 'title', key: 'body' } expect(a_post('/users/1/keys').with(body: body)).to have_been_made end it 'returns information about a created SSH key' do expect(@key.title).to eq('narkoz@helium') end end end describe '.delete_ssh_key' do describe 'without user ID' do before do stub_delete('/user/keys/1', 'key') @key = Gitlab.delete_ssh_key(1) end it 'gets the correct resource' do expect(a_delete('/user/keys/1')).to have_been_made end it 'returns information about a deleted SSH key' do expect(@key.title).to eq('narkoz@helium') end end describe 'with user ID' do before do stub_delete('/users/1/keys/1', 'key') @options = { user_id: 1 } @key = Gitlab.delete_ssh_key(1, @options) end it 'gets the correct resource' do expect(a_delete('/users/1/keys/1')).to have_been_made end it 'returns information about a deleted SSH key' do expect(@key.title).to eq('narkoz@helium') end end end describe '.emails' do describe 'without user ID' do before do stub_get('/user/emails', 'user_emails') @emails = Gitlab.emails end it 'gets the correct resource' do expect(a_get('/user/emails')).to have_been_made end it 'returns a information about a emails of user' do email = @emails.first expect(email.id).to eq 1 expect(email.email).to eq('email@example.com') end end describe 'with user ID' do before do stub_get('/users/2/emails', 'user_emails') @emails = Gitlab.emails(2) end it 'gets the correct resource' do expect(a_get('/users/2/emails')).to have_been_made end it 'returns a information about a emails of user' do email = @emails.first expect(email.id).to eq 1 expect(email.email).to eq('email@example.com') end end end describe '.email' do before do stub_get('/user/emails/2', 'user_email') @email = Gitlab.email(2) end it 'gets the correct resource' do expect(a_get('/user/emails/2')).to have_been_made end it 'returns a information about a email of user' do expect(@email.id).to eq 1 expect(@email.email).to eq('email@example.com') end end describe '.add_email' do describe 'without user ID' do before do stub_post('/user/emails', 'user_email') @email = Gitlab.add_email('email@example.com') end it 'gets the correct resource' do body = { email: 'email@example.com' } expect(a_post('/user/emails').with(body: body)).to have_been_made end it 'returns information about a new email' do expect(@email.id).to eq(1) expect(@email.email).to eq('email@example.com') end end describe 'with user ID' do before do stub_post('/users/2/emails', 'user_email') @email = Gitlab.add_email('email@example.com', 2) end it 'gets the correct resource' do body = { email: 'email@example.com' } expect(a_post('/users/2/emails').with(body: body)).to have_been_made end it 'returns information about a new email' do expect(@email.id).to eq(1) expect(@email.email).to eq('email@example.com') end end end describe '.delete_email' do describe 'without user ID' do before do stub_delete('/user/emails/1', 'user_email') @email = Gitlab.delete_email(1) end it 'gets the correct resource' do expect(a_delete('/user/emails/1')).to have_been_made end it 'returns information about a deleted email' do expect(@email).to be_truthy end end describe 'with user ID' do before do stub_delete('/users/2/emails/1', 'user_email') @email = Gitlab.delete_email(1, 2) end it 'gets the correct resource' do expect(a_delete('/users/2/emails/1')).to have_been_made end it 'returns information about a deleted email' do expect(@email).to be_truthy end end end describe '.user_search' do before do stub_get('/users?search=User', 'user_search') @users = Gitlab.user_search('User') end it 'gets the correct resource' do expect(a_get('/users?search=User')).to have_been_made end it 'returns an array of users found' do expect(@users.first.id).to eq(1) expect(@users.last.id).to eq(2) end end end gitlab-4.8.0/spec/gitlab/client/versions_spec.rb000066400000000000000000000007271341107427500216600ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.version' do before do stub_get('/version', 'version') end let!(:version) { Gitlab.version } it 'gets the correct resource' do expect(a_get('/version')).to have_been_made end it 'returns information about gitlab server' do expect(version.version).to eq('8.13.0-pre') expect(version.revision).to eq('4e963fe') end end end gitlab-4.8.0/spec/gitlab/client/wikis_spec.rb000066400000000000000000000036741341107427500211420ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do describe '.wikis' do before do stub_get('/projects/1/wikis', 'wikis') @wikis = Gitlab.wikis(1) end it 'gets the correct resource' do expect(a_get('/projects/1/wikis')).to have_been_made end it "returns a response of a project's wikis" do expect(@wikis).to be_a Gitlab::PaginatedResponse end end describe '.wiki' do before do stub_get('/projects/1/wikis/home', 'wiki') @wiki = Gitlab.wiki(1, 'home') end it 'gets the correct resource' do expect(a_get('/projects/1/wikis/home')).to have_been_made end it 'returns correct information about the wiki' do expect(@wiki.slug).to eq 'home' end end describe '.create_wiki' do before do stub_post('/projects/1/wikis', 'wiki') @wiki = Gitlab.create_wiki(1, 'home', 'home page') end it 'gets the correct resource' do expect(a_post('/projects/1/wikis') .with(body: { content: 'home page', title: 'home' })).to have_been_made end it 'returns correct information about the created wiki' do expect(@wiki.content).to eq 'home page' expect(@wiki.title).to eq 'home' end end describe '.update_wiki' do before do stub_put('/projects/1/wikis/home', 'wiki') @wiki = Gitlab.update_wiki(1, 'home', format: 'markdown') end it 'gets the correct resource' do expect(a_put('/projects/1/wikis/home') .with(body: { format: 'markdown' })).to have_been_made end it 'returns correct information about the updated wiki' do expect(@wiki.format).to eq 'markdown' end end describe '.delete_wiki' do before do stub_delete('/projects/1/wikis/home', 'empty') @wiki = Gitlab.delete_wiki(1, 'home') end it 'gets the correct resource' do expect(a_delete('/projects/1/wikis/home')).to have_been_made end end end gitlab-4.8.0/spec/gitlab/error_spec.rb000066400000000000000000000037721341107427500176660ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Error::ResponseError do before do @request_double = double(base_uri: 'https://gitlab.com/api/v3', path: '/foo') end let(:expected_messages) do [ %r{Server responded with code \d+, message: Displayed message. Request URI: https://gitlab.com/api/v3/foo}, %r{Server responded with code \d+, message: Displayed error_description. Request URI: https://gitlab.com/api/v3/foo}, %r{Server responded with code \d+, message: Displayed error. Request URI: https://gitlab.com/api/v3/foo}, %r{Server responded with code \d+, message: 'embed_entity' \(foo: bar\) \(sna: fu\), 'password' too short. Request URI: https://gitlab.com/api/v3/foo}, %r{Server responded with code \d+, message: First message. Second message.. Request URI: https://gitlab.com/api/v3/foo}, %r{Server responded with code \d+, message: 'error' Spam detected. Request URI: https://gitlab.com/api/v3/foo} ] end # Set up some response scenarios to test. [ { code: 401, parsed_response: Gitlab::ObjectifiedHash.new(message: 'Displayed message', error_description: 'should not be displayed', error: 'also will not be displayed') }, { code: 404, parsed_response: Gitlab::ObjectifiedHash.new(error_description: 'Displayed error_description', error: 'also will not be displayed') }, { code: 401, parsed_response: Gitlab::ObjectifiedHash.new(error: 'Displayed error') }, { code: 500, parsed_response: Gitlab::ObjectifiedHash.new(embed_entity: { foo: ['bar'], sna: ['fu'] }, password: ['too short']) }, { code: 403, parsed_response: Array.new(['First message.', 'Second message.']) }, { code: 400, parsed_response: Gitlab::ObjectifiedHash.new(message: { error: 'Spam detected' }) } ].each_with_index do |data, index| it 'returns the expected message' do response_double = double(**data, request: @request_double) expect(described_class.new(response_double).message).to match expected_messages[index] end end end gitlab-4.8.0/spec/gitlab/file_response_spec.rb000066400000000000000000000015621341107427500213650ustar00rootroot00000000000000require 'spec_helper' describe Gitlab::FileResponse do before do @file_response = described_class.new StringIO.new('', 'rb+') end context '.empty?' do it 'returns false' do expect(@file_response.empty?).to be false end end context '.to_hash' do it 'has `filename` key and `data` key' do h = @file_response.to_hash expect(h).to be_key(:filename) expect(h).to be_key(:data) end end context '.parse_headers!' do it 'parses headers' do @file_response.parse_headers!('Content-Disposition' => 'attachment; filename=artifacts.zip') expect(@file_response.filename).to eq 'artifacts.zip' end it 'handles quoted filenames' do @file_response.parse_headers!('Content-Disposition' => 'attachment; filename="artifacts.zip"') expect(@file_response.filename).to eq 'artifacts.zip' end end end gitlab-4.8.0/spec/gitlab/help_spec.rb000066400000000000000000000027611341107427500174620ustar00rootroot00000000000000require 'spec_helper' describe Gitlab::Help do describe '.ri_cmd' do context 'ri command found' do it 'returns the path to RI' do allow(described_class).to receive(:`).with(/which ri/).and_return('/usr/bin/ri') expect(described_class.ri_cmd).to eq('/usr/bin/ri') end end context 'ri command NOT found' do it 'raises RuntimeError' do allow(described_class).to receive(:`).with(/which ri/).and_return('') expect { described_class.ri_cmd }.to raise_error RuntimeError end end end describe '.change_help_output!' do before do @cmd = 'create_branch' @help_output = "Gitlab.#{@cmd}(4, 'new-branch', 'master')" @help_output_with_options = 'Gitlab.groups({ per_page: 3 })' end it 'returns a String of modified output' do described_class.change_help_output! @cmd, @help_output expect(@help_output).to eq("Gitlab.create_branch 4 'new-branch' 'master'") end it 'formats options hash and return a String of modified output' do described_class.change_help_output! 'groups', @help_output_with_options expect(@help_output_with_options).to eq('Gitlab.groups "{ per_page: 3 }"') end end describe '.namespace' do before do @cmd = 'create_tag' @namespace = described_class.namespace @cmd end it 'returns the full namespace for a command' do expect(@namespace).to be_a String expect(@namespace).to eq("Gitlab::Client::Tags.#{@cmd}") end end end gitlab-4.8.0/spec/gitlab/objectified_hash_spec.rb000066400000000000000000000024131341107427500217760ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::ObjectifiedHash do before do @hash = { a: 1, b: 2, 'string' => 'string', symbol: :symbol } @oh = described_class.new @hash end it 'objectifies a hash' do expect(@oh.a).to eq(@hash[:a]) expect(@oh.b).to eq(@hash[:b]) end describe '#to_hash' do it 'returns an original hash' do expect(@oh.to_hash).to eq(@hash) end it 'has an alias #to_h' do expect(@oh).to respond_to(:to_h) end end describe '#inspect' do it 'returns a formatted string' do pretty_string = "#<#{@oh.class.name}:#{@oh.object_id} {hash: #{@hash}}" expect(@oh.inspect).to eq(pretty_string) end end describe '#respond_to' do it 'returns true for methods this object responds to through method_missing as sym' do expect(@oh).to respond_to(:a) end it 'returns true for methods this object responds to through method_missing as string' do expect(@oh).to respond_to('string') end it 'does not care if you use a string or symbol to reference a method' do expect(@oh).to respond_to(:string) end it 'does not care if you use a string or symbol to reference a method' do expect(@oh).to respond_to('symbol') end end end gitlab-4.8.0/spec/gitlab/page_links_spec.rb000066400000000000000000000016001341107427500206350ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::PageLinks do before do @page_links = described_class.new('Link' => '; rel="first", ; rel="last", ; rel="prev", ; rel="next"') end context '.extract_links' do it 'extracts link header appropriately' do expect(@page_links.last).to eql 'http://example.com/api/v3/projects?page=20&per_page=5' expect(@page_links.first).to eql 'http://example.com/api/v3/projects?page=1&per_page=5' expect(@page_links.next).to eql 'http://example.com/api/v3/projects?page=9&per_page=5' expect(@page_links.prev).to eql 'http://example.com/api/v3/projects?page=7&per_page=5' end end end gitlab-4.8.0/spec/gitlab/paginated_response_spec.rb000066400000000000000000000055371341107427500224100ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::PaginatedResponse do before do array = [1, 2, 3, 4] @paginated_response = described_class.new array end it 'responds to *_page and has_*_page methods' do expect(@paginated_response).to respond_to :first_page expect(@paginated_response).to respond_to :last_page expect(@paginated_response).to respond_to :next_page expect(@paginated_response).to respond_to :prev_page expect(@paginated_response).to respond_to :has_first_page? expect(@paginated_response).to respond_to :has_last_page? expect(@paginated_response).to respond_to :has_next_page? expect(@paginated_response).to respond_to :has_prev_page? end context '.parse_headers!' do it 'parses headers' do @paginated_response.parse_headers!('Link' => '; rel="first", ; rel="last"') client = @paginated_response.client = double('client') first_page_response = double('first_page_response') last_page_response = double('last_page_response') allow(client).to receive(:endpoint).and_return('http://example.com/api/v3') allow(client).to receive(:get).with('/projects?page=1&per_page=5').and_return(first_page_response) allow(client).to receive(:get).with('/projects?page=20&per_page=5').and_return(last_page_response) expect(@paginated_response.has_first_page?).to be true expect(@paginated_response.has_last_page?).to be true expect(@paginated_response.has_next_page?).to be false expect(@paginated_response.has_prev_page?).to be false expect(@paginated_response.first_page).to be first_page_response expect(@paginated_response.last_page).to be last_page_response expect(@paginated_response.next_page).to be_nil expect(@paginated_response.prev_page).to be_nil end end context '.each_page' do it 'iterates pages' do next_page = double('next_page') allow(@paginated_response).to receive(:has_next_page?).and_return(true) allow(@paginated_response).to receive(:next_page).and_return(next_page) allow(next_page).to receive(:has_next_page?).and_return(false) expect { |b| @paginated_response.each_page(&b) }.to yield_successive_args(@paginated_response, next_page) end end context '.auto_paginate' do it 'returns an array if block is not given' do next_page = double('next_page') allow(@paginated_response).to receive(:has_next_page?).and_return(true) allow(@paginated_response).to receive(:next_page).and_return(next_page) allow(next_page).to receive(:has_next_page?).and_return(false) allow(next_page).to receive(:to_ary).and_return([5, 6, 7, 8]) expect(@paginated_response.auto_paginate).to contain_exactly(1, 2, 3, 4, 5, 6, 7, 8) end end end gitlab-4.8.0/spec/gitlab/request_spec.rb000066400000000000000000000051151341107427500202160ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Request do it { is_expected.to respond_to :get } it { is_expected.to respond_to :post } it { is_expected.to respond_to :put } it { is_expected.to respond_to :delete } before do @request = described_class.new end describe '.default_options' do it 'has default values' do default_options = described_class.default_options expect(default_options).to be_a Hash expect(default_options[:parser]).to be_a Proc expect(default_options[:format]).to eq(:json) expect(default_options[:headers]).to eq('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded') expect(default_options[:default_params]).to be_nil end end describe '.parse' do it 'returns ObjectifiedHash' do body = JSON.unparse(a: 1, b: 2) expect(described_class.parse(body)).to be_an Gitlab::ObjectifiedHash expect(described_class.parse('true')).to be true expect(described_class.parse('false')).to be false expect { described_class.parse('string') }.to raise_error(Gitlab::Error::Parsing) end end describe '#request_defaults' do context 'when endpoint is not set' do it 'raises Error::MissingCredentials' do @request.endpoint = nil expect do @request.request_defaults end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API') end end context 'when endpoint is set' do before do @request.endpoint = 'http://rabbit-hole.example.com' end it 'sets default_params' do @request.request_defaults('sudoer') expect(described_class.default_params).to eq(sudo: 'sudoer') end end end describe '#authorization_header' do it 'raises MissingCredentials when auth_token and private_token are not set' do expect do @request.send(:authorization_header, {}) end.to raise_error(Gitlab::Error::MissingCredentials) end it 'sets the correct header when given a private_token' do @request.private_token = 'ys9BtunN3rDKbaJCYXaN' expect(@request.send(:authorization_header, {})).to eq('PRIVATE-TOKEN' => 'ys9BtunN3rDKbaJCYXaN') end it 'sets the correct header when setting an auth_token via the private_token config option' do @request.private_token = '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603' expect(@request.send(:authorization_header, {})).to eq('Authorization' => 'Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') end end end gitlab-4.8.0/spec/gitlab/shell_history_spec.rb000066400000000000000000000027431341107427500214220ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' require 'tempfile' describe Gitlab::Shell::History do context 'saving to a file' do before do @file = Tempfile.new('.gitlab_shell_history') @history = described_class.new(file_path: @file.path) end after { @file.close(true) } it 'saves the lines' do @history << 'party on, dudes' @history << 'be excellent to each other' @history.save expect(File.read(@file.path)) .to eq("party on, dudes\nbe excellent to each other\n") end it 'has the lines' do @history << 'party on, dudes' @history << 'be excellent to each other' expect(@history.lines) .to eq(['party on, dudes', 'be excellent to each other']) end it 'limits the lines to GITLAB_HISTFILESIZE' do ENV['GITLAB_HISTFILESIZE'] = '2' @history << 'bogus' @history << 'party on, dudes' @history << 'be excellent to each other' @history.save expect(@history.lines) .to eq(['party on, dudes', 'be excellent to each other']) expect(File.read(@file.path)) .to eq("party on, dudes\nbe excellent to each other\n") end end context 'loading a file' do before do @file = load_fixture('shell_history') @history = described_class.new(file_path: @file.path) end it 'has the lines' do @history.load expect(@history.lines) .to eq(['party on, dudes', 'be excellent to each other']) end end end gitlab-4.8.0/spec/gitlab/shell_spec.rb000066400000000000000000000045171341107427500176420ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab::Shell do before do described_class.setup end describe '.execute' do context 'invalid command' do it 'raises RuntimeError' do expect { described_class.execute 'foobar', [] }.to raise_error(RuntimeError) end end end describe '.history' do before do @history = described_class.history end it 'returns a Gitlab::Shell::History instance' do expect(@history).to be_a Gitlab::Shell::History end it 'responds to :save' do expect(@history).to respond_to :save end it 'responds to :load' do expect(@history).to respond_to :load end it 'responds to :<<' do expect(@history).to respond_to :<< end end describe '.setup' do it 'sets the Readline completion_proc' do completion = Readline.completion_proc expect(completion).to be_truthy expect(completion).to be_a Proc end it 'sets the Readline completion_append_character' do completion_character = Readline.completion_append_character expect(completion_character).to eq(' ') end end describe '.completion' do before do @comp = described_class.completion end it 'returns a Proc object' do expect(@comp).to be_a Proc end context 'called with an argument' do it 'returns an Array of matching commands' do completed_cmds = @comp.call 'group' expect(completed_cmds).to be_a Array expect(completed_cmds.sort).to eq(%w[group group_access_requests group_member group_members group_milestone group_milestone_issues group_milestone_merge_requests group_milestones group_projects group_search group_subgroups group_variable group_variables groups]) end end end describe '.parse_input' do context 'with arguments' do it 'sets command & arguments' do described_class.parse_input('create_branch 1 "api" "master"') expect(described_class.command).to eq('create_branch') expect(described_class.arguments).to eq(%w[1 api master]) end end context 'without arguments' do it 'sets command & empty arguments' do described_class.parse_input('exit') expect(described_class.command).to eq('exit') expect(described_class.arguments).to be_empty end end end end gitlab-4.8.0/spec/gitlab_spec.rb000066400000000000000000000060241341107427500165260ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Gitlab do after { described_class.reset } describe '.client' do it 'is a Gitlab::Client' do expect(described_class.client).to be_a Gitlab::Client end it 'does not override each other' do client1 = described_class.client(endpoint: 'https://api1.example.com', private_token: '001') client2 = described_class.client(endpoint: 'https://api2.example.com', private_token: '002') expect(client1.endpoint).to eq('https://api1.example.com') expect(client2.endpoint).to eq('https://api2.example.com') expect(client1.private_token).to eq('001') expect(client2.private_token).to eq('002') end it 'sets private_token to the auth_token when provided' do client = described_class.client(endpoint: 'https://api2.example.com', auth_token: '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') expect(client.private_token).to eq('3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603') end end describe '.actions' do it 'returns an array of client methods' do actions = described_class.actions expect(actions).to be_an Array expect(actions.first).to be_a Symbol expect(actions.min).to eq(:accept_merge_request) end end describe '.endpoint=' do it 'sets endpoint' do described_class.endpoint = 'https://api.example.com' expect(described_class.endpoint).to eq('https://api.example.com') end end describe '.private_token=' do it 'sets private_token' do described_class.private_token = 'secret' expect(described_class.private_token).to eq('secret') end end describe '.auth_token=' do it 'sets auth_token', focus: true do described_class.auth_token = 'auth_secret' expect(described_class.private_token).to eq('auth_secret') end end describe '.sudo=' do it 'sets sudo' do described_class.sudo = 'user' expect(described_class.sudo).to eq('user') end end describe '.user_agent' do it 'returns default user_agent' do expect(described_class.user_agent).to eq(Gitlab::Configuration::DEFAULT_USER_AGENT) end end describe '.user_agent=' do it 'sets user_agent' do described_class.user_agent = 'Custom User Agent' expect(described_class.user_agent).to eq('Custom User Agent') end end describe '.configure' do Gitlab::Configuration::VALID_OPTIONS_KEYS.each do |key| it "sets #{key}" do described_class.configure do |config| config.send("#{key}=", key) expect(described_class.send(key)).to eq(key) end end end end describe '.http_proxy' do it 'delegates the method to Gitlab::Request' do described_class.endpoint = 'https://api.example.com' request = class_spy(Gitlab::Request).as_stubbed_const described_class.http_proxy('proxy.example.net', 1987, 'user', 'pass') expect(request).to have_received(:http_proxy).with('proxy.example.net', 1987, 'user', 'pass') end end end gitlab-4.8.0/spec/spec_helper.rb000066400000000000000000000020021341107427500165330ustar00rootroot00000000000000# frozen_string_literal: true require 'rspec' require 'webmock/rspec' require File.expand_path('../lib/gitlab', __dir__) require File.expand_path('../lib/gitlab/cli', __dir__) def capture_output out = StringIO.new $stdout = out $stderr = out yield $stdout = STDOUT $stderr = STDERR out.string end def load_fixture(name) File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json") end RSpec.configure do |config| config.before(:all) do Gitlab.endpoint = 'https://api.example.com' Gitlab.private_token = 'secret' end end %i[get post put delete].each do |method| define_method "stub_#{method}" do |path, fixture, status_code = 200| stub_request(method, "#{Gitlab.endpoint}#{path}") .with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) .to_return(body: load_fixture(fixture), status: status_code) end define_method "a_#{method}" do |path| a_request(method, "#{Gitlab.endpoint}#{path}") .with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }) end end