findjobs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d4476f5125af8474b17b4081f82478078ac0511d
4
+ data.tar.gz: 8488cce964c0824c718036001fc4e56dc3585a51
5
+ SHA512:
6
+ metadata.gz: 9676d9847dce7d8a8681915f8aa55160117890784a8cfc3f7fd241a4c34d633f17457f7c33f6ad33a98739592a53146f10d6375752c32aa0abe0f090be8a987d
7
+ data.tar.gz: 8e09939b3d4272ebf099b05fa1677692a0eef7f61f88f6a6c6ad58a2f558c3019e5517b739e7e8dd018af62f5866c6b745fb5b89cdc2d5611b7b24c244dc2beb
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ vendor/bundle/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - spec/spec_helper.rb
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Metrics/AbcSize:
11
+ Exclude:
12
+ - lib/findjobs/cli.rb
13
+
14
+ Metrics/MethodLength:
15
+ Exclude:
16
+ - lib/findjobs/cli.rb
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in findjobs.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Findjobs
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/findjobs`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'findjobs'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install findjobs
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/findjobs/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+ require 'rubocop/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ RuboCop::RakeTask.new(:rubocop) do |task|
9
+ task.fail_on_error = false
10
+ task.options = %w(--force-exclusion)
11
+ task.patterns = %w({lib,spec}/**/*.rb)
12
+ task.requires << 'rubocop-rspec'
13
+ end
14
+
15
+ task default: %w(spec rubocop)
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "findjobs"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
12
+
13
+ # require "irb"
14
+ # IRB.start
data/bin/findjobs ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../lib/findjobs.rb', __FILE__)
3
+
4
+ Findjobs::Cli.new.run
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/exe/findjobs ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'findjobs'
3
+
4
+ Findjobs::Cli.new.run
data/findjobs.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'findjobs/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "findjobs"
8
+ spec.version = Findjobs::VERSION
9
+ spec.authors = ["Alexander Tipugin"]
10
+ spec.email = ["atipugin@gmail.com"]
11
+
12
+ spec.summary = %q{Simple CLI to help you find your next job.}
13
+ spec.homepage = "https://github.com/atipugin/findjobs"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.9"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency 'rspec', '~> 3.3.0'
23
+ spec.add_development_dependency 'aruba', '~> 0.9.0'
24
+ spec.add_development_dependency 'rubocop', '~> 0.34.0'
25
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.3.1'
26
+ spec.add_development_dependency 'pry', '~> 0.10.1'
27
+ spec.add_development_dependency 'factory_girl', '~> 4.5.0'
28
+ spec.add_development_dependency 'ffaker', '~> 2.1.0'
29
+ spec.add_development_dependency 'rspec-collection_matchers', '~> 1.1.2'
30
+
31
+ spec.add_dependency 'commander', '~> 4.3.5'
32
+ spec.add_dependency 'feedjira', '~> 2.0.0'
33
+ spec.add_dependency 'virtus', '~> 1.0.5'
34
+ spec.add_dependency 'colorize', '~> 0.7.7'
35
+ end
@@ -0,0 +1,56 @@
1
+ module Findjobs
2
+ class Cli
3
+ include Commander::Methods
4
+
5
+ def run
6
+ program :name, 'findjobs'
7
+ program :version, Findjobs::VERSION
8
+ program :description, 'Simple CLI to help you find your next job.'
9
+
10
+ command :find do |c|
11
+ c.syntax = 'findjobs [term]'
12
+ c.description = 'Find jobs by specific term (i.e "ruby")'
13
+ c.option '--location STRING', String, 'Specify a location'
14
+ c.option '--days INTEGER', Integer, 'Limit an amount of days in results'
15
+ c.action do |args, options|
16
+ options.default(Findjobs::Finder.default_options)
17
+ results =
18
+ Findjobs::Finder
19
+ .new(args[0], location: options.location, days: options.days)
20
+ .by_date
21
+
22
+ if results.any?
23
+ enable_paging
24
+ results.each { |d, j| print_date(d, j) }
25
+ else
26
+ say %(No "#{args[0]}" jobs found.)
27
+ end
28
+ end
29
+ end
30
+
31
+ default_command :find
32
+
33
+ run!
34
+ end
35
+
36
+ private
37
+
38
+ def print_date(date, jobs)
39
+ say human_date(date).green.underline
40
+ say "\n"
41
+ jobs.each do |job|
42
+ say job.title.light_white
43
+ say job.url
44
+ say "\n"
45
+ end
46
+ end
47
+
48
+ def human_date(date)
49
+ case date
50
+ when Date.today then 'Today'
51
+ when Date.today - 1 then 'Yesterday'
52
+ else date.strftime('%b %m, %Y')
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,30 @@
1
+ module Findjobs
2
+ class Finder
3
+ attr_reader :term, :options
4
+
5
+ def self.default_options
6
+ { location: nil, days: 0 }
7
+ end
8
+
9
+ def initialize(term, options = {})
10
+ @term = term
11
+ @options = self.class.default_options.merge(options)
12
+ end
13
+
14
+ def by_date
15
+ Hash[
16
+ find
17
+ .group_by(&:date)
18
+ .sort_by { |k, _| k }
19
+ .reverse[0..options[:days].pred]
20
+ ]
21
+ end
22
+
23
+ def find
24
+ Findjobs::Providers::AVAILABLE_PROVIDERS
25
+ .map { |k| k.new(term, options[:location]).search }
26
+ .flatten
27
+ .select { |j| j.date <= Date.today }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module Findjobs
2
+ class Job
3
+ include Virtus.model
4
+
5
+ attribute :title, String
6
+ attribute :url, String
7
+ attribute :date, Date
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Findjobs
2
+ module Providers
3
+ class AuthenticJobs < Base
4
+ def url
5
+ 'https://authenticjobs.com/rss/custom.php' \
6
+ "?terms=#{term}&location=#{location}"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ module Findjobs
2
+ module Providers
3
+ class Base
4
+ attr_reader :term, :location
5
+
6
+ def initialize(term, location = nil)
7
+ @term = term
8
+ @location = location
9
+ end
10
+
11
+ def search
12
+ Feedjira::Feed.fetch_and_parse(url).entries.map do |entry|
13
+ Findjobs::Job
14
+ .new(
15
+ title: entry.title,
16
+ url: entry.url,
17
+ date: entry.published || entry.updated
18
+ )
19
+ end
20
+ end
21
+
22
+ def url
23
+ fail NotImplementedError, 'You need to implement this method first.'
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,10 @@
1
+ module Findjobs
2
+ module Providers
3
+ class Github < Base
4
+ def url
5
+ 'https://jobs.github.com/positions.atom' \
6
+ "?description=#{term}&location=#{location}"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Findjobs
2
+ module Providers
3
+ class StackOverflow < Base
4
+ def url
5
+ 'https://careers.stackoverflow.com/jobs/feed' \
6
+ "?searchTerm=#{term}&location=#{location}&range=20&distanceUnits=Miles"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ require 'findjobs/providers/base'
2
+ require 'findjobs/providers/github'
3
+ require 'findjobs/providers/stack_overflow'
4
+ require 'findjobs/providers/authentic_jobs'
5
+
6
+ module Findjobs
7
+ module Providers
8
+ AVAILABLE_PROVIDERS = [
9
+ Findjobs::Providers::Github,
10
+ Findjobs::Providers::StackOverflow,
11
+ Findjobs::Providers::AuthenticJobs
12
+ ]
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module Findjobs
2
+ VERSION = '0.1.0'
3
+ end
data/lib/findjobs.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/setup'
2
+ require 'commander'
3
+ require 'feedjira'
4
+ require 'virtus'
5
+ require 'colorize'
6
+
7
+ require 'findjobs/version'
8
+ require 'findjobs/job'
9
+ require 'findjobs/providers'
10
+ require 'findjobs/finder'
11
+ require 'findjobs/cli'
metadata ADDED
@@ -0,0 +1,262 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: findjobs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Tipugin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-09-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.3.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: aruba
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.34.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.34.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.3.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.3.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.10.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.10.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: factory_girl
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 4.5.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 4.5.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: ffaker
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 2.1.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 2.1.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec-collection_matchers
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.1.2
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 1.1.2
153
+ - !ruby/object:Gem::Dependency
154
+ name: commander
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 4.3.5
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 4.3.5
167
+ - !ruby/object:Gem::Dependency
168
+ name: feedjira
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 2.0.0
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 2.0.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: virtus
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 1.0.5
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 1.0.5
195
+ - !ruby/object:Gem::Dependency
196
+ name: colorize
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 0.7.7
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 0.7.7
209
+ description:
210
+ email:
211
+ - atipugin@gmail.com
212
+ executables:
213
+ - findjobs
214
+ extensions: []
215
+ extra_rdoc_files: []
216
+ files:
217
+ - ".gitignore"
218
+ - ".rspec"
219
+ - ".rubocop.yml"
220
+ - ".travis.yml"
221
+ - Gemfile
222
+ - README.md
223
+ - Rakefile
224
+ - bin/console
225
+ - bin/findjobs
226
+ - bin/setup
227
+ - exe/findjobs
228
+ - findjobs.gemspec
229
+ - lib/findjobs.rb
230
+ - lib/findjobs/cli.rb
231
+ - lib/findjobs/finder.rb
232
+ - lib/findjobs/job.rb
233
+ - lib/findjobs/providers.rb
234
+ - lib/findjobs/providers/authentic_jobs.rb
235
+ - lib/findjobs/providers/base.rb
236
+ - lib/findjobs/providers/github.rb
237
+ - lib/findjobs/providers/stack_overflow.rb
238
+ - lib/findjobs/version.rb
239
+ homepage: https://github.com/atipugin/findjobs
240
+ licenses: []
241
+ metadata: {}
242
+ post_install_message:
243
+ rdoc_options: []
244
+ require_paths:
245
+ - lib
246
+ required_ruby_version: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ required_rubygems_version: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
256
+ requirements: []
257
+ rubyforge_project:
258
+ rubygems_version: 2.4.5
259
+ signing_key:
260
+ specification_version: 4
261
+ summary: Simple CLI to help you find your next job.
262
+ test_files: []