brandeins-dl 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.rvmrc ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use 1.9.3" > .rvmrc
9
+ environment_id="ruby-1.9.3-p286@brandeins"
10
+
11
+ # Uncomment the following lines if you want to verify rvm version per project
12
+ # rvmrc_rvm_version="1.16.19 (stable)" # 1.10.1 seams as a safe start
13
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
+ # return 1
16
+ # }
17
+
18
+ # First we attempt to load the desired environment directly from the environment
19
+ # file. This is very fast and efficient compared to running through the entire
20
+ # CLI and selector. If you want feedback on which environment was used then
21
+ # insert the word 'use' after --create as this triggers verbose mode.
22
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
+ then
25
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
+ else
29
+ # If the environment file has not yet been created, use the RVM CLI to select.
30
+ rvm --create "$environment_id" || {
31
+ echo "Failed to create RVM environment '${environment_id}'."
32
+ return 1
33
+ }
34
+ fi
35
+
36
+ # If you use bundler, this might be useful to you:
37
+ # if [[ -s Gemfile ]] && {
38
+ # ! builtin command -v bundle >/dev/null ||
39
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
40
+ # }
41
+ # then
42
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
43
+ # gem install bundler
44
+ # fi
45
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
46
+ # then
47
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
48
+ # fi
data/Rakefile CHANGED
@@ -1,16 +1,18 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
- require './lib/brandeins-dl/version'
3
+ require './lib/brandeins/version'
4
4
 
5
5
  Rake::TestTask.new do |t|
6
6
  t.pattern = 'test/*_test.rb'
7
7
  end
8
8
 
9
9
  task :build do
10
- sh 'gem build brandeins-dl.gemspec'
10
+ sh 'gem build brandeins.gemspec'
11
11
  end
12
12
 
13
13
  task :publish do
14
14
  version = BrandEins::VERSION
15
- sh "gem push brandeins-dl-#{version}.gem"
16
- end
15
+ sh "gem push brandeins-#{version}.gem"
16
+ end
17
+
18
+ task :default => :test
data/bin/brandeins CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'brandeins-dl'
4
- BrandEins::CLI.start
3
+ require 'brandeins'
4
+ BrandEins::CLI.start
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "brandeins-dl/version"
3
+ require "brandeins/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "brandeins-dl"
@@ -8,10 +8,9 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Gregory Igelmund"]
9
9
  s.email = ["gregory.igelmund@gmail.com"]
10
10
  s.homepage = "http://www.grekko.de"
11
- s.summary = %q{BrandEins Downloader allows you to download past volumes of the Brand Eins magazine}
12
- s.description = %q{BrandEins Downloader offers two commands: 'brandeins download YEAR' and 'brandeins download YEAR --volume=NUMBER'}
11
+ s.summary = %q{Please do not use this gem anymore since it was renamed to `brandeins`. Install the new gem via `gem install brandeins`}
12
+ s.description = %q{Please do not use this gem anymore since it was renamed to `brandeins`. Install the new gem via `gem install brandeins`}
13
13
 
14
- #s.rubyforge_project = "brandeins-dl"
15
14
  s.add_dependency "rake"
16
15
  s.add_dependency "thor"
17
16
  s.add_dependency "nokogiri"
@@ -20,4 +19,9 @@ Gem::Specification.new do |s|
20
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
21
  s.require_paths = ["lib"]
22
+
23
+ s.post_install_message =<<-EOT
24
+ Please do not use this gem anymore since it was renamed to `brandeins`. Install the new gem via `gem install brandeins`
25
+
26
+ EOT
23
27
  end
@@ -1,5 +1,6 @@
1
1
  %w(
2
- brandeins-dl/version
2
+ brandeins/version
3
+ brandeins/helper
3
4
  nokogiri
4
5
  open-uri
5
6
  uri
@@ -16,25 +17,29 @@ module BrandEins
16
17
 
17
18
  desc '--version', 'Displays current version'
18
19
  def version
19
- puts BrandEins::VERSION
20
+ p BrandEins::VERSION
20
21
  end
21
22
 
22
- desc 'download_all', 'Download all magazines of the defined year'
23
- method_option :year, :type => :numeric, :required => true
24
- method_option :path, :type => :string, :required => true
25
- def download_all
26
- b1 = BrandEins::Downloader.new(options.path)
27
- b1.get_magazines_of_year(options.year)
28
- end
29
-
30
- desc 'download', 'Download a specific volume'
31
- method_option :path, :type => :string, :required => true
32
- method_option :volume, :type => :numeric, :required => true
33
- method_option :year, :type => :numeric, :required => true
23
+ desc 'download', 'Download past brand eins magazines (use `brandeins help download` to learn more about options)'
24
+ method_option :path, :type => :string
25
+ method_option :volume, :type => :numeric
26
+ method_option :year, :type => :numeric
34
27
  def download
28
+ path = options.path || File.expand_path('../..', __FILE__)
29
+ p "path: #{path}"
30
+ return false
35
31
  b1 = BrandEins::Downloader.new(options.path)
36
32
  b1.get_magazine(options.year, options.volume)
37
33
  end
34
+
35
+ desc 'setup', 'Checks if all requirements to use brandeins are met and gives instructions how to meet them'
36
+ def setup
37
+ if BrandEinsHelper.windows? || BrandEinsHelper.osx?
38
+ require 'brandeins/setup'
39
+ else
40
+ p 'Unknown/unsupported operating system. Please contact the gem author.'
41
+ end
42
+ end
38
43
  end
39
44
 
40
45
  class Downloader
@@ -0,0 +1,9 @@
1
+ module BrandEinsHelper
2
+ def self.windows?
3
+ RUBY_PLATFORM.include? 'w32'
4
+ end
5
+
6
+ def self.osx?
7
+ RUBY_PLATFORM.include? 'darwin'
8
+ end
9
+ end
@@ -0,0 +1,32 @@
1
+ class BrandEinsSetup
2
+ def initialize
3
+ p 'Checking requirements for your system'
4
+ if pdftk?
5
+ p 'It seems you have pdftk installed on your system.'
6
+ else
7
+ p 'It seems you are missing pdfk on your system.'
8
+ p pdfk_install_instructions
9
+ end
10
+ end
11
+
12
+ def pdfk_install_instructions
13
+ 'Visit http://www.pdflabs.com/docs/install-pdftk/ to install pdftk on your system'
14
+ end
15
+
16
+ def pdftk?
17
+ cmd? 'pdftk --version', 'pdftk.com'
18
+ end
19
+
20
+ private
21
+ def cmd?(cmd, hint)
22
+ f = IO.popen cmd
23
+ f.readlines.each do |line|
24
+ if line.include? hint
25
+ return true
26
+ end
27
+ end
28
+ return false
29
+ end
30
+ end
31
+
32
+ BrandEinsSetup.new
@@ -1,3 +1,3 @@
1
1
  module BrandEins
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../lib/brandeins-dl' , __FILE__)
1
+ require File.expand_path('../../lib/brandeins' , __FILE__)
2
2
  require 'minitest/autorun'
3
3
  require 'fakefs/safe'
4
4
 
@@ -35,4 +35,4 @@ class TestBrandEinsDownload < MiniTest::Unit::TestCase
35
35
  assert_equal magazine_links[0], (@base_url + '/magazin/nein-sagen.html')
36
36
  assert_equal magazine_links[1], (@base_url + '/magazin/markenkommunikation.html')
37
37
  end
38
- end
38
+ end
metadata CHANGED
@@ -1,102 +1,120 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: brandeins-dl
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
4
5
  prerelease:
5
- version: 0.0.8
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Gregory Igelmund
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-10-06 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: rake
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
27
31
  name: thor
28
- requirement: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
38
47
  name: nokogiri
39
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
45
54
  type: :runtime
46
55
  prerelease: false
47
- version_requirements: *id003
48
- description: "BrandEins Downloader offers two commands: 'brandeins download YEAR' and 'brandeins download YEAR --volume=NUMBER'"
49
- email:
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Please do not use this gem anymore since it was renamed to `brandeins`.
63
+ Install the new gem via `gem install brandeins`
64
+ email:
50
65
  - gregory.igelmund@gmail.com
51
- executables:
66
+ executables:
52
67
  - brandeins
53
68
  extensions: []
54
-
55
69
  extra_rdoc_files: []
56
-
57
- files:
70
+ files:
58
71
  - .gitignore
72
+ - .rvmrc
59
73
  - Gemfile
60
74
  - README.md
61
75
  - Rakefile
62
76
  - TODOS.md
63
77
  - bin/brandeins
64
- - brandeins-dl.gemspec
65
- - lib/brandeins-dl.rb
66
- - lib/brandeins-dl/version.rb
67
- - test/brandeins-dl_test.rb
78
+ - brandeins.gemspec
79
+ - lib/brandeins.rb
80
+ - lib/brandeins/helper.rb
81
+ - lib/brandeins/setup.rb
82
+ - lib/brandeins/version.rb
83
+ - test/brandeins_test.rb
68
84
  homepage: http://www.grekko.de
69
85
  licenses: []
86
+ post_install_message: ! 'Please do not use this gem anymore since it was renamed to
87
+ `brandeins`. Install the new gem via `gem install brandeins`
70
88
 
71
- post_install_message:
72
- rdoc_options: []
73
89
 
74
- require_paths:
90
+ '
91
+ rdoc_options: []
92
+ require_paths:
75
93
  - lib
76
- required_ruby_version: !ruby/object:Gem::Requirement
94
+ required_ruby_version: !ruby/object:Gem::Requirement
77
95
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: -3513034641520695490
82
- segments:
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ segments:
83
101
  - 0
84
- version: "0"
85
- required_rubygems_version: !ruby/object:Gem::Requirement
102
+ hash: 4023668933682446299
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
104
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: -3513034641520695490
91
- segments:
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ segments:
92
110
  - 0
93
- version: "0"
111
+ hash: 4023668933682446299
94
112
  requirements: []
95
-
96
113
  rubyforge_project:
97
- rubygems_version: 1.8.15
114
+ rubygems_version: 1.8.24
98
115
  signing_key:
99
116
  specification_version: 3
100
- summary: BrandEins Downloader allows you to download past volumes of the Brand Eins magazine
101
- test_files:
102
- - test/brandeins-dl_test.rb
117
+ summary: Please do not use this gem anymore since it was renamed to `brandeins`. Install
118
+ the new gem via `gem install brandeins`
119
+ test_files:
120
+ - test/brandeins_test.rb