brandeins 0.3.0.pre → 0.3.0

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: c1c4cc751ae449333a24d1127535da306b200154
4
- data.tar.gz: d2a62acfbdef5f2c7f563edc342579bd156523e2
3
+ metadata.gz: 452e52a68913302848e8c2c5900f09f02a5c0a44
4
+ data.tar.gz: 42ad2272e2097b36fd48dc2e4da04d5e8f8dac3a
5
5
  SHA512:
6
- metadata.gz: 5120d2ceaa37925d19fa43ca96cf8f5709526c5d7cc368cb19ea1e2c5a520de90670cd5d6c81987919b321967199358621b835a8f0e8c8fdb075d70623f5a9ad
7
- data.tar.gz: f2a313a749fcd7cebb93822bace5242af17018ae64825e4f1c9d065ec13ec607633138cf6cdff29efe79bbdf3e663c93e985eef53e00d3b47c27ad96a5ee1185
6
+ metadata.gz: 8b5380e9beed64f0377e5bd1420006135ce72687b083d463fbdf7c3167487d3380d8ee8e7888dd538b03ad63ccf328f7c66b90601331a659b9e3bb303247db99
7
+ data.tar.gz: 26f3a6237cae2991dc5f188997d0c3655142393e81fa4a3c39e7c578c99018ed01589908a0cedf3d1fa0d86a5f52330ff8bdd90d16d02a019d796c9fad87413a
@@ -3,3 +3,12 @@ AllCops:
3
3
  - Rakefile
4
4
  Excludes:
5
5
  - vendor/**
6
+
7
+ AndOr:
8
+ Enabled: false
9
+
10
+ AssignmentInCondition:
11
+ Enabled: false
12
+
13
+ SingleLineBlockParams:
14
+ Enabled: false
@@ -1,5 +1,6 @@
1
1
  language: ruby
2
2
  script: "rake spec"
3
+ bundler_args: --without debug
3
4
  rvm:
4
5
  - 1.9.3
5
6
  - 2.0.0
data/Gemfile CHANGED
@@ -7,9 +7,7 @@ group :test do
7
7
  end
8
8
 
9
9
  group :debug do
10
- if RUBY_VERSION.split('.').first.to_i > 1
11
- gem 'byebug'
12
- end
10
+ gem 'byebug'
13
11
  end
14
12
 
15
13
  gemspec
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brandeins (0.3.0.pre)
4
+ brandeins (0.3.0)
5
5
  nokogiri
6
6
  prawn
7
7
  rake
data/Rakefile CHANGED
@@ -1,25 +1,19 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
2
  require 'rubocop/rake_task'
4
- require 'rspec/autorun'
3
+ require 'rspec/core/rake_task'
5
4
 
6
5
  Rubocop::RakeTask.new
7
-
8
- Rake::TestTask.new(:spec) do |t|
9
- t.pattern = 'spec/lib/**/*_spec.rb'
10
- t.verbose = true
11
- end
6
+ RSpec::Core::RakeTask.new(:spec)
12
7
 
13
8
  task :load_version_file do
14
9
  require_relative './lib/brandeins/version'
15
10
  end
16
11
 
17
12
  task install: [ :load_version_file ] do
18
- require_relative './lib/brandeins/version'
19
13
  sh "gem install ./pkg/brandeins-#{BrandEins::VERSION}.gem"
20
14
  end
21
15
 
22
- task install: [ :load_version_file, :build ] do
16
+ task publish: [ :load_version_file, :build ] do
23
17
  sh "gem push ./pkg/brandeins-#{BrandEins::VERSION}.gem"
24
18
  end
25
19
 
@@ -1,4 +1,5 @@
1
- # -*- encoding: utf-8 -*-
1
+ # encoding: utf-8
2
+
2
3
  $:.push File.expand_path("../lib", __FILE__)
3
4
  require File.expand_path("../lib/brandeins/version.rb", __FILE__) unless defined? BrandEins::Version
4
5
 
@@ -3,5 +3,6 @@
3
3
  require_relative 'brandeins/version'
4
4
  require_relative 'brandeins/config'
5
5
  require_relative 'brandeins/kiosk'
6
+ require_relative 'brandeins/cli'
6
7
 
7
8
  module BrandEins; end
@@ -8,7 +8,7 @@ require_relative '../brandeins'
8
8
  require_relative '../brandeins/utils/cli_option_parser'
9
9
 
10
10
  module BrandEins
11
- class CLI
11
+ class Cli
12
12
  include Singleton
13
13
 
14
14
  def self.run(args)
@@ -21,38 +21,55 @@ module BrandEins
21
21
  end
22
22
 
23
23
  def run
24
- options = BrandEins::CliOptionParser.parse(@args)
25
- if options.version
26
- puts BrandEins::VERSION
27
- return
28
- end
29
- if options.download
30
- path = options.path
31
- month = options.month
32
- year = options.year
33
- errors = validate_options(options)
34
- puts errors.join("\n") && return unless error.empty?
35
- download(path: path, month: month, yeaR: year)
36
- end
24
+ options = BrandEins::Utils::CliOptionParser.parse(@args)
25
+ abort 'Unknown command' unless %w[help version setup download].include? options.cmd
26
+ send options.cmd, options
27
+ end
28
+
29
+ def version(options)
30
+ puts BrandEins::VERSION
31
+ end
32
+
33
+ def help(options)
34
+ puts BrandEins::Utils::CliOptionParser.parser
35
+ end
36
+
37
+ def setup(options)
38
+ puts 'You need to install pdftk in order to merge the downloaded pdfs.'
39
+ puts 'Either download it from their website or use a package manager like'
40
+ puts 'homebrew to install it on your system.'
37
41
  end
38
42
 
39
- def download(path: nil, month: nil, year: nil)
40
- kiosk = BrandEins::Kiosk.new(path: path)
41
- kiosk.fetch_magazine(month: month, year: year)
43
+ def download(options)
44
+ errors = validate_options(options)
45
+ abort errors.join("\n") if errors.size > 0
46
+
47
+ month = options.month
48
+ year = options.year
49
+ kiosk = BrandEins::Kiosk.new(options.to_h)
50
+ kiosk.download_magazine(month, year)
42
51
  rescue BrandEins::Utils::Fetcher::ContentNotFetchedError => e
43
52
  puts "Download Error: #{e}\n\n"
44
53
  puts "#{e.backtrace.join('\n')}"
45
54
  end
46
55
 
47
- def validate_options
48
- errors = []
49
- if !(1..12).include? @options.month
50
- errors.push("Invalid month: Must be between 1 and 12")
56
+ def validate_options(options)
57
+ [].tap do |errors|
58
+ if !valid_month?(options.month)
59
+ errors.push('Invalid month: Must be between 1 and 12')
60
+ end
61
+ if !valid_year?(options.year)
62
+ errors.push("Invalid year: Must be between 2000 and #{Time.now.year}")
63
+ end
51
64
  end
52
- if !(2000..Time.now.year).include? @options.year
53
- errors.push("Invalid year: Must be between 2000 and #{Time.now.year}")
54
- end
55
- return errors
65
+ end
66
+
67
+ def valid_month?(month)
68
+ (1..12).include? month
69
+ end
70
+
71
+ def valid_year?(year)
72
+ (2000..Time.now.year).include? year
56
73
  end
57
74
 
58
75
  end
@@ -1,15 +1,18 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'pathname'
2
- # Access it like:
3
- # BrandEins::Config['base_uri']
4
- #
4
+
5
5
  module BrandEins
6
+ # Used to store and retrieve default settings
7
+ # Access it like:
8
+ # BrandEins::Config['base_uri']
6
9
  class Config
7
10
  BASE_URI = 'http://www.brandeins.de'
8
11
  ARCHIVE_URI = BASE_URI + '/archiv.html'
9
12
  BASE_PATH = Pathname.new(ENV['HOME']) + '.brandeins'
10
13
  CACHE_PATH = BASE_PATH + 'cache'
11
14
  TEMP_PATH = BASE_PATH + 'temp'
12
- CACHE_LIMIT_BYTES = 400 * 1024 ** 2
15
+ CACHE_LIMIT_BYTES = 400 * 1024**2
13
16
 
14
17
  def self.[](name)
15
18
  const_get(name.upcase)
@@ -1,10 +1,11 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'pathname'
2
4
  require 'fileutils'
3
5
 
4
6
  require_relative 'config'
5
7
  require_relative 'utils/fetcher'
6
8
  require_relative 'pages/archive'
7
- require_relative 'pages/archive'
8
9
  require_relative 'pages/cover'
9
10
  require_relative 'merger/pdf_tools'
10
11
 
@@ -13,7 +14,7 @@ module BrandEins
13
14
  class Kiosk
14
15
  attr_reader :target_path
15
16
 
16
- class InvalidPathError < StandardError; end
17
+ InvalidPathError = Class.new StandardError
17
18
 
18
19
  def initialize(opts = {})
19
20
  @target_path = opts.fetch(:path) { Pathname.new('.').realpath.to_s }
@@ -24,7 +25,7 @@ module BrandEins
24
25
 
25
26
  def create_directories_if_necessary
26
27
  cache_path.mkpath unless cache_path.exist?
27
- temp_path.mkpath unless temp_path.exist?
28
+ temp_path.mkpath unless temp_path.exist?
28
29
  end
29
30
 
30
31
  def set_opts_for_cli_output(opts)
@@ -35,23 +36,20 @@ module BrandEins
35
36
 
36
37
  def raise_if_path_inaccessible
37
38
  path = Pathname.new(@target_path)
38
- if !path.writable?
39
- raise InvalidPathError, 'Could not access the given path'
40
- end
39
+ path.writable? or raise InvalidPathError,
40
+ "Cannot access the given path: #{@target_path}"
41
41
  end
42
42
 
43
- def download_magazine(month: nil, year: nil)
44
- magazine = fetch_magazine(month: month, year: year)
43
+ def download_magazine(month, year)
44
+ cli.info "Downloading to: #{@target_path}"
45
+ magazine = fetch_magazine(month, year)
45
46
  cover_pdf_path = download_cover(magazine)
46
47
  article_pdf_paths = download_article_pdfs(magazine)
47
- magazine_pdf_files = article_pdfs.unshift(cover_pdf)
48
- merge_pdf_files(magazine_pdf_files)
49
- end
50
-
51
- def merge_pdf_files(pdf_files)
52
- magazine_file_path = magazine_file_path(month: month, year: year)
53
- merger.merge_pdf_files(pdf_files, magazine_file_path)
48
+ magazine_pdf_paths = article_pdf_paths.unshift(cover_pdf_path)
49
+ magazine_file_path = magazine_file_path(month, year)
50
+ merger.merge_pdf_files(magazine_pdf_paths, magazine_file_path)
54
51
  clear_temp_path
52
+ cli.info "Successfully downloaded: #{magazine_file_path}"
55
53
  magazine_file_path
56
54
  end
57
55
 
@@ -64,11 +62,11 @@ module BrandEins
64
62
  cover.save_to(temp_path)
65
63
  end
66
64
 
67
- def fetch_magazine(month: nil, year: nil)
68
- archive.magazine_for(month: month, year: year)
65
+ def fetch_magazine(month, year)
66
+ archive.magazine_for(month, year)
69
67
  end
70
68
 
71
- def magazine_file_path(month: nil, year: nil)
69
+ def magazine_file_path(month, year)
72
70
  Pathname.new(@target_path) + "brandeins-#{month}-#{year}.pdf"
73
71
  end
74
72
 
@@ -31,14 +31,14 @@ module BrandEins
31
31
  cli.error "Error when merging file: #{e.inspect}"
32
32
  return false
33
33
  end
34
- return true
34
+ true
35
35
  end
36
36
 
37
37
  def cli
38
38
  @cli ||= BrandEins::Utils::CliOutput.instance
39
39
  end
40
40
 
41
- def _exec (cmd)
41
+ def _exec(cmd)
42
42
  IO.popen(cmd) do |io|
43
43
  io.each do |line|
44
44
  puts line
@@ -46,13 +46,13 @@ module BrandEins
46
46
  end
47
47
  end
48
48
 
49
- def _cmd_available? (cmd, args)
49
+ def _cmd_available?(cmd, args)
50
50
  begin
51
51
  open("|#{cmd} #{args.join(' ')}").close
52
- rescue Exception
52
+ rescue Errno::ENOENT
53
53
  return false
54
54
  end
55
- return true
55
+ true
56
56
  end
57
57
  end
58
58
 
@@ -11,11 +11,11 @@ module BrandEins
11
11
  end
12
12
 
13
13
  def args
14
- ['-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite', '-sOutputFile=__target_pdf__', '__pdf_files__']
14
+ %w[ -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=__target_pdf__ __pdf_files__ ]
15
15
  end
16
16
 
17
17
  def noop
18
- ['--version']
18
+ %w[--version]
19
19
  end
20
20
 
21
21
  end
@@ -11,11 +11,11 @@ module BrandEins
11
11
  end
12
12
 
13
13
  def args
14
- ['__pdf_files__', 'output', '__target_pdf__']
14
+ %w[ __pdf_files__ output __target_pdf__ ]
15
15
  end
16
16
 
17
17
  def noop
18
- ['--version']
18
+ %w[ --version ]
19
19
  end
20
20
 
21
21
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require_relative 'external/base'
3
4
  require_relative 'external/pdftk'
4
5
  require_relative 'external/ghostscript_windows'
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'nokogiri'
4
- require 'english'
5
4
 
6
5
  require_relative '../config'
7
6
  require_relative '../pages/magazine'
@@ -24,28 +23,27 @@ module BrandEins
24
23
  attr_reader :html
25
24
 
26
25
  def initialize(opts = {})
27
- @html = opts.delete(:html)
26
+ @html = opts.fetch(:html, nil)
28
27
  @magazines = {}
29
28
  end
30
29
 
31
30
  def html
32
- cli.info "Loading the archive" do
31
+ cli.info 'Loading the archive' do
33
32
  @html ||= fetcher.fetch(archive_url)
34
33
  end
35
34
  rescue BrandEins::Utils::Fetcher::ContentNotFetchedError => e
36
- raise e, "Could not download the archiv.html (May be the URL changed?)\n=> Original error: #{e.message}", e.backtrace
35
+ message = 'Could not download the archiv.html (Maybe the URL changed?)'
36
+ raise e, message + "\n=> Original error: #{e.message}", e.backtrace
37
37
  end
38
38
 
39
39
  def magazines_for_year(year)
40
40
  @magazines[year] ||= parse_magazines_for_year(year)
41
41
  end
42
42
 
43
- def magazine_for(month: nil, year: nil)
43
+ def magazine_for(month, year)
44
44
  magazines_for_year(year)[month]
45
45
  end
46
46
 
47
- private
48
-
49
47
  def document
50
48
  @document ||= Nokogiri::HTML(html)
51
49
  end
@@ -67,7 +65,7 @@ module BrandEins
67
65
 
68
66
  def extract_magazine_month(figure)
69
67
  meta = figure.css('.meta').first
70
- meta.text.match(/(?:.+)(\d{2})\/(?:.+)/) && $LAST_PAREN_MATCH.to_i
68
+ meta.text.match(/(?:.+)(\d{2})\/(?:.+)/) and $+.to_i
71
69
  end
72
70
 
73
71
  def brandeins_url
@@ -6,6 +6,7 @@ require_relative '../config'
6
6
 
7
7
  module BrandEins
8
8
  module Pages
9
+ # Represents an article of a magazine
9
10
  class Article
10
11
 
11
12
  def initialize(html)
@@ -7,6 +7,7 @@ require_relative '../utils/fetcher'
7
7
 
8
8
  module BrandEins
9
9
  module Pages
10
+ # Represents the magazine cover
10
11
  class Cover
11
12
 
12
13
  def initialize(magazine)
@@ -23,7 +24,7 @@ module BrandEins
23
24
 
24
25
  def to_pdf
25
26
  cover_image = download_cover_image
26
- cover_pdf = create_cover_pdf(cover_image)
27
+ create_cover_pdf(cover_image)
27
28
  end
28
29
 
29
30
  def download_cover_image
@@ -47,7 +48,6 @@ module BrandEins
47
48
  return cover_file_path if File.exists? cover_file_path
48
49
  File.binwrite(cover_file_path, to_pdf)
49
50
  cover_file_path
50
- rescue BrandEins::Utils::Fetcher::ContentNotFetchedError => e
51
51
  end
52
52
 
53
53
  def cover_file_path_for_path(path)
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'english'
4
3
  require 'nokogiri'
5
4
 
6
5
  require_relative '../config'
@@ -25,9 +24,7 @@ module BrandEins
25
24
  class Magazine
26
25
 
27
26
  def initialize(opts = {})
28
- if opts.is_a? String
29
- opts = { html: opts }
30
- end
27
+ opts = { html: opts } if opts.is_a? String
31
28
  @html = opts[:html]
32
29
  @url = opts[:url]
33
30
  end
@@ -92,20 +89,16 @@ module BrandEins
92
89
  end
93
90
 
94
91
  def parse_year
95
- if issue_text.match /Ausgabe (?:.+)\/(.+)/
96
- $LAST_PAREN_MATCH.to_i
97
- end
92
+ issue_text.match(/Ausgabe (?:.+)\/(.+)/) and $+.to_i
98
93
  end
99
94
 
100
95
  def parse_month
101
- if issue_text.match /Ausgabe (.+)\/(?:.+)/
102
- $LAST_PAREN_MATCH.to_i
103
- end
96
+ issue_text.match(/Ausgabe (.+)\/(?:.+)/) and $+.to_i
104
97
  end
105
98
 
106
99
  def issue_text
107
100
  node = document.css('.current-issue h3').last
108
- text = node.children.first.text
101
+ node.children.first.text
109
102
  end
110
103
 
111
104
  def parse_url
@@ -132,12 +125,12 @@ module BrandEins
132
125
  def file_path_for_pdf(path, pdf_url)
133
126
  target_path = Pathname.new(path)
134
127
  target_path.mkpath
135
- file_path = target_path + file_name_for_pdf_url(pdf_url)
128
+ target_path + file_name_for_pdf_url(pdf_url)
136
129
  end
137
130
 
138
131
  def file_name_for_pdf_url(pdf_url)
139
- uri_path = URI(pdf_url).path
140
- file_name = File.basename(uri_path)
132
+ uri_path = URI(pdf_url).path
133
+ File.basename(uri_path)
141
134
  end
142
135
 
143
136
  def cli
@@ -1,40 +1,51 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'ostruct'
2
4
 
3
5
  module BrandEins
4
- class CliOptionParser
5
- def self.parse(args = ARGV)
6
- options = OpenStruct.new
7
- opt_parser = OptionParser.new do |opts|
8
- opts.banner = "Usage: brandeins download --month n --year n"
9
- opts.separator ""
10
-
11
- opts.on('-m MONTH', '--month month', Integer, "The publication month of the magazine. E.g. for may: '5'") do |month|
12
- options.month = month
13
- end
6
+ module Utils
7
+ # Used to parse Cli input
8
+ class CliOptionParser
9
+ def self.parse(args = ARGV)
10
+ options = OpenStruct.new
11
+ options.cmd = args.first
12
+ opt_parser = parser(options)
13
+ opt_parser.parse!(args)
14
+ options
15
+ end
14
16
 
15
- opts.on('-y YEAR', '--year YEAR', Integer, "The publication year of the magazine. E.g. the current year '#{Time.now.year}'") do |year|
16
- options.year = year
17
- end
17
+ def self.parser(options = {})
18
+ @@parser ||= begin
19
+ OptionParser.new do |opts|
20
+ opts.banner = 'Usage: brandeins download --path ~/Documents --month n --year n'
21
+ opts.separator ''
18
22
 
19
- opts.on('--path [PATH]', 'The path where to download the magazine to. Default is the current directory.') do |path|
20
- options.path = path
21
- end
23
+ opts.on('-m MONTH', '--month month', Integer, 'The publication month of the magazine. E.g. for may: "5"') do |month|
24
+ options.month = month
25
+ end
22
26
 
23
- opts.on('-h', '--help', 'Show this message') do |help|
24
- options.help = help
25
- end
27
+ opts.on('-y YEAR', '--year YEAR', Integer, "The publication year of the magazine. E.g. the current year '#{Time.now.year}'") do |year|
28
+ options.year = year
29
+ end
26
30
 
27
- opts.on('-v', '--verbose', 'Be verbose') do |verbose|
28
- options.verbose = verbose
29
- end
31
+ opts.on('--path [PATH]', 'The path where to download the magazine to. Default is the current directory.') do |path|
32
+ options.path = File.expand_path(path)
33
+ end
34
+
35
+ opts.on('-h', '--help', 'Show this message') do |help|
36
+ options.cmd = help
37
+ end
30
38
 
31
- opts.on('--version', 'Show the version') do |version|
32
- options.version = version
39
+ opts.on('-v', '--verbose', 'Be verbose') do |verbose|
40
+ options.verbose = verbose
41
+ end
42
+
43
+ opts.on('--version', 'Show the version') do |version|
44
+ options.cmd = version
45
+ end
46
+ end
33
47
  end
34
48
  end
35
-
36
- opt_parser.parse!(args)
37
- options
38
49
  end
39
50
  end
40
51
  end
@@ -1,8 +1,11 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'singleton'
2
4
  require 'io/console'
3
5
 
4
6
  module BrandEins
5
7
  module Utils
8
+ # Used to print status messages to the cli
6
9
  class CliOutput
7
10
  include Singleton
8
11
 
@@ -12,6 +12,7 @@ require_relative 'cli_output'
12
12
  module BrandEins
13
13
  module Utils
14
14
 
15
+ # Used as a centralized resource fetcher with a caching mechanism
15
16
  class Fetcher
16
17
  include Singleton
17
18
 
@@ -86,7 +87,10 @@ module BrandEins
86
87
  end
87
88
 
88
89
  def cache_size_in_bytes
89
- cache_files.reduce(0) { |sum, (file, _)| next unless file; sum += File.size?(file) || 0 }
90
+ cache_files.reduce(0) do |sum, (file, _)|
91
+ next unless file
92
+ sum += File.size?(file) || 0
93
+ end
90
94
  end
91
95
 
92
96
  def remove_oldest_cache_file
@@ -103,7 +107,13 @@ module BrandEins
103
107
  end
104
108
 
105
109
  def cache_files
106
- @cache_files ||= Hash[Dir[cache_path + './*'].map { |f| [ f, File.mtime(f) ] }]
110
+ @cache_files ||= begin
111
+ files = Dir[cache_path + './*']
112
+ files_with_mtime = files.map do |file_path|
113
+ [file_path, File.mtime(file_path)]
114
+ end
115
+ Hash[files_with_mtime]
116
+ end
107
117
  end
108
118
 
109
119
  def cli
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'singleton'
2
4
  require 'prawn'
3
5
 
@@ -5,12 +7,10 @@ require_relative './cli_output'
5
7
 
6
8
  module BrandEins
7
9
  module Utils
10
+ # Testing Prawn for merging pdfs
8
11
  class Merger
9
12
  include Singleton
10
13
 
11
- def initialize
12
- end
13
-
14
14
  def merge_pdf_files(pdf_file_paths, target_pdf)
15
15
  cli.info "Merging pdf files to: #{target_pdf}" do
16
16
  Prawn::Document.generate(target_pdf, pdf_options) do |pdf|
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  module BrandEins
2
- VERSION = '0.3.0.pre'
4
+ VERSION = '0.3.0'
3
5
  end
@@ -31,7 +31,7 @@ describe BrandEins::Kiosk do
31
31
  end
32
32
  end
33
33
 
34
- describe '#fetch_magazine(month: 1, year: 2013)' do
34
+ describe '#fetch_magazine(1, 2013)' do
35
35
  it 'returns a magzine object' do
36
36
  archive_html = load_fixture 'archive.html'
37
37
  stub_request(:get, BrandEins::Config['archive_uri']).
@@ -59,7 +59,7 @@ describe BrandEins::Kiosk do
59
59
 
60
60
 
61
61
  kiosk = BrandEins::Kiosk.new
62
- magazine = kiosk.fetch_magazine(month: 1, year: 2013)
62
+ magazine = kiosk.fetch_magazine(1, 2013)
63
63
  expect(magazine).to be_a BrandEins::Pages::Magazine
64
64
  end
65
65
  end
@@ -6,7 +6,7 @@ require_lib 'brandeins/pages/archive'
6
6
 
7
7
  describe BrandEins::Pages::Archive do
8
8
 
9
- describe 'magazine_for(month: 1, year: 2000)' do
9
+ describe 'magazine_for(1, 2000)' do
10
10
  it 'returns the magazine for a given month and year' do
11
11
  archive_html = load_fixture 'archive.html'
12
12
  archive = BrandEins::Pages::Archive.new(html: archive_html)
@@ -23,7 +23,7 @@ describe BrandEins::Pages::Archive do
23
23
  stub_request(:get, 'http://www.brandeins.de/archiv/2013/neugier/ein-schauspieler-in-daenemark.html').
24
24
  to_return(status: 200, body: article_daenemark_html)
25
25
 
26
- magazine = archive.magazine_for(month: 1, year: 2013)
26
+ magazine = archive.magazine_for(1, 2013)
27
27
 
28
28
  expect(magazine.url).to eq 'http://www.brandeins.de/archiv/2013/neugier.html'
29
29
  expect(magazine.title).to eq 'Neugier'
@@ -10,7 +10,7 @@ describe BrandEins do
10
10
  describe '.run' do
11
11
  it 'shows current version' do
12
12
  out = capture_stdout do
13
- BrandEins::CLI.run(['--version'])
13
+ BrandEins::Cli.run(%w[version])
14
14
  end
15
15
  expect(out.chomp).to eq BrandEins::VERSION
16
16
  end
@@ -1,4 +1,4 @@
1
- require 'byebug'
1
+ require 'byebug' if defined? ByeBug
2
2
  require 'webmock/rspec'
3
3
  require_relative 'support/capture_stdout'
4
4
 
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.3.0.pre
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Igelmund
@@ -92,7 +92,6 @@ files:
92
92
  - lib/brandeins/utils/fetcher.rb
93
93
  - lib/brandeins/utils/merger.rb
94
94
  - lib/brandeins/version.rb
95
- - rubocop-todo.yml
96
95
  - spec/lib/brandeins/kiosk_spec.rb
97
96
  - spec/lib/brandeins/pages/archive_spec.rb
98
97
  - spec/lib/brandeins/pages/article_spec.rb
@@ -127,9 +126,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
126
  version: '0'
128
127
  required_rubygems_version: !ruby/object:Gem::Requirement
129
128
  requirements:
130
- - - '>'
129
+ - - '>='
131
130
  - !ruby/object:Gem::Version
132
- version: 1.3.1
131
+ version: '0'
133
132
  requirements: []
134
133
  rubyforge_project:
135
134
  rubygems_version: 2.1.11
@@ -1,141 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`.
2
- # The point is for the user to remove these configuration records
3
- # one by one as the offences are removed from the code base.
4
-
5
- AccessControl:
6
- Enabled: false
7
-
8
- AlignParameters:
9
- Enabled: false
10
-
11
- AndOr:
12
- Enabled: false
13
-
14
- AssignmentInCondition:
15
- Enabled: false
16
-
17
- AvoidClassVars:
18
- Enabled: false
19
-
20
- AvoidFor:
21
- Enabled: false
22
-
23
- AvoidPerlBackrefs:
24
- Enabled: false
25
-
26
- BlockAlignment:
27
- Enabled: false
28
-
29
- BlockNesting:
30
- Enabled: false
31
-
32
- Blocks:
33
- Enabled: false
34
-
35
- CaseEquality:
36
- Enabled: false
37
-
38
- CaseIndentation:
39
- Enabled: false
40
-
41
- CollectionMethods:
42
- Enabled: false
43
-
44
- Documentation:
45
- Enabled: false
46
-
47
- EmptyLineBetweenDefs:
48
- Enabled: false
49
-
50
- EmptyLines:
51
- Enabled: false
52
-
53
- EmptyLiteral:
54
- Enabled: false
55
-
56
- FavorUnlessOverNegatedIf:
57
- Enabled: false
58
-
59
- HashSyntax:
60
- Enabled: false
61
-
62
- IfUnlessModifier:
63
- Enabled: false
64
-
65
- LeadingCommentSpace:
66
- Enabled: false
67
-
68
- LineLength:
69
- Enabled: false
70
-
71
- LiteralInCondition:
72
- Enabled: false
73
-
74
- MethodLength:
75
- Enabled: false
76
-
77
- MultilineTernaryOperator:
78
- Enabled: false
79
-
80
- NumericLiterals:
81
- Enabled: false
82
-
83
- ParenthesesAroundCondition:
84
- Enabled: false
85
-
86
- RedundantReturn:
87
- Enabled: false
88
-
89
- RedundantSelf:
90
- Enabled: false
91
-
92
- RescueException:
93
- Enabled: false
94
-
95
- Semicolon:
96
- Enabled: false
97
-
98
- ShadowingOuterLocalVariable:
99
- Enabled: false
100
-
101
- SingleLineMethods:
102
- Enabled: false
103
-
104
- SpaceAfterComma:
105
- Enabled: false
106
-
107
- SpaceAroundBraces:
108
- Enabled: false
109
-
110
- SpaceAroundEqualsInParameterDefault:
111
- Enabled: false
112
-
113
- SpaceAroundOperators:
114
- Enabled: false
115
-
116
- SpaceInsideBrackets:
117
- Enabled: false
118
-
119
- SpaceInsideParens:
120
- Enabled: false
121
-
122
- StringLiterals:
123
- Enabled: false
124
-
125
- Syntax:
126
- Enabled: false
127
-
128
- TrailingWhitespace:
129
- Enabled: false
130
-
131
- UnlessElse:
132
- Enabled: false
133
-
134
- UnusedLocalVariable:
135
- Enabled: false
136
-
137
- UselessAssignment:
138
- Enabled: false
139
-
140
- WordArray:
141
- Enabled: false