Giter VIP home page Giter VIP logo

phrg-oo-cli-data-gem-walkthrough's Introduction

Building a CLI Gem Walkthrough

This video walks through the process of planning and building a CLI gem. There will be more videos on the process of building a more complex gem as well as on refactoring and improving a CLI gem.

Objectives

  1. Planning your application
  2. Generating and setting up a basic gem
  3. Basic CLI User interface
  4. Setting up your Objects
  5. Setting up your Scraper
  6. Bring it all together!

Video

<iframe width="100%" height="720" src="https://www.youtube.com/embed/_lDExWIhYKI?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>

Summary

  • Planning the gem.
  • Beginning the building process.
    • Setting up or generating the basic structure of the gem.
    • Creating and stubbing out the executable file.
  • requiring files with require and require_relative.
  • Coding the CLI class โ€” our controller.
    • Stubbing out the CLI class with hard-coded return data.
    • Creating the menu.
  • Setting up our Deal class.
    • #today method to return today's deals.
    • Stubbing out our first Deal instances with hard-coded data.
    • Setting up the Deal class attributes.
  • Testing our data in the console.
  • Wire up our menu with conditional logic to work with our array of deals.
    • Iterate over and display deals.
    • Fix spelling on #availability.
  • Setting up our scraper class โ€” should we use a Deal class method or a standalone class?
    • Set up Deals#scrape_deals method.
  • Adding gem dependencies to the app.
    • Add dependencies to gemspec.
    • Development dependencies or runtime dependencies?
  • Code individual scrape methods for each site.
    • Use CSS selectors to scrape desired information.
    • Create new Deal objects and set the attributes based on the scraped info.
    • Update logic for #availability.
  • Final thoughts and tips on the building process.

Code

View Building a CLI Gem Walkthrough on Learn.co and start learning to code for free.

PHRG Building a CLI Gem Walkthrough

phrg-oo-cli-data-gem-walkthrough's People

Contributors

annjohn avatar aviflombaum avatar gj avatar terry-thompson avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.