veyor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -10
- data/bin/veyor +45 -440
- data/lib/veyor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0821bd7d2a3b69705049ea80098e753c5be9e3f3
|
4
|
+
data.tar.gz: d66b1356c7c6f27f6918a349db03246cdda95496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0527f3b33a4aa3e9403c06c9249e8d97595b4b91112b2a07cdfc9a6e5c0294d43319a1172bc76b071052598b8f1aaf563427cde8ad46593ec500c027a5a3f16d
|
7
|
+
data.tar.gz: ba720ed12269b34fe1c30283bfaec1b318577c3677a058c69e0d58cd0310d44f17257c76ae667a9c779be4d75d93095e2819bc1b0f7f93962bf9333bd3645764
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@ veyor
|
|
2
2
|
=====
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/sckott/veyor.svg?branch=master)](https://travis-ci.org/sckott/veyor)
|
5
|
-
[![codecov.io](http://codecov.io/github/sckott/veyor/coverage.svg?branch=master)](http://codecov.io/github/sckott/veyor?branch=master)
|
6
5
|
[![gem version](https://img.shields.io/gem/v/veyor.svg)](https://rubygems.org/gems/veyor)
|
7
6
|
|
8
7
|
`veyor` is a low level client for the [Appveyor API](https://www.appveyor.com/docs/api)
|
@@ -41,13 +40,7 @@ More to come in future `veyor` versions
|
|
41
40
|
|
42
41
|
For changes see the [Changelog](https://github.com/sckott/veyor/blob/master/CHANGELOG.md)
|
43
42
|
|
44
|
-
##
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
require 'veyor'
|
48
|
-
```
|
49
|
-
|
50
|
-
### setup
|
43
|
+
## Setup
|
51
44
|
|
52
45
|
```ruby
|
53
46
|
Veyor.configuration do |config|
|
@@ -56,11 +49,13 @@ Veyor.configuration do |config|
|
|
56
49
|
end
|
57
50
|
```
|
58
51
|
|
59
|
-
|
52
|
+
Ideally, store those in env var keys like
|
60
53
|
|
61
54
|
* `ENV['APPVEYOR_ACCOUNT_NAME']`
|
62
55
|
* `ENV['APPVEYOR_API_TOKEN']`
|
63
56
|
|
57
|
+
## In Ruby
|
58
|
+
|
64
59
|
### get projects
|
65
60
|
|
66
61
|
```ruby
|
@@ -91,9 +86,95 @@ Veyor.build_start(project: 'cowsay')
|
|
91
86
|
Veyor.build_cancel(project: 'cowsay', version: '1.0.697')
|
92
87
|
```
|
93
88
|
|
89
|
+
## On the CLI
|
90
|
+
|
91
|
+
List commands
|
92
|
+
|
93
|
+
```
|
94
|
+
veyor
|
95
|
+
```
|
96
|
+
|
97
|
+
```
|
98
|
+
Commands:
|
99
|
+
veyor help [COMMAND] # Describe available commands or one specific command
|
100
|
+
veyor project [Name] # List a project
|
101
|
+
veyor projects # List projects
|
102
|
+
```
|
103
|
+
|
104
|
+
List your projects
|
105
|
+
|
106
|
+
```
|
107
|
+
veyor projects
|
108
|
+
```
|
109
|
+
|
110
|
+
```
|
111
|
+
alm
|
112
|
+
analogsea
|
113
|
+
aspacer
|
114
|
+
bmc
|
115
|
+
bold
|
116
|
+
ccafs
|
117
|
+
... cutoff
|
118
|
+
```
|
119
|
+
|
120
|
+
Get back json - parse with [jq](https://stedolan.github.io/jq/)
|
121
|
+
|
122
|
+
```
|
123
|
+
veyor projects --json | jq .[].builds[].status
|
124
|
+
```
|
125
|
+
|
126
|
+
```
|
127
|
+
"cancelled"
|
128
|
+
"success"
|
129
|
+
"success"
|
130
|
+
"failed"
|
131
|
+
"success"
|
132
|
+
"success"
|
133
|
+
```
|
134
|
+
|
135
|
+
List metadata for single project
|
136
|
+
|
137
|
+
```
|
138
|
+
veyor project cowsay
|
139
|
+
```
|
140
|
+
|
141
|
+
```
|
142
|
+
project: cowsay
|
143
|
+
repository: sckott/cowsay
|
144
|
+
branch: master
|
145
|
+
build status: cancelled
|
146
|
+
build ID: 3906530
|
147
|
+
```
|
148
|
+
|
149
|
+
JSON
|
150
|
+
|
151
|
+
```
|
152
|
+
veyor project cowsay --json | jq .project
|
153
|
+
```
|
154
|
+
|
155
|
+
```json
|
156
|
+
{
|
157
|
+
"projectId": 44589,
|
158
|
+
"accountId": 13586,
|
159
|
+
"accountName": "sckott",
|
160
|
+
"builds": [],
|
161
|
+
"name": "cowsay",
|
162
|
+
"slug": "cowsay",
|
163
|
+
"repositoryType": "gitHub",
|
164
|
+
"repositoryScm": "git",
|
165
|
+
"repositoryName": "sckott/cowsay",
|
166
|
+
"repositoryBranch": "master",
|
167
|
+
"isPrivate": false,
|
168
|
+
"skipBranchesWithoutAppveyorYml": false,
|
169
|
+
"enableSecu
|
170
|
+
...cutoff
|
171
|
+
```
|
172
|
+
|
173
|
+
|
174
|
+
|
94
175
|
## Contributing
|
95
176
|
|
96
|
-
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Code of Conduct]
|
177
|
+
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Code of Conduct](https://github.com/sckott/veyor/blob/master/CONDUCT.md).
|
97
178
|
|
98
179
|
|
99
180
|
## License
|
data/bin/veyor
CHANGED
@@ -4,475 +4,80 @@ require "thor"
|
|
4
4
|
require "veyor"
|
5
5
|
require "multi_json"
|
6
6
|
|
7
|
-
class
|
7
|
+
class Yey < Thor
|
8
|
+
|
8
9
|
include Thor::Actions
|
9
10
|
# class_option :json, :type => :boolean, :default => false
|
10
11
|
|
11
|
-
desc "
|
12
|
-
long_desc <<-LONGDESC
|
13
|
-
`veyor works` accepts one or more DOIs to search for works
|
14
|
-
|
15
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
16
|
-
|
17
|
-
# A single DOI
|
18
|
-
\x5$ veyor works 10.1371/journal.pone.0033693
|
19
|
-
|
20
|
-
DOI: 10.1371/journal.pone.0033693
|
21
|
-
\x5type: journal-article
|
22
|
-
\x5title: Methylphenidate Exposure Induces Dopamine Neuron Loss and Activation of Microglia in the Basal Ganglia of Mice
|
23
|
-
|
24
|
-
# Many DOIs
|
25
|
-
\x5$ veyor works "10.1007/12080.1874-1746,10.1007/10452.1573-5125"
|
26
|
-
|
27
|
-
DOI: 10.1007/12080.1874-1746
|
28
|
-
\x5type: journal
|
29
|
-
\x5title: Theoretical Ecology
|
30
|
-
|
31
|
-
DOI: 10.1007/10452.1573-5125
|
32
|
-
\x5type: journal
|
33
|
-
\x5title: Aquatic Ecology
|
34
|
-
|
35
|
-
# Verbose output gives JSON, pipe onwards, e.g., parse with jq
|
36
|
-
\x5$ veyor works "10.1371/journal.pone.0033693,10.1007/12080.1874-1746,10.1007/10452.1573-5125" --json=true | jq .[].message.member
|
37
|
-
|
38
|
-
"http://id.crossref.org/member/340"
|
39
|
-
\x5"http://id.crossref.org/member/297"
|
40
|
-
\x5"http://id.crossref.org/member/297"
|
41
|
-
|
42
|
-
# Filter usage
|
43
|
-
\x5$ veyor works --filter=has_orcid:true --json --limit=4 | jq '.message.items[].author[].ORCID | select(. != null)'
|
44
|
-
|
45
|
-
"http://orcid.org/0000-0003-4087-8021"
|
46
|
-
\x5"http://orcid.org/0000-0002-2076-5452"
|
47
|
-
\x5"http://orcid.org/0000-0003-4087-8021"
|
48
|
-
\x5"http://orcid.org/0000-0002-2076-5452"
|
49
|
-
LONGDESC
|
50
|
-
option :json, :type => :boolean, :default => false
|
51
|
-
option :filter, :type => :hash, :default => nil
|
52
|
-
option :limit, :type => :numeric, :default => nil
|
53
|
-
def works(ids=nil)
|
54
|
-
if ids.nil?
|
55
|
-
out = veyor.works(filter: options[:filter], limit: options[:limit])
|
56
|
-
else
|
57
|
-
out = veyor.works(ids: ids.split(","), filter: options[:filter])
|
58
|
-
end
|
59
|
-
if !options[:json]
|
60
|
-
out = out.collect { |x| x['message'].select { |k,v| k[/DOI|type|title/] } }
|
61
|
-
out.each do |x|
|
62
|
-
puts 'DOI: ' + x['DOI'].to_s
|
63
|
-
puts 'type: ' + x['type']
|
64
|
-
puts 'title: ' + x['title'][0]
|
65
|
-
puts
|
66
|
-
end
|
67
|
-
else
|
68
|
-
puts MultiJson.encode(out)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
desc "members [member IDs]", "Get members by id"
|
12
|
+
desc "projects", "List projects"
|
73
13
|
long_desc <<-LONGDESC
|
74
|
-
`veyor
|
75
|
-
|
76
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
77
|
-
|
78
|
-
$ veyor members 98
|
79
|
-
|
80
|
-
id: 98
|
81
|
-
\x5title: Hindawi Publishing Corporation
|
82
|
-
|
83
|
-
$ veyor members "98,340"
|
84
|
-
|
85
|
-
id: 98
|
86
|
-
\x5title: Hindawi Publishing Corporation
|
87
|
-
|
88
|
-
id: 340
|
89
|
-
\x5title: Public Library of Science (PLoS)
|
14
|
+
`veyor projects` list projects
|
90
15
|
|
91
|
-
|
16
|
+
# List projects
|
17
|
+
\x5$ veyor projects
|
92
18
|
|
93
|
-
|
19
|
+
"foo"
|
20
|
+
\x5"bar"
|
21
|
+
\x5... (cutoff)
|
94
22
|
|
95
|
-
|
23
|
+
# Get JSON back
|
24
|
+
\x5$ veyor projects --json | jq .[].builds[].status
|
96
25
|
|
97
|
-
|
26
|
+
"cancelled"
|
27
|
+
\x5"success"
|
28
|
+
\x5"success"
|
29
|
+
\x5"failed"
|
30
|
+
\x5... (cutoff)
|
98
31
|
LONGDESC
|
99
32
|
option :json, :type => :boolean, :default => false
|
100
|
-
|
101
|
-
|
102
|
-
option :works, :type => :boolean, :default => false
|
103
|
-
def members(ids=nil)
|
104
|
-
if ids.nil?
|
105
|
-
out = veyor.members(query: options[:query], limit: options[:limit],
|
106
|
-
works: options[:works])
|
107
|
-
else
|
108
|
-
out = veyor.members(ids: ids.split(","), query: options[:query], limit: options[:limit],
|
109
|
-
works: options[:works])
|
110
|
-
end
|
33
|
+
def projects
|
34
|
+
out = Veyor.projects()
|
111
35
|
|
112
36
|
if !options[:json]
|
113
|
-
|
114
|
-
|
115
|
-
out = out['message']['items']
|
116
|
-
else
|
117
|
-
out = out.collect { |x| x['message'] }
|
118
|
-
end
|
119
|
-
|
120
|
-
# out = out.collect { |x| x['message'].select { |k,v| k[/id|primary-name/] } }
|
121
|
-
out.each do |x|
|
122
|
-
puts 'id: ' + x['id'].to_s
|
123
|
-
puts 'title: ' + x['primary-name']
|
124
|
-
puts
|
125
|
-
end
|
126
|
-
else
|
127
|
-
print_works(out)
|
128
|
-
end
|
37
|
+
names = out.collect{ |x| x['name'] }.sort
|
38
|
+
puts names
|
129
39
|
else
|
130
40
|
puts MultiJson.encode(out)
|
131
41
|
end
|
132
42
|
end
|
133
43
|
|
134
|
-
|
135
|
-
desc "prefixes [DOI prefixes]", "Search for prefixes by DOI prefix"
|
44
|
+
desc "project [Name]", "List a project"
|
136
45
|
long_desc <<-LONGDESC
|
137
|
-
`veyor
|
138
|
-
|
139
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
140
|
-
|
141
|
-
$ veyor prefixes 10.1016
|
142
|
-
|
143
|
-
member: http://id.crossref.org/member/78
|
144
|
-
\x5name: Elsevier BV
|
145
|
-
\x5prefix: http://id.crossref.org/prefix/10.1016
|
146
|
-
|
147
|
-
$ veyor prefixes "10.1016,10.1371"
|
46
|
+
`veyor project` list a project's metadata
|
148
47
|
|
149
|
-
|
150
|
-
\
|
151
|
-
\x5prefix: http://id.crossref.org/prefix/10.1016
|
48
|
+
# Get metadata for a project
|
49
|
+
\x5$ veyor project cowsay
|
152
50
|
|
153
|
-
|
154
|
-
\
|
155
|
-
\
|
51
|
+
project: cowsay
|
52
|
+
\x5 repository: sckott/cowsay
|
53
|
+
\x5 branch: master
|
54
|
+
\x5 build status: cancelled
|
55
|
+
\x5 build ID: 3906530
|
156
56
|
|
157
|
-
|
57
|
+
# Get JSON back
|
58
|
+
\x5$ veyor project cowsay --json | jq .build.status
|
158
59
|
|
159
|
-
"
|
160
|
-
\x5"Public Library of Science (PLoS)"
|
161
|
-
\x5"Springer Science + Business Media"
|
162
|
-
\x5"Co-Action Publishing"
|
163
|
-
\x5"Oxford University Press (OUP)"
|
60
|
+
"cancelled"
|
164
61
|
LONGDESC
|
165
62
|
option :json, :type => :boolean, :default => false
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
out = veyor.prefixes(limit: options[:limit], works: options[:works])
|
63
|
+
def project(name)
|
64
|
+
out = Veyor.project(project: name)
|
65
|
+
if out.keys.length == 1 and out.keys[0] == "message"
|
66
|
+
puts "project not found"
|
171
67
|
else
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
if out.class == Hash
|
179
|
-
out = out['message']['items']
|
180
|
-
else
|
181
|
-
out = out.collect { |x| x['message'] }
|
182
|
-
end
|
183
|
-
|
184
|
-
out.each do |x|
|
185
|
-
puts 'member: ' + x['member']
|
186
|
-
puts 'name: ' + x['name']
|
187
|
-
puts 'prefix: ' + x['prefix']
|
188
|
-
puts
|
189
|
-
end
|
190
|
-
else
|
191
|
-
print_works(out)
|
192
|
-
end
|
193
|
-
else
|
194
|
-
puts MultiJson.encode(out)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
desc "funders [funder IDs]", "Search for funders by DOI prefix"
|
199
|
-
long_desc <<-LONGDESC
|
200
|
-
`veyor funders` accepts one or more Crossref funder IDs
|
201
|
-
|
202
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
203
|
-
|
204
|
-
$ veyor funders 100004410
|
205
|
-
|
206
|
-
id: 100004410
|
207
|
-
\x5name: European Molecular Biology Organization
|
208
|
-
\x5location: Germany
|
209
|
-
|
210
|
-
$ veyor funders "10.13039/100000001,10.13039/100000015"
|
211
|
-
|
212
|
-
id: 100000001
|
213
|
-
\x5name: National Science Foundation
|
214
|
-
\x5location: United States
|
215
|
-
|
216
|
-
id: 100000015
|
217
|
-
\x5name: U.S. Department of Energy
|
218
|
-
\x5location: United States
|
219
|
-
|
220
|
-
$ veyor funders "10.13039/100000001,10.13039/100000015" --json=true | jq .[].message.name
|
221
|
-
|
222
|
-
"National Science Foundation"
|
223
|
-
\x5"U.S. Department of Energy"
|
224
|
-
|
225
|
-
$ veyor funders --query=NSF --limit=2
|
226
|
-
|
227
|
-
$ veyor funders 10.13039/100000001 --works=true --limit=2
|
228
|
-
LONGDESC
|
229
|
-
option :json, :type => :boolean, :default => false
|
230
|
-
option :query, :type => :string, :default => nil
|
231
|
-
option :limit, :type => :numeric, :default => nil
|
232
|
-
option :works, :type => :boolean, :default => false
|
233
|
-
def funders(ids=nil)
|
234
|
-
if ids.nil?
|
235
|
-
out = veyor.funders(query: options[:query], limit: options[:limit],
|
236
|
-
works: options[:works])
|
237
|
-
else
|
238
|
-
out = veyor.funders(ids: ids.split(","), query: options[:query], limit: options[:limit],
|
239
|
-
works: options[:works])
|
240
|
-
end
|
241
|
-
|
242
|
-
if !options[:json]
|
243
|
-
if !options[:works]
|
244
|
-
if out.class == Hash
|
245
|
-
out = out['message']['items']
|
246
|
-
else
|
247
|
-
out = out.collect { |x| x['message'] }
|
248
|
-
end
|
249
|
-
|
250
|
-
out.each do |x|
|
251
|
-
puts 'id: ' + x['id']
|
252
|
-
puts 'name: ' + x['name']
|
253
|
-
puts 'location: ' + x['location']
|
254
|
-
puts
|
255
|
-
end
|
256
|
-
else
|
257
|
-
print_works(out)
|
258
|
-
end
|
259
|
-
else
|
260
|
-
puts MultiJson.encode(out)
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
|
265
|
-
desc "journals [journal ISSNs]", "Search for journals by ISSNs"
|
266
|
-
long_desc <<-LONGDESC
|
267
|
-
`veyor journals` accepts one or more journal ISSNs
|
268
|
-
|
269
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
270
|
-
|
271
|
-
$ veyor journals 2167-8359
|
272
|
-
|
273
|
-
id: 100004410
|
274
|
-
\x5name: European Molecular Biology Organization
|
275
|
-
\x5location: Germany
|
276
|
-
|
277
|
-
$ veyor journals "1803-2427,2326-4225"
|
278
|
-
|
279
|
-
id: 100000001
|
280
|
-
\x5name: National Science Foundation
|
281
|
-
\x5location: United States
|
282
|
-
|
283
|
-
id: 100000015
|
284
|
-
\x5name: U.S. Department of Energy
|
285
|
-
\x5location: United States
|
286
|
-
|
287
|
-
$ veyor journals "1803-2427,2326-4225" --json=true | jq .[].message.title
|
288
|
-
|
289
|
-
"National Science Foundation"
|
290
|
-
\x5"U.S. Department of Energy"
|
291
|
-
|
292
|
-
$ veyor journals --query=ecology --limit=2
|
293
|
-
|
294
|
-
$ veyor journals 2167-8359 --query=ecology --works=true --limit=2
|
295
|
-
LONGDESC
|
296
|
-
option :json, :type => :boolean, :default => false
|
297
|
-
option :query, :type => :string, :default => nil
|
298
|
-
option :limit, :type => :numeric, :default => nil
|
299
|
-
option :works, :type => :boolean, :default => false
|
300
|
-
def journals(ids=nil)
|
301
|
-
if ids.nil?
|
302
|
-
out = veyor.journals(query: options[:query], limit: options[:limit],
|
303
|
-
works: options[:works])
|
304
|
-
else
|
305
|
-
out = veyor.journals(ids: ids.split(","), query: options[:query], limit: options[:limit],
|
306
|
-
works: options[:works])
|
307
|
-
end
|
308
|
-
|
309
|
-
if !options[:json]
|
310
|
-
if !options[:works]
|
311
|
-
if out.class == Hash
|
312
|
-
out = out['message']['items']
|
313
|
-
else
|
314
|
-
out = out.collect { |x| x['message'] }
|
315
|
-
end
|
316
|
-
|
317
|
-
out.each do |x|
|
318
|
-
puts 'ISSN: ' + x['ISSN'][0]
|
319
|
-
puts 'title: ' + x['title']
|
320
|
-
puts 'publisher: ' + x['publisher']
|
321
|
-
puts
|
322
|
-
end
|
323
|
-
else
|
324
|
-
print_works(out)
|
325
|
-
end
|
326
|
-
else
|
327
|
-
puts MultiJson.encode(out)
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
desc "types [type name]", "Search for types by name"
|
332
|
-
long_desc <<-LONGDESC
|
333
|
-
`veyor types` accepts one or more type names
|
334
|
-
|
335
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
336
|
-
|
337
|
-
$ veyor types journal
|
338
|
-
|
339
|
-
id: 100004410
|
340
|
-
\x5name: European Molecular Biology Organization
|
341
|
-
\x5location: Germany
|
342
|
-
|
343
|
-
$ veyor types journal dissertation
|
344
|
-
|
345
|
-
id: 100000001
|
346
|
-
\x5name: National Science Foundation
|
347
|
-
\x5location: United States
|
348
|
-
|
349
|
-
id: 100000015
|
350
|
-
\x5name: U.S. Department of Energy
|
351
|
-
\x5location: United States
|
352
|
-
|
353
|
-
$ veyor types journal dissertation --json=true | jq .[].message
|
354
|
-
|
355
|
-
"National Science Foundation"
|
356
|
-
\x5"U.S. Department of Energy"
|
357
|
-
|
358
|
-
$ veyor types dissertation --works
|
359
|
-
|
360
|
-
$ veyor types dissertation --works --limit=2
|
361
|
-
LONGDESC
|
362
|
-
option :json, :type => :boolean, :default => false
|
363
|
-
option :works, :type => :boolean, :default => false
|
364
|
-
option :limit, :type => :numeric, :default => nil
|
365
|
-
def types(*ids)
|
366
|
-
out = veyor.types(ids: ids, limit: options[:limit],
|
367
|
-
works: options[:works])
|
368
|
-
|
369
|
-
if !options[:json]
|
370
|
-
if !options[:works]
|
371
|
-
if out.class == Hash
|
372
|
-
out = out['message']['items']
|
373
|
-
else
|
374
|
-
out = out.collect { |x| x['message'] }
|
375
|
-
end
|
376
|
-
|
377
|
-
out.each do |x|
|
378
|
-
puts 'id: ' + x['id']
|
379
|
-
puts 'label: ' + x['label']
|
380
|
-
puts
|
381
|
-
end
|
382
|
-
else
|
383
|
-
print_works(out)
|
384
|
-
end
|
385
|
-
else
|
386
|
-
puts MultiJson.encode(out)
|
387
|
-
end
|
388
|
-
end
|
389
|
-
|
390
|
-
desc "licenses", "Search for licenses by name"
|
391
|
-
long_desc <<-LONGDESC
|
392
|
-
`veyor licenses` accepts one or more type names
|
393
|
-
|
394
|
-
Toggle `json` to get simplified (summary) or complete output (JSON)
|
395
|
-
|
396
|
-
$ veyor licenses
|
397
|
-
|
398
|
-
url: http://avs.org
|
399
|
-
\x5work-count: 1
|
400
|
-
|
401
|
-
url: http://creativecommons.org/LICENSEs/by/3.0/
|
402
|
-
\x5work-count: 14
|
403
|
-
|
404
|
-
$ veyor licenses --query=creative
|
405
|
-
|
406
|
-
id: 100000001
|
407
|
-
\x5name: National Science Foundation
|
408
|
-
\x5location: United States
|
409
|
-
|
410
|
-
id: 100000015
|
411
|
-
\x5name: U.S. Department of Energy
|
412
|
-
\x5location: United States
|
413
|
-
|
414
|
-
$ veyor licenses --json=true | jq .message.items[]
|
415
|
-
|
416
|
-
"National Science Foundation"
|
417
|
-
\x5"U.S. Department of Energy"
|
418
|
-
LONGDESC
|
419
|
-
option :json, :type => :boolean, :default => false
|
420
|
-
option :query, :type => :string, :default => nil
|
421
|
-
def licenses
|
422
|
-
out = veyor.licenses(query: options[:query])
|
423
|
-
if !options[:json]
|
424
|
-
out = out['message']['items']
|
425
|
-
out.each do |x|
|
426
|
-
puts 'url: ' + x['URL']
|
427
|
-
puts 'work-count: ' + x['work-count'].to_s
|
68
|
+
if !options[:json]
|
69
|
+
puts 'project: ' + out['project']['name']
|
70
|
+
puts 'repository: ' + out['project']['repositoryName']
|
71
|
+
puts 'branch: ' + out['project']['repositoryBranch']
|
72
|
+
puts 'build status: ' + out['build']['status']
|
73
|
+
puts 'build ID: ' + out['build']['buildId'].to_s
|
428
74
|
puts
|
75
|
+
else
|
76
|
+
puts MultiJson.encode(out)
|
429
77
|
end
|
430
|
-
else
|
431
|
-
puts MultiJson.encode(out)
|
432
|
-
end
|
433
|
-
end
|
434
|
-
|
435
|
-
desc "contneg", "Content negotiation"
|
436
|
-
long_desc <<-LONGDESC
|
437
|
-
`veyor contneg` accepts a DOI
|
438
|
-
|
439
|
-
$ veyor contneg 10.1890/13-0590.1
|
440
|
-
|
441
|
-
Murtaugh, P. A. (2014). In defense of P values . Ecology, 95(3), 611–617. doi:10.1890/13-0590.1
|
442
|
-
|
443
|
-
$ veyor contneg 10.1890/13-0590.1 --style=heredity
|
444
|
-
|
445
|
-
Murtaugh PA (2014). In defense of P values . Ecology 95: 611–617.
|
446
|
-
LONGDESC
|
447
|
-
option :format, :type => :string, :default => "text"
|
448
|
-
option :style, :type => :string, :default => "apa"
|
449
|
-
option :locale, :type => :string, :default => "en-US"
|
450
|
-
def contneg(ids)
|
451
|
-
puts veyor.content_negotiation(ids: ids, format: options[:format], style:
|
452
|
-
options[:style], locale: options[:locale])
|
453
|
-
end
|
454
|
-
|
455
|
-
desc "version", "Get veyor version"
|
456
|
-
def version
|
457
|
-
puts veyor::VERSION
|
458
|
-
end
|
459
|
-
|
460
|
-
private
|
461
|
-
|
462
|
-
def print_works(data)
|
463
|
-
if data.is_a? Array
|
464
|
-
data = data[0]['message']['items']
|
465
|
-
else
|
466
|
-
data = data.collect { |x| x['message'].select { |k,v| k[/DOI|type|title/] } }
|
467
|
-
end
|
468
|
-
data.each do |x|
|
469
|
-
puts 'DOI: ' + x['DOI']
|
470
|
-
puts 'type: ' + x['type']
|
471
|
-
puts 'title: ' + x['title'][0]
|
472
|
-
puts
|
473
78
|
end
|
474
79
|
end
|
475
80
|
|
476
81
|
end
|
477
82
|
|
478
|
-
|
83
|
+
Yey.start(ARGV)
|
data/lib/veyor/version.rb
CHANGED