remote_job_scraper 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +61 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/remote_job_scraper +5 -0
- data/lib/remote_job_scraper/version.rb +3 -0
- data/lib/remote_job_scraper.rb +64 -0
- data/lib/sites/base.rb +62 -0
- data/lib/sites/elixir_radar.rb +10 -0
- data/lib/sites/jobs_rails42.rb +64 -0
- data/lib/sites/rails_jobs.rb +9 -0
- data/lib/sites/remote_ok.rb +45 -0
- data/lib/sites/we_work_remotely.rb +52 -0
- data/lib/support/offer_parser.rb +52 -0
- data/lib/support/spreadsheet_creator.rb +40 -0
- data/lib/support/user_agent.rb +7486 -0
- data/remote_job_scraper.gemspec +48 -0
- metadata +201 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spreadsheet'
|
2
|
+
|
3
|
+
module Support
|
4
|
+
module SpreadsheetCreator
|
5
|
+
|
6
|
+
def self.generate(path: 'data/summary/', filename: 'remote_job_summary_.xls')
|
7
|
+
Spreadsheet.client_encoding = 'UTF-8'
|
8
|
+
book = Spreadsheet::Workbook.new
|
9
|
+
|
10
|
+
dirnames.each_with_index do |dirname, index|
|
11
|
+
file = Dir.glob(dirname).first
|
12
|
+
sheet = book.create_worksheet name: dirname.split("/")[-2]
|
13
|
+
|
14
|
+
CSV.foreach(file).with_index(0) do |row, index|
|
15
|
+
sheet.row(index).push(*(Spreadsheet::Link.new row[0]), *row[1..-1])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
book.write path.concat(
|
20
|
+
Time.now.strftime("%Y%m%d%H%M%S").concat('_remote_jobs_summary.xls')
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.dirnames
|
25
|
+
if ENV['RAILS_ENV'] == 'test'
|
26
|
+
[
|
27
|
+
"#{RemoteJobScraper.root}/spec/fixtures/data/remote_ok/*",
|
28
|
+
"#{RemoteJobScraper.root}/spec/fixtures/data/we_work_remotely/*",
|
29
|
+
"#{RemoteJobScraper.root}/spec/fixtures/data/jobs_rails42/*"
|
30
|
+
]
|
31
|
+
else
|
32
|
+
[
|
33
|
+
"#{RemoteJobScraper.root}/data/remote_ok/*",
|
34
|
+
"#{RemoteJobScraper.root}/data/we_work_remotely/*",
|
35
|
+
"#{RemoteJobScraper.root}/data/jobs_rails42/*"
|
36
|
+
]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|