Deal finder in Ruby. Helps keep an eye on various deals and stuff by pulling multiple sources and sorting through it.
rbenv, ruby, rails, bundler. See installation here
- Here's a nice guide on how to publish a proper Ruby gem. Pretty comprehensive.
- Example on how to write a module and its methods: Nokogiri (cleaner), HTTParty (unnecessary module cyclic reference but good method ref).
- Also, good scraper example to study; involves
http client, HTML parsing, File I/O.
- Another pretty nice (but nothing to study) example is Upton.
- place all source code inside
lib/deal_aggregator/; then require them at the top of
lib/deal_aggregator.rb- the main module for export.
- use Module over Class. No need to use instantiable class, since people will use its methods directly without instantiating. Declare methods with a
def self.greet(n = 'hi') ...
- to test the module,
bundler console, do
- to add dependencies, u have to manually (eww) add it at the end of
spec.add_runtime_dependency "nokogiri", ">= 0". Then, the
npm installequivalent is
bundle install. Also, gems are installed on your machine rather than the project folder.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install deal_finder
TODO: Write usage instructions here
After checking out the repo, run
bin/setup to install dependencies. You can also run
bin/console for an interactive prompt that will allow you to experiment.
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, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.