veye 0.1.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/veye/project/check.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require_relative '../views/project
|
2
|
-
require_relative '../base_executor
|
1
|
+
require_relative '../views/project'
|
2
|
+
require_relative '../base_executor'
|
3
3
|
|
4
4
|
module Veye
|
5
5
|
module Project
|
@@ -25,69 +25,82 @@ module Veye
|
|
25
25
|
|
26
26
|
def self.get_list(api_key, options)
|
27
27
|
results = Veye::API::Project.get_list(api_key)
|
28
|
-
|
28
|
+
valid_response?(results, 'Can not read list of projects.')
|
29
29
|
show_results(@output_formats, results.data, options)
|
30
30
|
end
|
31
31
|
|
32
|
-
def self.
|
33
|
-
results = Veye::API::Project.
|
34
|
-
|
32
|
+
def self.get_project(api_key, project_key, options)
|
33
|
+
results = Veye::API::Project.get_project(api_key, project_key)
|
34
|
+
err_msg = "No data for the project: `#{project_key}`"
|
35
|
+
valid_response?(results, err_msg)
|
35
36
|
show_results(@output_formats, results.data, options)
|
36
|
-
|
37
|
+
if options[:format] != 'json'
|
38
|
+
show_dependencies(@dependency_output_formats, results.data, options)
|
39
|
+
end
|
37
40
|
end
|
38
41
|
|
39
|
-
def self.
|
40
|
-
results = Veye::API::Project.
|
41
|
-
|
42
|
+
def self.upload(api_key, filename, options)
|
43
|
+
results = Veye::API::Project.upload(api_key, filename)
|
44
|
+
valid_response?(results, 'Upload failed.')
|
42
45
|
show_results(@output_formats, results.data, options)
|
43
|
-
|
46
|
+
if options[:format] != 'json'
|
47
|
+
show_dependencies(@dependency_output_formats, results.data, options)
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
|
-
def self.
|
47
|
-
results = Veye::API::Project.
|
48
|
-
|
49
|
-
catch_request_error(results, err_msg)
|
51
|
+
def self.update(api_key, project_key, filename, options)
|
52
|
+
results = Veye::API::Project.update(api_key, project_key, filename)
|
53
|
+
valid_response?(results, 'Re-upload failed.')
|
50
54
|
show_results(@output_formats, results.data, options)
|
51
|
-
|
55
|
+
if options[:format] != 'json'
|
56
|
+
show_dependencies(@dependency_output_formats, results.data, options)
|
57
|
+
end
|
52
58
|
end
|
53
59
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
#checks project file and initializes veye.json file iff it's missing
|
61
|
+
#files - an array with filenames to check, ['Gemfile', 'bower.json']
|
62
|
+
#path - nil or string, a relative path to the project root directory
|
63
|
+
def self.check(api_key, path, files, options)
|
64
|
+
project_settings = Veye::Settings.load(path)
|
65
|
+
#initialize project settings to keep various project specific data
|
66
|
+
if project_settings.nil?
|
67
|
+
file_map = files.to_a.inject({}) {|acc, x| acc.store(x, nil); acc}
|
68
|
+
opts = {'projects' => file_map}
|
69
|
+
project_settings = Veye::Settings.init(path, opts)
|
70
|
+
end
|
60
71
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
else
|
66
|
-
results['dependencies'].to_a.keep_if {|x| x['outdated']}
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.show_dependencies(results, options)
|
71
|
-
format = options[:format]
|
72
|
-
format ||= 'pretty'
|
73
|
-
return if format == 'json'
|
74
|
-
self.supported_format?(@dependency_output_formats, format)
|
72
|
+
unless project_settings.has_key?('projects')
|
73
|
+
printf "veye.json is malformed - missing `project` key".color(:red)
|
74
|
+
exit 0
|
75
|
+
end
|
75
76
|
|
76
|
-
deps =
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
deps = {}
|
78
|
+
project_settings['projects'].each do |filename, project_id|
|
79
|
+
filepath = "#{path}/#{filename}"
|
80
|
+
results = if project_id.nil?
|
81
|
+
Veye::API::Project.upload(api_key, filepath)
|
82
|
+
else
|
83
|
+
Veye::API::Project.update(api_key, project_id, filepath)
|
84
|
+
end
|
85
|
+
error_msg = "Failed to check dependencies for `#{filename.to_s.color(:red)}`"
|
86
|
+
if valid_response?(results, error_msg)
|
87
|
+
deps[filename] = results.data
|
88
|
+
project_settings['projects'].store(filename, results.data['project_key'])
|
89
|
+
else
|
90
|
+
deps[filename] = {error: "Failed to check a file `#{filepath}`"}
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
Veye::Settings.dump(path, project_settings)
|
95
|
+
#show_results(@output_formats, deps, options)
|
96
|
+
show_bulk_dependencies(@dependency_output_formats, deps, options)
|
81
97
|
end
|
82
98
|
|
83
|
-
def self.
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
fail_msg.color(:red),
|
89
|
-
response.data['error'])
|
90
|
-
end
|
99
|
+
def self.delete_project(api_key, project_key)
|
100
|
+
results = Veye::API::Project.delete_project(api_key, project_key)
|
101
|
+
err_msg = "Failed to delete project: `#{project_key}`"
|
102
|
+
valid_response?(results, err_msg)
|
103
|
+
show_message(results, 'Deleted', 'Cant delete.')
|
91
104
|
end
|
92
105
|
end
|
93
106
|
end
|
data/lib/veye/project/license.rb
CHANGED
@@ -12,7 +12,7 @@ module Veye
|
|
12
12
|
'table' => Project::LicenceTable.new
|
13
13
|
}
|
14
14
|
|
15
|
-
def self.get_licenses(
|
15
|
+
def self.get_licenses(api_key, project_key, options)
|
16
16
|
results = Veye::API::Project.get_licenses(api_key, project_key)
|
17
17
|
err_msg = "Cant access a information for project `#{project_key}`."
|
18
18
|
catch_request_error(results, err_msg)
|
data/lib/veye/project.rb
CHANGED
@@ -6,5 +6,31 @@ module Veye
|
|
6
6
|
# projects on VersionEye and presenting results
|
7
7
|
# on command line.
|
8
8
|
module Project
|
9
|
+
@supported_files = [
|
10
|
+
'project\.clj', 'bower\.json', 'project\.json', 'gemfile',
|
11
|
+
'gemfile\.lock', '*\.gradle', '*\.sbt', '*\.pom\.xml', 'podfile'
|
12
|
+
]
|
13
|
+
|
14
|
+
def self.supported_files
|
15
|
+
@supported_files
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.supported?(filename)
|
19
|
+
@supported_files.any? {|ptrn| filename.to_s.downcase.match(/^#{ptrn}$/) }
|
20
|
+
end
|
21
|
+
|
22
|
+
#returns list of supported filenames in the working folder
|
23
|
+
def self.get_files(path)
|
24
|
+
files = Set.new
|
25
|
+
Dir.foreach(path) do |filename|
|
26
|
+
files << filename if supported?(filename)
|
27
|
+
end
|
28
|
+
|
29
|
+
if files.include?('Gemfile') and files.include?('Gemfile.lock')
|
30
|
+
files.delete 'Gemfile'
|
31
|
+
end
|
32
|
+
|
33
|
+
files
|
34
|
+
end
|
9
35
|
end
|
10
36
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Veye
|
4
|
+
|
5
|
+
#This class includes methods to manage project specific
|
6
|
+
# settings to make it recurrent usage simpler for users
|
7
|
+
class Settings
|
8
|
+
@filename = "veye.json"
|
9
|
+
@default_options = {
|
10
|
+
projects: {} #file_name : project_key
|
11
|
+
}
|
12
|
+
|
13
|
+
def self.filename
|
14
|
+
@filename
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.default_options
|
18
|
+
@default_options
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.file_fullpath(path)
|
22
|
+
path ||= Dir.pwd
|
23
|
+
file_path = "#{path}/#{@filename}"
|
24
|
+
File.absolute_path(file_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
#read config file from current working directory
|
28
|
+
#it returns nil if settings file doesnt exists or not readable
|
29
|
+
#otherwise it returns a map of settings
|
30
|
+
def self.load(path)
|
31
|
+
file_path = file_fullpath(path)
|
32
|
+
return unless File.exist?(file_path)
|
33
|
+
JSON.load(File.open(file_path, 'r'))
|
34
|
+
end
|
35
|
+
|
36
|
+
#saves map of options into settings file
|
37
|
+
#ps: it overwrites whole content in settings file
|
38
|
+
def self.dump(path, options)
|
39
|
+
file_path = file_fullpath(path)
|
40
|
+
File.open(file_path, 'w') {|f| f.write(options.to_json) }
|
41
|
+
end
|
42
|
+
|
43
|
+
#initializes default VersionEye settings file and saves it into the file
|
44
|
+
def self.init(path, options)
|
45
|
+
opts = @default_options.merge(options)
|
46
|
+
dump(path, opts)
|
47
|
+
opts
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/veye/version.rb
CHANGED
@@ -13,7 +13,7 @@ module Veye
|
|
13
13
|
printf(
|
14
14
|
"%3d - %s\n",
|
15
15
|
index + 1,
|
16
|
-
"#{result["name"]}".color(:green)
|
16
|
+
"#{result["name"]}".color(:green)
|
17
17
|
)
|
18
18
|
printf("\t%-15s: %s\n", 'language', result['language'])
|
19
19
|
printf("\t%-15s: %s\n", 'owner_name', result['owner_name'])
|
@@ -10,11 +10,11 @@ module Veye
|
|
10
10
|
items.each_with_index do |result, index|
|
11
11
|
printf("%3d - %s\n",
|
12
12
|
index + 1,
|
13
|
-
"#{result["name"]}".color(:green)
|
13
|
+
"#{result["name"]}".color(:green))
|
14
14
|
printf("\t%-15s: %s\n", "Product key", result["prod_key"].bright)
|
15
15
|
printf("\t%-15s: %s\n", "Product type", "#{result['prod_type']}")
|
16
16
|
printf("\t%-15s: %s\n", "Language", result["language"])
|
17
|
-
printf("\t%-15s: %s\n", "Version", "#{result['version']}".
|
17
|
+
printf("\t%-15s: %s\n", "Version", "#{result['version']}".color(:green))
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -4,27 +4,47 @@ module Veye
|
|
4
4
|
module Project
|
5
5
|
class DependencyCSV < BaseCSV
|
6
6
|
def initialize
|
7
|
-
headings = "nr,name,prod_key,outdated,
|
7
|
+
headings = "nr,name,prod_key,outdated,current,requested,stable,licenses"
|
8
8
|
super(headings)
|
9
9
|
end
|
10
10
|
|
11
|
-
def format(results)
|
11
|
+
def format(results, filename = nil)
|
12
12
|
return nil if results.nil?
|
13
13
|
results = [results] if results.is_a?(Hash)
|
14
14
|
|
15
15
|
results.each_with_index do |result, index|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
result['version_current'],
|
22
|
-
result['version_requested'],
|
23
|
-
result['stable'],
|
24
|
-
result['license']
|
25
|
-
)
|
16
|
+
if filename.nil?
|
17
|
+
print_line(result, index + 1)
|
18
|
+
else
|
19
|
+
print_line_with_filename(result, index + 1, filename)
|
20
|
+
end
|
26
21
|
end
|
27
22
|
end
|
23
|
+
|
24
|
+
def print_line(result, i)
|
25
|
+
printf("%d,%s,%s,%s,%s,%s,%s,%s\n",
|
26
|
+
i,
|
27
|
+
result['name'],
|
28
|
+
result['prod_key'],
|
29
|
+
result['outdated'],
|
30
|
+
result['version_current'],
|
31
|
+
result['version_requested'],
|
32
|
+
result['stable'],
|
33
|
+
result['licenses'].to_a.map {|x| x['name']}.join(';'))
|
34
|
+
end
|
35
|
+
|
36
|
+
def print_line_with_filename(result, i, filename)
|
37
|
+
printf("%d,%s,%s,%s,%s,%s,%s,%s,%s\n",
|
38
|
+
i, filename,
|
39
|
+
result['name'],
|
40
|
+
result['prod_key'],
|
41
|
+
result['outdated'],
|
42
|
+
result['version_current'],
|
43
|
+
result['version_requested'],
|
44
|
+
result['stable'],
|
45
|
+
result['licenses'].to_a.map {|x| x['name']}.join(';'))
|
46
|
+
end
|
47
|
+
|
28
48
|
end
|
29
49
|
end
|
30
50
|
end
|
@@ -3,8 +3,12 @@ require_relative '../base_json.rb'
|
|
3
3
|
module Veye
|
4
4
|
module Project
|
5
5
|
class DependencyJSON < BaseJSON
|
6
|
-
def format(results)
|
7
|
-
|
6
|
+
def format(results, filename = nil)
|
7
|
+
if filename.nil?
|
8
|
+
@results[:repo] = results['repo']
|
9
|
+
else
|
10
|
+
@results[filename] = results
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
@@ -3,23 +3,31 @@ require_relative '../base_pretty.rb'
|
|
3
3
|
module Veye
|
4
4
|
module Project
|
5
5
|
class DependencyPretty < BasePretty
|
6
|
-
def format(results)
|
6
|
+
def format(results, filename = nil)
|
7
7
|
return if results.nil?
|
8
8
|
results = [results] if results.is_a?(Hash)
|
9
|
+
printf("#-- Dependencies ------------------------------------------\n")
|
9
10
|
results.each_with_index do |result, index|
|
10
11
|
project_name = "#{result['name']}".color(:green).bright
|
11
12
|
printf("%3d - %s\n", index + 1, project_name)
|
13
|
+
#shows project file names
|
14
|
+
if filename
|
15
|
+
printf("\t%-15s: %s\n", "Sourcefile", filename)
|
16
|
+
end
|
17
|
+
|
12
18
|
printf("\t%-15s: %s\n", "Product key", result["prod_key"])
|
13
19
|
|
14
20
|
color_code = (result["outdated"] == true) ? :red : :green
|
15
|
-
printf("\t%-15s: %s\n",
|
16
|
-
|
21
|
+
printf("\t%-15s: %s\n",
|
22
|
+
"Outdated",
|
23
|
+
"#{result['outdated']}".color(color_code))
|
24
|
+
|
25
|
+
printf("\t%-15s: %s\n", "Current", "#{result['version_current']}".color(color_code))
|
17
26
|
|
18
|
-
printf("\t%-15s: %s\n", "
|
19
|
-
"#{result['version_current']}".color(color_code))
|
27
|
+
printf("\t%-15s: %s\n", "Requested", result["version_requested"])
|
20
28
|
|
21
|
-
|
22
|
-
printf("\t%-15s: %s\n", "
|
29
|
+
licenses = result["licenses"].to_a.map {|x| x['name']}
|
30
|
+
printf("\t%-15s: %s\n", "Licenses", licenses.join(', '))
|
23
31
|
|
24
32
|
end
|
25
33
|
end
|
@@ -7,18 +7,20 @@ module Veye
|
|
7
7
|
headings = %w{index name prod_key version_current version_requested outdated stable license}
|
8
8
|
super("Project dependencies", headings)
|
9
9
|
end
|
10
|
-
def format(results)
|
10
|
+
def format(results, filename = nil)
|
11
11
|
results = [results] if results.is_a?(Hash)
|
12
12
|
|
13
13
|
results.each_with_index do |result, index|
|
14
|
-
row = [
|
15
|
-
|
14
|
+
row = [
|
15
|
+
index + 1,
|
16
|
+
(filename or result["name"]),
|
16
17
|
result["prod_key"],
|
17
18
|
result["version_current"],
|
18
19
|
result["version_requested"],
|
19
20
|
result["outdated"] ? "outdated":"no",
|
20
21
|
result["stable"] ? "stable": "unstable",
|
21
|
-
result["
|
22
|
+
result["licenses"].to_a.map {|x| x['name']}.join(',')
|
23
|
+
]
|
22
24
|
@table << row
|
23
25
|
end
|
24
26
|
end
|
@@ -11,7 +11,7 @@ module Veye
|
|
11
11
|
results.each_with_index do |result, index|
|
12
12
|
project_name = "#{result['name']}".color(:green).bright
|
13
13
|
printf("%3d - %s\n", index + 1, project_name)
|
14
|
-
printf("\t%-15s: %s\n", "Project key", "#{result['
|
14
|
+
printf("\t%-15s: %s\n", "Project key", "#{result['id']}".bright)
|
15
15
|
printf("\t%-15s: %s\n", "Project type", result['project_type'])
|
16
16
|
printf("\t%-15s: %s\n", "Public", result['public'])
|
17
17
|
printf("\t%-15s: %s\n", "Period", result['period'])
|
@@ -2,11 +2,12 @@ require_relative '../base_table.rb'
|
|
2
2
|
|
3
3
|
module Veye
|
4
4
|
module Project
|
5
|
-
|
5
|
+
class InfoTable < BaseTable
|
6
6
|
def initialize
|
7
7
|
headings = %w(index name project_key private period source dependencies outdated created_at)
|
8
8
|
super("List of projects", headings)
|
9
9
|
end
|
10
|
+
|
10
11
|
def format(results)
|
11
12
|
return if results.nil?
|
12
13
|
results = [results] if results.is_a? Hash
|
@@ -17,8 +18,8 @@ module Veye
|
|
17
18
|
result['dep_number'], result['out_number'], result['created_at']]
|
18
19
|
@table << row
|
19
20
|
end
|
20
|
-
|
21
|
-
|
21
|
+
end
|
22
|
+
end
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
data/lib/veye.rb
CHANGED
@@ -5,14 +5,15 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
require 'veye/helpers/format_helpers.rb'
|
7
7
|
|
8
|
-
require 'veye/version
|
9
|
-
require 'veye/service
|
10
|
-
require 'veye/api
|
11
|
-
require 'veye/package
|
12
|
-
require 'veye/project
|
13
|
-
require 'veye/user
|
14
|
-
require 'veye/github
|
15
|
-
require 'veye/pagination
|
8
|
+
require 'veye/version'
|
9
|
+
require 'veye/service'
|
10
|
+
require 'veye/api'
|
11
|
+
require 'veye/package'
|
12
|
+
require 'veye/project'
|
13
|
+
require 'veye/user'
|
14
|
+
require 'veye/github'
|
15
|
+
require 'veye/pagination'
|
16
|
+
require 'veye/settings'
|
16
17
|
|
17
18
|
$global_options ||= {}
|
18
19
|
DEFAULT_CONFIG_FILE = '.veye.rc'
|
data/results.html
ADDED
File without changes
|
data/test/api/github_test.rb
CHANGED
data/test/api/package_test.rb
CHANGED
@@ -3,12 +3,12 @@ require_relative '../test_helper'
|
|
3
3
|
class PackageTest < Minitest::Test
|
4
4
|
def setup
|
5
5
|
init_environment
|
6
|
-
@api_key = "
|
6
|
+
@api_key = ENV["VEYE_API_KEY"]
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_info_api_call
|
10
10
|
VCR.use_cassette('package_info') do
|
11
|
-
res = Veye::API::Package::get_package('veye', 'ruby')
|
11
|
+
res = Veye::API::Package::get_package(@api_key, 'veye', 'ruby')
|
12
12
|
|
13
13
|
assert_equal 200, res.code
|
14
14
|
assert_equal true, res.success
|
@@ -20,7 +20,7 @@ class PackageTest < Minitest::Test
|
|
20
20
|
|
21
21
|
def test_search_api_call
|
22
22
|
VCR.use_cassette('package_search') do
|
23
|
-
res = Veye::API::Package.search('veye')
|
23
|
+
res = Veye::API::Package.search(@api_key, 'veye')
|
24
24
|
refute_nil res
|
25
25
|
assert_equal true, res.success
|
26
26
|
assert_equal 200, res.code
|
@@ -68,11 +68,12 @@ class PackageTest < Minitest::Test
|
|
68
68
|
|
69
69
|
def test_reference_api_call
|
70
70
|
VCR.use_cassette('package_reference') do
|
71
|
-
res = Veye::API::Package.get_references('ruby', 'ruby')
|
71
|
+
res = Veye::API::Package.get_references(@api_key, 'ruby', 'ruby')
|
72
72
|
refute_nil res
|
73
|
+
|
73
74
|
assert_equal 200, res.code
|
74
75
|
assert_equal true, res.success
|
75
|
-
assert_equal "
|
76
|
+
assert_equal "gitit", res.data['results'].first.fetch("name", nil)
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
data/test/api/project_test.rb
CHANGED
data/test/api/user_test.rb
CHANGED
data/test/files/Testfile
ADDED
File without changes
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: delete
|
5
|
-
uri: https://www.versioneye.com/api/v2/github/versioneye:veye?api_key=
|
5
|
+
uri: https://www.versioneye.com/api/v2/github/versioneye:veye?api_key=316dbd6b80b053f5b1e5&branch=master
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,28 +21,26 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Sat, 12 Mar 2016 18:45:38 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/json
|
27
27
|
Content-Length:
|
28
28
|
- '16'
|
29
29
|
Connection:
|
30
30
|
- keep-alive
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000
|
33
31
|
Set-Cookie:
|
34
|
-
- api_key=
|
32
|
+
- api_key=316dbd6b80b053f5b1e5
|
35
33
|
Etag:
|
36
34
|
- W/"7363e85fe9edee6f053a4b319588c086"
|
37
35
|
Cache-Control:
|
38
36
|
- max-age=0, private, must-revalidate
|
39
37
|
X-Request-Id:
|
40
|
-
-
|
38
|
+
- 3dc80523-b4a4-4112-90f6-bc99e3af1e0d
|
41
39
|
X-Runtime:
|
42
|
-
- '0.
|
40
|
+
- '0.269159'
|
43
41
|
body:
|
44
42
|
encoding: UTF-8
|
45
43
|
string: '{"success":true}'
|
46
44
|
http_version:
|
47
|
-
recorded_at:
|
48
|
-
recorded_with: VCR
|
45
|
+
recorded_at: Sat, 12 Mar 2016 18:38:17 GMT
|
46
|
+
recorded_with: VCR 3.0.1
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://www.versioneye.com/api/v2/github/versioneye:veye?api_key=
|
5
|
+
uri: https://www.versioneye.com/api/v2/github/versioneye:veye?api_key=316dbd6b80b053f5b1e5
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,29 +21,27 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Sat, 12 Mar 2016 18:48:21 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/json
|
27
27
|
Content-Length:
|
28
|
-
- '
|
28
|
+
- '453'
|
29
29
|
Connection:
|
30
30
|
- keep-alive
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000
|
33
31
|
Set-Cookie:
|
34
|
-
- api_key=
|
32
|
+
- api_key=316dbd6b80b053f5b1e5
|
35
33
|
Etag:
|
36
|
-
- W/"
|
34
|
+
- W/"f66ca9e1f4d09b82bfe661be75934fe5"
|
37
35
|
Cache-Control:
|
38
36
|
- max-age=0, private, must-revalidate
|
39
37
|
X-Request-Id:
|
40
|
-
-
|
38
|
+
- 6c3c14ee-5136-44ab-9446-e57a03d7dfb0
|
41
39
|
X-Runtime:
|
42
|
-
- '0.
|
40
|
+
- '0.050714'
|
43
41
|
body:
|
44
42
|
encoding: UTF-8
|
45
43
|
string: '{"repo":{"name":"veye","fullname":"versioneye/veye","language":"ruby","owner_login":"versioneye","owner_type":"organization","description":"VersionEye
|
46
|
-
command line tool ","private":false,"fork":false,"branches":
|
44
|
+
command line tool ","private":false,"fork":false,"branches":null,"git_url":"git://github.com/versioneye/veye.git","html_url":"https://github.com/versioneye/veye","created_at":"2012-12-27T11:15:03.000+00:00","cached_at":"2016-02-24T10:25:53.782+00:00","size":832,"homepage":null},"imported_projects":[]}'
|
47
45
|
http_version:
|
48
|
-
recorded_at:
|
49
|
-
recorded_with: VCR
|
46
|
+
recorded_at: Sat, 12 Mar 2016 18:41:00 GMT
|
47
|
+
recorded_with: VCR 3.0.1
|