veye 0.0.6 → 0.0.7
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.
- data/Gemfile.lock +16 -16
- data/README.md +66 -0
- data/bin/veye +140 -186
- data/lib/veye/base_executor.rb +24 -0
- data/lib/veye/github/delete.rb +35 -0
- data/lib/veye/github/import.rb +32 -0
- data/lib/veye/github/info.rb +30 -0
- data/lib/veye/github/list.rb +37 -0
- data/lib/veye/github/search.rb +34 -0
- data/lib/veye/github/sync.rb +33 -0
- data/lib/veye/github.rb +14 -0
- data/lib/veye/helpers/format_helpers.rb +4 -1
- data/lib/veye/helpers/repo_helpers.rb +5 -0
- data/lib/veye/package/follow.rb +37 -22
- data/lib/veye/package/info.rb +17 -27
- data/lib/veye/package/search.rb +29 -40
- data/lib/veye/project/check.rb +80 -74
- data/lib/veye/project/licence.rb +17 -31
- data/lib/veye/service.rb +16 -4
- data/lib/veye/user/me.rb +25 -45
- data/lib/veye/version.rb +1 -1
- data/lib/veye/views/base_csv.rb +26 -0
- data/lib/veye/views/base_json.rb +20 -0
- data/lib/veye/views/base_markdown.rb +17 -0
- data/lib/veye/views/base_pretty.rb +17 -0
- data/lib/veye/views/base_table.rb +34 -0
- data/lib/veye/views/github/info_csv.rb +30 -0
- data/lib/veye/views/github/info_json.rb +11 -0
- data/lib/veye/views/github/info_pretty.rb +35 -0
- data/lib/veye/views/github/info_table.rb +36 -0
- data/lib/veye/views/github/list_csv.rb +28 -0
- data/lib/veye/views/github/list_json.rb +16 -0
- data/lib/veye/views/github/list_pretty.rb +27 -0
- data/lib/veye/views/github/list_table.rb +28 -0
- data/lib/veye/views/github/search_csv.rb +36 -0
- data/lib/veye/views/github/search_json.rb +12 -0
- data/lib/veye/views/github/search_pretty.rb +31 -0
- data/lib/veye/views/github/search_table.rb +34 -0
- data/lib/veye/views/github.rb +19 -0
- data/lib/veye/{package → views/package}/info_csv.rb +7 -6
- data/lib/veye/views/package/info_json.rb +12 -0
- data/lib/veye/{package → views/package}/info_pretty.rb +8 -10
- data/lib/veye/views/package/info_table.rb +25 -0
- data/lib/veye/views/package/search_csv.rb +28 -0
- data/lib/veye/views/package/search_json.rb +11 -0
- data/lib/veye/views/package/search_pretty.rb +26 -0
- data/lib/veye/views/package/search_table.rb +25 -0
- data/lib/veye/views/package.rb +14 -0
- data/lib/veye/views/project/dependency_csv.rb +30 -0
- data/lib/veye/views/project/dependency_json.rb +11 -0
- data/lib/veye/views/project/dependency_markdown.rb +31 -0
- data/lib/veye/{project/project_dependency_pretty.rb → views/project/dependency_pretty.rb} +5 -7
- data/lib/veye/{project/project_dependency_table.rb → views/project/dependency_table.rb} +6 -15
- data/lib/veye/{project/project_csv.rb → views/project/info_csv.rb} +7 -7
- data/lib/veye/views/project/info_json.rb +12 -0
- data/lib/veye/{project/project_markdown.rb → views/project/info_markdown.rb} +8 -14
- data/lib/veye/{project/project_pretty.rb → views/project/info_pretty.rb} +3 -4
- data/lib/veye/views/project/info_table.rb +24 -0
- data/lib/veye/{project/project_licence_csv.rb → views/project/licence_csv.rb} +7 -5
- data/lib/veye/views/project/licence_json.rb +11 -0
- data/lib/veye/{project/project_licence_pretty.rb → views/project/licence_pretty.rb} +4 -6
- data/lib/veye/views/project/licence_table.rb +24 -0
- data/lib/veye/views/project.rb +22 -0
- data/lib/veye/views/user/favorite_csv.rb +32 -0
- data/lib/veye/views/user/favorite_json.rb +13 -0
- data/lib/veye/views/user/favorite_pretty.rb +23 -0
- data/lib/veye/views/user/favorite_table.rb +24 -0
- data/lib/veye/views/user/profile_csv.rb +23 -0
- data/lib/veye/views/user/profile_json.rb +12 -0
- data/lib/veye/{user → views/user}/profile_pretty.rb +6 -10
- data/lib/veye/views/user/profile_table.rb +30 -0
- data/lib/veye/views/user.rb +14 -0
- data/lib/veye.rb +3 -1
- metadata +90 -60
- data/lib/veye/package/info_json.rb +0 -14
- data/lib/veye/package/info_table.rb +0 -29
- data/lib/veye/package/search_csv.rb +0 -33
- data/lib/veye/package/search_json.rb +0 -19
- data/lib/veye/package/search_pretty.rb +0 -35
- data/lib/veye/package/search_table.rb +0 -40
- data/lib/veye/project/project_dependency_csv.rb +0 -30
- data/lib/veye/project/project_dependency_json.rb +0 -12
- data/lib/veye/project/project_dependency_markdown.rb +0 -47
- data/lib/veye/project/project_json.rb +0 -11
- data/lib/veye/project/project_licence_json.rb +0 -12
- data/lib/veye/project/project_licence_table.rb +0 -29
- data/lib/veye/project/project_table.rb +0 -30
- data/lib/veye/user/favorite_csv.rb +0 -28
- data/lib/veye/user/favorite_json.rb +0 -14
- data/lib/veye/user/favorite_pretty.rb +0 -25
- data/lib/veye/user/favorite_table.rb +0 -28
- data/lib/veye/user/profile_csv.rb +0 -21
- data/lib/veye/user/profile_json.rb +0 -14
- data/lib/veye/user/profile_table.rb +0 -34
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
veye (0.0.
|
|
5
|
-
awesome_print (
|
|
6
|
-
gli (
|
|
7
|
-
rainbow
|
|
8
|
-
render-as-markdown (~> 0.0.
|
|
9
|
-
rest-client (
|
|
10
|
-
terminal-table (
|
|
4
|
+
veye (0.0.7)
|
|
5
|
+
awesome_print (~> 1.2.0)
|
|
6
|
+
gli (~> 2.8.1)
|
|
7
|
+
rainbow (~> 1.1.4)
|
|
8
|
+
render-as-markdown (~> 0.0.5)
|
|
9
|
+
rest-client (~> 1.6.7)
|
|
10
|
+
terminal-table (~> 1.4.5)
|
|
11
11
|
|
|
12
12
|
GEM
|
|
13
13
|
remote: https://rubygems.org/
|
|
@@ -27,19 +27,19 @@ GEM
|
|
|
27
27
|
multi_json (>= 1.7.5, < 2.0)
|
|
28
28
|
multi_test (>= 0.0.2)
|
|
29
29
|
diff-lcs (1.2.4)
|
|
30
|
-
ffi (1.9.
|
|
31
|
-
gherkin (2.12.
|
|
30
|
+
ffi (1.9.1)
|
|
31
|
+
gherkin (2.12.2)
|
|
32
32
|
multi_json (~> 1.3)
|
|
33
|
-
gli (2.8.
|
|
34
|
-
json (1.8.
|
|
33
|
+
gli (2.8.1)
|
|
34
|
+
json (1.8.1)
|
|
35
35
|
mime-types (1.25)
|
|
36
|
-
multi_json (1.8.
|
|
36
|
+
multi_json (1.8.2)
|
|
37
37
|
multi_test (0.0.2)
|
|
38
38
|
rainbow (1.1.4)
|
|
39
39
|
rake (10.1.0)
|
|
40
40
|
rdoc (4.0.1)
|
|
41
41
|
json (~> 1.4)
|
|
42
|
-
render-as-markdown (0.0.
|
|
42
|
+
render-as-markdown (0.0.5)
|
|
43
43
|
rest-client (1.6.7)
|
|
44
44
|
mime-types (>= 1.16)
|
|
45
45
|
rspec-expectations (2.14.3)
|
|
@@ -50,7 +50,7 @@ PLATFORMS
|
|
|
50
50
|
ruby
|
|
51
51
|
|
|
52
52
|
DEPENDENCIES
|
|
53
|
-
aruba
|
|
54
|
-
rake
|
|
55
|
-
rdoc
|
|
53
|
+
aruba (~> 0.5.3)
|
|
54
|
+
rake (~> 10.1.0)
|
|
55
|
+
rdoc (~> 4.0)
|
|
56
56
|
veye!
|
data/README.md
CHANGED
|
@@ -302,4 +302,70 @@ This command removes the specified project from your project's list.
|
|
|
302
302
|
```
|
|
303
303
|
$> veye me favorites
|
|
304
304
|
$> veye me favorites --page=2 --format=table
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Github
|
|
308
|
+
|
|
309
|
+
`Github` command includes subcommands to manage your Github repositories on VersionEye.
|
|
310
|
+
|
|
311
|
+
All subcommands expect that you had already connected your Github with your VersionEye account. Otherwise you'll get plain exception message.
|
|
312
|
+
|
|
313
|
+
##### Sync
|
|
314
|
+
|
|
315
|
+
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.
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
$> veye github sync
|
|
319
|
+
$> veye github sync --force
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
###### List
|
|
323
|
+
|
|
324
|
+
`list` commands shows paginated view of your repositories.
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
$> veye github list --format=table
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
###### Info
|
|
331
|
+
|
|
332
|
+
This command shows more detailed information.
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
$> veye github info versioneye/veye
|
|
336
|
+
$> veye github info versioneye/veye --format=table
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
###### Import
|
|
340
|
+
|
|
341
|
+
`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.
|
|
342
|
+
|
|
343
|
+
By default, it tries to read project file on master branch; you can use a `--branch` flag to specify the name of branch.
|
|
344
|
+
|
|
345
|
+
This command gives exception when you are trying to import already imported repository.
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
$> veye github import versioneye/veye
|
|
350
|
+
$> veye github import versioneye/veye --branch=dev
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
###### Delete
|
|
355
|
+
|
|
356
|
+
It removes imported project.
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
$> veye github delete versioneye/veye
|
|
360
|
+
$> veye github delete versioneye/veye --branch=dev
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
###### Search
|
|
364
|
+
|
|
365
|
+
This command makes authorized request to the Github search api for repositories. As authorized user, you can make up to *5000* request per hour.
|
|
366
|
+
|
|
367
|
+
```
|
|
368
|
+
$> veye github search versioneye
|
|
369
|
+
$> veye github search json --language=php --page=2 ;; filter results by language
|
|
370
|
+
$> veye github search veye --user versioneye ;; filter results by users
|
|
305
371
|
```
|
data/bin/veye
CHANGED
|
@@ -44,25 +44,16 @@ pre do |global_options, command, args|
|
|
|
44
44
|
check_config_file
|
|
45
45
|
$global_options = init_environment
|
|
46
46
|
$global_options.merge!(global_options)
|
|
47
|
-
needs_api_key = !
|
|
47
|
+
needs_api_key = !COMMANDS_WITHOUT_API_KEY.member?(command.name)
|
|
48
48
|
check_configs($global_options, needs_api_key)
|
|
49
49
|
$global_options[:url] = Veye::API::Resource.build_url($global_options)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
desc 'check service status'
|
|
53
53
|
command :ping do |c|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
puts "#{respond.data['message']}".foreground(:green)
|
|
58
|
-
else
|
|
59
|
-
printf(
|
|
60
|
-
"VersionEye didnt recognized secret word.Answered %s, %s\n",
|
|
61
|
-
respond.code.to_s.foreground(:red),
|
|
62
|
-
"#{respond.message}".foreground(:yellow)
|
|
63
|
-
)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
54
|
+
c.action do |global_options, options, args|
|
|
55
|
+
Veye::Service.ping
|
|
56
|
+
end
|
|
66
57
|
end
|
|
67
58
|
|
|
68
59
|
desc 'change the api key'
|
|
@@ -82,11 +73,11 @@ command :search do |c|
|
|
|
82
73
|
c.desc 'filter results by language'
|
|
83
74
|
c.flag [:l, :language, 'language-name']
|
|
84
75
|
|
|
85
|
-
c.desc 'filter result by
|
|
76
|
+
c.desc 'filter result by Maven specific GroupId'
|
|
86
77
|
c.flag "group-id"
|
|
87
78
|
|
|
88
79
|
c.desc "get next N results, by default it only return 30 results."
|
|
89
|
-
c.flag [:page, 'page-number']
|
|
80
|
+
c.flag [:page, 'page-number'], :default_value => 1
|
|
90
81
|
|
|
91
82
|
c.desc "change output format"
|
|
92
83
|
c.flag [:format,'format-name'], :default_value => "pretty"
|
|
@@ -98,26 +89,7 @@ command :search do |c|
|
|
|
98
89
|
c.action do |global_options, options, args|
|
|
99
90
|
help_now!("the search term is mandatory.".foreground(:red)) if args.empty?
|
|
100
91
|
search_term = args.shift
|
|
101
|
-
|
|
102
|
-
options[:language],
|
|
103
|
-
options["group-id"],
|
|
104
|
-
options[:page])
|
|
105
|
-
|
|
106
|
-
if response.success == false or response.data["results"].empty?
|
|
107
|
-
error_msg = sprintf(
|
|
108
|
-
"No results for `%s` %s",
|
|
109
|
-
"#{search_term}".foreground(:yellow),
|
|
110
|
-
(options[:language].nil?)? "" : " for language: #{options[:language]}"
|
|
111
|
-
)
|
|
112
|
-
exit_now!(error_msg)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
Veye::Package::Search.format(response.data["results"], options[:format])
|
|
116
|
-
if options[:pagination]
|
|
117
|
-
printf("\n#-- pagination data ------------------\n")
|
|
118
|
-
Veye::Pagination::Show.format response.data['paging'], options[:format]
|
|
119
|
-
end
|
|
120
|
-
|
|
92
|
+
Veye::Package::Search.search(search_term, options)
|
|
121
93
|
end
|
|
122
94
|
end
|
|
123
95
|
|
|
@@ -130,17 +102,7 @@ command :info do |c|
|
|
|
130
102
|
c.action do |global_options, options, args|
|
|
131
103
|
help_now!("package_key is missing".foreground(:red)) if args.empty?
|
|
132
104
|
package_key = args.shift
|
|
133
|
-
response = Veye::Package::Info.
|
|
134
|
-
|
|
135
|
-
unless response.success
|
|
136
|
-
error_msg = sprintf(
|
|
137
|
-
"Didnt find any package with product_key: `%s`",
|
|
138
|
-
"#{package_key}".foreground(:yellow)
|
|
139
|
-
)
|
|
140
|
-
exit_now!(error_msg)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
Veye::Package::Info.format(response.data, options[:format])
|
|
105
|
+
response = Veye::Package::Info.get_package(package_key, options)
|
|
144
106
|
end
|
|
145
107
|
end
|
|
146
108
|
|
|
@@ -150,23 +112,12 @@ arg_name 'product_file'
|
|
|
150
112
|
command :check do |c|
|
|
151
113
|
c.desc "change output format"
|
|
152
114
|
c.flag [:format, 'format-name'], :default_value => 'pretty'
|
|
153
|
-
|
|
115
|
+
|
|
154
116
|
c.action do |global_options, options, args|
|
|
155
|
-
help_now!("
|
|
117
|
+
help_now!("Project file is missing.".foreground(:red)) if args.empty?
|
|
156
118
|
file_name = args.shift
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
exit_now!("File upload failed.\n #{response.message}\n".foreground(:red))
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
if response.success
|
|
163
|
-
Veye::Project::Check.format_dependencies(
|
|
164
|
-
response.data['dependencies'],
|
|
165
|
-
options[:format]
|
|
166
|
-
)
|
|
167
|
-
else
|
|
168
|
-
exit_now!("Didnt get dependency info from API: #{response.message}")
|
|
169
|
-
end
|
|
119
|
+
api_key = global_options[:api_key]
|
|
120
|
+
response = Veye::Project::Check.upload(file_name, api_key, options)
|
|
170
121
|
end
|
|
171
122
|
end
|
|
172
123
|
|
|
@@ -176,19 +127,23 @@ arg_name 'subcommand'
|
|
|
176
127
|
command :projects do |c|
|
|
177
128
|
c.desc "change output format"
|
|
178
129
|
c.flag [:format, 'format-name'], :default_value => 'pretty'
|
|
179
|
-
|
|
130
|
+
|
|
180
131
|
c.desc "show all projects"
|
|
181
132
|
c.command :list do |list|
|
|
182
133
|
list.action do |global_options, options, args|
|
|
183
134
|
api_key = global_options[:api_key]
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
135
|
+
Veye::Project::Check.get_list(api_key, options)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
c.desc "show project info"
|
|
140
|
+
c.arg_name "project_key"
|
|
141
|
+
c.command :info do |info|
|
|
142
|
+
info.action do |global_options, options, args|
|
|
143
|
+
help_now!("Project_key is unspecified".foreground(:red)) if args.empty?
|
|
144
|
+
proj_key = args.shift
|
|
145
|
+
api_key = global_options[:api_key]
|
|
146
|
+
Veye::Project::Check.get_project(proj_key, api_key, options)
|
|
192
147
|
end
|
|
193
148
|
end
|
|
194
149
|
|
|
@@ -199,55 +154,20 @@ command :projects do |c|
|
|
|
199
154
|
help_now!("The filepath is missing.".foreground(:red)) if args.empty?
|
|
200
155
|
filename = args.shift
|
|
201
156
|
api_key = global_options[:api_key]
|
|
202
|
-
|
|
203
|
-
unless response.success
|
|
204
|
-
error_msg = "Uploading failed - #{response.message.foreground(:red)}"
|
|
205
|
-
exit_now! error_msg
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
Veye::Project::Check.format(response.data, options[:format])
|
|
209
|
-
Veye::Project::Check.format_dependencies(response.data['dependencies'], options[:format])
|
|
157
|
+
Veye::Project::Check.upload(filename, api_key, options)
|
|
210
158
|
end
|
|
211
159
|
end
|
|
212
|
-
|
|
160
|
+
|
|
213
161
|
c.desc "update existing project file"
|
|
214
162
|
c.arg_name "project_key_and_filepath", multiple: true
|
|
215
163
|
c.command :update do |update|
|
|
216
164
|
update.action do |global_options, options, args|
|
|
217
165
|
help_now!("The project key and the filepath are missing".foreground(:red)) if args.empty?
|
|
218
166
|
help_now!("One argument is missing: a project key or filepath".foreground(:red)) if args.count == 1
|
|
219
|
-
|
|
220
|
-
project_key, filename = args
|
|
221
|
-
api_key = global_options[:api_key]
|
|
222
|
-
|
|
223
|
-
response = Veye::Project::Check.update(project_key, filename, api_key)
|
|
224
|
-
unless response.success
|
|
225
|
-
error_msg = "Uploading failed - #{response.message.foreground(:red)}"
|
|
226
|
-
exit_now! error_msg
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
Veye::Project::Check.format(response.data, options[:format])
|
|
230
|
-
Veye::Project::Check.format_dependencies(response.data['dependencies'], options[:format])
|
|
231
|
-
end
|
|
232
|
-
end
|
|
233
167
|
|
|
234
|
-
|
|
235
|
-
c.arg_name "project_key"
|
|
236
|
-
c.command :show do |show|
|
|
237
|
-
show.action do |global_options, options, args|
|
|
238
|
-
help_now!("Project_key is unspecified".foreground(:red)) if args.empty?
|
|
239
|
-
proj_key = args.shift
|
|
168
|
+
project_key, filename = args
|
|
240
169
|
api_key = global_options[:api_key]
|
|
241
|
-
|
|
242
|
-
response = Veye::Project::Check.get_project(proj_key, api_key)
|
|
243
|
-
unless response.success
|
|
244
|
-
error_msg = "Cant read information about project: `#{proj_key}`"
|
|
245
|
-
error_msg += "- #{response.message}".foreground(:red)
|
|
246
|
-
exit_now! error_msg
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
Veye::Project::Check.format(response.data, options[:format])
|
|
250
|
-
Veye::Project::Check.format_dependencies(response.data['dependencies'], options[:format])
|
|
170
|
+
Veye::Project::Check.update(project_key, filename, api_key, options)
|
|
251
171
|
end
|
|
252
172
|
end
|
|
253
173
|
|
|
@@ -258,16 +178,7 @@ command :projects do |c|
|
|
|
258
178
|
help_now!("Project's key is unspecified".foreground(:red)) if args.empty?
|
|
259
179
|
proj_key = args.shift
|
|
260
180
|
api_key = global_options[:api_key]
|
|
261
|
-
|
|
262
|
-
response = Veye::Project::Licence.get_project(proj_key, api_key)
|
|
263
|
-
unless response.success
|
|
264
|
-
error_msg = sprintf("%s \n %s",
|
|
265
|
-
"Cant access a information for project `#{proj_key}`".foreground(:red),
|
|
266
|
-
"#{response.message}")
|
|
267
|
-
exit_now! error_msg
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
Veye::Project::Licence.format(response.data, options[:format])
|
|
181
|
+
Veye::Project::Licence.get_project(proj_key, api_key, options)
|
|
271
182
|
end
|
|
272
183
|
end
|
|
273
184
|
|
|
@@ -278,14 +189,7 @@ command :projects do |c|
|
|
|
278
189
|
help_now!("Project is missing".foreground(:red)) if args.empty?
|
|
279
190
|
proj_key = args.shift
|
|
280
191
|
api_key = global_options[:api_key]
|
|
281
|
-
|
|
282
|
-
response = Veye::Project::Check.delete_project(proj_key, api_key)
|
|
283
|
-
unless response.success
|
|
284
|
-
printf("Cant delete - %s\n%s\n", response.message.foreground(:red),
|
|
285
|
-
response.data['error'])
|
|
286
|
-
else
|
|
287
|
-
printf "Deleted\n".foreground(:green)
|
|
288
|
-
end
|
|
192
|
+
Veye::Project::Check.delete_project(proj_key, api_key)
|
|
289
193
|
end
|
|
290
194
|
end
|
|
291
195
|
end
|
|
@@ -302,16 +206,7 @@ command :products do |c|
|
|
|
302
206
|
help_now!("Product's key is missing".foreground(:red)) if args.empty?
|
|
303
207
|
prod_key = args.shift
|
|
304
208
|
api_key = global_options[:api_key]
|
|
305
|
-
|
|
306
|
-
response = Veye::Package::Follow.get_follow_status(prod_key, api_key)
|
|
307
|
-
unless response.success
|
|
308
|
-
error_msg = sprintf("Checking state of following failed: %s \n %s",
|
|
309
|
-
"#{response.message}".foreground(:red),
|
|
310
|
-
"#{response.data}")
|
|
311
|
-
exit_now! error_msg
|
|
312
|
-
end
|
|
313
|
-
|
|
314
|
-
printf "#{response.data}\n".foreground(:green)
|
|
209
|
+
Veye::Package::Follow.get_follow_status(prod_key, api_key)
|
|
315
210
|
end
|
|
316
211
|
end
|
|
317
212
|
|
|
@@ -322,15 +217,7 @@ command :products do |c|
|
|
|
322
217
|
help_now!("Product's key is missing".foreground(:red)) if args.empty?
|
|
323
218
|
prod_key = args.shift
|
|
324
219
|
api_key = global_options[:api_key]
|
|
325
|
-
|
|
326
|
-
response = Veye::Package::Follow.follow(prod_key, api_key)
|
|
327
|
-
unless response.success
|
|
328
|
-
error_msg = sprintf("Following failed: %s \n %s",
|
|
329
|
-
"#{response.message}".foreground(:red),
|
|
330
|
-
"#{response.data}")
|
|
331
|
-
exit_now! error_msg
|
|
332
|
-
end
|
|
333
|
-
printf "#{response.data}\n".foreground(:green)
|
|
220
|
+
Veye::Package::Follow.follow(prod_key, api_key)
|
|
334
221
|
end
|
|
335
222
|
end
|
|
336
223
|
|
|
@@ -341,16 +228,7 @@ command :products do |c|
|
|
|
341
228
|
help_now!("Product's key is missing".foreground(:red)) if args.empty?
|
|
342
229
|
prod_key = args.shift
|
|
343
230
|
api_key = global_options[:api_key]
|
|
344
|
-
|
|
345
|
-
response = Veye::Package::Follow.unfollow(prod_key, api_key)
|
|
346
|
-
unless response.success
|
|
347
|
-
error_msg = sprintf("Unfollowing failed: %s \n %s",
|
|
348
|
-
"#{response.message}".foreground(:red),
|
|
349
|
-
"#{response.data}")
|
|
350
|
-
exit_now! error_msg
|
|
351
|
-
end
|
|
352
|
-
|
|
353
|
-
printf "#{response.data}\n".foreground(:green)
|
|
231
|
+
Veye::Package::Follow.unfollow(prod_key, api_key)
|
|
354
232
|
end
|
|
355
233
|
end
|
|
356
234
|
end
|
|
@@ -361,48 +239,124 @@ command :me do |c|
|
|
|
361
239
|
c.desc "change output format"
|
|
362
240
|
c.flag [:format, 'format-name'], :default_value => 'pretty'
|
|
363
241
|
|
|
242
|
+
c.desc "pagination number"
|
|
243
|
+
c.flag [:page, 'page-number'], :default_value => 1
|
|
244
|
+
|
|
245
|
+
c.desc "show paging information"
|
|
246
|
+
c.switch [:pagination, 'show-pagination'],
|
|
247
|
+
:default_value => true,
|
|
248
|
+
:negatable => true
|
|
249
|
+
|
|
364
250
|
c.desc "get profile information"
|
|
365
251
|
c.action do |global_options, options, args|
|
|
366
252
|
api_key = global_options[:api_key]
|
|
367
|
-
|
|
368
|
-
unless response.success
|
|
369
|
-
error_msg = sprintf("Failed to read your profile data: %s\n%s\n",
|
|
370
|
-
"#{response.message}".foreground(:red),
|
|
371
|
-
"#{response.data}")
|
|
372
|
-
exit_now! error_msg
|
|
373
|
-
end
|
|
374
|
-
|
|
375
|
-
Veye::User::Me.format_profile response.data, options[:format]
|
|
253
|
+
Veye::User::Me.get_profile(api_key, options)
|
|
376
254
|
end
|
|
377
255
|
|
|
378
256
|
c.desc "get your favorite packages"
|
|
379
257
|
c.command :favorites do |favorites|
|
|
380
|
-
favorites.
|
|
381
|
-
|
|
258
|
+
favorites.action do |global_options, options, args|
|
|
259
|
+
api_key = global_options[:api_key]
|
|
260
|
+
Veye::User::Me.get_favorites(api_key, options)
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
desc "work with github repositories"
|
|
266
|
+
command :github do |c|
|
|
267
|
+
c.desc "change output format"
|
|
268
|
+
c.flag [:format, 'format-name'], :default_value => 'pretty'
|
|
269
|
+
c.desc "page number for pagination"
|
|
270
|
+
c.flag [:page, 'page-number'], :default_value => 1
|
|
271
|
+
|
|
272
|
+
c.desc "show paging information"
|
|
273
|
+
c.switch [:pagination, 'show-pagination'], :default_value => true,
|
|
274
|
+
:negatable => true
|
|
382
275
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
:negatable => true
|
|
276
|
+
c.desc "filter by language"
|
|
277
|
+
c.flag [:lang, :language]
|
|
386
278
|
|
|
387
|
-
|
|
279
|
+
c.desc "filter by user"
|
|
280
|
+
c.flag [:user]
|
|
281
|
+
|
|
282
|
+
c.desc "specify branch"
|
|
283
|
+
c.flag [:branch], :default_value => "master"
|
|
284
|
+
|
|
285
|
+
c.action do |global_options, options, args|
|
|
286
|
+
help_now!
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
c.desc "list all your repositories"
|
|
290
|
+
c.command :list do |list|
|
|
291
|
+
list.desc "filter by visibility, (accepts: true/false)"
|
|
292
|
+
list.flag [:private]
|
|
293
|
+
|
|
294
|
+
list.desc "filter by name of organisation"
|
|
295
|
+
list.flag [:org, 'org-name']
|
|
296
|
+
|
|
297
|
+
list.desc "filter by type of organisation"
|
|
298
|
+
list.flag ['org-type']
|
|
299
|
+
|
|
300
|
+
list.action do |global_options, options, args|
|
|
388
301
|
api_key = global_options[:api_key]
|
|
389
|
-
response = Veye::
|
|
390
|
-
|
|
391
|
-
unless response.success
|
|
392
|
-
error_msg = sprintf("Failed to read your profile data: %s\n%s\n",
|
|
393
|
-
"#{response.message}".foreground(:red),
|
|
394
|
-
"#{response.data}")
|
|
395
|
-
exit_now! error_msg
|
|
396
|
-
end
|
|
397
|
-
|
|
398
|
-
Veye::User::Me.format_favorites response.data['favorites'], options[:format]
|
|
399
|
-
if options[:pagination]
|
|
400
|
-
printf("\n#-- pagination data ------------------\n")
|
|
401
|
-
Veye::Pagination::Show.format response.data['paging'], options[:format]
|
|
402
|
-
end
|
|
302
|
+
response = Veye::Github::List.get_list(api_key, options)
|
|
403
303
|
end
|
|
304
|
+
end #end-of-list
|
|
305
|
+
|
|
306
|
+
c.desc "update list of repositories"
|
|
307
|
+
c.command :sync do |sync|
|
|
308
|
+
sync.desc "if true, then reloads all collections"
|
|
309
|
+
sync.switch [:force], :default_value => false
|
|
404
310
|
|
|
311
|
+
sync.action do |global_options, options, args|
|
|
312
|
+
api_key = global_options[:api_key]
|
|
313
|
+
response = Veye::Github::Sync.import_all(api_key, options)
|
|
314
|
+
end
|
|
315
|
+
end #end of sync
|
|
316
|
+
|
|
317
|
+
c.desc "search repositories on github"
|
|
318
|
+
c.arg_name "search_term"
|
|
319
|
+
c.command :search do |gsearch|
|
|
320
|
+
gsearch.action do |global_options, options, args|
|
|
321
|
+
help_now!("the search term is mandatory.".foreground(:red)) if args.empty?
|
|
322
|
+
search_term = args.shift
|
|
323
|
+
api_key = global_options[:api_key]
|
|
324
|
+
Veye::Github::Search.search(api_key, search_term, options)
|
|
325
|
+
end
|
|
326
|
+
end # end of search
|
|
327
|
+
|
|
328
|
+
c.desc "show more specific information for the repository"
|
|
329
|
+
c.arg_name "repo_name"
|
|
330
|
+
c.command :info do |info|
|
|
331
|
+
info.action do |global_options, options, args|
|
|
332
|
+
help_now!("the name of repository is mandatory".foreground(:red)) if args.empty?
|
|
333
|
+
repo_name = args.shift
|
|
334
|
+
api_key = global_options[:api_key]
|
|
335
|
+
Veye::Github::Info.get_repo(api_key, repo_name, options)
|
|
336
|
+
end
|
|
337
|
+
end # end of info
|
|
338
|
+
|
|
339
|
+
c.desc "import project from github repository"
|
|
340
|
+
c.arg_name "repo_name"
|
|
341
|
+
c.command :import do |imp|
|
|
342
|
+
imp.action do |global_options, options, args|
|
|
343
|
+
help_now!("the name of repository is mandatory".foreground(:red)) if args.empty?
|
|
344
|
+
repo_name = args.shift
|
|
345
|
+
api_key = global_options[:api_key]
|
|
346
|
+
Veye::Github::Import.import_repo(api_key, repo_name, options)
|
|
347
|
+
end
|
|
348
|
+
end # end of import
|
|
349
|
+
|
|
350
|
+
c.desc "remove imported project"
|
|
351
|
+
c.arg_name "repo_name"
|
|
352
|
+
c.command :delete do |del|
|
|
353
|
+
del.action do |global_options, options, args|
|
|
354
|
+
help_now!("the name of repository is mandatory".foreground(:red)) if args.empty?
|
|
355
|
+
repo_name = args.shift
|
|
356
|
+
api_key = global_options[:api_key]
|
|
357
|
+
Veye::Github::Delete.delete_repo(api_key, repo_name, options)
|
|
358
|
+
end
|
|
405
359
|
end
|
|
406
|
-
end
|
|
360
|
+
end #end of github comamnd
|
|
407
361
|
|
|
408
362
|
exit run(ARGV)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
class BaseExecutor
|
|
3
|
+
extend FormatHelpers
|
|
4
|
+
extend RepoHelpers
|
|
5
|
+
|
|
6
|
+
def self.show_results(output_formats, results, options = {}, paging = nil)
|
|
7
|
+
format = options[:format]
|
|
8
|
+
self.supported_format?(output_formats, format)
|
|
9
|
+
formatter = output_formats[format]
|
|
10
|
+
|
|
11
|
+
formatter.before
|
|
12
|
+
formatter.format(results)
|
|
13
|
+
formatter.after(paging, options[:pagination])
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.catch_request_error(response, msg)
|
|
17
|
+
if response.nil? or not response.success
|
|
18
|
+
error_msg = sprintf("%s\n%s\n",
|
|
19
|
+
"#{msg}".foreground(:red),
|
|
20
|
+
"#{response.data}")
|
|
21
|
+
exit_now! error_msg
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require_relative '../base_executor.rb'
|
|
2
|
+
|
|
3
|
+
module Veye
|
|
4
|
+
module Github
|
|
5
|
+
class Delete < BaseExecutor
|
|
6
|
+
|
|
7
|
+
def self.delete_repo(api_key, repo_name, options)
|
|
8
|
+
github_api = API::Resource.new(RESOURCE_PATH)
|
|
9
|
+
qparams = {
|
|
10
|
+
:params => {
|
|
11
|
+
:api_key => api_key,
|
|
12
|
+
:branch => options[:branch]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
response_data = nil
|
|
16
|
+
safe_repo_key = self.encode_repo_key(repo_name)
|
|
17
|
+
github_api.resource["/#{safe_repo_key}"].delete(qparams) do |response, request, result|
|
|
18
|
+
response_data = API::JSONResponse.new(request, result, response)
|
|
19
|
+
end
|
|
20
|
+
show_result(response_data)
|
|
21
|
+
response_data
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.show_result(response)
|
|
25
|
+
unless response.success
|
|
26
|
+
printf("Cant delete - %s\n%s\n", response.message.foreground(:red),
|
|
27
|
+
response.data['error'])
|
|
28
|
+
else
|
|
29
|
+
printf "Deleted\n".foreground(:green)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require_relative '../views/github.rb'
|
|
2
|
+
require_relative '../base_executor.rb'
|
|
3
|
+
|
|
4
|
+
module Veye
|
|
5
|
+
module Github
|
|
6
|
+
class Import < BaseExecutor
|
|
7
|
+
@@output_formats = {
|
|
8
|
+
'csv' => Github::InfoCSV.new,
|
|
9
|
+
'json' => Github::InfoJSON.new,
|
|
10
|
+
'pretty' => Github::InfoPretty.new,
|
|
11
|
+
'table' => Github::InfoTable.new
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
def self.import_repo(api_key, repo_name, options)
|
|
15
|
+
github_api = API::Resource.new(RESOURCE_PATH)
|
|
16
|
+
results = nil
|
|
17
|
+
params = {api_key: api_key, branch: options[:branch]}
|
|
18
|
+
repo_name = encode_repo_key(repo_name)
|
|
19
|
+
|
|
20
|
+
github_api.resource["/#{repo_name}"].post(params) do |response, request, result|
|
|
21
|
+
results = API::JSONResponse.new(request, result, response)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
catch_request_error(results, "Can not find repository `#{repo_name}`")
|
|
25
|
+
show_results(@@output_formats, results.data, options, nil)
|
|
26
|
+
results
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|