brandeins-dl 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module BrandEins
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/brandeins-dl.rb CHANGED
@@ -33,12 +33,13 @@ module BrandEins
33
33
  @url = "http://www.brandeins.de"
34
34
  @archive = ArchiveSite.new
35
35
  @dl_dir = path
36
+ @tmp_dir = path + "/tmp"
36
37
 
37
38
  check_download_path
38
39
  end
39
40
 
40
41
  def check_download_path
41
- Dir.mkdir(@dl_dir) unless File.exists?(@dl_dir)
42
+ FileUtils.mkdir_p @tmp_dir unless File.exists?(@tmp_dir)
42
43
  end
43
44
 
44
45
  def get_magazines_of_year(year = 2000)
@@ -73,7 +74,7 @@ module BrandEins
73
74
  end
74
75
 
75
76
  def process_pdf_links(pdf_links, target_pdf)
76
- pdf_downloader = PDFDownloader.new(pdf_links, @dl_dir)
77
+ pdf_downloader = PDFDownloader.new(pdf_links, @tmp_dir)
77
78
  pdf_files = pdf_downloader.download_all
78
79
  merge_pdfs(pdf_files, target_pdf)
79
80
  end
@@ -85,7 +86,7 @@ module BrandEins
85
86
  end
86
87
 
87
88
  def cleanup
88
- FileUtils.rm_r Dir.glob("#{@dl_dir}/*")
89
+ FileUtils.rm_r @tmp_dir
89
90
  end
90
91
 
91
92
  class PDFDownloader
@@ -226,3 +227,7 @@ module BrandEins
226
227
 
227
228
  end
228
229
  end
230
+
231
+ b1 = BrandEins::Downloader.new "/Users/gregoryigelmund/Desktop/tmp"
232
+ b1.get_magazine(2012, 1)
233
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: brandeins-dl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gregory Igelmund
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-04 00:00:00 Z
13
+ date: 2012-02-11 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake