veye 0.1.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +61 -55
- data/README.md +2 -1
- data/bin/veye +26 -15
- data/changelogs.md +13 -0
- data/lib/veye/api/package.rb +24 -22
- data/lib/veye/api/project.rb +1 -1
- data/lib/veye/base_executor.rb +56 -4
- data/lib/veye/helpers/format_helpers.rb +2 -2
- data/lib/veye/package/follow.rb +3 -3
- data/lib/veye/package/info.rb +2 -2
- data/lib/veye/package/references.rb +2 -2
- data/lib/veye/package/search.rb +3 -2
- data/lib/veye/pagination/pagination_pretty.rb +1 -1
- data/lib/veye/project/check.rb +62 -49
- data/lib/veye/project/license.rb +1 -1
- data/lib/veye/project.rb +26 -0
- data/lib/veye/settings.rb +50 -0
- data/lib/veye/version.rb +1 -1
- data/lib/veye/views/github/info_pretty.rb +1 -2
- data/lib/veye/views/github/search_pretty.rb +1 -1
- data/lib/veye/views/package/references_pretty.rb +2 -2
- data/lib/veye/views/project/dependency_csv.rb +32 -12
- data/lib/veye/views/project/dependency_json.rb +6 -2
- data/lib/veye/views/project/dependency_pretty.rb +15 -7
- data/lib/veye/views/project/dependency_table.rb +6 -4
- data/lib/veye/views/project/info_pretty.rb +1 -1
- data/lib/veye/views/project/info_table.rb +4 -3
- data/lib/veye.rb +9 -8
- data/results.html +0 -0
- data/test/api/github_test.rb +1 -1
- data/test/api/package_test.rb +6 -5
- data/test/api/project_test.rb +1 -1
- data/test/api/user_test.rb +1 -1
- data/test/files/Testfile +0 -0
- data/test/fixtures/vcr_cassettes/github_delete.yml +7 -9
- data/test/fixtures/vcr_cassettes/github_info.yml +10 -12
- data/test/fixtures/vcr_cassettes/github_list.yml +43 -44
- data/test/fixtures/vcr_cassettes/github_sync.yml +7 -9
- data/test/fixtures/vcr_cassettes/package_follow.yml +9 -11
- data/test/fixtures/vcr_cassettes/package_follow_status.yml +7 -9
- data/test/fixtures/vcr_cassettes/package_info.yml +17 -18
- data/test/fixtures/vcr_cassettes/package_reference.yml +9 -11
- data/test/fixtures/vcr_cassettes/package_search.yml +8 -10
- data/test/fixtures/vcr_cassettes/package_unfollow.yml +7 -9
- data/test/fixtures/vcr_cassettes/project_check_new.yml +161 -0
- data/test/fixtures/vcr_cassettes/project_check_update.yml +162 -0
- data/test/fixtures/vcr_cassettes/project_delete.yml +6 -8
- data/test/fixtures/vcr_cassettes/project_get.yml +10 -12
- data/test/fixtures/vcr_cassettes/project_license.yml +12 -13
- data/test/fixtures/vcr_cassettes/project_list.yml +11 -11
- data/test/fixtures/vcr_cassettes/project_update.yml +14 -16
- data/test/fixtures/vcr_cassettes/project_upload.yml +13 -15
- data/test/fixtures/vcr_cassettes/user_get_favorites.yml +10 -12
- data/test/fixtures/vcr_cassettes/user_get_profile.yml +9 -11
- data/test/github_delete_test.rb +2 -2
- data/test/github_import_test.rb +1 -1
- data/test/github_info_test.rb +10 -6
- data/test/github_list_test.rb +20 -14
- data/test/github_sync_test.rb +1 -1
- data/test/package_follow_test.rb +4 -4
- data/test/package_info_test.rb +14 -11
- data/test/package_reference_test.rb +21 -16
- data/test/package_search_test.rb +11 -10
- data/test/project_check_test.rb +75 -41
- data/test/project_license_test.rb +14 -25
- data/test/user_me_test.rb +13 -13
- data/veye.gemspec +14 -14
- metadata +51 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c6d015ec997e45e2e4a94f7f7a7525165820f89
|
4
|
+
data.tar.gz: f50049bdfd288dc94b0917b5ebff5c2fd0f85b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d61e89da5274ffccfa4423baecae93f7fe0c9ed5db0d5348d082b3542e98cb87ddb6a3a97dbda076a0f38d0d210345fbff7620e981e532388bb76c49bd29f13
|
7
|
+
data.tar.gz: 962c3c1ed75f123ca1fc9d641d40973c9255e6931e768771950ad13f68513cfd559d6642b9d5fc4374f19ad82cce38b62776a6bf899a0201d7e30d451460fea7
|
data/Gemfile.lock
CHANGED
@@ -1,109 +1,115 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
veye (0.
|
5
|
-
awesome_print (
|
6
|
-
contracts (
|
7
|
-
gli (
|
8
|
-
rainbow (
|
9
|
-
render-as-markdown
|
10
|
-
rest-client (
|
11
|
-
terminal-table (
|
4
|
+
veye (0.2)
|
5
|
+
awesome_print (~> 1.6)
|
6
|
+
contracts (~> 0.13)
|
7
|
+
gli (= 2.13.4)
|
8
|
+
rainbow (~> 2.0)
|
9
|
+
render-as-markdown (~> 0)
|
10
|
+
rest-client (~> 1.8)
|
11
|
+
terminal-table (~> 1.4)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
addressable (2.
|
16
|
+
addressable (2.4.0)
|
17
17
|
ansi (1.5.0)
|
18
|
-
aruba (0.
|
19
|
-
childprocess (
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
aruba (0.14.0)
|
19
|
+
childprocess (~> 0.5.6)
|
20
|
+
contracts (~> 0.9)
|
21
|
+
cucumber (>= 1.3.19)
|
22
|
+
ffi (~> 1.9.10)
|
23
|
+
rspec-expectations (>= 2.99)
|
24
|
+
thor (~> 0.19)
|
25
|
+
ast (2.2.0)
|
25
26
|
awesome_print (1.6.1)
|
26
27
|
builder (3.2.2)
|
27
|
-
childprocess (0.5.
|
28
|
+
childprocess (0.5.9)
|
28
29
|
ffi (~> 1.0, >= 1.0.11)
|
29
|
-
contracts (0.
|
30
|
-
crack (0.4.
|
30
|
+
contracts (0.13.0)
|
31
|
+
crack (0.4.3)
|
31
32
|
safe_yaml (~> 1.0.0)
|
32
|
-
cucumber (2.
|
33
|
+
cucumber (2.3.2)
|
33
34
|
builder (>= 2.1.2)
|
34
|
-
cucumber-core (~> 1.
|
35
|
+
cucumber-core (~> 1.4.0)
|
36
|
+
cucumber-wire (~> 0.0.1)
|
35
37
|
diff-lcs (>= 1.1.3)
|
36
|
-
gherkin (~> 2.
|
38
|
+
gherkin (~> 3.2.0)
|
37
39
|
multi_json (>= 1.7.5, < 2.0)
|
38
40
|
multi_test (>= 0.1.2)
|
39
|
-
cucumber-core (1.
|
40
|
-
gherkin (~> 2.
|
41
|
+
cucumber-core (1.4.0)
|
42
|
+
gherkin (~> 3.2.0)
|
43
|
+
cucumber-wire (0.0.1)
|
41
44
|
diff-lcs (1.2.5)
|
42
|
-
domain_name (0.5.
|
45
|
+
domain_name (0.5.20160309)
|
43
46
|
unf (>= 0.0.5, < 1.0.0)
|
44
47
|
ffi (1.9.10)
|
45
|
-
gherkin (2.
|
46
|
-
|
47
|
-
|
48
|
+
gherkin (3.2.0)
|
49
|
+
gli (2.13.4)
|
50
|
+
hashdiff (0.3.0)
|
48
51
|
http-cookie (1.0.2)
|
49
52
|
domain_name (~> 0.5)
|
50
53
|
json (1.8.3)
|
51
|
-
mime-types (2.
|
52
|
-
minitest (5.
|
53
|
-
minitest-reporters (1.
|
54
|
+
mime-types (2.99.1)
|
55
|
+
minitest (5.8.4)
|
56
|
+
minitest-reporters (1.1.8)
|
54
57
|
ansi
|
55
58
|
builder
|
56
59
|
minitest (>= 5.0)
|
57
60
|
ruby-progressbar
|
58
|
-
multi_json (1.11.
|
61
|
+
multi_json (1.11.2)
|
59
62
|
multi_test (0.1.2)
|
60
|
-
netrc (0.
|
61
|
-
parser (2.
|
62
|
-
ast (
|
63
|
+
netrc (0.11.0)
|
64
|
+
parser (2.3.0.6)
|
65
|
+
ast (~> 2.2)
|
63
66
|
powerpack (0.1.1)
|
64
|
-
rainbow (2.
|
65
|
-
rake (
|
66
|
-
rdoc (4.2.
|
67
|
+
rainbow (2.1.0)
|
68
|
+
rake (11.1.0)
|
69
|
+
rdoc (4.2.2)
|
67
70
|
json (~> 1.4)
|
68
71
|
render-as-markdown (0.0.6)
|
69
72
|
rest-client (1.8.0)
|
70
73
|
http-cookie (>= 1.0.2, < 2.0)
|
71
74
|
mime-types (>= 1.16, < 3.0)
|
72
75
|
netrc (~> 0.7)
|
73
|
-
rspec-expectations (3.
|
76
|
+
rspec-expectations (3.4.0)
|
74
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
-
rspec-support (~> 3.
|
76
|
-
rspec-support (3.
|
77
|
-
rubocop (0.
|
78
|
-
|
79
|
-
parser (>= 2.2.2.5, < 3.0)
|
78
|
+
rspec-support (~> 3.4.0)
|
79
|
+
rspec-support (3.4.1)
|
80
|
+
rubocop (0.38.0)
|
81
|
+
parser (>= 2.3.0.6, < 3.0)
|
80
82
|
powerpack (~> 0.1)
|
81
83
|
rainbow (>= 1.99.1, < 3.0)
|
82
|
-
ruby-progressbar (~> 1.
|
84
|
+
ruby-progressbar (~> 1.7)
|
85
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
83
86
|
ruby-progressbar (1.7.5)
|
84
87
|
safe_yaml (1.0.4)
|
85
88
|
terminal-table (1.5.2)
|
89
|
+
thor (0.19.1)
|
86
90
|
unf (0.1.4)
|
87
91
|
unf_ext
|
88
|
-
unf_ext (0.0.7.
|
89
|
-
|
90
|
-
|
92
|
+
unf_ext (0.0.7.2)
|
93
|
+
unicode-display_width (1.0.2)
|
94
|
+
vcr (3.0.1)
|
95
|
+
webmock (1.24.2)
|
91
96
|
addressable (>= 2.3.6)
|
92
97
|
crack (>= 0.3.2)
|
98
|
+
hashdiff
|
93
99
|
|
94
100
|
PLATFORMS
|
95
101
|
ruby
|
96
102
|
|
97
103
|
DEPENDENCIES
|
98
|
-
aruba (
|
99
|
-
minitest (
|
100
|
-
minitest-reporters (
|
101
|
-
rake (
|
104
|
+
aruba (~> 0.14)
|
105
|
+
minitest (~> 5.8)
|
106
|
+
minitest-reporters (~> 1.0)
|
107
|
+
rake (~> 11.1)
|
102
108
|
rdoc (~> 4.2)
|
103
|
-
rubocop (
|
104
|
-
vcr (
|
109
|
+
rubocop (~> 0.38)
|
110
|
+
vcr (~> 3.0.1)
|
105
111
|
veye!
|
106
|
-
webmock (
|
112
|
+
webmock (~> 1.11)
|
107
113
|
|
108
114
|
BUNDLED WITH
|
109
115
|
1.10.5
|
data/README.md
CHANGED
@@ -193,7 +193,8 @@ All contributions are welcome - comments, new ideas, help with documentation & h
|
|
193
193
|
|
194
194
|
|
195
195
|
```
|
196
|
-
$>
|
196
|
+
$> rm test/fixtures/vcr_cassettes/* #if needed
|
197
|
+
$> VEYE_API_KEY=<YOUR_API_KEY> rake test
|
197
198
|
$> rake test TEST=test/file_you_changed.rb
|
198
199
|
```
|
199
200
|
|
data/bin/veye
CHANGED
@@ -16,7 +16,7 @@ program_long_desc Rainbow(Veye::BIGEYE).green
|
|
16
16
|
wrap_help_text :verbatim
|
17
17
|
version Veye::VERSION
|
18
18
|
|
19
|
-
COMMANDS_WITHOUT_API_KEY = [:help, :ping
|
19
|
+
COMMANDS_WITHOUT_API_KEY = [:help, :ping]
|
20
20
|
|
21
21
|
config_file '.veye.rc'
|
22
22
|
|
@@ -93,8 +93,9 @@ command :search do |c|
|
|
93
93
|
c.action do |global_options, options, args|
|
94
94
|
error_msg = "the search term is mandatory.".color(:red)
|
95
95
|
help_now!(error_msg) if args.empty?
|
96
|
+
api_key = global_options[:api_key]
|
96
97
|
search_term = args.shift
|
97
|
-
Veye::Package::Search.search(search_term, options)
|
98
|
+
Veye::Package::Search.search(api_key, search_term, options)
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
@@ -107,8 +108,9 @@ command :info do |c|
|
|
107
108
|
c.action do |global_options, options, args|
|
108
109
|
error_msg = Rainbow("package_key is missing").red
|
109
110
|
help_now!(error_msg) if args.empty?
|
111
|
+
api_key = global_options[:api_key]
|
110
112
|
package_key = args.shift
|
111
|
-
Veye::Package::Info.get_package(package_key, options)
|
113
|
+
Veye::Package::Info.get_package(api_key, package_key, options)
|
112
114
|
end
|
113
115
|
end
|
114
116
|
|
@@ -130,7 +132,9 @@ command :references do |c|
|
|
130
132
|
error_msg = Rainbow("package_key is missing").red
|
131
133
|
help_now!(error_msg) if args.empty?
|
132
134
|
package_key = args.shift
|
133
|
-
|
135
|
+
|
136
|
+
api_key = global_options[:api_key]
|
137
|
+
Veye::Package::References.get_references(api_key, package_key, options)
|
134
138
|
end
|
135
139
|
end
|
136
140
|
|
@@ -143,10 +147,17 @@ command :check do |c|
|
|
143
147
|
c.flag [:format, 'format-name'], :default_value => 'pretty'
|
144
148
|
|
145
149
|
c.action do |global_options, options, args|
|
146
|
-
|
147
|
-
|
150
|
+
file_path = args.shift
|
151
|
+
file_path ||= Dir.pwd
|
152
|
+
|
148
153
|
api_key = global_options[:api_key]
|
149
|
-
Veye::Project
|
154
|
+
files = Veye::Project.get_files(file_path)
|
155
|
+
|
156
|
+
if files.empty?
|
157
|
+
printf "Found no project files in: ".color(:red) + file_path + "\n"
|
158
|
+
else
|
159
|
+
Veye::Project::Check.check(file_path, files, api_key, options)
|
160
|
+
end
|
150
161
|
end
|
151
162
|
end
|
152
163
|
|
@@ -176,7 +187,7 @@ command :projects do |c|
|
|
176
187
|
proj_key = args.shift
|
177
188
|
api_key = global_options[:api_key]
|
178
189
|
|
179
|
-
Veye::Project::Check.get_project(
|
190
|
+
Veye::Project::Check.get_project(api_key, proj_key, options)
|
180
191
|
end
|
181
192
|
end
|
182
193
|
|
@@ -187,7 +198,7 @@ command :projects do |c|
|
|
187
198
|
help_now!("The filepath is missing.".color(:red)) if args.empty?
|
188
199
|
filename = args.shift
|
189
200
|
api_key = global_options[:api_key]
|
190
|
-
Veye::Project::Check.upload(
|
201
|
+
Veye::Project::Check.upload(api_key, filename, options)
|
191
202
|
end
|
192
203
|
end
|
193
204
|
|
@@ -200,7 +211,7 @@ command :projects do |c|
|
|
200
211
|
|
201
212
|
project_key, filename = args
|
202
213
|
api_key = global_options[:api_key]
|
203
|
-
Veye::Project::Check.update(project_key, filename,
|
214
|
+
Veye::Project::Check.update(api_key, project_key, filename, options)
|
204
215
|
end
|
205
216
|
end
|
206
217
|
|
@@ -211,7 +222,7 @@ command :projects do |c|
|
|
211
222
|
help_now!("Project's key is unspecified".color(:red)) if args.empty?
|
212
223
|
proj_key = args.shift
|
213
224
|
api_key = global_options[:api_key]
|
214
|
-
Veye::Project::License.get_licenses(
|
225
|
+
Veye::Project::License.get_licenses(api_key, proj_key, options)
|
215
226
|
end
|
216
227
|
end
|
217
228
|
|
@@ -222,7 +233,7 @@ command :projects do |c|
|
|
222
233
|
help_now!("Project is missing".color(:red)) if args.empty?
|
223
234
|
proj_key = args.shift
|
224
235
|
api_key = global_options[:api_key]
|
225
|
-
Veye::Project::Check.delete_project(
|
236
|
+
Veye::Project::Check.delete_project(api_key, proj_key)
|
226
237
|
end
|
227
238
|
end
|
228
239
|
end
|
@@ -239,7 +250,7 @@ command :products do |c|
|
|
239
250
|
help_now!("Product's key is missing".color(:red)) if args.empty?
|
240
251
|
prod_key = args.shift
|
241
252
|
api_key = global_options[:api_key]
|
242
|
-
Veye::Package::Follow.get_follow_status(
|
253
|
+
Veye::Package::Follow.get_follow_status(api_key, prod_key)
|
243
254
|
end
|
244
255
|
end
|
245
256
|
|
@@ -250,7 +261,7 @@ command :products do |c|
|
|
250
261
|
help_now!("Product's key is missing".color(:red)) if args.empty?
|
251
262
|
prod_key = args.shift
|
252
263
|
api_key = global_options[:api_key]
|
253
|
-
Veye::Package::Follow.follow(
|
264
|
+
Veye::Package::Follow.follow(api_key, prod_key)
|
254
265
|
end
|
255
266
|
end
|
256
267
|
|
@@ -261,7 +272,7 @@ command :products do |c|
|
|
261
272
|
help_now!("Product's key is missing".color(:red)) if args.empty?
|
262
273
|
prod_key = args.shift
|
263
274
|
api_key = global_options[:api_key]
|
264
|
-
Veye::Package::Follow.unfollow(
|
275
|
+
Veye::Package::Follow.unfollow(api_key, prod_key)
|
265
276
|
end
|
266
277
|
end
|
267
278
|
end
|
data/changelogs.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelogs
|
2
2
|
|
3
|
+
## 0.2
|
4
|
+
|
5
|
+
* fixed dependency sorting - it show outdated dependencies first;
|
6
|
+
* fixed projects which used old API project_key;
|
7
|
+
* fixed parameter inconsistencies for `check`, `licenses` commands;
|
8
|
+
* updated dependencies;
|
9
|
+
* add api_keys for packages api;
|
10
|
+
* breaking changes in `check` command - it tracks all supported project files in the folder
|
11
|
+
* add `veye.json` file to keep and manage a project specific configurations
|
12
|
+
* fixed licenses field in project output
|
13
|
+
* add Settings class to manage `veye.json` file
|
14
|
+
|
15
|
+
|
3
16
|
## 0.1
|
4
17
|
|
5
18
|
* first stable release - no new functionalities
|
data/lib/veye/api/package.rb
CHANGED
@@ -17,79 +17,81 @@ module Veye
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# returns package information
|
20
|
-
def self.get_package(prod_key, language)
|
20
|
+
def self.get_package(api_key, prod_key, language)
|
21
21
|
lang = encode_language(language)
|
22
22
|
safe_prod_key = encode_prod_key(prod_key)
|
23
|
+
qparams = {}
|
24
|
+
qparams[:api_key] = api_key if api_key.to_s.size > 0
|
23
25
|
product_api = Resource.new "#{RESOURCE_PATH}/#{lang}/#{safe_prod_key}"
|
24
|
-
product_api.resource.get do |response, request, result|
|
26
|
+
product_api.resource.get({params: qparams}) do |response, request, result|
|
25
27
|
JSONResponse.new(request, result, response)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
def self.search(search_term, language = nil, group_id = nil, page = '1')
|
31
|
+
def self.search(api_key, search_term, language = nil, group_id = nil, page = '1')
|
30
32
|
search_api = Resource.new "#{RESOURCE_PATH}/search/#{search_term}"
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
qparams = { q: search_term.to_s }
|
35
|
+
qparams[:lang] = encode_language(language) unless language.nil?
|
36
|
+
qparams[:g] = group_id unless group_id.nil?
|
35
37
|
if page.nil?
|
36
|
-
|
38
|
+
qparams[:page] = '1'
|
37
39
|
else
|
38
|
-
|
40
|
+
qparams[:page] = page.to_s
|
39
41
|
end
|
40
42
|
|
41
|
-
|
42
|
-
search_api.resource.get(
|
43
|
+
qparams[:api_key] = api_key if api_key.to_s.size > 0
|
44
|
+
search_api.resource.get({params: qparams}) do |response, request, result|
|
43
45
|
JSONResponse.new(request, result, response)
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def self.get_follow_status(api_key, prod_key, language)
|
48
50
|
product_api = Resource.new(RESOURCE_PATH)
|
49
|
-
qparams = {
|
51
|
+
qparams = {api_key: api_key}
|
50
52
|
lang = encode_language(language)
|
51
53
|
safe_prod_key = encode_prod_key(prod_key)
|
52
|
-
|
53
54
|
path = "#{lang}/#{safe_prod_key}/follow.json"
|
54
|
-
product_api.resource[path].get(qparams) do |response, request, result|
|
55
|
+
product_api.resource[path].get({params: qparams}) do |response, request, result|
|
55
56
|
Veye::API::JSONResponse.new(request, result, response)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
59
60
|
def self.follow(api_key, prod_key, language)
|
60
61
|
api = Resource.new(RESOURCE_PATH)
|
61
|
-
qparams = { api_key: api_key }
|
62
62
|
lang = encode_language(language)
|
63
63
|
safe_prod_key = encode_prod_key(prod_key)
|
64
64
|
|
65
|
-
path = "/#{lang}/#{safe_prod_key}/follow.json"
|
66
|
-
api.resource[path].post(
|
65
|
+
path = "/#{lang}/#{safe_prod_key}/follow.json?api_key=#{api_key}"
|
66
|
+
api.resource[path].post({}) do |response, request, result|
|
67
67
|
JSONResponse.new(request, result, response)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.unfollow(api_key, prod_key, language)
|
72
72
|
api = Resource.new(RESOURCE_PATH)
|
73
|
-
qparams = {
|
73
|
+
qparams = {api_key: api_key}
|
74
74
|
lang = encode_language(language)
|
75
75
|
safe_prod_key = encode_prod_key(prod_key)
|
76
76
|
|
77
77
|
path = "/#{lang}/#{safe_prod_key}/follow.json"
|
78
|
-
api.resource[path].delete(qparams) do |response, request, result|
|
78
|
+
api.resource[path].delete({params: qparams}) do |response, request, result|
|
79
79
|
JSONResponse.new(request, result, response)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
def self.get_references(prod_key, language, page = nil)
|
83
|
+
def self.get_references(api_key, prod_key, language, page = nil)
|
84
84
|
api = Resource.new(RESOURCE_PATH)
|
85
85
|
lang = encode_language(language).capitalize # endpoint bug
|
86
86
|
safe_prod_key = encode_prod_key(prod_key)
|
87
|
-
|
87
|
+
|
88
88
|
api_path = "/#{lang}/#{safe_prod_key}/references"
|
89
89
|
page_nr = page.to_s unless page.nil?
|
90
90
|
page_nr ||= 1
|
91
|
-
|
92
|
-
|
91
|
+
|
92
|
+
qparams = {page: page_nr}
|
93
|
+
qparams[:api_key] = api_key if api_key.to_s.size > 0
|
94
|
+
api.resource[api_path].get({params: qparams}) do |response, request, result|
|
93
95
|
JSONResponse.new(request, result, response)
|
94
96
|
end
|
95
97
|
end
|
data/lib/veye/api/project.rb
CHANGED
data/lib/veye/base_executor.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
require_relative 'helpers/format_helpers'
|
2
|
+
|
1
3
|
# Base class that will bring many helpers into command classes.
|
2
4
|
class BaseExecutor
|
3
5
|
extend FormatHelpers
|
4
6
|
|
5
7
|
def self.show_results(output_formats, results, options = {}, paging = nil)
|
6
|
-
|
7
|
-
|
8
|
-
formatter = output_formats[format]
|
8
|
+
formatter = get_formatter(output_formats, options)
|
9
|
+
return if formatter.nil?
|
9
10
|
|
10
11
|
formatter.before
|
11
12
|
formatter.format(results)
|
@@ -14,7 +15,7 @@ class BaseExecutor
|
|
14
15
|
|
15
16
|
def self.valid_response?(response, msg)
|
16
17
|
if response.nil? || response.success != true
|
17
|
-
|
18
|
+
printf "#{msg.to_s.color(:red)}: #{response.data}\n"
|
18
19
|
return false
|
19
20
|
end
|
20
21
|
|
@@ -25,4 +26,55 @@ class BaseExecutor
|
|
25
26
|
def self.catch_request_error(response, msg)
|
26
27
|
valid_response?(response, msg)
|
27
28
|
end
|
29
|
+
|
30
|
+
def self.filter_dependencies(results, options)
|
31
|
+
|
32
|
+
if options[:all]
|
33
|
+
results['dependencies'].to_a.sort_by {|x| x['outdated'] ? -1 : 0}
|
34
|
+
else
|
35
|
+
results['dependencies'].to_a.keep_if {|x| x['outdated']}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.show_dependencies(output_formats, results, options)
|
40
|
+
formatter = get_formatter(output_formats, options)
|
41
|
+
return if formatter.nil?
|
42
|
+
|
43
|
+
deps = filter_dependencies(results, options)
|
44
|
+
|
45
|
+
formatter.before
|
46
|
+
formatter.format deps
|
47
|
+
formatter.after
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.show_bulk_dependencies(output_formats, results, options)
|
51
|
+
formatter = get_formatter(output_formats, options)
|
52
|
+
return if formatter.nil?
|
53
|
+
|
54
|
+
formatter.before
|
55
|
+
results.each do |filename, deps|
|
56
|
+
formatter.format filter_dependencies(deps, options), filename
|
57
|
+
end
|
58
|
+
|
59
|
+
formatter.after
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.show_message(results, success_msg, fail_msg)
|
63
|
+
if results.success
|
64
|
+
printf "#{success_msg}\n".color(:green)
|
65
|
+
else
|
66
|
+
printf("Error: %s\n%s\n",
|
67
|
+
fail_msg.color(:red),
|
68
|
+
response.data['error'])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.get_formatter(output_formats, options)
|
73
|
+
format = options[:format]
|
74
|
+
format ||= 'pretty'
|
75
|
+
#return if format == 'json' #dependecy json format is handled by results formatter
|
76
|
+
output_formats[format] if supported_format?(output_formats, format)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
28
80
|
end
|
@@ -9,7 +9,7 @@ module FormatHelpers
|
|
9
9
|
|
10
10
|
def formats_attached?(output_formats)
|
11
11
|
if output_formats.nil?
|
12
|
-
|
12
|
+
printf 'Executor doesnt have any formattor defined.\n'.color(:red)
|
13
13
|
end
|
14
14
|
!output_formats.nil?
|
15
15
|
end
|
@@ -18,7 +18,7 @@ module FormatHelpers
|
|
18
18
|
unless output_formats.key?(format)
|
19
19
|
msg = "Unsupported output format: `#{format}`\n".color(:red)
|
20
20
|
msg += "Supported formats: #{output_formats.keys.join(', ')}\n"
|
21
|
-
|
21
|
+
printf msg
|
22
22
|
return false
|
23
23
|
end
|
24
24
|
true
|
data/lib/veye/package/follow.rb
CHANGED
@@ -14,7 +14,7 @@ module Veye
|
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.get_follow_status(
|
17
|
+
def self.get_follow_status(api_key, package_key)
|
18
18
|
prod_key, lang = Package.parse_key(package_key)
|
19
19
|
results = Veye::API::Package.get_follow_status(api_key, prod_key, lang)
|
20
20
|
if valid_response?(results, 'Didnt get any response.')
|
@@ -22,7 +22,7 @@ module Veye
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.follow(
|
25
|
+
def self.follow(api_key, package_key)
|
26
26
|
prod_key, lang = Package.parse_key(package_key)
|
27
27
|
results = Veye::API::Package.follow(api_key, prod_key, lang)
|
28
28
|
if valid_response?(results, 'Cant follow.')
|
@@ -30,7 +30,7 @@ module Veye
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.unfollow(
|
33
|
+
def self.unfollow(api_key, package_key)
|
34
34
|
prod_key, lang = Package.parse_key(package_key)
|
35
35
|
results = Veye::API::Package.unfollow(api_key, prod_key, lang)
|
36
36
|
if valid_response?(results, 'Cant unfollow.')
|
data/lib/veye/package/info.rb
CHANGED
@@ -12,9 +12,9 @@ module Veye
|
|
12
12
|
'table' => Package::InfoTable.new
|
13
13
|
}
|
14
14
|
|
15
|
-
def self.get_package(package_key, options = {})
|
15
|
+
def self.get_package(api_key, package_key, options = {})
|
16
16
|
prod_key, lang = Package.parse_key(package_key)
|
17
|
-
results = Veye::API::Package.get_package(prod_key, lang)
|
17
|
+
results = Veye::API::Package.get_package(api_key, prod_key, lang)
|
18
18
|
err_msg = "Didnt find any package with product_key: `#{package_key}`"
|
19
19
|
if valid_response?(results, err_msg)
|
20
20
|
paging = results.data['paging']
|
@@ -12,10 +12,10 @@ module Veye
|
|
12
12
|
'table' => Package::ReferencesTable.new
|
13
13
|
}
|
14
14
|
|
15
|
-
def self.get_references(package_key, options = {})
|
15
|
+
def self.get_references(api_key, package_key, options = {})
|
16
16
|
prod_key, lang = Package.parse_key(package_key)
|
17
17
|
results = Veye::API::Package.get_references(
|
18
|
-
prod_key, lang, options[:page]
|
18
|
+
api_key, prod_key, lang, options[:page]
|
19
19
|
)
|
20
20
|
if valid_response?(results, "No references for: `#{package_key}`")
|
21
21
|
paging = results.data['paging']
|
data/lib/veye/package/search.rb
CHANGED
@@ -13,9 +13,10 @@ module Veye
|
|
13
13
|
'table' => Package::SearchTable.new
|
14
14
|
}
|
15
15
|
|
16
|
-
def self.search(search_term, options)
|
16
|
+
def self.search(api_key, search_term, options)
|
17
17
|
results = Veye::API::Package.search(
|
18
|
-
search_term, options[:language],
|
18
|
+
api_key, search_term, options[:language],
|
19
|
+
options['group-id'], options[:page]
|
19
20
|
)
|
20
21
|
if valid_response?(results, "No results for `#{search_term}`")
|
21
22
|
show_results(@output_formats,
|
@@ -9,7 +9,7 @@ module Veye
|
|
9
9
|
|
10
10
|
def format(paging)
|
11
11
|
printf("\t%15s - %s\n",
|
12
|
-
"Current page".color(:green)
|
12
|
+
"Current page".color(:green),
|
13
13
|
"#{paging['current_page']}".bright)
|
14
14
|
puts "\t-------------------------"
|
15
15
|
printf("\t%-15s: %s\n", "Per page", paging['per_page'])
|