wwdcdownloader 20.15.0 → 20.15.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: 0fe0443938f3d059a6f274bf211800297bcf90c1
4
- data.tar.gz: e7b3467543be7066b09be3d4e6644b1a66ee7210
3
+ metadata.gz: a2d71fcde45c66981ed68168710f4085498102db
4
+ data.tar.gz: 181c01fccaae06aee0d91be050db109260d5e5d0
5
5
  SHA512:
6
- metadata.gz: fbd64abd2413b12da383cb42b60e24cf510697c94208a7b83dd5471f562fce94b45d6e278489f0a43ea040e71132ad7306d27bfc9bb9328c11b288d2b9de00c1
7
- data.tar.gz: f8861a8f33c8cff7f76e53624fd360f7164b97e66c62d77174b22340e855d23d32d85db82d8611ab833d1c418ad46de260eac5089c8c28db0c82fcc9d9be75ca
6
+ metadata.gz: aa1d3f05932f400bd2fa843eea5403553961b1605d70122ff9116a0df540ce5c510062c008356d923ee8151320fc64dac312eb071c9f199fecfd0562c3e0c519
7
+ data.tar.gz: 7a9f32527580fa232b45c65292ea51bb5329d04ce1bb0ff1f3a601f7a2503b023d3eeb5a3cb3ce0ba49aeb4bb1795f49a044de0f559f877335a82beeed8588a5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 20.15.0
1
+ 20.15.1
@@ -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.exists?(dir)
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
- if duplicates_ok or !self.downloaded_files.include?(url)
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(dest_dir + "/" + filename, 'wb') do |file|
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 lib
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 )
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "wwdcdownloader"
8
- s.version = "20.15.0"
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-06-10"
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.0
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-06-10 00:00:00.000000000 Z
11
+ date: 2015-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json