web-puc 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/web-puc.rb +19 -15
- metadata +12 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 340505a85ca7da37714a19c89ee124f58b48f7da8c5c1490cb729cf6d1b56160
|
4
|
+
data.tar.gz: d7d7efa0a100905caf47476887be91184645e3e3c2f8f32c96f5887557ae9b76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318dd140ae45e73a5f5d73d4a75c79670779b0a2cec426be23c9b1f875f023b631668e294e1025ab9a8388b559f9fd4bb47fa3be862a9095086c455b959c2baa
|
7
|
+
data.tar.gz: 33d9dae6e2ae85a954bb2b01dd403a6545ceb7e0a99a5f828f9bca8ccadc87538ff8b094a0c8c815319449a508ff356177a6a27fe724e4e5e872f8456f54a64a
|
data/lib/web-puc.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require "ostruct"
|
3
|
+
require "optparse"
|
4
|
+
require "yaml"
|
5
|
+
require "structured-acceptance-test"
|
6
|
+
require "net/http"
|
4
7
|
require 'shellwords'
|
5
|
-
require
|
6
|
-
require 'yaml'
|
7
|
-
require_relative 'version'
|
8
|
+
#require "gemrake"
|
8
9
|
|
9
10
|
DATA_STORE_FILENAME = File.expand_path('~/.web-puc-data.yml')
|
10
11
|
CACHE_EXPIRATION_PERIOD = 7*24*60*60
|
@@ -13,7 +14,6 @@ class LibraryNotImplementedException < Exception
|
|
13
14
|
end
|
14
15
|
|
15
16
|
class Optparse
|
16
|
-
|
17
17
|
def self.parse(args)
|
18
18
|
options = OpenStruct.new
|
19
19
|
options.exclude = []
|
@@ -45,16 +45,17 @@ class Optparse
|
|
45
45
|
options.libs = list
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
# TODO:
|
49
|
+
#opts.on_tail('-v', '--version', 'Show version') do
|
50
|
+
# spec = Gem::Specification::load(File.expand_path('../web-puc.gemspec', __FILE__))
|
51
|
+
# puts "web-puc #{spec.version}"
|
52
|
+
# exit
|
53
|
+
#end
|
52
54
|
end
|
53
55
|
|
54
56
|
opt_parser.parse!(args)
|
55
57
|
options
|
56
58
|
end
|
57
|
-
|
58
59
|
end
|
59
60
|
|
60
61
|
def get_link(lib, version)
|
@@ -99,14 +100,17 @@ else
|
|
99
100
|
end
|
100
101
|
|
101
102
|
options.libs.each { |lib|
|
102
|
-
if !libs_cached.nil? && !libs_cached[lib].nil? && libs_cached[lib]['expired'] < Time.now
|
103
|
+
if !libs_cached.nil? && !libs_cached[lib].nil? && Time.at(libs_cached[lib]['expired']) < Time.now
|
103
104
|
libs_versions[lib] = libs_cached[lib]
|
104
105
|
else
|
105
|
-
|
106
|
+
# Fetch using net/http
|
107
|
+
response_text = Net::HTTP.get(URI("https://api.cdnjs.com/libraries/#{lib}?fields=assets"))
|
108
|
+
# response = JSON.parse HTTP.get("https://api.cdnjs.com/libraries/#{lib}?fields=assets").body
|
109
|
+
response = JSON.parse response_text
|
106
110
|
unless response['assets'].nil?
|
107
111
|
libs_versions[lib] = Hash.new
|
108
112
|
libs_versions[lib]['version'] = Array.new
|
109
|
-
libs_versions[lib]['expired'] = Time.now + CACHE_EXPIRATION_PERIOD
|
113
|
+
libs_versions[lib]['expired'] = Time.now.to_i + CACHE_EXPIRATION_PERIOD
|
110
114
|
response['assets'].each_with_index { |asset, index|
|
111
115
|
# first version is a most actual
|
112
116
|
next if index == 0
|
@@ -118,7 +122,7 @@ options.libs.each { |lib|
|
|
118
122
|
File.write(DATA_STORE_FILENAME, libs_cached.merge(libs_versions).to_yaml)
|
119
123
|
|
120
124
|
process = StatModule::Process.new('WebPuc')
|
121
|
-
process.version =
|
125
|
+
# TODO: process.version = ...
|
122
126
|
process.description = 'Validate your web project uses the latest CSS & JS includes.'
|
123
127
|
process.maintainer = 'William Entriken'
|
124
128
|
process.email = 'github.com@phor.net'
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-puc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Entriken
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '12'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '12'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -30,42 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: http
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.5'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.5'
|
54
|
+
version: '5.1'
|
69
55
|
description: Validate your web project uses the latest CSS & JS includes
|
70
56
|
email: github.com@phor.net
|
71
57
|
executables:
|
@@ -79,7 +65,7 @@ homepage: https://github.com/fulldecent/web-puc
|
|
79
65
|
licenses:
|
80
66
|
- MIT
|
81
67
|
metadata: {}
|
82
|
-
post_install_message:
|
68
|
+
post_install_message:
|
83
69
|
rdoc_options: []
|
84
70
|
require_paths:
|
85
71
|
- lib
|
@@ -94,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
80
|
- !ruby/object:Gem::Version
|
95
81
|
version: '0'
|
96
82
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
-
signing_key:
|
83
|
+
rubygems_version: 3.3.11
|
84
|
+
signing_key:
|
99
85
|
specification_version: 4
|
100
86
|
summary: Web Package Update Checker
|
101
87
|
test_files: []
|