cdnget 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33c37d02737ffd6d7f382b0d9646a627046caf41
4
- data.tar.gz: 1bf0171c024ebd5cd726b63e14054ad827494311
3
+ metadata.gz: f08c962b34e126b4223544721dccd62fdfc242fc
4
+ data.tar.gz: f461d62a21806c43c138c17a0fc69fb3df5a2f6c
5
5
  SHA512:
6
- metadata.gz: f284b04b033d2d17fcc51c03d367e45b35b45e0172c1d65f79c31f728f15ab990f39422609dca01148b4a9cb1da3538dfe1a3c0b6a4a2910785b28252f95d6cc
7
- data.tar.gz: 8ff04a6ec36d7466aadcdd2b07b37683addf4dacb172e27a988396444a5ea59b5f4ffa928eadb0ffa83f1090e05ed9856678ed5d83a1d6bb39daec110d675a06
6
+ metadata.gz: c9862859cc9a25407431036702dbbb7fddc4419b2306c9c5f87a6027f4fa650409c549bb14939c8844d85d55ef5e6e4b939788c5550faada3074a899d2108029
7
+ data.tar.gz: 9aea1f38fcbb4e332d97c5993905d7d18761f57769fb489fb2aaa056bfa6cc4f71294ef9be50d7df7ef5088c7432a7465397ef2f2bbdd3de656f8602984712b2
data/CHANGES.md CHANGED
@@ -2,6 +2,12 @@ Changes
2
2
  =======
3
3
 
4
4
 
5
+ Release 1.0.1 (2021-10-02)
6
+ ---------------------------
7
+
8
+ * Skip downloading '.DS_Store' files from unpkg.com (due to 403 Forbidden)
9
+
10
+
5
11
  Release 1.0.0 (2021-10-02)
6
12
  ---------------------------
7
13
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  CDNget
2
2
  ======
3
3
 
4
- ($Release: 1.0.0 $)
4
+ ($Release: 1.0.1 $)
5
5
 
6
6
  CDNget is a utility script to download files from CDNJS, jsDelivr, UNPKG or Google.
7
7
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ###
4
4
 
5
- RELEASE = '$Release: 1.0.0 $'.split()[1]
5
+ RELEASE = '$Release: 1.0.1 $'.split()[1]
6
6
  COPYRIGHT = 'copyright(c) 2016 kuwata-lab.com all rights reserved'
7
7
  LICENSE = 'MIT License'
8
8
 
data/bin/cdnget CHANGED
@@ -30,7 +30,7 @@ require 'pp'
30
30
  module CDNGet
31
31
 
32
32
 
33
- RELEASE = '$Release: 1.0.0 $'.split()[1]
33
+ RELEASE = '$Release: 1.0.1 $'.split()[1]
34
34
 
35
35
 
36
36
  class HttpConnection
@@ -137,8 +137,15 @@ module CDNGet
137
137
  target_dir = d[:destdir] ? File.join(basedir, d[:destdir]) \
138
138
  : File.join(basedir, library, version)
139
139
  http = nil
140
+ skipfile = d[:skipfile] # ex: /\.DS_Store\z/
140
141
  d[:files].each do |file|
141
142
  filepath = File.join(target_dir, file)
143
+ #
144
+ if skipfile && file =~ skipfile
145
+ puts "#{filepath} ... Skipped" # for example, skip '.DS_Store' files
146
+ next
147
+ end
148
+ #
142
149
  if filepath.end_with?('/')
143
150
  if File.exist?(filepath)
144
151
  puts "#{filepath} ... Done (Already exists)" unless quiet
@@ -149,6 +156,7 @@ module CDNGet
149
156
  end
150
157
  next
151
158
  end
159
+ #
152
160
  dirpath = File.dirname(filepath)
153
161
  print "#{filepath} ..." unless quiet
154
162
  url = File.join(d[:baseurl], file) # not use URI.join!
@@ -471,6 +479,7 @@ module CDNGet
471
479
  baseurl: baseurl,
472
480
  default: jdata["default"],
473
481
  destdir: "#{library}@#{version}",
482
+ skipfile: /\.DS_Store\z/, # downloading '.DS_Store' from UNPKG results in 403
474
483
  })
475
484
  return dict
476
485
  end
data/cdnget.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |o|
4
4
  o.name = "cdnget"
5
- o.version = '$Release: 1.0.0 $'.split()[1]
5
+ o.version = '$Release: 1.0.1 $'.split()[1]
6
6
  o.authors = ["makoto kuwata"]
7
7
  o.email = ["kwa@kuwata-lab.com"]
8
8
 
data/lib/cdnget.rb CHANGED
@@ -30,7 +30,7 @@ require 'pp'
30
30
  module CDNGet
31
31
 
32
32
 
33
- RELEASE = '$Release: 1.0.0 $'.split()[1]
33
+ RELEASE = '$Release: 1.0.1 $'.split()[1]
34
34
 
35
35
 
36
36
  class HttpConnection
@@ -137,8 +137,15 @@ module CDNGet
137
137
  target_dir = d[:destdir] ? File.join(basedir, d[:destdir]) \
138
138
  : File.join(basedir, library, version)
139
139
  http = nil
140
+ skipfile = d[:skipfile] # ex: /\.DS_Store\z/
140
141
  d[:files].each do |file|
141
142
  filepath = File.join(target_dir, file)
143
+ #
144
+ if skipfile && file =~ skipfile
145
+ puts "#{filepath} ... Skipped" # for example, skip '.DS_Store' files
146
+ next
147
+ end
148
+ #
142
149
  if filepath.end_with?('/')
143
150
  if File.exist?(filepath)
144
151
  puts "#{filepath} ... Done (Already exists)" unless quiet
@@ -149,6 +156,7 @@ module CDNGet
149
156
  end
150
157
  next
151
158
  end
159
+ #
152
160
  dirpath = File.dirname(filepath)
153
161
  print "#{filepath} ..." unless quiet
154
162
  url = File.join(d[:baseurl], file) # not use URI.join!
@@ -471,6 +479,7 @@ module CDNGet
471
479
  baseurl: baseurl,
472
480
  default: jdata["default"],
473
481
  destdir: "#{library}@#{version}",
482
+ skipfile: /\.DS_Store\z/, # downloading '.DS_Store' from UNPKG results in 403
474
483
  })
475
484
  return dict
476
485
  end
data/test/cdnget_test.rb CHANGED
@@ -1023,6 +1023,28 @@ END
1023
1023
  end
1024
1024
 
1025
1025
 
1026
+ describe "cdnget CDN bulma 0.9.3 dir" do
1027
+
1028
+ before do
1029
+ @tmpdir = "tmpdir1"
1030
+ Dir.mkdir @tmpdir
1031
+ end
1032
+
1033
+ after do
1034
+ FileUtils.rm_rf @tmpdir
1035
+ end
1036
+
1037
+ it "(unpkg) skips '.DS_Store' files." do
1038
+ sout, serr = capture_io do()
1039
+ CDNGet::Main.new("cdnget").run("unpkg", "bulma", "0.9.3", @tmpdir)
1040
+ end
1041
+ ok {sout}.include?("#{@tmpdir}/bulma@0.9.3/sass/.DS_Store ... Skipped\n")
1042
+ ok {sout}.include?("#{@tmpdir}/bulma@0.9.3/sass/base/.DS_Store ... Skipped\n")
1043
+ end
1044
+
1045
+ end
1046
+
1047
+
1026
1048
  describe "cdnget CDN jquery 2.2.0 foo bar" do
1027
1049
 
1028
1050
  it "results in argument error." do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdnget
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - makoto kuwata