myprecious 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/myprecious.rb +57 -47
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 893fc5a6cb5c046d8736086691de01186b3b85ed840d140b48ac397ddcad9659
|
4
|
+
data.tar.gz: 2b3c8e647ec5f964c62df80f7d3ea0de13cbbddcfc011de1ae584dd61f004121
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bc15c82107084497d9e309e01cc0a420db698765a7c659060efc3d9af75bf8c5971cc545eeb870a1f48bfddcbd10c36a5952c2015db2601795134b9d90ad5a3
|
7
|
+
data.tar.gz: 165f2675864eac45601e9d526b2e581facda1bc4ecc318f31b100455c8eda06e56d3d22486a1f2149583bc0b0e39b845c2b47e76fb5d7f098eff4e136f0a84c1
|
data/lib/myprecious.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'gems'
|
2
2
|
require 'date'
|
3
|
+
require 'git'
|
3
4
|
|
4
5
|
class MyPrecious
|
5
6
|
def self.update
|
7
|
+
g = Git.open(Dir.pwd)
|
8
|
+
repo_name = g.repo.path.split(".git")[0].split("/").last
|
9
|
+
repo_name = repo_name + "-dependency-tracking"
|
6
10
|
gem_lines = {}
|
7
11
|
gem_name_pos = 0
|
8
12
|
gem_version_pos = 1
|
@@ -12,11 +16,12 @@ class MyPrecious
|
|
12
16
|
gem_license_pos = 5
|
13
17
|
gem_change_pos = 6
|
14
18
|
default_length = 7
|
15
|
-
|
16
|
-
|
19
|
+
already_fetched_gems = {}
|
20
|
+
if File.file?(repo_name+'.md')
|
21
|
+
File.open(repo_name+".md", "r").each_with_index do |line, line_number|
|
17
22
|
#puts line + " dds " + line_number.to_s
|
18
23
|
word_array = line.split('|')
|
19
|
-
if line_number ==
|
24
|
+
if line_number == 1
|
20
25
|
default_length = word_array.size
|
21
26
|
word_array.each_with_index do |word, index|
|
22
27
|
if word.strip == 'Gem'
|
@@ -28,25 +33,26 @@ class MyPrecious
|
|
28
33
|
elsif word.strip == 'Date available'
|
29
34
|
gem_date_pos = index
|
30
35
|
elsif word.strip == 'Age (in days)'
|
31
|
-
gem_age_pos = index
|
36
|
+
gem_age_pos = index
|
32
37
|
elsif word.strip == 'License Type'
|
33
|
-
gem_change_pos = index
|
38
|
+
gem_change_pos = index
|
34
39
|
elsif word.strip == 'Change Log'
|
35
40
|
gem_change_pos = index
|
36
41
|
end
|
37
42
|
end
|
38
|
-
elsif line_number >
|
43
|
+
elsif line_number > 2
|
39
44
|
gem_name_index = word_array[gem_name_pos].strip
|
40
45
|
#extract just the name of the gem from the first column
|
41
|
-
#since that column contains a markdown-formatted hyperlink
|
46
|
+
#since that column contains a markdown-formatted hyperlink
|
42
47
|
gem_name_index = gem_name_index[/\[(.*?)\]/,1]
|
43
48
|
gem_lines[gem_name_index] = line_number
|
44
49
|
end
|
45
|
-
|
50
|
+
|
46
51
|
end
|
47
52
|
#puts gem_lines
|
48
53
|
else
|
49
|
-
File.open('
|
54
|
+
File.open(repo_name+'.md', 'w') { |write_file|
|
55
|
+
write_file.puts "Last updated:" + Date.today.to_s + "; Use for directional purposes only, this data is not real time and might be slightly inaccurate" + "\n\n"
|
50
56
|
write_file.puts "Gem | Our Version | Latest Version | Date available | Age (in days) | License Type | Change Log"
|
51
57
|
write_file.puts "--- | --- | --- | --- | --- | --- | ---"
|
52
58
|
}
|
@@ -54,58 +60,62 @@ class MyPrecious
|
|
54
60
|
|
55
61
|
file = File.new("Gemfile", "r")
|
56
62
|
|
57
|
-
final_write = File.readlines('
|
63
|
+
final_write = File.readlines(repo_name+'.md')
|
58
64
|
|
59
65
|
while (line = file.gets)
|
60
66
|
gem_line = line.strip
|
61
67
|
if (gem_line.include? 'gem') && !gem_line.start_with?('#') && !gem_line.start_with?('source')
|
68
|
+
name = gem_line.split(' ')[1].split(',')[0].tr(" '\"", "")
|
62
69
|
begin
|
63
|
-
name
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
current_build = Date.parse gem_info["built_at"]
|
70
|
+
puts name + " is being fetched, and processed"
|
71
|
+
gems_latest_info = Gems.info name
|
72
|
+
current_version = Gem::Specification.find_all_by_name(name).max ? Gem::Specification.find_all_by_name(name).max.version : gems_latest_info["version"]
|
73
|
+
|
74
|
+
gems_info = Gems.versions name
|
75
|
+
latest_build = ''
|
76
|
+
gems_info.each do |gem_info|
|
77
|
+
if gem_info["number"].to_s == gems_latest_info["version"].to_s
|
78
|
+
latest_build = Date.parse gem_info["built_at"]
|
79
|
+
end
|
80
|
+
if gem_info["number"].to_s == current_version.to_s && !already_fetched_gems[name]
|
81
|
+
already_fetched_gems[name] = true
|
82
|
+
current_build = Date.parse gem_info["built_at"]
|
77
83
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
array_to_write
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
array_to_write[
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
84
|
+
days_complete = latest_build - current_build
|
85
|
+
#puts name
|
86
|
+
#puts gem_lines
|
87
|
+
if gem_lines[name].nil?
|
88
|
+
array_to_write = Array.new(default_length) { |i| "" }
|
89
|
+
else
|
90
|
+
array_to_write = final_write[gem_lines[name]].split('|')
|
91
|
+
end
|
92
|
+
array_to_write[gem_name_pos] = "[" + name + "]" + "(" + gems_latest_info["homepage_uri"].to_s + ")"
|
93
|
+
array_to_write[gem_version_pos] = current_version.to_s
|
94
|
+
array_to_write[gem_latest_pos] = gems_latest_info["version"].to_s
|
95
|
+
array_to_write[gem_date_pos] = (latest_build).to_s
|
96
|
+
array_to_write[gem_age_pos] = days_complete.to_i.to_s
|
97
|
+
if !gem_info["licenses"].nil?
|
98
|
+
array_to_write[gem_license_pos] = gem_info["licenses"][0]
|
99
|
+
else
|
100
|
+
array_to_write[gem_license_pos] = "N/A"
|
101
|
+
end
|
102
|
+
array_to_write[gem_change_pos] = gems_latest_info["changelog_uri"].to_s + "\n"
|
103
|
+
if !gem_lines[name].nil?
|
104
|
+
final_write[gem_lines[name]] = array_to_write.join("|")
|
105
|
+
else
|
106
|
+
final_write << array_to_write.join("|")
|
100
107
|
end
|
101
108
|
end
|
102
109
|
end
|
103
110
|
rescue Exception => e
|
104
111
|
puts e
|
112
|
+
puts name
|
105
113
|
end
|
106
114
|
end
|
107
115
|
end
|
108
|
-
File.open('
|
116
|
+
File.open(repo_name+'.md', 'w') { |f| f.write(final_write.join) }
|
109
117
|
file.close
|
110
118
|
end
|
111
119
|
end
|
120
|
+
|
121
|
+
MyPrecious.update
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myprecious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Balki Kodarapu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gems
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 1.0.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.0'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 1.0.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
33
|
description: A simple, markdown generated with information about your gems
|
34
34
|
email: balki.kodarapu@gmail.com
|
35
35
|
executables:
|
@@ -58,8 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
|
62
|
-
rubygems_version: 2.4.8
|
61
|
+
rubygems_version: 3.0.3
|
63
62
|
signing_key:
|
64
63
|
specification_version: 4
|
65
64
|
summary: Your precious dependencies!
|