remote_job_scraper 0.1.0 → 0.2.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: debb2440ac5898b2fc0642017b9bf01aa6adb89f
4
- data.tar.gz: e370546575983d780c9ed6aa28d7611270b08b86
3
+ metadata.gz: 5bbc3d06e54e5b828ef7817799a7305d914eac90
4
+ data.tar.gz: 72a6243b5a1f0568a7e96d64c1f55bdd4036b846
5
5
  SHA512:
6
- metadata.gz: '0844c2a152641653717d587829e8a73aca58292afb175e014a4edc08386ff009de153703fc37d8d271cfd5919441a73a25b5f6ee79c2dda2cd375d1bccbe2e70'
7
- data.tar.gz: cfd1916966d735458d11f4953f0ec26932833e7c03fb028890bfb3f6226ff30c0ce1c58f5a733597f070d3b185dca3597abcacf8f3aaa6befc690cb699366cd5
6
+ metadata.gz: a8b357f4170c3b1a4d70571c15598d2437b2f9eb24dc9c0185b37d074fd2e18ccb36f2a99230fcd28cc6f14367484b06d9ceaf2be735cb61d882175c9d25c1c6
7
+ data.tar.gz: 6789a0f0f69246f93d5390ecd6ae09e2059dea4be51770eeafef2479ed147d60c8bf3dc34b55c47e766123f1a9785383793a61d2bc53beaace05127a7016af4e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- remote_job_scraper (0.1.0)
4
+ remote_job_scraper (0.2.0)
5
5
  nokogiri
6
6
  spreadsheet
7
7
  thor
data/README.md CHANGED
@@ -7,28 +7,16 @@ Going through many job listings and finding the right one may be a time-consumin
7
7
 
8
8
  ## Installation
9
9
 
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'remote_job_scraper'
14
- ```
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
10
  $ gem install remote_job_scraper
23
11
 
24
12
  ## Usage
25
13
 
26
14
  $ bundle exec exe/remote_job_scraper
27
15
 
28
-
29
16
  * Tested with Ruby versions:
30
17
 
31
18
  * [x] 2.4.1
19
+ * [x] 2.0.0
32
20
 
33
21
  ## Development
34
22
 
@@ -38,7 +26,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
38
26
 
39
27
  ## Contributing
40
28
 
41
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/remote_job_scraper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rafaltrojanowski/remote_job_scraper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
42
30
 
43
31
  ## License
44
32
 
@@ -1,3 +1,3 @@
1
1
  module RemoteJobScraper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -15,20 +15,20 @@ require "thor"
15
15
 
16
16
  module RemoteJobScraper
17
17
 
18
- AVAILABLE_SERVICES = %w(we_work_remotely remote_ok 42jobs_rails)
18
+ AVAILABLE_SITES = %w(we_work_remotely remote_ok 42jobs_rails)
19
19
 
20
20
  class CLI < Thor
21
21
 
22
- desc 'collect_jobs', 'Retrieves data from all sites'
22
+ desc 'collect_jobs', "Retrieves data from #{AVAILABLE_SITES.join(', ')}"
23
23
  def collect_jobs
24
24
  [Sites::WeWorkRemotely, Sites::RemoteOk].each do |klass|
25
25
  klass.new.collect_jobs
26
26
  end
27
27
  end
28
28
 
29
- desc 'collect_jobs_from', 'Retrieves data from specified service'
30
- def collect_jobs_from(service_name)
31
- case service_name
29
+ desc 'collect_jobs_from SITE', "Retrieves data from SITE, e.g. #{AVAILABLE_SITES.sample}"
30
+ def collect_jobs_from(site)
31
+ case site
32
32
  when 'we_work_remotely'
33
33
  then Sites::WeWorkRemotely.new.collect_jobs
34
34
  when 'remote_ok'
@@ -36,26 +36,26 @@ module RemoteJobScraper
36
36
  when '42jobs_rails'
37
37
  then Sites::JobsRails42.new.collect_jobs
38
38
  else
39
- raise "#{service_name} is not correct. Use: #{AVAILABLE_SERVICES.join(', ')}."
39
+ raise "#{site} is not correct. Use: #{AVAILABLE_SITES.join(', ')}."
40
40
  end
41
41
  end
42
42
 
43
- desc 'generate_summary', 'Collect all data and export to XLS file'
43
+ desc 'generate_summary', "Merges data from #{AVAILABLE_SITES.join(', ')} and exports to XLS file"
44
44
  def generate_summary
45
45
  Support::SpreadsheetCreator.generate
46
46
  end
47
47
 
48
- desc 'clean_up', 'Removes all stored data'
49
- def clean_up
50
- puts "This command will remote all stored data."
48
+ desc 'remove DIRNAME', "Removes DIRNAME (default: 'data'). Use carefully."
49
+ def remove(dirname = 'data')
50
+ puts "[Warning!]"
51
+ puts "This command will remove #{Dir.pwd}/#{dirname} permanently"
51
52
  puts "Press Ctrl-C to abort."
52
53
 
53
- sleep 2
54
+ sleep 3
54
55
 
55
- FileUtils.rm_rf('data')
56
- puts "Removed data."
56
+ FileUtils.rm_rf(dirname)
57
+ puts "Removed data in #{Dir.pwd}/#{dirname}."
57
58
  end
58
-
59
59
  end
60
60
 
61
61
  def self.root
@@ -16,11 +16,18 @@ module Support
16
16
  end
17
17
  end
18
18
 
19
- book.write path.concat(
19
+ FileUtils.mkdir_p absolute_path(path)
20
+
21
+ book.write absolute_path(path).concat(
20
22
  Time.now.strftime("%Y%m%d%H%M%S").concat('_remote_jobs_summary.xls')
21
23
  )
22
24
  end
23
25
 
26
+ def self.absolute_path(path)
27
+ return path unless ENV['RAILS_ENV'] == 'test'
28
+ "#{RemoteJobScraper.root}/spec/fixtures/#{path}"
29
+ end
30
+
24
31
  def self.dirnames
25
32
  if ENV['RAILS_ENV'] == 'test'
26
33
  [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_job_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafał Trojanowski