brandeins 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile.lock +4 -7
- data/README.md +40 -12
- data/Rakefile +2 -2
- data/Vagrantfile +99 -0
- data/brandeins.gemspec +1 -1
- data/lib/brandeins.rb +1 -0
- data/lib/brandeins/downloader.rb +3 -4
- data/lib/brandeins/errors.rb +5 -0
- data/lib/brandeins/merger/{templates → external}/base.rb +6 -2
- data/lib/brandeins/merger/{templates → external}/ghostscript_windows.rb +2 -2
- data/lib/brandeins/merger/{templates/pdftk_osx.rb → external/pdftk.rb} +2 -2
- data/lib/brandeins/merger/pdf_tools.rb +12 -28
- data/lib/brandeins/setup.rb +1 -1
- data/lib/brandeins/version.rb +1 -1
- metadata +8 -15
- data/lib/brandeins/merger/extensions.rb +0 -9
- data/lib/brandeins/merger/templates/osx.rb +0 -11
- data/lib/brandeins/merger/templates/windows.rb +0 -11
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brandeins (0.2.
|
4
|
+
brandeins (0.2.2)
|
5
5
|
nokogiri
|
6
6
|
prawn
|
7
7
|
rake
|
@@ -12,7 +12,6 @@ GEM
|
|
12
12
|
specs:
|
13
13
|
Ascii85 (1.0.2)
|
14
14
|
addressable (2.3.2)
|
15
|
-
afm (0.2.0)
|
16
15
|
columnize (0.3.6)
|
17
16
|
crack (0.3.2)
|
18
17
|
debugger (1.3.1)
|
@@ -24,15 +23,13 @@ GEM
|
|
24
23
|
debugger-ruby_core_source (1.1.8)
|
25
24
|
hashery (2.1.0)
|
26
25
|
nokogiri (1.5.6)
|
27
|
-
pdf-reader (1.
|
26
|
+
pdf-reader (1.2.0)
|
28
27
|
Ascii85 (~> 1.0.0)
|
29
|
-
afm (~> 0.2.0)
|
30
28
|
hashery (~> 2.0)
|
31
29
|
ruby-rc4
|
32
|
-
|
33
|
-
prawn (0.12.0)
|
30
|
+
prawn (1.0.0.rc1)
|
34
31
|
pdf-reader (>= 0.9.0)
|
35
|
-
ttfunk (~> 1.0.
|
32
|
+
ttfunk (~> 1.0.3)
|
36
33
|
rake (10.0.3)
|
37
34
|
ruby-rc4 (0.1.5)
|
38
35
|
thor (0.17.0)
|
data/README.md
CHANGED
@@ -1,26 +1,54 @@
|
|
1
|
-
|
1
|
+
[![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/grekko/brandeins) [![Gem Version](https://badge.fury.io/rb/brandeins.png)](http://badge.fury.io/rb/brandeins) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/grekko/brandeins)
|
2
|
+
|
3
|
+
BrandEins Downloader
|
4
|
+
--------
|
2
5
|
|
3
6
|
BrandEins Downloader is a command line tool to download former volumes
|
4
|
-
of the german
|
5
|
-
are available
|
6
|
-
|
7
|
+
of the german economy magazine [Brand Eins](http://www.brandeins.de/).
|
8
|
+
The articles are available on the websites archive and BrandEins Downloader
|
9
|
+
helps a little out to download all single fragmented files and merges them
|
10
|
+
into a single pdf.
|
7
11
|
|
8
12
|
|
9
|
-
|
13
|
+
Requirements
|
14
|
+
--------
|
10
15
|
BrandEins Downloader uses [*pdftk*](http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) and depends on *ruby*, *rubygems*, and
|
11
16
|
several ruby libraries (that you can get through rubygems)
|
12
17
|
|
13
18
|
|
14
|
-
|
15
|
-
|
19
|
+
Install
|
20
|
+
--------
|
21
|
+
|
22
|
+
```bash
|
23
|
+
gem install brandeins
|
24
|
+
```
|
25
|
+
|
26
|
+
|
27
|
+
Usage
|
28
|
+
--------
|
29
|
+
Download just a certain single magazine
|
30
|
+
|
31
|
+
```bash
|
32
|
+
brandeins download --path=/Path/where/to/download/the/files --year=2011 --volume=5
|
33
|
+
```
|
34
|
+
|
35
|
+
Download the whole collection of a year
|
36
|
+
|
37
|
+
```bash
|
38
|
+
brandeins download --path=/Path/where/to/download/the/files --year=2011 --all
|
39
|
+
```
|
16
40
|
|
17
41
|
|
18
|
-
|
42
|
+
Development
|
43
|
+
--------
|
44
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
45
|
+
- Please create a topic branch for every separate change you make.
|
46
|
+
- Update the README.
|
19
47
|
|
20
|
-
Download just one magazine
|
21
48
|
|
22
|
-
|
49
|
+
### Author
|
50
|
+
[Gregory Igelmund](https://github.com/grekko) [(@grekko)](https://twitter.com/grekko)
|
23
51
|
|
24
|
-
Download the whole collecion of a certain year
|
25
52
|
|
26
|
-
|
53
|
+
### Contributors
|
54
|
+
[Thorben Schröder](https://github.com/walski)
|
data/Rakefile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rake/testtask'
|
3
|
-
require './lib/brandeins/version'
|
4
3
|
|
5
4
|
Rake::TestTask.new do |t|
|
6
5
|
t.test_files = FileList['test/*_test.rb', 'specs/*_spec.rb']
|
@@ -8,11 +7,12 @@ Rake::TestTask.new do |t|
|
|
8
7
|
end
|
9
8
|
|
10
9
|
task :install do
|
10
|
+
require './lib/brandeins/version'
|
11
11
|
sh "gem install ./pkg/brandeins-#{BrandEins::VERSION}.gem"
|
12
12
|
end
|
13
13
|
|
14
14
|
task publish: [ :build ] do
|
15
|
-
version
|
15
|
+
require './lib/brandeins/version'
|
16
16
|
sh "gem push ./pkg/brandeins-#{BrandEins::VERSION}.gem"
|
17
17
|
end
|
18
18
|
|
data/Vagrantfile
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant::Config.run do |config|
|
5
|
+
# All Vagrant configuration is done here. The most common configuration
|
6
|
+
# options are documented and commented below. For a complete reference,
|
7
|
+
# please see the online documentation at vagrantup.com.
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "archlinux"
|
11
|
+
|
12
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
13
|
+
# doesn't already exist on the user's system.
|
14
|
+
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
15
|
+
|
16
|
+
# Boot with a GUI so you can see the screen. (Default is headless)
|
17
|
+
# config.vm.boot_mode = :gui
|
18
|
+
|
19
|
+
# Assign this VM to a host-only network IP, allowing you to access it
|
20
|
+
# via the IP. Host-only networks can talk to the host machine as well as
|
21
|
+
# any other machines on the same network, but cannot be accessed (through this
|
22
|
+
# network interface) by any external networks.
|
23
|
+
# config.vm.network :hostonly, "192.168.33.10"
|
24
|
+
|
25
|
+
# Assign this VM to a bridged network, allowing you to connect directly to a
|
26
|
+
# network using the host's network device. This makes the VM appear as another
|
27
|
+
# physical device on your network.
|
28
|
+
# config.vm.network :bridged
|
29
|
+
|
30
|
+
# Forward a port from the guest to the host, which allows for outside
|
31
|
+
# computers to access the VM, whereas host only networking does not.
|
32
|
+
# config.vm.forward_port 80, 8080
|
33
|
+
|
34
|
+
# Share an additional folder to the guest VM. The first argument is
|
35
|
+
# an identifier, the second is the path on the guest to mount the
|
36
|
+
# folder, and the third is the path on the host to the actual folder.
|
37
|
+
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
|
38
|
+
|
39
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
40
|
+
# are contained in a directory path relative to this Vagrantfile.
|
41
|
+
# You will need to create the manifests directory and a manifest in
|
42
|
+
# the file archlinux.pp in the manifests_path directory.
|
43
|
+
#
|
44
|
+
# An example Puppet manifest to provision the message of the day:
|
45
|
+
#
|
46
|
+
# # group { "puppet":
|
47
|
+
# # ensure => "present",
|
48
|
+
# # }
|
49
|
+
# #
|
50
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
51
|
+
# #
|
52
|
+
# # file { '/etc/motd':
|
53
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
54
|
+
# # Managed by Puppet.\n"
|
55
|
+
# # }
|
56
|
+
#
|
57
|
+
# config.vm.provision :puppet do |puppet|
|
58
|
+
# puppet.manifests_path = "manifests"
|
59
|
+
# puppet.manifest_file = "archlinux.pp"
|
60
|
+
# end
|
61
|
+
|
62
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
63
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
64
|
+
# some recipes and/or roles.
|
65
|
+
#
|
66
|
+
# config.vm.provision :chef_solo do |chef|
|
67
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
68
|
+
# chef.roles_path = "../my-recipes/roles"
|
69
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
70
|
+
# chef.add_recipe "mysql"
|
71
|
+
# chef.add_role "web"
|
72
|
+
#
|
73
|
+
# # You may also specify custom JSON attributes:
|
74
|
+
# chef.json = { :mysql_password => "foo" }
|
75
|
+
# end
|
76
|
+
|
77
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
78
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
79
|
+
#
|
80
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
81
|
+
# ORGNAME in the URL and validation key.
|
82
|
+
#
|
83
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
84
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
85
|
+
# validation key to validation.pem.
|
86
|
+
#
|
87
|
+
# config.vm.provision :chef_client do |chef|
|
88
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
89
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# If you're using the Opscode platform, your validator client is
|
93
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
94
|
+
#
|
95
|
+
# IF you have your own Chef Server, the default validation client name is
|
96
|
+
# chef-validator, unless you changed the configuration.
|
97
|
+
#
|
98
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
99
|
+
end
|
data/brandeins.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
|
3
|
+
require File.expand_path("../lib/brandeins/version.rb", __FILE__) unless defined? BrandEins::Version
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "brandeins"
|
data/lib/brandeins.rb
CHANGED
data/lib/brandeins/downloader.rb
CHANGED
@@ -69,12 +69,11 @@ module BrandEins
|
|
69
69
|
pdf_files = download(pdf_links)
|
70
70
|
|
71
71
|
pdf_cover = create_cover_pdf(year, volume)
|
72
|
-
pdf_files = pdf_files.
|
72
|
+
pdf_files = pdf_files.unshift(pdf_cover)
|
73
73
|
|
74
|
-
if
|
74
|
+
if @pdftool
|
75
75
|
target_pdf_path = "#{@dl_dir}/#{target_pdf}"
|
76
|
-
@pdftool.merge_pdf_files(pdf_files, target_pdf_path)
|
77
|
-
cleanup
|
76
|
+
@pdftool.merge_pdf_files(pdf_files, target_pdf_path) && cleanup
|
78
77
|
else
|
79
78
|
puts 'brandeins wont merge the single pdf files since it didnt find an appropriate pdf tool' if $BE_VERBOSE
|
80
79
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module BrandEins
|
4
4
|
module Merger
|
5
|
-
module
|
5
|
+
module External
|
6
6
|
|
7
7
|
class Base
|
8
8
|
|
@@ -29,7 +29,11 @@ module BrandEins
|
|
29
29
|
|
30
30
|
private
|
31
31
|
def _exec (cmd)
|
32
|
-
IO.popen(cmd)
|
32
|
+
IO.popen(cmd) do |io|
|
33
|
+
io.each do |line|
|
34
|
+
puts line
|
35
|
+
end
|
36
|
+
end
|
33
37
|
end
|
34
38
|
|
35
39
|
def _cmd_available? (cmd, args)
|
@@ -1,45 +1,29 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'brandeins/merger/
|
3
|
-
require 'brandeins/merger/
|
4
|
-
require 'brandeins/merger/
|
5
|
-
require 'brandeins/merger/templates/pdftk_osx'
|
6
|
-
require 'brandeins/merger/templates/windows'
|
7
|
-
require 'brandeins/merger/templates/ghostscript_windows'
|
2
|
+
require 'brandeins/merger/external/base'
|
3
|
+
require 'brandeins/merger/external/pdftk'
|
4
|
+
require 'brandeins/merger/external/ghostscript_windows'
|
8
5
|
|
9
6
|
module BrandEins
|
10
7
|
module Merger
|
11
8
|
class PdfTools
|
12
9
|
|
13
10
|
class << self
|
14
|
-
def get_pdf_tool(env =
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
init_pdf_tools and return_pdf_tool
|
11
|
+
def get_pdf_tool(env = {})
|
12
|
+
env = env || {}
|
13
|
+
env[:os] ||= RUBY_PLATFORM
|
14
|
+
get_klass_for_external(env).new
|
19
15
|
end
|
20
16
|
|
21
17
|
private
|
22
|
-
def init_pdf_tools
|
23
|
-
template_group = choose_template_group
|
24
|
-
@pdf_tools = get_subclasses template_group
|
25
|
-
end
|
26
|
-
|
27
|
-
def choose_template_group
|
28
|
-
return BrandEins::Merger::Templates::Windows if @env[:os].include? 'w32'
|
29
|
-
return BrandEins::Merger::Templates::OSX if @env[:os].include? 'darwin'
|
30
|
-
end
|
31
18
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
19
|
+
def get_klass_for_external(env)
|
20
|
+
if env[:os].include? 'w32'
|
21
|
+
BrandEins::Merger::External::GhostscriptWindows
|
22
|
+
else
|
23
|
+
BrandEins::Merger::External::Pdftk
|
36
24
|
end
|
37
25
|
end
|
38
26
|
|
39
|
-
def return_pdf_tool
|
40
|
-
@pdf_tools.first.new if @pdf_tools.length > 0
|
41
|
-
end
|
42
|
-
|
43
27
|
end
|
44
28
|
|
45
29
|
end
|
data/lib/brandeins/setup.rb
CHANGED
data/lib/brandeins/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brandeins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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-
|
12
|
+
date: 2013-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -91,18 +91,17 @@ files:
|
|
91
91
|
- README.md
|
92
92
|
- Rakefile
|
93
93
|
- TODOS.md
|
94
|
+
- Vagrantfile
|
94
95
|
- bin/brandeins
|
95
96
|
- brandeins.gemspec
|
96
97
|
- lib/brandeins.rb
|
97
98
|
- lib/brandeins/cli.rb
|
98
99
|
- lib/brandeins/downloader.rb
|
99
|
-
- lib/brandeins/
|
100
|
+
- lib/brandeins/errors.rb
|
101
|
+
- lib/brandeins/merger/external/base.rb
|
102
|
+
- lib/brandeins/merger/external/ghostscript_windows.rb
|
103
|
+
- lib/brandeins/merger/external/pdftk.rb
|
100
104
|
- lib/brandeins/merger/pdf_tools.rb
|
101
|
-
- lib/brandeins/merger/templates/base.rb
|
102
|
-
- lib/brandeins/merger/templates/ghostscript_windows.rb
|
103
|
-
- lib/brandeins/merger/templates/osx.rb
|
104
|
-
- lib/brandeins/merger/templates/pdftk_osx.rb
|
105
|
-
- lib/brandeins/merger/templates/windows.rb
|
106
105
|
- lib/brandeins/parser/archive_site.rb
|
107
106
|
- lib/brandeins/parser/article_site.rb
|
108
107
|
- lib/brandeins/parser/magazine_site.rb
|
@@ -134,21 +133,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
133
|
- - ! '>='
|
135
134
|
- !ruby/object:Gem::Version
|
136
135
|
version: '0'
|
137
|
-
segments:
|
138
|
-
- 0
|
139
|
-
hash: 1329463463916465473
|
140
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
137
|
none: false
|
142
138
|
requirements:
|
143
139
|
- - ! '>='
|
144
140
|
- !ruby/object:Gem::Version
|
145
141
|
version: '0'
|
146
|
-
segments:
|
147
|
-
- 0
|
148
|
-
hash: 1329463463916465473
|
149
142
|
requirements: []
|
150
143
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.8.
|
144
|
+
rubygems_version: 1.8.25
|
152
145
|
signing_key:
|
153
146
|
specification_version: 3
|
154
147
|
summary: BrandEins gem allows you to download past volumes of the Brand Eins magazine
|