glub 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/RELEASE_NOTES.md +7 -0
  3. data/VERSION +1 -1
  4. data/lib/glub.rb +18 -12
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7406d71ec8dbcfb6c2e3692792e61c5c5b98f88f
4
- data.tar.gz: 873f3447a5d16ce8adc86a81ae668eaf69906fab
3
+ metadata.gz: 7bfcd3b02fd5169fe935b82ca32f3cdcc6635890
4
+ data.tar.gz: 1bf30b0eac40e38b9e37318e565efd07c6322d70
5
5
  SHA512:
6
- metadata.gz: d4e62e55889813623cee37b4e5db3da47ed1dd8a6ff3406d548116bca9cac189840f34b303dc70104e098d9c16429b44ff472cf6ab22d00e5173718a80846ec3
7
- data.tar.gz: 33dba21bb5e3ea10bce3805b9678e2e03ff5577ac6ba44351d65d1b2f8d62fe5dd7c6be746dfbe35398a51813b2466b4c6fcf76a092bc1d77cbbf7a2cd1657d4
6
+ metadata.gz: c894a914cf34f4744b2a0af3f08d9368b08b58be6cb9af6e2495dd8d8d58ccc802d3f2eafaca9e88522df25142b0af682da208aa419ea19b8cda018084910d73
7
+ data.tar.gz: d9df910bc79ac1ed2b53571ed959aea1b4d321c7b0728cb1c2daedbc346c659395f1d7254211bfe6b655a7bca497c2793c3a032cf252da08639a717caefd266e
@@ -1,5 +1,12 @@
1
1
  # Release notes for glub
2
2
 
3
+ ## Release 0.2.0 - 14th February 2015
4
+
5
+ ### Notes
6
+
7
+ * clone and list commands now handle pagination properly
8
+ * other commands will be updated across the next week
9
+
3
10
  ## Release 0.0.2 - 17th April 2013
4
11
 
5
12
  ### Notes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.2.0
@@ -49,19 +49,21 @@ class Glub < Sif::Loader
49
49
 
50
50
  desc "list", "Lists all projects"
51
51
  def list
52
-
53
- response = RestClient.get(
54
- "#{@api_endpoint}/projects/all?private_token=#{@api_key}&per_page=1000000"
55
- )
56
-
57
- response = JSON.parse response.body
52
+ response = []
53
+ per_page = 100
54
+ page = 0
55
+ while response.length == page * per_page do
56
+ page += 1
57
+ url = "#{@api_endpoint}/projects/all?private_token=#{@api_key}&page=#{page}&per_page=#{per_page}"
58
+ git_lab_data = RestClient.get(url)
59
+ response.concat JSON.parse(git_lab_data.body)
60
+ end
58
61
 
59
62
  projects = []
60
63
  response.each { |project| projects << "Name:#{project['name']} / ID:#{project['id']}" }
61
64
  puts "Projects: "
62
65
  projects.each { |project| puts " #{project}" }
63
66
  "#{projects}"
64
-
65
67
  end
66
68
 
67
69
  desc "list_groups", "Lists all groups"
@@ -171,12 +173,16 @@ class Glub < Sif::Loader
171
173
 
172
174
  desc "clone", "Clone from a list of projects"
173
175
  def clone
176
+ response = []
177
+ per_page = 100
178
+ page = 0
179
+ while response.length == page * per_page do
180
+ page += 1
181
+ url = "#{@api_endpoint}/projects/all?private_token=#{@api_key}&page=#{page}&per_page=#{per_page}"
182
+ git_lab_data = RestClient.get(url)
183
+ response.concat JSON.parse(git_lab_data.body)
184
+ end
174
185
 
175
- response = RestClient.get(
176
- "#{@api_endpoint}/projects/all?private_token=#{@api_key}&per_page=1000000"
177
- )
178
-
179
- response = JSON.parse response.body
180
186
  response = response.sort_by {|r| r['name']}
181
187
 
182
188
  projects = []
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.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - George McIntosh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-25 00:00:00.000000000 Z
12
+ date: 2015-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: webmock
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.2.2
171
+ rubygems_version: 2.4.5
172
172
  signing_key:
173
173
  specification_version: 3
174
174
  summary: Command-line Gitlab client