wwdcdownloader 20.15.0 → 20.15.1
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/wwdcdownloader.rb +8 -6
- data/wwdcdownloader.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2d71fcde45c66981ed68168710f4085498102db
|
4
|
+
data.tar.gz: 181c01fccaae06aee0d91be050db109260d5e5d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa1d3f05932f400bd2fa843eea5403553961b1605d70122ff9116a0df540ce5c510062c008356d923ee8151320fc64dac312eb071c9f199fecfd0562c3e0c519
|
7
|
+
data.tar.gz: 7a9f32527580fa232b45c65292ea51bb5329d04ce1bb0ff1f3a601f7a2503b023d3eeb5a3cb3ce0ba49aeb4bb1795f49a044de0f559f877335a82beeed8588a5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
20.15.
|
1
|
+
20.15.1
|
data/lib/wwdcdownloader.rb
CHANGED
@@ -43,7 +43,7 @@ class WWDCDownloader
|
|
43
43
|
|
44
44
|
# Creates the given directory if it doesn't exist already.
|
45
45
|
def mkdir(dir)
|
46
|
-
if File.
|
46
|
+
if File.directory?(dir)
|
47
47
|
false
|
48
48
|
else
|
49
49
|
Dir.mkdir dir
|
@@ -93,14 +93,15 @@ class WWDCDownloader
|
|
93
93
|
|
94
94
|
def download_file(url, filename, dest_dir, duplicates_ok = true)
|
95
95
|
did_download = false
|
96
|
-
|
96
|
+
outfilename = dest_dir + "/" + filename
|
97
|
+
if duplicates_ok or (!File.exists?(outfilename) and !self.downloaded_files.include?(url))
|
97
98
|
# remember what we downloaded
|
98
99
|
self.downloaded_files << url
|
99
100
|
|
100
101
|
puts " Downloading #{url}"
|
101
102
|
begin
|
102
103
|
self.read_url(url) do |downloaded_file|
|
103
|
-
open(
|
104
|
+
open(outfilename, 'wb') do |file|
|
104
105
|
file.write(downloaded_file)
|
105
106
|
end
|
106
107
|
did_download = true
|
@@ -123,7 +124,8 @@ class WWDCDownloader
|
|
123
124
|
puts "Scraping the WWDC libraries..."
|
124
125
|
WWDC_LIBRARIES.each do |lib_hash|
|
125
126
|
lib = "#{lib_hash[:base]}#{lib_hash[:lib]}"
|
126
|
-
puts
|
127
|
+
puts
|
128
|
+
puts "Library #{lib}"
|
127
129
|
self.read_url(lib) do |body|
|
128
130
|
body = body.gsub("''", '""')
|
129
131
|
res = JSON.parse(body)
|
@@ -139,13 +141,13 @@ class WWDCDownloader
|
|
139
141
|
|
140
142
|
# get the files
|
141
143
|
dirname = "#{dl_dir}/#{title.gsub(/\/|&|!|:/, '')}"
|
142
|
-
puts " Creating #{dirname}"
|
143
144
|
did_create_dir = mkdir(dirname)
|
145
|
+
puts " Created #{dirname}" if did_create_dir
|
144
146
|
|
145
147
|
segments = doc[9].split('/')
|
146
148
|
url = "#{lib_hash[:base]}/samplecode/#{segments[2]}/book.json"
|
147
149
|
|
148
|
-
puts url
|
150
|
+
#puts url
|
149
151
|
did_download = download_sample_code_from_book_json(url, "#{lib_hash[:base]}/samplecode/#{segments[2]}", dirname, false)
|
150
152
|
if !did_download and did_create_dir
|
151
153
|
Dir.delete( dirname )
|
data/wwdcdownloader.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "wwdcdownloader"
|
8
|
-
s.version = "20.15.
|
8
|
+
s.version = "20.15.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Johannes Fahrenkrug"]
|
12
|
-
s.date = "2015-
|
12
|
+
s.date = "2015-07-04"
|
13
13
|
s.description = "At each year's WWDC, Apple releases great sample projects. Unfortunately it is very tedious to manually download all these treasures through your browser. WWDC-Downloader solves this problem for you!"
|
14
14
|
s.email = "johannes@springenwerk.com"
|
15
15
|
s.executables = ["wwdcdownloader"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wwdcdownloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 20.15.
|
4
|
+
version: 20.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Fahrenkrug
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|