wwdcdownloader 20.13.3 → 20.13.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/wwdcdownloader.rb +32 -21
- data/wwdcdownloader.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
20.13.
|
1
|
+
20.13.4
|
data/lib/wwdcdownloader.rb
CHANGED
@@ -87,25 +87,32 @@ class WWDCDownloader
|
|
87
87
|
filename = book_res["sampleCode"]
|
88
88
|
url = "#{code_base_url}/#{filename}"
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
did_download = download_file(url, filename, dest_dir, duplicates_ok)
|
91
|
+
end
|
92
|
+
end
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
94
|
+
did_download
|
95
|
+
end
|
96
|
+
|
97
|
+
def download_file(url, filename, dest_dir, duplicates_ok = true)
|
98
|
+
did_download = false
|
99
|
+
if duplicates_ok or !self.downloaded_files.include?(url)
|
100
|
+
# remember what we downloaded
|
101
|
+
self.downloaded_files << url
|
102
|
+
|
103
|
+
puts " Downloading #{url}"
|
104
|
+
begin
|
105
|
+
self.mech.get(url) do |downloaded_file|
|
106
|
+
open(dest_dir + "/" + filename, 'wb') do |file|
|
107
|
+
file.write(downloaded_file.body)
|
104
108
|
end
|
105
|
-
|
106
|
-
puts " Already downloaded this file, skipping."
|
109
|
+
did_download = true
|
107
110
|
end
|
111
|
+
rescue Exception => e
|
112
|
+
puts " Download failed #{e}"
|
108
113
|
end
|
114
|
+
elsif !duplicates_ok
|
115
|
+
puts " Already downloaded this file, skipping."
|
109
116
|
end
|
110
117
|
|
111
118
|
did_download
|
@@ -114,17 +121,21 @@ class WWDCDownloader
|
|
114
121
|
def download_sample_code_for_page(a_page_url, dest_dir, duplicates_ok = true)
|
115
122
|
self.mech.get(a_page_url) do |page|
|
116
123
|
has_samplecode = false
|
117
|
-
page.links_with(:href =>
|
124
|
+
page.links_with(:href => /\.zip/ ).each do |link|
|
118
125
|
has_samplecode = true
|
119
|
-
code_base_url = File.dirname(link.href)
|
120
|
-
|
121
|
-
|
126
|
+
#code_base_url = File.dirname(link.href)
|
127
|
+
#download_sample_code_from_book_json("#{code_base_url}/book.json", code_base_url, dest_dir, duplicates_ok)
|
128
|
+
if link.href =~ /(\w+\.zip)$/
|
129
|
+
download_file(link.href, $1, dest_dir, duplicates_ok)
|
130
|
+
else
|
131
|
+
has_samplecode = false
|
132
|
+
end
|
122
133
|
end
|
123
134
|
|
124
135
|
if !has_samplecode
|
125
136
|
puts " Sorry, this session doesn't have samplecode, cleaning up."
|
126
137
|
begin
|
127
|
-
Dir.delete(
|
138
|
+
Dir.delete(dest_dir)
|
128
139
|
rescue
|
129
140
|
end
|
130
141
|
end
|
@@ -240,7 +251,7 @@ class WWDCDownloader
|
|
240
251
|
'wwdc2013-assets'
|
241
252
|
end
|
242
253
|
|
243
|
-
w = WWDCDownloader.new(dl_dir, '2013-06-
|
254
|
+
w = WWDCDownloader.new(dl_dir, '2013-06-01')
|
244
255
|
w.login
|
245
256
|
w.load
|
246
257
|
return 0
|
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.13.
|
8
|
+
s.version = "20.13.4"
|
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 = "2013-06-
|
12
|
+
s.date = "2013-06-26"
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wwdcdownloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 20.13.
|
4
|
+
version: 20.13.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
segments:
|
159
159
|
- 0
|
160
|
-
hash:
|
160
|
+
hash: -3064146426134169573
|
161
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
162
|
none: false
|
163
163
|
requirements:
|