glub 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +14 -0
- data/Gemfile.lock +37 -0
- data/LICENCE-2.0.txt +202 -0
- data/README.md +45 -0
- data/RELEASE_NOTES.md +15 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/fixtures/vcr_cassettes/create_project.yml +55 -0
- data/fixtures/vcr_cassettes/list_projects.yml +51 -0
- data/glub +5 -0
- data/glub.gemspec +77 -0
- data/lib/glub.rb +37 -8
- data/sample_config/working_config +2 -0
- data/test/glub.rb +19 -0
- data/test/list_projects.rb +19 -0
- data/test/testconfig +3 -0
- metadata +124 -8
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.4)
|
5
|
+
crack (0.3.2)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.8.4)
|
8
|
+
bundler (~> 1.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
rdoc
|
12
|
+
json (1.7.7)
|
13
|
+
mime-types (1.19)
|
14
|
+
rake (10.0.3)
|
15
|
+
rdoc (4.0.1)
|
16
|
+
json (~> 1.4)
|
17
|
+
rest-client (1.6.7)
|
18
|
+
mime-types (>= 1.16)
|
19
|
+
sif (0.0.1)
|
20
|
+
thor (0.16.0)
|
21
|
+
vcr (2.4.0)
|
22
|
+
webmock (1.11.0)
|
23
|
+
addressable (>= 2.2.7)
|
24
|
+
crack (>= 0.3.2)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
bundler
|
31
|
+
jeweler (~> 1.8.4)
|
32
|
+
rake
|
33
|
+
rest-client
|
34
|
+
sif
|
35
|
+
thor
|
36
|
+
vcr
|
37
|
+
webmock
|
data/LICENCE-2.0.txt
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Gitlab command-line client
|
2
|
+
|
3
|
+
This is a Gitlab command-line client. It's still very early in development. So far, you can create projects, and that's it.
|
4
|
+
|
5
|
+
Dependencies:
|
6
|
+
|
7
|
+
* [Thor](http://whatisthor.com)
|
8
|
+
* [Rest Client](http://rubygems.org/gems/rest-client)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
gem install glub
|
13
|
+
|
14
|
+
## Config
|
15
|
+
|
16
|
+
You will need a file called .gitlab in your home directory. It's a YAML file.
|
17
|
+
|
18
|
+
You can get your API key - also known as private token - from your account page on Gitlab
|
19
|
+
|
20
|
+
### Config example
|
21
|
+
|
22
|
+
api_endpoint: http://gitlab.mycompany.com/api/v3
|
23
|
+
api_key : Kd834fh3ofoaal
|
24
|
+
|
25
|
+
## FAQ
|
26
|
+
|
27
|
+
Nothing. Nobody's asked me anything about it.
|
28
|
+
|
29
|
+
## Questions I'm going to answer anyway, whether anyone asks them or not
|
30
|
+
|
31
|
+
* **Why did you create this?** - I had to check in a lot of little projects to a local Gitlab repo, and I'm lazy
|
32
|
+
* **Why is it called glub?** - The *gl* bit stands for GitLab, obviously, and glub is just a short word that starts with that.
|
33
|
+
|
34
|
+
## TODOs
|
35
|
+
|
36
|
+
This is very much an early release, that'll be getting added to frequently.
|
37
|
+
|
38
|
+
Coming soon:
|
39
|
+
|
40
|
+
* More control over project creation
|
41
|
+
|
42
|
+
|
43
|
+
## Licence
|
44
|
+
|
45
|
+
This is released under the [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) licence.
|
data/RELEASE_NOTES.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Release notes for glub
|
2
|
+
|
3
|
+
## Release 0.0.2 - 17th April 2013
|
4
|
+
|
5
|
+
### Notes
|
6
|
+
|
7
|
+
* Now published as a gem
|
8
|
+
* Now notifies user of command to use to add new repo as a remote
|
9
|
+
|
10
|
+
## Release 0.0.1 - 17th April 2013
|
11
|
+
|
12
|
+
### Notes
|
13
|
+
|
14
|
+
* Initial release
|
15
|
+
* Can now create a project in Gitlab
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "glub"
|
18
|
+
gem.homepage = "http://georgemcintosh.com/glub"
|
19
|
+
gem.license = "Apache 2.0"
|
20
|
+
gem.summary = "Command-line Gitlab client"
|
21
|
+
gem.description = "Glub - a Gitlab client for your command-line."
|
22
|
+
gem.email = "george@georgemcintosh.com"
|
23
|
+
gem.authors = ["George McIntosh"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'rdoc/task'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "glub #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.3
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://gitlab.com/api/v3/projects?private_token=fjv8JKK87ujjH77
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"name":"my-test-project","description":"this is a new project","default_branch":"master","issues_enabled":"true","wiki_ebabled":"true","wall_enabled":"true","merge_requests_enabled":"true"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Content-Length:
|
17
|
+
- '190'
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Wed, 17 Apr 2013 17:27:14 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '632'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Status:
|
36
|
+
- 201 Created
|
37
|
+
X-Ua-Compatible:
|
38
|
+
- IE=Edge,chrome=1
|
39
|
+
Etag:
|
40
|
+
- ! '"43f9385dddf7d6c36a6b9a15cae30309"'
|
41
|
+
Cache-Control:
|
42
|
+
- max-age=0, private, must-revalidate
|
43
|
+
X-Request-Id:
|
44
|
+
- a0c3b7382a29b38e170b2a833ea6852a
|
45
|
+
X-Runtime:
|
46
|
+
- '0.265636'
|
47
|
+
X-Rack-Cache:
|
48
|
+
- invalidate, pass
|
49
|
+
body:
|
50
|
+
encoding: US-ASCII
|
51
|
+
string: ! '{"id":4706,"name":"my-test-project","description":"this is a new
|
52
|
+
project","default_branch":"master","owner":{"id":4490,"username":"georgemc","email":"george@georgemcintosh.com","name":"GeorgeMc","state":"active","created_at":"2013-04-17T17:16:12Z"},"public":false,"path":"my-test-project","path_with_namespace":"georgemc/my-test-project","issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":false,"wiki_enabled":true,"created_at":"2013-04-17T17:27:14Z","namespace":{"created_at":"2013-04-17T17:16:12Z","description":"","id":4468,"name":"georgemc","owner_id":4490,"path":"georgemc","updated_at":"2013-04-17T17:16:12Z"}}'
|
53
|
+
http_version:
|
54
|
+
recorded_at: Wed, 17 Apr 2013 17:26:21 GMT
|
55
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://gitlab.com/api/v3/projects?private_token=fjv8JKK87ujjH77
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Wed, 17 Apr 2013 17:34:14 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '634'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Status:
|
32
|
+
- 200 OK
|
33
|
+
X-Ua-Compatible:
|
34
|
+
- IE=Edge,chrome=1
|
35
|
+
Etag:
|
36
|
+
- ! '"e770a176a79061810bb4995866c29811"'
|
37
|
+
Cache-Control:
|
38
|
+
- max-age=0, private, must-revalidate
|
39
|
+
X-Request-Id:
|
40
|
+
- b89417d8ca2792e90d64bee844d200de
|
41
|
+
X-Runtime:
|
42
|
+
- '0.030415'
|
43
|
+
X-Rack-Cache:
|
44
|
+
- miss
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: ! '[{"id":4706,"name":"my-test-project","description":"this is a new
|
48
|
+
project","default_branch":"master","owner":{"id":4490,"username":"georgemc","email":"george@georgemcintosh.com","name":"GeorgeMc","state":"active","created_at":"2013-04-17T17:16:12Z"},"public":false,"path":"my-test-project","path_with_namespace":"georgemc/my-test-project","issues_enabled":true,"merge_requests_enabled":true,"wall_enabled":false,"wiki_enabled":true,"created_at":"2013-04-17T17:27:14Z","namespace":{"created_at":"2013-04-17T17:16:12Z","description":"","id":4468,"name":"georgemc","owner_id":4490,"path":"georgemc","updated_at":"2013-04-17T17:16:12Z"}}]'
|
49
|
+
http_version:
|
50
|
+
recorded_at: Wed, 17 Apr 2013 17:33:20 GMT
|
51
|
+
recorded_with: VCR 2.4.0
|
data/glub
ADDED
data/glub.gemspec
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "glub"
|
8
|
+
s.version = "0.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["George McIntosh"]
|
12
|
+
s.date = "2013-04-18"
|
13
|
+
s.description = "Glub - a Gitlab client for your command-line."
|
14
|
+
s.email = "george@georgemcintosh.com"
|
15
|
+
s.executables = ["glub"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
22
|
+
"LICENCE-2.0.txt",
|
23
|
+
"README.md",
|
24
|
+
"RELEASE_NOTES.md",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"bin/glub",
|
28
|
+
"fixtures/vcr_cassettes/create_project.yml",
|
29
|
+
"fixtures/vcr_cassettes/list_projects.yml",
|
30
|
+
"glub",
|
31
|
+
"glub.gemspec",
|
32
|
+
"lib/glub.rb",
|
33
|
+
"sample_config/working_config",
|
34
|
+
"test/glub.rb",
|
35
|
+
"test/list_projects.rb",
|
36
|
+
"test/testconfig"
|
37
|
+
]
|
38
|
+
s.homepage = "http://georgemcintosh.com/glub"
|
39
|
+
s.licenses = ["Apache 2.0"]
|
40
|
+
s.require_paths = ["lib"]
|
41
|
+
s.rubygems_version = "1.8.24"
|
42
|
+
s.summary = "Command-line Gitlab client"
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
s.specification_version = 3
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<webmock>, [">= 0"])
|
49
|
+
s.add_runtime_dependency(%q<vcr>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<thor>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
53
|
+
s.add_runtime_dependency(%q<sif>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
58
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
59
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
61
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
62
|
+
s.add_dependency(%q<sif>, [">= 0"])
|
63
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
65
|
+
end
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
68
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
69
|
+
s.add_dependency(%q<thor>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
71
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
72
|
+
s.add_dependency(%q<sif>, [">= 0"])
|
73
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
74
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/lib/glub.rb
CHANGED
@@ -4,17 +4,19 @@ require 'rest_client'
|
|
4
4
|
require 'json'
|
5
5
|
require 'yaml'
|
6
6
|
require 'thor'
|
7
|
+
require 'sif'
|
7
8
|
|
8
|
-
class Glub <
|
9
|
+
class Glub < Sif::Loader
|
9
10
|
|
10
|
-
|
11
|
-
@@api_key = config['api_key']
|
12
|
-
@@gitlab_host = config['gitlab_host']
|
13
|
-
@@api_endpoint = "http://#{@@gitlab_host}/api/v3"
|
11
|
+
config_file '.glub'
|
14
12
|
|
13
|
+
class_option :config, :default => "#{ENV['HOME']}/.glub", :aliases => ['-c']
|
14
|
+
class_option :host, :aliases => ['-h']
|
15
|
+
class_option :api_key, :aliases => ['-k']
|
16
|
+
|
15
17
|
desc "create NAME", "Creates a new Gitlab project"
|
16
18
|
def create(project_name)
|
17
|
-
|
19
|
+
|
18
20
|
puts "Creating Gitlab project #{project_name}"
|
19
21
|
command = {
|
20
22
|
:name => project_name,
|
@@ -27,7 +29,7 @@ class Glub < Thor
|
|
27
29
|
}
|
28
30
|
|
29
31
|
response = RestClient.post(
|
30
|
-
"#{
|
32
|
+
"#{@api_endpoint}/projects?private_token=#{@api_key}",
|
31
33
|
command.to_json,
|
32
34
|
:content_type => 'application/json'
|
33
35
|
)
|
@@ -35,9 +37,36 @@ class Glub < Thor
|
|
35
37
|
response = JSON.parse response.body
|
36
38
|
|
37
39
|
puts "Repository #{project_name} created. Add it as a remote using: "
|
38
|
-
|
40
|
+
setup_repo = "git remote add origin git@#{@gitlab_host}:#{response['path_with_namespace']}.git"
|
41
|
+
puts " #{setup_repo}"
|
42
|
+
setup_repo
|
39
43
|
end
|
40
44
|
|
45
|
+
desc "list projects", "Lists all projects"
|
46
|
+
def list
|
47
|
+
|
48
|
+
response = RestClient.get(
|
49
|
+
"#{@api_endpoint}/projects?private_token=#{@api_key}"
|
50
|
+
)
|
51
|
+
|
52
|
+
response = JSON.parse response.body
|
53
|
+
|
54
|
+
projects = []
|
55
|
+
response.each { |project| projects << project['name'] }
|
56
|
+
puts "Projects: "
|
57
|
+
projects.each { |project| puts " #{project}" }
|
58
|
+
"#{projects}"
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
no_tasks do
|
63
|
+
def load_configuration
|
64
|
+
super
|
65
|
+
protocol = @secure ? 'https' : 'http'
|
66
|
+
@api_endpoint = "#{protocol}://#{@gitlab_host}/api/v3"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
41
70
|
end
|
42
71
|
|
43
72
|
|
data/test/glub.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'vcr'
|
4
|
+
require './lib/glub'
|
5
|
+
|
6
|
+
VCR.configure do |c|
|
7
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
8
|
+
c.hook_into :webmock
|
9
|
+
end
|
10
|
+
|
11
|
+
class GlubTest < Test::Unit::TestCase
|
12
|
+
def test_create_project
|
13
|
+
VCR.use_cassette('create_project') do
|
14
|
+
args = ['create', 'my-test-project', '-c=./test/testconfig']
|
15
|
+
response = Glub.start args
|
16
|
+
assert_match /.*git remote add origin git@gitlab.com:georgemc\/my-test-project.*/, response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'vcr'
|
4
|
+
require './lib/glub'
|
5
|
+
|
6
|
+
VCR.configure do |c|
|
7
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
8
|
+
c.hook_into :webmock
|
9
|
+
end
|
10
|
+
|
11
|
+
class ListProjectTest < Test::Unit::TestCase
|
12
|
+
def test_list_projects
|
13
|
+
VCR.use_cassette('list_projects') do
|
14
|
+
args = ['list', '-c=./test/testconfig']
|
15
|
+
response = Glub.start args
|
16
|
+
assert_match /my-test-project/, response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/test/testconfig
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,40 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: webmock
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: vcr
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
14
46
|
- !ruby/object:Gem::Dependency
|
15
47
|
name: thor
|
16
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -27,6 +59,22 @@ dependencies:
|
|
27
59
|
- - ! '>='
|
28
60
|
- !ruby/object:Gem::Version
|
29
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
30
78
|
- !ruby/object:Gem::Dependency
|
31
79
|
name: rest-client
|
32
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,17 +91,82 @@ dependencies:
|
|
43
91
|
- - ! '>='
|
44
92
|
- !ruby/object:Gem::Version
|
45
93
|
version: '0'
|
46
|
-
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: sif
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: bundler
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: jeweler
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.8.4
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 1.8.4
|
142
|
+
description: Glub - a Gitlab client for your command-line.
|
47
143
|
email: george@georgemcintosh.com
|
48
144
|
executables:
|
49
145
|
- glub
|
50
146
|
extensions: []
|
51
|
-
extra_rdoc_files:
|
147
|
+
extra_rdoc_files:
|
148
|
+
- README.md
|
52
149
|
files:
|
53
|
-
-
|
150
|
+
- Gemfile
|
151
|
+
- Gemfile.lock
|
152
|
+
- LICENCE-2.0.txt
|
153
|
+
- README.md
|
154
|
+
- RELEASE_NOTES.md
|
155
|
+
- Rakefile
|
156
|
+
- VERSION
|
54
157
|
- bin/glub
|
55
|
-
|
56
|
-
|
158
|
+
- fixtures/vcr_cassettes/create_project.yml
|
159
|
+
- fixtures/vcr_cassettes/list_projects.yml
|
160
|
+
- glub
|
161
|
+
- glub.gemspec
|
162
|
+
- lib/glub.rb
|
163
|
+
- sample_config/working_config
|
164
|
+
- test/glub.rb
|
165
|
+
- test/list_projects.rb
|
166
|
+
- test/testconfig
|
167
|
+
homepage: http://georgemcintosh.com/glub
|
168
|
+
licenses:
|
169
|
+
- Apache 2.0
|
57
170
|
post_install_message:
|
58
171
|
rdoc_options: []
|
59
172
|
require_paths:
|
@@ -64,6 +177,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
177
|
- - ! '>='
|
65
178
|
- !ruby/object:Gem::Version
|
66
179
|
version: '0'
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
hash: -4234807907285407120
|
67
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
184
|
none: false
|
69
185
|
requirements:
|
@@ -75,5 +191,5 @@ rubyforge_project:
|
|
75
191
|
rubygems_version: 1.8.24
|
76
192
|
signing_key:
|
77
193
|
specification_version: 3
|
78
|
-
summary:
|
194
|
+
summary: Command-line Gitlab client
|
79
195
|
test_files: []
|