gitlab 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/CHANGELOG.md +157 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +16 -10
  6. data/lib/gitlab.rb +1 -1
  7. data/lib/gitlab/api.rb +5 -3
  8. data/lib/gitlab/cli.rb +21 -3
  9. data/lib/gitlab/cli_helpers.rb +46 -79
  10. data/lib/gitlab/client.rb +2 -1
  11. data/lib/gitlab/client/branches.rb +16 -1
  12. data/lib/gitlab/client/groups.rb +1 -0
  13. data/lib/gitlab/client/issues.rb +1 -0
  14. data/lib/gitlab/client/labels.rb +2 -0
  15. data/lib/gitlab/client/merge_requests.rb +12 -10
  16. data/lib/gitlab/client/milestones.rb +15 -0
  17. data/lib/gitlab/client/notes.rb +22 -6
  18. data/lib/gitlab/client/projects.rb +18 -0
  19. data/lib/gitlab/client/repositories.rb +4 -1
  20. data/lib/gitlab/client/repository_files.rb +72 -0
  21. data/lib/gitlab/client/snippets.rb +1 -11
  22. data/lib/gitlab/client/system_hooks.rb +1 -0
  23. data/lib/gitlab/client/users.rb +2 -0
  24. data/lib/gitlab/configuration.rb +3 -1
  25. data/lib/gitlab/error.rb +0 -3
  26. data/lib/gitlab/help.rb +77 -31
  27. data/lib/gitlab/objectified_hash.rb +6 -0
  28. data/lib/gitlab/request.rb +31 -15
  29. data/lib/gitlab/shell.rb +57 -58
  30. data/lib/gitlab/version.rb +1 -1
  31. data/spec/fixtures/branch_delete.json +3 -0
  32. data/spec/fixtures/merge_request_changes.json +1 -0
  33. data/spec/fixtures/milestone_issues.json +1 -0
  34. data/spec/fixtures/project_search.json +1 -0
  35. data/spec/fixtures/repository_file.json +1 -0
  36. data/spec/gitlab/cli_helpers_spec.rb +58 -0
  37. data/spec/gitlab/cli_spec.rb +1 -2
  38. data/spec/gitlab/client/branches_spec.rb +15 -0
  39. data/spec/gitlab/client/merge_requests_spec.rb +20 -12
  40. data/spec/gitlab/client/milestones_spec.rb +16 -0
  41. data/spec/gitlab/client/notes_spec.rb +17 -0
  42. data/spec/gitlab/client/projects_spec.rb +45 -8
  43. data/spec/gitlab/client/repository_files_spec.rb +45 -0
  44. data/spec/gitlab/help_spec.rb +44 -0
  45. data/spec/gitlab/objectified_hash_spec.rb +7 -0
  46. data/spec/gitlab/request_spec.rb +45 -6
  47. data/spec/gitlab/shell_spec.rb +80 -0
  48. data/spec/gitlab_spec.rb +12 -0
  49. metadata +23 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dc7a38a2ba00b6ea3f0305b57d4f5209ba03511
4
- data.tar.gz: ba2dcfd5474bd971f26a8baa0ae3949128ca6a5d
3
+ metadata.gz: d3aff91d521f83558b2ae2a2f9d5044be3753c48
4
+ data.tar.gz: e44498d72ac0c58dc3c8d609e53167fef2a30107
5
5
  SHA512:
6
- metadata.gz: 1e9eebbb77c15cad4a5b030061177e8c7ea898b57896f63fb8608ac8fa2812623eb12f5e5d2d3fa1f607945946821a03e040571cd3331478bdde29fc5796f974
7
- data.tar.gz: f90b16ae0d5fbce51044534b4751ff272b492d501a9bd63dfa7e31b8395f1e9166d541266ccaa58fc8e64f6cadf1d5639d0b0e1afd4fdb35a403018c35b5b65a
6
+ metadata.gz: 0e5dc00e6c2c0f34837798e9370a82013154c595b4cde38397d20e87b3bd7457cb5a0e32a6b578df1ebbe6e1457eda03c468da21a91c4ab26a42ff54de43d91e
7
+ data.tar.gz: d9cd147c62de28adb48a9be726b6b1a44b8c0e2d63337d44df2cd1f6eaf18ace338a7f1b8ab7a649683bbe6bb3537015be8dd45a46e44577bb1fdf9b0548bc52
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - 2.0.0
4
+ - 2.0
5
5
  - 2.1
6
+ - 2.2
@@ -0,0 +1,157 @@
1
+ ## Change Log
2
+
3
+ ### upcoming
4
+ - **Your contribution here.**
5
+
6
+ ### 3.4.0 (22/04/2015)
7
+ - [9acb83d](https://github.com/NARKOZ/gitlab/commit/9acb83d2d068720b07934f5152313dc22a2f6374) remove check for missing attributes
8
+ - [8896e2b](https://github.com/NARKOZ/gitlab/commit/8896e2b7d5e8df509d48a411fd4440e27ed13995) return false when response body is empty
9
+ - [a04f3af](https://github.com/NARKOZ/gitlab/commit/a04f3af2d7aa8eec60c4f044fdb148e45c1ca133) escape ref parameter for repo_file_contents
10
+ - [8dcfec5](https://github.com/NARKOZ/gitlab/commit/8dcfec5aaaff9ef1c12687c5f9ca90f6aed0f912) Add tests for project_search. (@asedge)
11
+ - [75ead81](https://github.com/NARKOZ/gitlab/commit/75ead813b4335bab2464b6af0fb776c3d746242f) Added :page and :per_page query options to snippet_notes method (@StephenOTT)
12
+ - [f9818cb](https://github.com/NARKOZ/gitlab/commit/f9818cb121c8eeb9197e66732fec30ab90deecad) Added :page and :per_page query options to issue_notes method (@StephenOTT)
13
+ - [f92d745](https://github.com/NARKOZ/gitlab/commit/f92d745f1f561955d8fcbed4e23b43bb92ace255) Added :page and :per_page query options to notes method (@StephenOTT)
14
+ - [d4c3f20](https://github.com/NARKOZ/gitlab/commit/d4c3f2052c844486cf2b99a5346af4cd3fc001c9) Add support for merge_request_changes (@dsander)
15
+ - [2253fba](https://github.com/NARKOZ/gitlab/commit/2253fbab0a915d23f30de04a90167a0c783f9a6b) Allow authenticating via oauth with the private_token (@dsander)
16
+ - [8b7bcb4](https://github.com/NARKOZ/gitlab/commit/8b7bcb478e168f5ce2c94b8633b33128c29252b9) add inspect method to ObjectifiedHash
17
+ - [257737c](https://github.com/NARKOZ/gitlab/commit/257737c80ca93a71dfb5f8d990e5de1423603dfc) add delete_branch (@marc-ta)
18
+ - [f6532d5](https://github.com/NARKOZ/gitlab/commit/f6532d5074e0bb0d06bc251fb43b73f49a7af17a) improve docs
19
+ - [5164e6d](https://github.com/NARKOZ/gitlab/commit/5164e6de544bc34c57c3444e0b63cf3aada23776) Adding options hash to milestone_issues method.
20
+ - [57fa92d](https://github.com/NARKOZ/gitlab/commit/57fa92d7eef96e84498fa005e7ab83abc2a41a2b) Added support to get milestone issues. (@pbendersky)
21
+ - [d604e58](https://github.com/NARKOZ/gitlab/commit/d604e58732ea08fb15acdc1be339535e34e68d73) Add create_merge_request_note
22
+ - [cea19b8](https://github.com/NARKOZ/gitlab/commit/cea19b8e607033700dcab4648c05ac398cfe9566) Add project_search method (@ey3ball)
23
+ - [d0ebd3b](https://github.com/NARKOZ/gitlab/commit/d0ebd3b3a0ed83fc62d2a2e22ba9aa29a99cdcb6) Catch SIGINT earlier during shell session. Fixes #111. (@asedge)
24
+ - [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)
25
+ - [da18909](https://github.com/NARKOZ/gitlab/commit/da1890949fb9eb60c13ab670dd8428d27de1814b) Add some method documentation and small style fixes. (@asedge)
26
+ - [7e1b408](https://github.com/NARKOZ/gitlab/commit/7e1b408e48152df1ce6e2be74a653c3801a37c10) Authenticate via oauth an auth_token (@dsander)
27
+ - [adb28b3](https://github.com/NARKOZ/gitlab/commit/adb28b30dab47bd3a58eae697d40e4aa346ea2c8) Update create_merge_request doc to include :target_project_id parameter. Closes #108. (@asedge)
28
+ - [525e913](https://github.com/NARKOZ/gitlab/commit/525e9131fe99a3f7396b547810e957058ab5a092) add ruby-2.2 to travis-ci
29
+ - [3671c89](https://github.com/NARKOZ/gitlab/commit/3671c89071d712ee71fa51cac67f3e0b9a28b03b) Save shell history when user presses Ctrl-d (@asedge)
30
+ - [c8e5f50](https://github.com/NARKOZ/gitlab/commit/c8e5f50684533e00550bfa4474062665000df28a) Hide httparty & httparty= methods from Gitlab.actions - just like endpoint, private_token, etc. (@asedge)
31
+ - [358deeb](https://github.com/NARKOZ/gitlab/commit/358deeb8ed849defe28c7cba84e1935d549fce22) Fix a regression with exception handling in shell. (@asedge)
32
+ - [9612ce3](https://github.com/NARKOZ/gitlab/commit/9612ce3b8274a385ce8c1fcd5ca5d0a0eba71c7e) Added support for repository files create, edit and remove. (@razielgn)
33
+ - [2203ad7](https://github.com/NARKOZ/gitlab/commit/2203ad7fcaa337da3d9700cbbc342d961be18eee) Fix headings in action_table. (@asedge)
34
+ - [b4dceb3](https://github.com/NARKOZ/gitlab/commit/b4dceb3d2d582682f3cb35ca63e41e237d222596) add CHANGELOG.md
35
+ - [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)
36
+ - [bffd84f](https://github.com/NARKOZ/gitlab/commit/bffd84f4e9e37d056772536f33a52f40df0b7882) Refactor Gitlab::Help. Add tests some. (@asedge)
37
+ - [9bd4f7a](https://github.com/NARKOZ/gitlab/commit/9bd4f7ad69614ee009c351811deee9eb2a6c3d05) Add test for Gitlab::Shell. (@asedge)
38
+ - [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)
39
+
40
+ ### 3.3.0 (22/12/2014)
41
+ - [42b4bc7](https://github.com/NARKOZ/gitlab/commit/42b4bc7b0e5e35f151ab61e27099606f0f38af31) fix docs and specs
42
+ - [04e39e0](https://github.com/NARKOZ/gitlab/commit/04e39e013a7a74f6101a97c3791da0594da232a3) ability to update hook triggers
43
+ - [6c66fe9](https://github.com/NARKOZ/gitlab/commit/6c66fe92a56cca58630a34ed3e7991517dd63604) remove useless check for available hook events
44
+ - [c4b981d](https://github.com/NARKOZ/gitlab/commit/c4b981dd69974aa7e1cb088c9b9fd44e0c0a9b54) add accept_merge_request method
45
+ - [51611fe](https://github.com/NARKOZ/gitlab/commit/51611fe669987cd9f4c1fac0ed96c743e391bbf2) Use endpoint instance var instead of base_uri class method. Fixes #94. (@asedge)
46
+ - [1ec8b38](https://github.com/NARKOZ/gitlab/commit/1ec8b38322657c3f97a60deb10dc08b828ba9875) test multiple clients
47
+ - [44d013a](https://github.com/NARKOZ/gitlab/commit/44d013af76535a2227678869148fb7a8195691df) Capture CTRL-C in Shell (@chrisdambrosio)
48
+ - [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)
49
+ - [ce20c47](https://github.com/NARKOZ/gitlab/commit/ce20c4768c3e591b0cea72e8738371ab76d7289e) limit history file size - closes #93 (@chrisdambrosio)
50
+ - [1cf656f](https://github.com/NARKOZ/gitlab/commit/1cf656f7cf9f1821339b9e6ed711f6218cddbf0f) Save/load shell mode history - closes #79 (@chrisdambrosio)
51
+ - [727780b](https://github.com/NARKOZ/gitlab/commit/727780b8f282bb8fe461a54e558fe0775b4b36fd) HTTP proxy support - closes #52 (@chrisdambrosio)
52
+ - [e4ceb18](https://github.com/NARKOZ/gitlab/commit/e4ceb187aa5e47d20740676aea4f36c473ddd241) implement .file_contents (@chrisdambrosio)
53
+ - [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)
54
+ - [a7d0e0a](https://github.com/NARKOZ/gitlab/commit/a7d0e0a8c1c50c4ab43faccdb88f049f5b84a1cf) add CONTRIBUTING.md
55
+ - [1f4ef8e](https://github.com/NARKOZ/gitlab/commit/1f4ef8ed25ccd1bdbeccf677a0a94106903d0f24) improve docs
56
+ - [3a8d339](https://github.com/NARKOZ/gitlab/commit/3a8d33946adec71724304f661d70eb515a2f6848) Repository tree root level files (@semenyukdmitriy)
57
+ - [ddab89e](https://github.com/NARKOZ/gitlab/commit/ddab89e6aa9917d06cddd121aa486424753bdf84) Adds support for comments on commits (@jeroenj)
58
+ - [a7c18f1](https://github.com/NARKOZ/gitlab/commit/a7c18f1180157021ef8d24791f32a30511940fbf) Add labels api for list, create, edit and delete. (@artworx)
59
+ - [d9940d5](https://github.com/NARKOZ/gitlab/commit/d9940d5f4dfd8fdc4530b249b518e0d048dbfdbb) Support pagination in Gitlab.merge_request_comments (@cubiware)
60
+ - [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)
61
+ - [6d8a98f](https://github.com/NARKOZ/gitlab/commit/6d8a98f7930d2df5af19cc838eb95ae9c775e1a1) Add repo compare API (@zlx)
62
+ - [76e29e6](https://github.com/NARKOZ/gitlab/commit/76e29e632ce345ed17d69401dcb286dc85a951aa) Add support for annotated tag creation. Update tests for create_tag. (@asedge)
63
+ - [40295b8](https://github.com/NARKOZ/gitlab/commit/40295b8889c0094babffc81a5d7749d32b0fbda6) introduce HTTParty-configuration, fix #61 (@barraq)
64
+ - [916e8a7](https://github.com/NARKOZ/gitlab/commit/916e8a72371a097fa63065b05d3dca0be7bc9e93) Improved arg parsing for gitlab readline shell. Other small fixes/improvements on regexes. (@asedge)
65
+ - [382fe71](https://github.com/NARKOZ/gitlab/commit/382fe71e3d509a57f736138ffbb673695577f709) Add missing documentation: :group_id, :namespace_id (@arioch)
66
+ - [c9f9662](https://github.com/NARKOZ/gitlab/commit/c9f9662a9b1116c838b523ed64c6abdb4aae4b8b) add exit command to shell
67
+
68
+ ### 3.2.0 (22/06/2014)
69
+ - [fee67da](https://github.com/NARKOZ/gitlab/commit/fee67da36cdab7906004e7a060602eb342c8b946) Handling some error cases when calling for help. (@asedge)
70
+ - [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)
71
+ - [599deff](https://github.com/NARKOZ/gitlab/commit/599deffbe193aed420747be16516b29b8beeb31f) Fix output_table call in CLI. (@asedge)
72
+ - [4a5f81f](https://github.com/NARKOZ/gitlab/commit/4a5f81f0e605a89205c05a4baefdbf6d2331d667) Initial commit of Gitlab CLI shell. Tab completion for Gitlab.actions. (@asedge)
73
+ - [48ba2a1](https://github.com/NARKOZ/gitlab/commit/48ba2a178b0e3f206588ccd5aeed14e52d1ba269) fix specs after update to RSpec 3
74
+ - [a8284af](https://github.com/NARKOZ/gitlab/commit/a8284af9af017e0bf381347a534f9a2426e35d64) Add spec for project_events method (@hassaku)
75
+ - [8e8527c](https://github.com/NARKOZ/gitlab/commit/8e8527cc4743a11ea285072e11f1bb4e703757ff) Add method to get a list of project events (@hassaku)
76
+ - [8c2aa8f](https://github.com/NARKOZ/gitlab/commit/8c2aa8fc9f660696596639d458444bc00fe17f0c) Add create_tag method. Add tests for new method. (@asedge)
77
+ - [cd5ae8b](https://github.com/NARKOZ/gitlab/commit/cd5ae8ba8aca5025a41ec1dd9fad70dae10c2fd3) clarify default config options
78
+
79
+ ### 3.1.0 (22/05/2014)
80
+ - [16834bb](https://github.com/NARKOZ/gitlab/commit/16834bb178fa6bf6c7ec8b67bfedfdc32145769d) add info command to CLI
81
+ - [68aebb7](https://github.com/NARKOZ/gitlab/commit/68aebb76b24972b7d00a78f3d4f923fca009ba31) ability to delete a project
82
+ - [ac54e55](https://github.com/NARKOZ/gitlab/commit/ac54e55825d16373862fbbc176d6c9c2594dc593) set command arguments when no filters
83
+ - [23be13e](https://github.com/NARKOZ/gitlab/commit/23be13e87c3c99764fcb27393ce99d9cc05633b9) fix docs
84
+ - [1b298dc](https://github.com/NARKOZ/gitlab/commit/1b298dcd5f71321867ad2bd3c18522a7602357ad) fix ruby 1.9 compatibility
85
+ - [af92ff5](https://github.com/NARKOZ/gitlab/commit/af92ff546af578ba0753c254fabf73761553f4c8) add confirmation for destructive commands
86
+ - [b1602d2](https://github.com/NARKOZ/gitlab/commit/b1602d2f5ce0a614de48d5295654d0699fe69c0d) move methods related to CLI output to a separate module
87
+ - [4183a52](https://github.com/NARKOZ/gitlab/commit/4183a52ca6344d86aa152e189bc20c467c96c5a5) improve help message
88
+ - [0bba284](https://github.com/NARKOZ/gitlab/commit/0bba284e9447a4a6aa95990b65db5ae4d44ce989) add specs for CLI
89
+ - [5ec08bc](https://github.com/NARKOZ/gitlab/commit/5ec08bc0173e986e5979ca0c809d70002186f0cc) ability to filter CLI output
90
+ - [ba86169](https://github.com/NARKOZ/gitlab/commit/ba861692bae33cba8d22ac3beb223995a4df216c) add table output for multiple records
91
+ - [9cc540c](https://github.com/NARKOZ/gitlab/commit/9cc540c948bd71a70e3c1f6fc656e1bbde0dcb00) initial wrap-up of CLI
92
+ - [bee9745](https://github.com/NARKOZ/gitlab/commit/bee9745f2202f9dafd20b0edee185fe54f413cb2) include modules alphabetically
93
+ - [4963f16](https://github.com/NARKOZ/gitlab/commit/4963f16f3eb0a3f3a6dd7fbdc3b7f3aeab8d57cc) add special method that lists available actions for client
94
+ - [fe50c24](https://github.com/NARKOZ/gitlab/commit/fe50c24437ea2bd729044f30ef6afe8df1932f32) support environment variables
95
+ - [7a5d40c](https://github.com/NARKOZ/gitlab/commit/7a5d40ccd576abfb35c137f9e172821351d2dac8) eliminate ruby warning
96
+ - [b7fc447](https://github.com/NARKOZ/gitlab/commit/b7fc447211fe281e01f111f8a9fad08396fdfa4d) convert specs to new RSpec 2.14 syntax
97
+ - [471a643](https://github.com/NARKOZ/gitlab/commit/471a643a60a17ea9048615a2ac2d295e0682edd4) pass private token using HTTP headers
98
+ - [bbf6521](https://github.com/NARKOZ/gitlab/commit/bbf6521362d5af460c63a730d95f822e55160e82) fix users session spec
99
+ - [672a8d5](https://github.com/NARKOZ/gitlab/commit/672a8d54988dfafce4e3288a63f6cf67bf13c292) test Request class
100
+ - [3bf0363](https://github.com/NARKOZ/gitlab/commit/3bf03631769a419504f669bd3154953072701c61) set private_token param separately for each request
101
+ - [90760cd](https://github.com/NARKOZ/gitlab/commit/90760cdeb3dfaa7be5fdfa5eba792c3a8e617c57) Single commit and diff of a commit (@nanofi)
102
+ - [9b696d4](https://github.com/NARKOZ/gitlab/commit/9b696d4bd07c1ca5d8d41e6aaeb51f260393b789) pluralize module name: SystemHook -> SystemHooks
103
+ - [3b2cda9](https://github.com/NARKOZ/gitlab/commit/3b2cda9e974568f8d1d6bfebbf3f114686638f44) get rid of ruby argument prefix warning
104
+ - [0d6ca05](https://github.com/NARKOZ/gitlab/commit/0d6ca0565ee0eaf02ae077332f8082c8d939ce22) System Hook API (@nanofi)
105
+ - [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)
106
+ - [7f91a9a](https://github.com/NARKOZ/gitlab/commit/7f91a9a10dc8071d14d3ffaea001e32ac2f70180) Fixed: create project deploy key (@semenyukdmitriy)
107
+ - [b347574](https://github.com/NARKOZ/gitlab/commit/b3475743c624e7cc426ca099f0c86411ffaf6dd8) Project hooks: set events to trigger on (@semenyukdmitriy)
108
+ - [af49245](https://github.com/NARKOZ/gitlab/commit/af492453819678eca9f2a8e25b51d318e23d148c) Add merge_request_comments to get a MR's comments
109
+ - [2b9e659](https://github.com/NARKOZ/gitlab/commit/2b9e659afd646f8ffca7b323e40246096837eae7) Doc & test that update_merge_request can set state
110
+ - [45b0b9f](https://github.com/NARKOZ/gitlab/commit/45b0b9fc86016ba31e66b600172da6ace63f7a00) add 'to_hash' method for ObjectifiedHash
111
+ - [ce5294f](https://github.com/NARKOZ/gitlab/commit/ce5294f2ec74417626403595899a85c97d92318c) test against MRI 2.1.0
112
+ - [35aadef](https://github.com/NARKOZ/gitlab/commit/35aadef3f321d4d700c3f7926f2206ac241e7191) scope for projects api (@voanhduy1512)
113
+ - [7152c85](https://github.com/NARKOZ/gitlab/commit/7152c8520bf77f49385bb71ef82a574172500b00) Add edit_user method (@robertomiranda)
114
+
115
+ ### 3.0.0 (22/10/2013)
116
+ - [da31730](https://github.com/NARKOZ/gitlab/commit/da3173016870d76aabbd43ee1b04e7348cbdbb1e) handle response code 405
117
+ - [3c18ad0](https://github.com/NARKOZ/gitlab/commit/3c18ad0d373b4647232be3bbc1ee88aed9a3bbfc) remove ruby 1.8 patch
118
+ - [3fca003](https://github.com/NARKOZ/gitlab/commit/3fca0033e8dabbefdbf50fc15713866521d0e1d3) re-implement handling of sudo requests
119
+ - [49c54a6](https://github.com/NARKOZ/gitlab/commit/49c54a67a8c1a67dd1f471c93e63c6dace329817) ability to paginate group members
120
+ - [8ba8361](https://github.com/NARKOZ/gitlab/commit/8ba8361d6fed3967986243a9c48871b79040bb51) fix compatibility with API v3; update docs
121
+ - [93e8b81](https://github.com/NARKOZ/gitlab/commit/93e8b81632067879d874a31e18ab48a50ccaf05c) prettify error message
122
+ - [1752997](https://github.com/NARKOZ/gitlab/commit/1752997f22586c76929c7396db8892fe930cb93a) Add methods to manage deployment keys (@sosedoff)
123
+ - [613dda8](https://github.com/NARKOZ/gitlab/commit/613dda8f7b42770635023137fb6844709ad77ffd) Add group api, removed user_teams api
124
+ - [8db4e88](https://github.com/NARKOZ/gitlab/commit/8db4e88ade68401e3e2dc26f8cc9b78a48a0f8ea) Update error_message to print request uri on response failure
125
+ - [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)
126
+ - [6f4a170](https://github.com/NARKOZ/gitlab/commit/6f4a170191a401c7eaf97522c5b8e20970e90249) Adding tests for missing merge request api calls. (@thomasbiddle)
127
+ - [af42bcb](https://github.com/NARKOZ/gitlab/commit/af42bcb7c18b27db266efdf7c9645d795d691760) Adding support for creating, updating, and commenting on merge requests. (@thomasbiddle)
128
+ - [f7aac38](https://github.com/NARKOZ/gitlab/commit/f7aac3860169ce0d0268676dc278d8150e497df8) minor updates indicating support for creating public projects (@amacarthur)
129
+ - [44a090d](https://github.com/NARKOZ/gitlab/commit/44a090d983de178ebdc7f6cd9cdcc339d731f9ef) added apis for the admin of fork links (@amacarthur)
130
+ - [32f1419](https://github.com/NARKOZ/gitlab/commit/32f14199c53da58ce00572530a002f769c808024) Added sudo functionality
131
+ - [b7f6c48](https://github.com/NARKOZ/gitlab/commit/b7f6c48b65b4d18cc18919fab12cefa99826578e) Made 409's throw exceptions
132
+ - [d1f581f](https://github.com/NARKOZ/gitlab/commit/d1f581ff410ba5c42d03e2cf98efa548a6139b01) Fixed an issue with access level var in add team project
133
+ - [8a5d679](https://github.com/NARKOZ/gitlab/commit/8a5d679806bd1dc8501965450fe12d0e807fbd93) Add user_team api
134
+ - [b4444fc](https://github.com/NARKOZ/gitlab/commit/b4444fce8c3dd9f0caa2d1a096e61ce6373136fe) Adding user_teams api
135
+ - [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)
136
+ - [13457a4](https://github.com/NARKOZ/gitlab/commit/13457a4bfd67088e156489d09db148739a0af700) add support for POST /projects/user:user_id (@leesolutions)
137
+ - [5e556fa](https://github.com/NARKOZ/gitlab/commit/5e556fac11daa25d3d9683904cf8f96b8e0bb009) update travis-ci config with ruby-2.0
138
+ - [3b8513d](https://github.com/NARKOZ/gitlab/commit/3b8513da22c8d78ce6a284ac8a7a5eaad6ab349d) Groups api additions
139
+ - [f2ba111](https://github.com/NARKOZ/gitlab/commit/f2ba111dba70eca5346a880c541dafaf35d3332a) don't expose data in ObjectifiedHash
140
+ - [c6889eb](https://github.com/NARKOZ/gitlab/commit/c6889ebfd455892690c0cddc3b88c670d8723435) add specs for notes
141
+ - [e562a7d](https://github.com/NARKOZ/gitlab/commit/e562a7db8ffdf9ec947895800e9c5b7753b83bfb) bring support for ruby 1.8
142
+ - [63c3592](https://github.com/NARKOZ/gitlab/commit/63c3592af45aa0d01de09910f562a4f875d01f6a) Notes api for wall, issues, and snippets notes. List, read and create. (@jozefvaclavik)
143
+
144
+ ### 2.2.0 (22/11/2012)
145
+ - [2ef4d48](https://github.com/NARKOZ/gitlab/commit/2ef4d48a0db13a7363973455c3c0ac9d2bf6df56) support merge requests API
146
+
147
+ ### 2.1.0 (22/10/2012)
148
+ - [89541c1](https://github.com/NARKOZ/gitlab/commit/89541c1dddccf185318645bb2748541955f221b0) add ability to create a user
149
+ - [483b4f6](https://github.com/NARKOZ/gitlab/commit/483b4f6812e657e9ea12c0c89199654393554aa7) fix typos in docs
150
+ - [7632ecb](https://github.com/NARKOZ/gitlab/commit/7632ecba57c8fa3fe966ee6eb0055bb7752d79fd) add ability to list project snippets
151
+ - [6c5637e](https://github.com/NARKOZ/gitlab/commit/6c5637e526f73bfb1c7791b12756ebdadeae4e5f) add project_hook and edit_project_hook methods
152
+ - [5fcf078](https://github.com/NARKOZ/gitlab/commit/5fcf078437b62a39de7d49c6d92fd5cdf09c565c) Fix add_team_member (@mizzy)
153
+ - [6a0176a](https://github.com/NARKOZ/gitlab/commit/6a0176aac542eacd9df24da20a8994f9f70e6ed7) refactor Request class
154
+ - [53746d5](https://github.com/NARKOZ/gitlab/commit/53746d55f19f75e72b3439d25f7940ba66151c94) add convenient methods to change a state of an issue
155
+
156
+ ### 2.0.0 (21/09/2012)
157
+ - [b47a324](https://github.com/NARKOZ/gitlab/commit/b47a324d616b7fa4e23160abae357887b9dde13f) initial implementation
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2014 Nihad Abbasov <mail@narkoz.me>
1
+ Copyright (c) 2012-2015 Nihad Abbasov <mail@narkoz.me>
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # Gitlab
2
2
 
3
- [![Build Status](https://travis-ci.org/NARKOZ/gitlab.png)](http://travis-ci.org/NARKOZ/gitlab)
3
+ [![Build Status](https://img.shields.io/travis/NARKOZ/gitlab.svg?style=flat)](https://travis-ci.org/NARKOZ/gitlab)
4
+ [![Code Climate](https://img.shields.io/codeclimate/github/NARKOZ/gitlab.svg?style=flat)](https://codeclimate.com/github/NARKOZ/gitlab)
5
+ [![Inline docs](http://inch-ci.org/github/NARKOZ/gitlab.svg?style=flat)](https://inch-ci.org/github/NARKOZ/gitlab)
6
+ [![Gem version](https://img.shields.io/gem/v/gitlab.svg?style=flat)](https://rubygems.org/gems/gitlab)
7
+ [![License](https://img.shields.io/badge/license-BSD-red.svg?style=flat)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt)
4
8
 
5
9
  [website](http://narkoz.github.io/gitlab) |
6
- [documentation](http://rubydoc.info/gems/gitlab/frames)
10
+ [documentation](http://rubydoc.info/gems/gitlab/frames) |
11
+ [gitlab-live](https://github.com/NARKOZ/gitlab-live)
7
12
 
8
13
  Gitlab is a Ruby wrapper and CLI for the [GitLab API](https://github.com/gitlabhq/gitlabhq/tree/master/doc/api#gitlab-api).
9
14
 
@@ -19,7 +24,7 @@ Or add to a Gemfile:
19
24
 
20
25
  ```ruby
21
26
  gem 'gitlab'
22
- # gem 'gitlab', :git => 'git://github.com/NARKOZ/gitlab.git'
27
+ # gem 'gitlab', github: 'NARKOZ/gitlab'
23
28
  ```
24
29
 
25
30
  ## Usage
@@ -29,7 +34,7 @@ Configuration example:
29
34
  ```ruby
30
35
  Gitlab.configure do |config|
31
36
  config.endpoint = 'https://example.net/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT']
32
- config.private_token = 'qEsq1pt6HJPaNciie3MG' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
37
+ config.private_token = 'qEsq1pt6HJPaNciie3MG' # user's private token or OAuth2 access token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
33
38
  # Optional
34
39
  # config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]'
35
40
  # config.sudo = 'user' # username for sudo mode, default: nil
@@ -55,11 +60,11 @@ Gitlab.http_proxy('proxyhost', 8888)
55
60
  Gitlab.http_proxy('proxyhost', 8888, 'proxyuser', 'strongpasswordhere')
56
61
 
57
62
  # list projects
58
- Gitlab.projects(:per_page => 5)
63
+ Gitlab.projects(per_page: 5)
59
64
  # => [#<Gitlab::ObjectifiedHash:0x000000023326e0 @data={"id"=>1, "code"=>"brute", "name"=>"Brute", "description"=>nil, "path"=>"brute", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x00000002331600 @data={"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"}>, #<Gitlab::ObjectifiedHash:0x000000023450d8 @data={"id"=>2, "code"=>"mozart", "name"=>"Mozart", "description"=>nil, "path"=>"mozart", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x00000002344ca0 @data={"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"}>, #<Gitlab::ObjectifiedHash:0x00000002344958 @data={"id"=>3, "code"=>"gitlab", "name"=>"Gitlab", "description"=>nil, "path"=>"gitlab", "default_branch"=>nil, "owner"=>#<Gitlab::ObjectifiedHash:0x000000023447a0 @data={"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"}>]
60
65
 
61
66
  # initialize a new client
62
- g = Gitlab.client(:endpoint => 'https://api.example.com', :private_token => 'qEsq1pt6HJPaNciie3MG')
67
+ g = Gitlab.client(endpoint: 'https://api.example.com', private_token: 'qEsq1pt6HJPaNciie3MG')
63
68
  # => #<Gitlab::Client:0x00000001e62408 @endpoint="https://api.example.com", @private_token="qEsq1pt6HJPaNciie3MG", @user_agent="Gitlab Ruby Gem 2.0.0">
64
69
 
65
70
  # get a user
@@ -100,8 +105,8 @@ gitlab user --only=id,username
100
105
 
101
106
  gitlab user --except=email,bio
102
107
 
103
- # how to pass options hash to a command (use YAML)
104
- gitlab create_merge_request 4 "I'm creating a new merge request." "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
108
+ # passing options hash to a command (use YAML)
109
+ gitlab create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
105
110
 
106
111
  ```
107
112
 
@@ -122,10 +127,11 @@ gitlab> groups
122
127
  # protect a branch
123
128
  gitlab> protect_branch 1 master
124
129
 
125
- # how to pass options hash to a command (use YAML)
126
- gitlab> create_merge_request 4 "I'm creating a new merge request." "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
130
+ # passing options hash to a command (use YAML)
131
+ gitlab> create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"
127
132
  ```
128
133
 
134
+ Web version is available at https://gitlab-live.herokuapp.com
129
135
  For more information, refer to [website](http://narkoz.github.io/gitlab).
130
136
 
131
137
  ## License
@@ -36,7 +36,7 @@ module Gitlab
36
36
  #
37
37
  # @return [Array<Symbol>]
38
38
  def self.actions
39
- hidden = /endpoint|private_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults/
39
+ hidden = /endpoint|private_token|user_agent|sudo|get|post|put|\Adelete\z|validate|set_request_defaults|httparty/
40
40
  (Gitlab::Client.instance_methods - Object.methods).reject {|e| e[hidden]}
41
41
  end
42
42
  end
@@ -3,15 +3,17 @@ module Gitlab
3
3
  class API < Request
4
4
  # @private
5
5
  attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
6
+ # @private
7
+ alias_method :auth_token=, :private_token=
6
8
 
7
9
  # Creates a new API.
8
10
  # @raise [Error:MissingCredentials]
9
11
  def initialize(options={})
10
12
  options = Gitlab.options.merge(options)
11
- Configuration::VALID_OPTIONS_KEYS.each do |key|
12
- send("#{key}=", options[key])
13
+ (Configuration::VALID_OPTIONS_KEYS + [:auth_token]).each do |key|
14
+ send("#{key}=", options[key]) if options[key]
13
15
  end
14
- set_request_defaults @endpoint, @private_token, @sudo
16
+ set_request_defaults(@sudo)
15
17
  end
16
18
  end
17
19
  end
@@ -6,15 +6,31 @@ require_relative 'shell'
6
6
  class Gitlab::CLI
7
7
  extend Helpers
8
8
 
9
+ # Starts a new CLI session.
10
+ #
11
+ # @example
12
+ # Gitlab::CLI.start(['help'])
13
+ # Gitlab::CLI.start(['help', 'issues'])
14
+ #
15
+ # @param [Array] args The command and it's optional arguments.
9
16
  def self.start(args)
10
17
  command = args.shift.strip rescue 'help'
11
18
  run(command, args)
12
19
  end
13
20
 
21
+ # Processes a CLI command and outputs a result to the stream (stdout).
22
+ #
23
+ # @example
24
+ # Gitlab::CLI.run('help')
25
+ # Gitlab::CLI.run('help', ['issues'])
26
+ #
27
+ # @param [String] cmd The name of a command.
28
+ # @param [Array] args The optional arguments for a command.
29
+ # @return [nil]
14
30
  def self.run(cmd, args=[])
15
31
  case cmd
16
32
  when 'help'
17
- puts actions_table
33
+ puts help(args.shift) { |out| out.gsub!(/Gitlab\./, 'gitlab ') }
18
34
  when 'info'
19
35
  endpoint = Gitlab.endpoint ? Gitlab.endpoint : 'not set'
20
36
  private_token = Gitlab.private_token ? Gitlab.private_token : 'not set'
@@ -39,8 +55,10 @@ class Gitlab::CLI
39
55
  end
40
56
 
41
57
  begin
42
- yaml_load_and_symbolize_hash!(command_args)
43
- rescue
58
+ yaml_load_arguments! command_args
59
+ command_args.map! {|arg| symbolize_keys arg }
60
+ rescue => e
61
+ puts e.message
44
62
  exit 1
45
63
  end
46
64
 
@@ -1,9 +1,36 @@
1
1
  require 'yaml'
2
+
2
3
  class Gitlab::CLI
3
4
  # Defines methods related to CLI output and formatting.
4
5
  module Helpers
5
6
  extend self
6
7
 
8
+ # Returns actions available to CLI & Shell
9
+ #
10
+ # @return [Array]
11
+ def actions
12
+ @actions ||= Gitlab.actions
13
+ end
14
+
15
+ # Returns Gitlab::Client instance
16
+ #
17
+ # @return [Gitlab::Client]
18
+ def client
19
+ @client ||= Gitlab::Client.new(endpoint: (Gitlab.endpoint || ''))
20
+ end
21
+
22
+ # Returns method names and their owners
23
+ #
24
+ # @return [Array<Hash>]
25
+ def method_owners
26
+ @method_owners ||= actions.map do |action|
27
+ {
28
+ name: action.to_s,
29
+ owner: client.method(action).owner.to_s
30
+ }
31
+ end
32
+ end
33
+
7
34
  # Returns filtered required fields.
8
35
  #
9
36
  # @return [Array]
@@ -49,87 +76,33 @@ class Gitlab::CLI
49
76
  end
50
77
  end
51
78
 
52
- # Table with available commands.
79
+ # Gets defined help for a specific command/action.
53
80
  #
54
81
  # @return [String]
55
- def actions_table
56
- client = Gitlab::Client.new(endpoint: '')
57
- actions = Gitlab.actions
58
- methods = []
59
-
60
- actions.each do |action|
61
- methods << {
62
- name: action,
63
- owner: client.method(action).owner.to_s.gsub('Gitlab::Client::', '')
64
- }
65
- end
66
-
67
- owners = methods.map {|m| m[:owner]}.uniq.sort
68
- methods_c = methods.group_by {|m| m[:owner]}
69
- methods_c = methods_c.map {|_, v| [_, v.sort_by {|hv| hv[:name]}] }
70
- methods_c = Hash[methods_c.sort_by(&:first).map {|k, v| [k, v]}]
71
- max_column_length = methods_c.values.max_by(&:size).size
72
-
73
- rows = max_column_length.times.map do |i|
74
- methods_c.keys.map do |key|
75
- methods_c[key][i] ? methods_c[key][i][:name] : ''
76
- end
77
- end
78
-
79
- table do |t|
80
- t.title = "Available commands (#{actions.size} total)"
81
- t.headings = owners
82
-
83
- rows.each do |row|
84
- t.add_row row
85
- end
82
+ def help(cmd = nil, &block)
83
+ if cmd.nil? or Gitlab::Help.help_map.has_key?(cmd)
84
+ Gitlab::Help.actions_table(cmd)
85
+ else
86
+ Gitlab::Help.get_help(cmd, &block)
86
87
  end
87
88
  end
88
89
 
89
- # Decides which table to use.
90
- #
91
- # @return [String]
90
+ # Outputs a nicely formatted table or error msg.
92
91
  def output_table(cmd, args, data)
93
92
  case data
94
93
  when Gitlab::ObjectifiedHash
95
- puts single_record_table(data, cmd, args)
94
+ puts record_table([data], cmd, args)
96
95
  when Array
97
- puts multiple_record_table(data, cmd, args)
98
- else
99
- puts data.inspect
100
- end
101
- end
102
-
103
- # Table for a single record.
104
- #
105
- # @return [String]
106
- def single_record_table(data, cmd, args)
107
- hash = data.to_h
108
- keys = hash.keys.sort {|x, y| x.to_s <=> y.to_s }
109
- keys = keys & required_fields(args) if required_fields(args).any?
110
- keys = keys - excluded_fields(args)
111
-
112
- table do |t|
113
- t.title = "Gitlab.#{cmd} #{args.join(', ')}"
114
-
115
- keys.each_with_index do |key, index|
116
- case value = hash[key]
117
- when Hash
118
- value = 'Hash'
119
- when nil
120
- value = 'null'
121
- end
122
-
123
- t.add_row [key, value]
124
- t.add_separator unless keys.size - 1 == index
125
- end
96
+ puts record_table(data, cmd, args)
97
+ else # probably just an error msg
98
+ puts data
126
99
  end
127
100
  end
128
101
 
129
- # Table for multiple records.
102
+ # Table to display records.
130
103
  #
131
- # @return [String]
132
- def multiple_record_table(data, cmd, args)
104
+ # @return [Terminal::Table]
105
+ def record_table(data, cmd, args)
133
106
  return 'No data' if data.empty?
134
107
 
135
108
  arr = data.map(&:to_h)
@@ -162,7 +135,7 @@ class Gitlab::CLI
162
135
  end
163
136
 
164
137
  # Helper function to call Gitlab commands with args.
165
- def gitlab_helper(cmd, args=[])
138
+ def gitlab_helper(cmd, args = [])
166
139
  begin
167
140
  data = args.any? ? Gitlab.send(cmd, *args) : Gitlab.send(cmd)
168
141
  rescue => e
@@ -181,8 +154,7 @@ class Gitlab::CLI
181
154
  begin
182
155
  newhash[key.to_sym] = symbolize_keys(value)
183
156
  rescue NoMethodError
184
- puts "error: cannot convert hash key to symbol: #{arg}"
185
- raise
157
+ raise "error: cannot convert hash key to symbol: #{key}"
186
158
  end
187
159
  end
188
160
  end
@@ -190,19 +162,14 @@ class Gitlab::CLI
190
162
  hash
191
163
  end
192
164
 
193
- # Run YAML::load on each arg and symbolize hash keys if found.
165
+ # Run YAML::load on each arg.
194
166
  # @return [Array]
195
- def yaml_load_and_symbolize_hash!(args)
167
+ def yaml_load_arguments!(args)
196
168
  args.map! do |arg|
197
169
  begin
198
170
  arg = YAML::load(arg)
199
-
200
- if arg.is_a?(Hash)
201
- arg = symbolize_keys(arg)
202
- end
203
171
  rescue Psych::SyntaxError
204
- puts "error: Argument is not valid YAML syntax: #{arg}"
205
- raise
172
+ raise "error: Argument is not valid YAML syntax: #{arg}"
206
173
  end
207
174
 
208
175
  arg