veye 0.0.8.1 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8417e37216d48d74634953437a828cdfae51a0ec
4
- data.tar.gz: e9df1c912c93a2e6ccebc7c13639c5ab1378ea58
3
+ metadata.gz: ed87ae6f638f1aeed2602575a9988254d9e12ddc
4
+ data.tar.gz: 713504f09b4dd5adfd1a22529009d2e7e2605ad5
5
5
  SHA512:
6
- metadata.gz: c52077bcd76e3a439a793f0153f654634458d6bb7597f94022fc15dbff8e94c7a2df04b452ac8466782e653ddaf1ce2bda96f38d38ebd3942420fbde24a1f175
7
- data.tar.gz: 46d504467244d8bfb323acaa36300579fecf97b2d366308e6366a2734ac63622ce0b3d2306354cd9fb9bdf691a4a784153fb7421e000de3d9c8a91b8a20e0b54
6
+ metadata.gz: a9e8b894dc55cadb9a7bc5744d6e9d085301a83262aaefd0eba3756a2bede2e853e50c193ed50b14ba2c5ed7389c37404680a63d11984752a214cd865cc9db49
7
+ data.tar.gz: 33cf0c557cbde68f816733defc2b231cb0a53bf9a3e9c156e02d8a1ab3b7a7cb68a79a6da8064d3f305967b32654c37a3505c925ed36c58d86b279ff657474b2
data/Gemfile.lock CHANGED
@@ -2,12 +2,12 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  veye (0.0.8.1)
5
- awesome_print (~> 1.2.0)
6
- gli (~> 2.11.0)
7
- rainbow (~> 2.0.0)
8
- render-as-markdown (~> 0.0.6)
9
- rest-client (~> 1.6.7)
10
- terminal-table (~> 1.4.5)
5
+ awesome_print (~> 1.2)
6
+ gli (~> 2.11)
7
+ rainbow (~> 2.0)
8
+ render-as-markdown (~> 0.0)
9
+ rest-client (~> 1.6)
10
+ terminal-table (~> 1.4)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
@@ -52,7 +52,7 @@ PLATFORMS
52
52
  ruby
53
53
 
54
54
  DEPENDENCIES
55
- aruba (~> 0.6.0)
56
- rake (~> 10.3.2)
57
- rdoc (~> 4.1.1)
55
+ aruba (~> 0.6)
56
+ rake (~> 10.3)
57
+ rdoc (~> 4.1)
58
58
  veye!
data/README.md CHANGED
@@ -1,32 +1,33 @@
1
1
  # Veye
2
2
 
3
- [![Dependency Status](https://www.versioneye.com/ruby/veye/0.0.5/badge.png)](https://www.versioneye.com/ruby/veye/0.0.5)
3
+ [![Dependency Status](https://www.versioneye.com/ruby/veye/0.0.8.1/badge.svg)](https://www.versioneye.com/ruby/veye/0.0.8.1)
4
4
 
5
- [VersionEye](http://www.versioneye.com/) is a cross-platform search engine and crowdsourcing app for opensource software libraries.
5
+ [![Join the chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/versioneye?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
6
6
 
7
- * Take advantage of the extended search to find any library you look for.
7
+
8
+ [VersionEye](http://www.versioneye.com/) is a cross-platform search engine and crowdsourcing app for opensource software libraries.
9
+
10
+ * Take advantage of the extended search to find any library you look for.
8
11
  * Follow and track your favorite software packages via RSS feed.
9
- * Leave comments and add additional meta information to the libraries to improve the quality of the data.
12
+ * Leave comments and add additional meta information to the libraries to improve the quality of the data.
10
13
  * Contribute to this crowdsourcing project to make the world a better place for software developers.
11
14
 
12
15
 
13
- **veye** is commandline tool to make all this available on command-line and manipulate results with awesome tools and scripts.
14
-
15
- **PS:** Our _premium customers_ can also use offline search. Please send your email to `contact@versioneye.com` to get more information.
16
+ **veye** is opensouce commandline tool to make all this available on your console and allows you write scripts for continous updating and due diligence.
16
17
 
17
18
  Most endpoints require the api-key, which you can get [here](https://www.versioneye.com/settings/api).
18
19
 
19
20
  ![Main help](http://dl.dropbox.com/u/19578784/versioneye/cli_start_page.png)
20
21
 
21
22
 
22
- ### Install
23
+ ## Install
23
24
 
24
25
 
25
26
  ```
26
27
  $> gem install veye
27
28
  ```
28
29
 
29
- ### Using dev-version
30
+ ### only for dev-version
30
31
 
31
32
  ###### Download source
32
33
 
@@ -40,7 +41,7 @@ Most endpoints require the api-key, which you can get [here](https://www.version
40
41
  $> bundle
41
42
  $> bundle exec bin/veye ping
42
43
  ```
43
-
44
+
44
45
  ###### Or build Gem file and install it as global command
45
46
 
46
47
  ```
@@ -48,12 +49,12 @@ Most endpoints require the api-key, which you can get [here](https://www.version
48
49
  $> veye help
49
50
  $> veye ping
50
51
  ```
51
-
52
- ### Initial configuration
53
52
 
54
- The tool will raise exception when a configuration file is missing. The tool needs configuration file to keep user specific settings and authorization key.
53
+ ## Initial configuration
54
+
55
+ The tool will raise exception when a configuration file is missing. The tool needs configuration file to keep user specific settings and authorization key.
55
56
 
56
- ###### create config file
57
+ #### create config file
57
58
 
58
59
  ```
59
60
  $> veye initconfig
@@ -64,324 +65,365 @@ The tool will raise exception when a configuration file is missing. The tool nee
64
65
  :port: "3000"
65
66
  ....
66
67
  ```
67
-
68
- ###### add key
68
+
69
+ #### initialize api key
69
70
 
70
71
  Please visit [your settings page](https://www.versioneye.com/settings/api) on VersionEye for the api-key and then use command `veye change_key` to save your api key.
71
72
 
72
73
  ```
73
74
  $> veye change_key abj23j2bj33k14
74
75
  Success: your's key is now saved.
75
- ```
76
+ ```
76
77
 
77
78
  # Basic usage
78
79
 
79
80
 
80
- ### Check service
81
- You can use this service to check does the tool works and tests is our API accessible. This command doesnt need authorization.
82
-
83
- ```bash
84
- $> veye ping
81
+ ```bash
82
+ $> veye ping
85
83
  pong
86
- ```
87
84
 
88
- ### Search packages
89
-
90
- This command opens window to magnificient world of software packages - VersionEye has ~ 250K software libraries and it's reachable via your commandline.
91
-
92
- ###### Get command help
93
-
94
- ```bash
95
- $> veye search help
96
- ```
97
-
98
- ###### Basic package search with language filtering
99
-
100
- ```bash
101
- $> veye search junit
102
- $> veye search -l java
103
- $> veye search --language java
104
- $> veye search --language-name=java
105
-
106
- #search packages for multiple languages
107
- $> veye search --lang=nodejs,php
108
- ```
85
+ $> veye search json --lang=r,php --page=2
109
86
 
110
- ###### Use result paging
87
+ #you can cancel pagination with --no-pagination argument
88
+ $> veye search junit --page 3 --no-pagination
89
+ ```
111
90
 
112
- ```
113
- $> veye search junit --page 2
114
- $> veye search junit --page-number=2
115
- $> veye search json --lang=r,php --page=2
116
-
117
- #you can cancel pagination with --no-pagination argument
118
- $> veye search junit --page 3 --no-pagination
119
- ```
120
91
 
121
- ### Output formats
92
+ ## Output formats
122
93
 
123
94
  All commands support format-flag, that allows you change output format.
124
95
 
125
- ###### pretty print
96
+ #### pretty print
97
+
98
+ Prettyprint is human readable output with colors to highlight an most important piece of information on a screen.
99
+ It's designed after other ruby command-line tools.
126
100
 
127
- Prettyprint is human readable output with colors. It's designed after other ruby command-line tools.
128
-
129
101
  ```bash
130
102
  $> veye search json --format=pretty
131
103
  ```
132
-
133
- ![Pretty format](https://s3-eu-west-1.amazonaws.com/veye/search_format_pretty.png)
134
-
135
- ###### CSV
136
- CSV is good format for unix command line tools as [awk](http://www.gnu.org/software/gawk/manual/gawk.html)
137
-
104
+
105
+ ![Pretty format](http://dl.dropbox.com/u/19578784/versioneye/search_pretty.png)
106
+
107
+ #### CSV
108
+ CSV is good format for unix command line tools such as [awk](http://www.gnu.org/software/gawk/manual/gawk.html)
109
+
138
110
  ```bash
139
111
  $> veye search json --format=csv
140
112
  ```
141
113
 
142
- ![CSV format](https://s3-eu-west-1.amazonaws.com/veye/search_format_csv.png)
114
+ ![CSV format](http://dl.dropbox.com/u/19578784/versioneye/search_csv.png)
115
+
116
+ #### JSON
143
117
 
144
- ###### JSON
145
-
146
- It also supports JSON to manipulate results with [jq](http://stedolan.github.com/jq/) .
118
+ JSON output is great, if you're going to manipulate output results with [jq](http://stedolan.github.com/jq/).
147
119
  Check out our jq recipes in [wiki](https://github.com/versioneye/veye/wiki/jq-recipes) .
148
-
149
-
120
+
121
+
150
122
  ```bash
151
123
  $> veye search json --format=json
152
124
  ```
153
-
154
- ![Json format](https://s3-eu-west-1.amazonaws.com/veye/search_format_json.png)
155
-
156
- ###### Table view
157
125
 
158
- A Tabular view for bigger screens. It's shows results as one Excel sheet - title and content.
159
-
126
+ ![Json format](http://dl.dropbox.com/u/19578784/versioneye/search_json.png)
127
+
128
+ #### Table view
129
+ It's shows results as one Excel sheet - title and content.
130
+ A Tabular view is best suited for bigger screens.
131
+
160
132
  ```bash
161
133
  $> veye search json --format=table
162
134
  ```
163
- ![Table output](https://s3-eu-west-1.amazonaws.com/veye/search_format_table.png)
164
-
165
135
 
166
- ###### Markdown
136
+ ![Table output](http://dl.dropbox.com/u/19578784/versioneye/search_table.png)
137
+
138
+
139
+ #### Markdown
167
140
 
168
141
  This flag formats your results in markdown.
169
-
142
+
170
143
  Here's dependencies of demo project formatted as [markdown table](https://gist.github.com/timgluz/6857422).
171
144
 
172
145
  ```
146
+ $> veye projects show rubygem_gemfile_lock_1 --format=md
147
+ $> veye projects show rubygem_gemfile_lock_1 --format=md > dependencies.md
173
148
 
174
- $> veye projects show rubygem_gemfile_lock_1 --format=md
175
- $> veye projects show rubygem_gemfile_lock_1 --format=md > dependencies.md
176
149
  ```
177
150
 
178
151
 
179
- ###### Empty response
152
+ #### Empty response
180
153
 
181
154
  There will be situation, when [VersionEye](http://versioneye.com) dont have information about your search, then you will see similar response on commandline:
182
155
 
183
156
  ```
184
- No results for 'json' with given parameters:
157
+ No results for 'json' with given parameters:
185
158
  {:q=>"json", :lang=>"python", :page=>1}
186
159
  ```
187
-
188
- ### Global options
160
+ #### Extra information
161
+
162
+ Commands that show list of items, always show pagination information by default. You can always cancel this information by using `no-pagination` flag and feed data into unix tools.
163
+
164
+ ```
165
+ $> veye search junit --page 3 --no-pagination
166
+ ```
167
+
168
+ ## Global options
189
169
 
190
170
  You can override your default global options by adding proper keyword and value.
191
- For example to override a number of port, when doing search:
171
+ For example to overriding a port number:
192
172
 
193
173
  ```
194
- $> veye --port=4567 search json --lang=php,nodejs
174
+ $> veye --port=4567 search json --lang=php,nodejs
195
175
  ```
196
176
 
197
- ###### Timeouts
177
+ ##### Timeouts
198
178
 
199
179
  The best place to manage timeouts for a single run is to use commandline flags.
200
180
 
201
181
  ```
202
- $> veye --timeout=100 --open_timeout=10 ping
182
+ $> veye --timeout=100 --open_timeout=10 ping
203
183
  ```
204
184
 
205
185
  **NB!** unit of timeout is a second and it's doesnt accepts milliseconds. Therefore smallest timeout is 1second and you can use -1 as infinite timeout.
206
186
 
207
- If you want to change timeout settings permanently, then you shall change timeout values in your `.veye.rc` file.
187
+ If you want to change timeout settings permanently, then you shall change timeout values in your `.veye.rc` file.
208
188
 
209
- ###### Updating options file
189
+ #### Updating options file
210
190
 
211
191
  There may be a situation when you need to update/re-write saved config file. Then you you can use `veye initconfig --force` command to re-write already existing configuration file.
212
192
 
213
- ### Package information
193
+ # Commands
194
+
195
+ ## Package
196
+
197
+ #### Package search
198
+
199
+ This command opens window to magnificient world of software packages - VersionEye has ~ 300K software libraries and it's reachable via your commandline.
200
+
201
+ ###### Get command help
202
+
203
+ ```bash
204
+ $> veye search help
205
+ ```
206
+
207
+ ###### Basic package search with language filtering
208
+
209
+ ```bash
210
+ $> veye search junit
211
+ $> veye search -l java
212
+ $> veye search --language java
213
+ $> veye search --language-name=java
214
+
215
+ #search packages for multiple languages
216
+ $> veye search --lang=nodejs,php
217
+ ```
218
+
219
+ ###### Paginate through results
220
+
221
+ ```
222
+ $> veye search junit --page 2
223
+ $> veye search junit --page-number=2
224
+ $> veye search json --lang=r,php --page=2
225
+
226
+ #you can cancel pagination with --no-pagination argument
227
+ $> veye search junit --page 3 --no-pagination
228
+ ```
229
+
230
+ #### package information
214
231
 
215
232
  Ok, thats most trickiest part of our tool. You need to prepend a language of package just before product's key. For example, if you have Java package with product key junit/junit, then you have to encode this value as: `java/junit/junit`.
216
233
 
217
234
 
218
235
  It supports also `--format` flag with same values.
219
236
 
220
- ```
221
- $> veye info java/junit/junit
222
- Asking information about: junit/junit
223
- ```
224
-
225
- ![Pretty print](https://s3-eu-west-1.amazonaws.com/veye/info_format_pretty2.png)
226
-
237
+ ```
238
+ $> veye info java/junit/junit
239
+ Asking information about: junit/junit
240
+ ```
227
241
 
228
- ### Products
242
+ ![Pretty print](http://dl.dropbox.com/u/19578784/versioneye/info_pretty.png)
229
243
 
230
- This command has subcommands to control your personal connections with libraries.
244
+ #### package references
245
+
246
+ You can use a `references` commands to fetch data about packages, which are using the package.
231
247
 
232
248
  ```
233
- ;;follow some package to add it into your RSS feed
234
- $> veye products follow clojure/ztellman/aleph
235
- $> veye products unfollow clojure/ztellman/aleph
236
-
237
- ;; show the list of products in your's RSS feed
238
- $> veye products
249
+ $> veye references java/log4j/log4j
250
+ $> veye references java/log4j/log4j --format=table
251
+ $> veye references java/log4j/log4j --no-pagination
239
252
  ```
240
253
 
241
- ### Check
254
+ #### personal connection with packages
242
255
 
243
- Use `check` command to upload your project file and check the state of dependencies. **NB!** it only shows information about dependencies, if you need also project info, then please use `veye project upload` command.
256
+ `product` command has subcommands to control your personal connections with libraries.
244
257
 
245
258
  ```
246
- $> veye check test/files/Gemfile
259
+ ;;follow some package to add it into your RSS feed
260
+ $> veye products follow clojure/ztellman/aleph
261
+ $> veye products unfollow clojure/ztellman/aleph
262
+
263
+ ;; show the list of products in your's RSS feed
264
+ $> veye products
247
265
  ```
248
266
 
249
- ### Project
267
+ ## Project
250
268
 
251
269
  The `project` command holds a multiple subcommands for working with our project files.
252
270
 
253
- ###### show existing projects
271
+ #### show existing projects
254
272
 
255
273
  ```
256
- $> veye projects list
257
- $> veye projects --format=table
274
+ $> veye projects list
275
+ $> veye projects --format=table
258
276
  ```
259
277
 
260
- ###### show information of specific project
278
+ #### show information of specific project
261
279
 
262
280
  A `show` command expects a proper project_key, which you can from the list of already existing projects.
263
281
 
264
282
  ```
265
- $> veye projects show rubygem_gemfile_1
266
- $> veye projects show rubygem_gemfile_1 --format=table
283
+ $> veye projects show rubygem_gemfile_1
284
+ $> veye projects show rubygem_gemfile_1 --format=table
267
285
  ```
268
286
 
269
- ###### upload project file
287
+ #### check project file
288
+
289
+ Use `check` command to upload your project file and check the state of dependencies. **NB!** it only shows information about dependencies, if you need also project info, then please use `veye project upload` command.
290
+
291
+ ```
292
+ $> veye check test/files/Gemfile
293
+ ```
294
+
295
+ #### upload project file
270
296
 
271
297
  Use `upload` command to create new project. This command expects proper filepath to the file and the file is smaller than 500KB. VersionEye supports currently 8 different package managers(*Leiningen, Gem, Maven, NPM, Packagist, Pip, Setup.py, R*), Bower and Obj-C is already on pipeline.
272
298
 
273
299
  ```
274
- $> veye projects upload test/files/Gemfile
275
- $> veye projects upload test/files/maven.pom
300
+ $> veye projects upload test/files/Gemfile
301
+ $> veye projects upload test/files/maven.pom
276
302
  ```
277
303
 
278
- ###### re-upload project file for existing project
304
+ #### re-upload project file for existing project
279
305
 
280
306
  You can use `update` command to update the information of already existing project.
281
307
  This command expects correct project_key and a path to file.
282
308
 
283
309
  ```
284
- $> veye projects update rubygem_gemfile_1 test/files/Gemfile
285
- $> veye projects update rubygem_gemfile_1 test/files/Gemfile --format=table
310
+ $> veye projects update rubygem_gemfile_1 test/files/Gemfile
311
+ $> veye projects update rubygem_gemfile_1 test/files/Gemfile --format=table
286
312
  ```
287
313
 
288
- ###### Delete project
314
+ #### Delete project
289
315
 
290
316
  This command removes the specified project from your project's list.
291
317
 
292
318
  ```
293
- $> veye projects delete rubygem_gemfile_1
319
+ $> veye projects delete rubygem_gemfile_1
294
320
  Deleted
295
321
  ```
296
322
 
297
- ###### Licences
323
+ #### Licences
298
324
 
299
325
  `licence` command returns all licenses used in your project.
300
326
 
301
327
  ```
302
- $> veye projects licences rubygem_gemfile_1 --format=table
328
+ $> veye projects licences rubygem_gemfile_1 --format=table
303
329
  ```
304
330
 
305
331
 
306
- ### Me
332
+ ## Me
307
333
 
308
334
  `me` command returns short overview of your profile and your current payment plan.
309
335
 
310
336
  ```
311
- $> veye me
312
- ```
337
+ $> veye me
338
+ ```
313
339
 
314
- ###### Favorite packages
340
+ #### Favorite packages
315
341
 
316
342
  `me` command has a `favorite` subcommand, which returns all packages you're currently following.
317
343
 
318
344
  ```
319
- $> veye me favorites
320
- $> veye me favorites --page=2 --format=table
345
+ $> veye me favorites
346
+ $> veye me favorites --page=2 --format=table
321
347
  ```
322
348
 
323
- ### Github
349
+ ## Github
324
350
 
325
351
  `Github` command includes subcommands to manage your Github repositories on VersionEye.
326
352
 
327
353
  All subcommands expect that you had already connected your Github with your VersionEye account. Otherwise you'll get plain exception message.
328
354
 
329
- ##### Sync
355
+ #### Sync
330
356
 
331
357
  Updates your Github data - this api's resource tries to be lazy: it pulls updates only if there's no cached repositories or Github shows there's any changes on your repositories. But you can use `--force` switch to re-import all data regardless there's any changes on your repositories. Beware this command can takes time.
332
358
 
333
359
  ```
334
- $> veye github sync
335
- $> veye github sync --force
360
+ $> veye github sync
361
+ $> veye github sync --force
336
362
  ```
337
363
 
338
- ###### List
364
+ #### List
339
365
 
340
366
  `list` commands shows paginated view of your repositories.
341
367
 
342
368
  ```
343
- $> veye github list --format=table
369
+ $> veye github list --format=table
344
370
  ```
345
371
 
346
- ###### Info
372
+ #### Info
347
373
 
348
374
  This command shows more detailed information.
349
375
 
350
376
  ```
351
- $> veye github info versioneye/veye
352
- $> veye github info versioneye/veye --format=table
377
+ $> veye github info versioneye/veye
378
+ $> veye github info versioneye/veye --format=table
353
379
  ```
354
380
 
355
- ###### Import
381
+ #### Import
356
382
 
357
383
  `import` command takes fullname of repository and tries to import project file from that repository. Fullname have to include the owner and the name of repository.
358
384
 
359
- By default, it tries to read project file on master branch; you can use a `--branch` flag to specify the name of branch.
385
+ By default, it tries to read project file on master branch; you can use a `--branch` flag to specify the name of branch.
360
386
 
361
387
  This command gives exception when you are trying to import already imported repository.
362
388
 
363
389
 
364
390
  ```
365
- $> veye github import versioneye/veye
366
- $> veye github import versioneye/veye --branch=dev
391
+ $> veye github import versioneye/veye
392
+ $> veye github import versioneye/veye --branch=dev
367
393
  ```
368
394
 
369
395
 
370
- ###### Delete
396
+ #### Delete
371
397
 
372
398
  It removes imported project.
373
399
 
374
400
  ```
375
- $> veye github delete versioneye/veye
376
- $> veye github delete versioneye/veye --branch=dev
401
+ $> veye github delete versioneye/veye
402
+ $> veye github delete versioneye/veye --branch=dev
377
403
  ```
378
404
 
379
- ###### Search
405
+ #### Search
380
406
 
381
- This command makes authorized request to the Github search api for repositories. As authorized user, you can make up to *5000* request per hour.
407
+ This command makes authorized request to the Github search api for repositories. As authorized user, you can make up to *5000* request per hour.
382
408
 
383
409
  ```
384
- $> veye github search versioneye
385
- $> veye github search json --language=php --page=2 ;; filter results by language
386
- $> veye github search veye --user versioneye ;; filter results by users
410
+ $> veye github search versioneye
411
+
412
+ ;; filter results by language
413
+ $> veye github search json --language=php --page=2
414
+
415
+ ;; filter results by users
416
+ $> veye github search veye --user versioneye
387
417
  ```
418
+
419
+ # Contibuting
420
+
421
+ All contributions are welcome - comments, new ideas, help with documentation & help with features;
422
+
423
+ # License
424
+ The MIT License (MIT)
425
+
426
+ Copyright (c)2015 **VersionEye GMHB**
427
+
428
+
429
+ [MIT licence](http://choosealicense.com/licenses/mit/)
data/bin/veye CHANGED
@@ -115,6 +115,29 @@ command :info do |c|
115
115
  end
116
116
  end
117
117
 
118
+ desc 'check a references of package'
119
+ arg_name 'product_key'
120
+ command :references do |c|
121
+ c.desc "change output format"
122
+ c.flag [:format, 'format-name'], :default_value => 'pretty'
123
+
124
+ c.desc "page number for pagination"
125
+ c.flag [:page, 'page-number'], :default_value => 1
126
+
127
+ c.desc "show paging information"
128
+ c.switch [:pagination, 'show-pagination'], :default_value => true,
129
+ :negatable => true
130
+
131
+
132
+ c.action do |global_options, options, args|
133
+ error_msg = Rainbow("package_key is missing").red
134
+ help_now!(error_msg) if args.empty?
135
+ package_key = args.shift
136
+ response = Veye::Package::References.get_references(package_key, options)
137
+ end
138
+ end
139
+
140
+
118
141
  desc 'analyzes given project file and returns version info'
119
142
  arg_name 'product_file'
120
143
 
@@ -23,9 +23,9 @@ module Veye
23
23
  You missed language or product key.
24
24
  Example: clojure/ztellman/aleph, which as required structure <prog lang>/<product_code>
25
25
  ]
26
- error_msg = sprrintf("%s. \n%s",
26
+ error_msg = sprintf("%s. \n%s",
27
27
  "Error: Malformed key.".color(:red),
28
- msg)
28
+ msg)
29
29
  exit_now!(error_msg)
30
30
  end
31
31
 
@@ -0,0 +1,54 @@
1
+ require_relative '../views/package.rb'
2
+ require_relative '../base_executor.rb'
3
+
4
+ module Veye
5
+ module Package
6
+ class References < BaseExecutor
7
+ @@output_formats = {
8
+ 'csv' => Package::ReferencesCSV.new,
9
+ 'json' => Package::ReferencesJSON.new,
10
+ 'pretty' => Package::ReferencesPretty.new,
11
+ 'table' => Package::ReferencesTable.new
12
+ }
13
+
14
+ def self.validate_input!(lang, safe_prod_key)
15
+ if lang.nil? or safe_prod_key.nil?
16
+ msg = %Q[
17
+ You missed language or product key.
18
+ Example: clojure/ztellman/aleph, which as required structure
19
+ <prog lang>/<product_code>
20
+ ]
21
+ error_msg = sprintf("%s. \n%s",
22
+ "Error: Malformed key.".color(:red),
23
+ msg)
24
+ exit_now!(error_msg)
25
+ end
26
+ end
27
+
28
+ def self.get_references(package_key, options = {})
29
+ product_api = API::Resource.new(RESOURCE_PATH)
30
+
31
+ tokens = package_key.to_s.split('/')
32
+ lang = Package.encode_language(tokens.first).capitalize #endpoint bug
33
+
34
+ safe_prod_key = Package.encode_prod_key(tokens.drop(1).join("/"))
35
+ validate_input!(lang, safe_prod_key)
36
+
37
+ api_path = "/#{lang}/#{safe_prod_key}/references"
38
+ page_nr = options[:page] || "1"
39
+ qparams = {params: {page: page_nr}}
40
+ results = nil
41
+
42
+ product_api.resource[api_path].get(qparams) do |response, request, result, &block|
43
+ results = API::JSONResponse.new(request, result, response)
44
+ end
45
+
46
+ catch_request_error(results, "No references for: `#{package_key}`")
47
+ show_results(@@output_formats, results.data, options, results.data['paging'])
48
+ return results
49
+
50
+ end
51
+ end
52
+ end
53
+ end
54
+
data/lib/veye/package.rb CHANGED
@@ -1,23 +1,24 @@
1
1
  require_relative 'package/info.rb'
2
2
  require_relative 'package/search.rb'
3
3
  require_relative 'package/follow.rb'
4
+ require_relative 'package/references.rb'
4
5
 
5
6
  # -- define module constants here
6
7
  module Veye
7
8
  module Package
8
9
  RESOURCE_PATH = "/products"
9
-
10
+
10
11
  def supported_languages
11
12
  Set.new ["Clojure", "Java", "Javascript", "Node.JS", "PHP", "Python", "Ruby", "R"]
12
13
  end
13
14
 
14
15
  def self.encode_prod_key(prod_key)
15
16
  prod_key = prod_key.to_s
16
- prod_key.gsub(/\//, ":").gsub(/\./, "~")
17
+ prod_key.gsub(/\//, ":").gsub(/\./, "~")
17
18
  end
18
19
 
19
20
  def self.encode_language(lang)
20
- lang.gsub(/\./, "").downcase
21
+ lang.gsub(/\./, "").downcase
21
22
  end
22
23
  end
23
24
  end
data/lib/veye/version.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  module Veye
2
- VERSION = '0.0.8.1'
2
+ VERSION = '0.0.9'
3
3
  BIGEYE = %q{
4
4
 
5
- _ __ _ ______
6
- | | / /___ _____ _____ (_)____ ____ / ____/__ __ ___
5
+ _ __ _ ______
6
+ | | / /___ _____ _____ (_)____ ____ / ____/__ __ ___
7
7
  | | / // _ \ / ___// ___// // __ \ / __ \ / __/ / / / // _ \
8
8
  | |/ // __// / (__ )/ // /_/ // / / // /___ / /_/ // __/
9
- |___/ \___//_/ /____//_/ \____//_/ /_//_____/ \__, / \___/
10
- /____/
9
+ |___/ \___//_/ /____//_/ \____//_/ /_//_____/ \__, / \___/
10
+ /____/
11
11
 
12
12
  }
13
13
 
@@ -0,0 +1,28 @@
1
+ require_relative '../base_csv.rb'
2
+
3
+ module Veye
4
+ module Package
5
+ class ReferencesCSV < BaseCSV
6
+ def initialize
7
+ headers = "nr,name,language,prod_key,prod_type,version"
8
+ super(headers)
9
+ end
10
+
11
+ def format(response)
12
+ items = response['results']
13
+ return if items.nil?
14
+
15
+ items.each_with_index do |result, index|
16
+ printf("%d,%s,%s,%s,%s,%s\n",
17
+ index + 1,
18
+ result["name"],
19
+ result["language"],
20
+ result["prod_key"],
21
+ result["prod_type"],
22
+ result["version"])
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,11 @@
1
+ require_relative '../base_json.rb'
2
+
3
+ module Veye
4
+ module Package
5
+ class ReferencesJSON < BaseJSON
6
+ def format(results)
7
+ @results[:results] = results['results']
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../base_pretty.rb'
2
+
3
+ module Veye
4
+ module Package
5
+ class ReferencesPretty < BasePretty
6
+ def format(results)
7
+ items = results['results']
8
+ return if items.nil?
9
+
10
+ items.each_with_index do |result, index|
11
+ printf("%3d - %s\n",
12
+ index + 1,
13
+ "#{result["name"]}".color(:green).bright)
14
+ printf("\t%-15s: %s\n", "Product key", result["prod_key"].bright)
15
+ printf("\t%-15s: %s\n", "Product type", "#{result['prod_type']}")
16
+ printf("\t%-15s: %s\n", "Language", result["language"])
17
+ printf("\t%-15s: %s\n", "Version", "#{result['version']}".bright)
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../base_table.rb'
2
+
3
+ module Veye
4
+ module Package
5
+ class ReferencesTable < BaseTable
6
+ def initialize
7
+ headings = %w(index name version product_key product_type language)
8
+ super("Package references", headings)
9
+ end
10
+
11
+ def format(results)
12
+ items = results['results']
13
+ return if items.nil?
14
+ items.each_with_index do |result, index|
15
+ row = [index+1, result["name"], result["version"], result["prod_key"]]
16
+ row << result["prod_type"]
17
+ row << result["language"]
18
+
19
+ @table << row
20
+ end
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -8,7 +8,13 @@ require_relative 'package/search_json.rb'
8
8
  require_relative 'package/search_pretty.rb'
9
9
  require_relative 'package/search_table.rb'
10
10
 
11
+ require_relative 'package/references_csv.rb'
12
+ require_relative 'package/references_json.rb'
13
+ require_relative 'package/references_pretty.rb'
14
+ require_relative 'package/references_table.rb'
15
+
16
+
11
17
  module Veye
12
18
  module Github
13
19
  end
14
- end
20
+ end
@@ -4,7 +4,7 @@ module Veye
4
4
  module Project
5
5
  class InfoMarkdown < BaseMarkdown
6
6
  def initialize
7
- headings = %w(index name project_key project_type private period source dependencies outdated created)
7
+ headings = %w(index name project_key project_type public period source dependencies outdated created)
8
8
  super("Project's information", headings)
9
9
  end
10
10
 
@@ -18,7 +18,7 @@ module Veye
18
18
  result["name"],
19
19
  result["project_key"],
20
20
  result["project_type"],
21
- result["private"].to_s,
21
+ result["public"].to_s,
22
22
  result["period"],
23
23
  result["source"],
24
24
  result["dep_number"].to_s,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.1
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - VersionEye GMBH
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-02 00:00:00.000000000 Z
13
+ date: 2015-07-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -145,16 +145,13 @@ email: reiz@versioneye.com
145
145
  executables:
146
146
  - veye
147
147
  extensions: []
148
- extra_rdoc_files:
149
- - README.rdoc
150
- - veye.rdoc
148
+ extra_rdoc_files: []
151
149
  files:
152
150
  - DEPENDENCIES.md
153
151
  - Gemfile
154
152
  - Gemfile.lock
155
153
  - Makefile
156
154
  - README.md
157
- - README.rdoc
158
155
  - Rakefile
159
156
  - bin/veye
160
157
  - lib/veye.rb
@@ -175,6 +172,7 @@ files:
175
172
  - lib/veye/package.rb
176
173
  - lib/veye/package/follow.rb
177
174
  - lib/veye/package/info.rb
175
+ - lib/veye/package/references.rb
178
176
  - lib/veye/package/search.rb
179
177
  - lib/veye/pagination.rb
180
178
  - lib/veye/pagination/pagination_csv.rb
@@ -212,6 +210,10 @@ files:
212
210
  - lib/veye/views/package/info_json.rb
213
211
  - lib/veye/views/package/info_pretty.rb
214
212
  - lib/veye/views/package/info_table.rb
213
+ - lib/veye/views/package/references_csv.rb
214
+ - lib/veye/views/package/references_json.rb
215
+ - lib/veye/views/package/references_pretty.rb
216
+ - lib/veye/views/package/references_table.rb
215
217
  - lib/veye/views/package/search_csv.rb
216
218
  - lib/veye/views/package/search_json.rb
217
219
  - lib/veye/views/package/search_pretty.rb
@@ -244,18 +246,12 @@ files:
244
246
  - test/files/Gemfile
245
247
  - test/files/maven-1.0.1.pom.xml
246
248
  - test/test_helper.rb
247
- - veye.rdoc
248
249
  homepage: https://github.com/versioneye/veye
249
250
  licenses:
250
251
  - MIT
251
252
  metadata: {}
252
253
  post_install_message: 'Thanks for installing! To get more info, use: veye help'
253
- rdoc_options:
254
- - "--title"
255
- - veye
256
- - "--main"
257
- - README.rdoc
258
- - "-ri"
254
+ rdoc_options: []
259
255
  require_paths:
260
256
  - lib
261
257
  - lib
@@ -271,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
267
  version: '0'
272
268
  requirements: []
273
269
  rubyforge_project:
274
- rubygems_version: 2.2.2
270
+ rubygems_version: 2.4.3
275
271
  signing_key:
276
272
  specification_version: 4
277
273
  summary: Commandline tool for VersionEye
data/README.rdoc DELETED
@@ -1,6 +0,0 @@
1
- = veye
2
-
3
- Describe your project here
4
-
5
- :include:veye.rdoc
6
-
data/veye.rdoc DELETED
@@ -1,5 +0,0 @@
1
- = veye
2
-
3
- Generate this with
4
- veye rdoc
5
- After you have described your command line interface