Skip to content

Commit 3f12182

Browse files
committed
Finish off that thing
1 parent add8085 commit 3f12182

3 files changed

Lines changed: 21 additions & 76 deletions

File tree

Makefile

Lines changed: 0 additions & 17 deletions
This file was deleted.

Rakefile

Lines changed: 20 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,28 @@
11
require_relative "./main"
22

3+
sources = ['Timpul', 'Publika', 'Unimedia', 'ProTv', 'Agora', 'Prime']
4+
5+
desc "Run for debug mode"
36
task :console do
47
sh "ruby -e \"require('./main.rb');binding.pry\""
58
end
69

7-
desc "Fetched only new content by default."
8-
namespace :fetch do
9-
desc "Fetch resources from Timpul Source"
10-
task :timpul, [:first, :last] do |_task, options|
11-
Fetchers::Timpul.new.run(options[:first], options[:last])
12-
end
13-
14-
desc "Fetch resources from Publika Source"
15-
task :publika, [:first, :last] do |_task, options|
16-
Fetchers::Publika.new.run(options[:first], options[:last])
17-
end
18-
19-
desc "Fetch resources from Unimedia Source"
20-
task :unimedia, [:first, :last] do |_task, options|
21-
Fetchers::Unimedia.new.run(options[:first], options[:last])
22-
end
23-
24-
desc "Fetch resources from ProTV Source"
25-
task :protv, [:first, :last] do |_task, options|
26-
Fetchers::ProTv.new.run(options[:first], options[:last])
27-
end
28-
29-
desc "Fetch resources from Agora Source"
30-
task :agora, [:first, :last] do |_task, options|
31-
Fetchers::Agora.new.run(options[:first], options[:last])
32-
end
33-
34-
desc "Fetch resources from Prime Source"
35-
task :prime, [:first, :last] do |_task, options|
36-
Fetchers::Prime.new.run(options[:first], options[:last])
37-
end
38-
end
39-
40-
namespace :parse do
41-
desc "Parse ProTV source and update DB"
42-
task :protv do
43-
Parsers::ProTv.new.run
44-
end
45-
46-
desc "Parse Timpul source and update DB"
47-
task :timpul do
48-
Parsers::Timpul.new.run
49-
end
50-
51-
desc "Parse Publika source and update DB"
52-
task :publika do
53-
Parsers::Publika.new.run
54-
end
55-
56-
desc "Parse Unimedia source and update DB"
57-
task :unimedia do
58-
Parsers::Unimedia.new.run
59-
end
60-
61-
task :agora do
62-
Parsers::Agora.new.run
10+
sources.each do |source|
11+
namespace :fetch do
12+
desc "Fetch resources from #{source} Source"
13+
task source.downcase.to_sym, [:first, :last] do |_task, options|
14+
if options.to_hash != {}
15+
Kernel.const_get("Fetchers::#{source}").new.run(options[:first], options[:last])
16+
else
17+
Kernel.const_get("Fetchers::#{source}").new.run
18+
end
19+
end
20+
end
21+
22+
namespace :parse do
23+
desc "Parse resources from #{source} and update DB"
24+
task source.downcase.to_sym do
25+
Kernel.const_get("Parsers::#{source}").new.run
26+
end
6327
end
6428
end

Readme.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ There are several steps:
1818
- Analyze the full data set
1919
- Create a visualization
2020

21-
Run `make run`, wait around 6 hours and you'll have everything.
22-
You'll also need around 7GB of disk space.
23-
2421
Use rake tasks to trigger fetchers and parsers.
2522
Ex. `rake fetch:publika` or `rake parse:unimedia`
2623

@@ -30,3 +27,4 @@ Currently in stock:
3027
- Unimedia
3128
- Publika
3229
- Timpul
30+
- Agora

0 commit comments

Comments
 (0)