Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

76 changes: 20 additions & 56 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,64 +1,28 @@
require_relative "./main"

sources = ['Timpul', 'Publika', 'Unimedia', 'ProTv', 'Agora', 'Prime']

desc "Run for debug mode"
task :console do
sh "ruby -e \"require('./main.rb');binding.pry\""
end

desc "Fetched only new content by default."
namespace :fetch do
desc "Fetch resources from Timpul Source"
task :timpul, [:first, :last] do |_task, options|
Fetchers::Timpul.new.run(options[:first], options[:last])
end

desc "Fetch resources from Publika Source"
task :publika, [:first, :last] do |_task, options|
Fetchers::Publika.new.run(options[:first], options[:last])
end

desc "Fetch resources from Unimedia Source"
task :unimedia, [:first, :last] do |_task, options|
Fetchers::Unimedia.new.run(options[:first], options[:last])
end

desc "Fetch resources from ProTV Source"
task :protv, [:first, :last] do |_task, options|
Fetchers::ProTv.new.run(options[:first], options[:last])
end

desc "Fetch resources from Agora Source"
task :agora, [:first, :last] do |_task, options|
Fetchers::Agora.new.run(options[:first], options[:last])
end

desc "Fetch resources from Prime Source"
task :prime, [:first, :last] do |_task, options|
Fetchers::Prime.new.run(options[:first], options[:last])
end
end

namespace :parse do
desc "Parse ProTV source and update DB"
task :protv do
Parsers::ProTv.new.run
end

desc "Parse Timpul source and update DB"
task :timpul do
Parsers::Timpul.new.run
end

desc "Parse Publika source and update DB"
task :publika do
Parsers::Publika.new.run
end

desc "Parse Unimedia source and update DB"
task :unimedia do
Parsers::Unimedia.new.run
end

task :agora do
Parsers::Agora.new.run
sources.each do |source|
namespace :fetch do
desc "Fetch resources from #{source} Source"
task source.downcase.to_sym, [:first, :last] do |_task, options|
if options.to_hash != {}
Kernel.const_get("Fetchers::#{source}").new.run(options[:first], options[:last])
else
Kernel.const_get("Fetchers::#{source}").new.run
end
end
end

namespace :parse do
desc "Parse resources from #{source} and update DB"
task source.downcase.to_sym do
Kernel.const_get("Parsers::#{source}").new.run
end
end
end
4 changes: 1 addition & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ There are several steps:
- Analyze the full data set
- Create a visualization

Run `make run`, wait around 6 hours and you'll have everything.
You'll also need around 7GB of disk space.

Use rake tasks to trigger fetchers and parsers.
Ex. `rake fetch:publika` or `rake parse:unimedia`

Expand All @@ -30,3 +27,4 @@ Currently in stock:
- Unimedia
- Publika
- Timpul
- Agora