GithubHelp home page GithubHelp logo

emjose / ruby-cli-setup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sylwiavargas/ruby-cli-setup

0.0 1.0 0.0 609 KB

๐Ÿ”ปA treat for those who'd like to make a ruby CLI but don't know where to start.

Ruby 100.00%

ruby-cli-setup's Introduction

Process

NOTE

  • this setup contains a rakefile with helpful process reminders

Setup

  1. Create Gemfile + run bundle
  2. Create migrations: run rake db:create_migration and add the syntax you need (e.g. NAME=create_users)
  3. Migrate: run rake db:migrate
  • REMEMBER never ever ever change anything in schema.
  1. Go to .bin/run.rb and change the name of the app on line 3 AND/OR go to Rakefile and change the name of the app on line 15
  2. Go to ./app/models and change the names of the files (e.g. User.rb <- singular) and the class names inside
  3. Set up association macros in classes (belongs_to / has_many / has_many, through:)
  4. Create seed file in db/seed.rb + then run rake db:seed
  • remember: seeding does not give you any output so no news on your console == good news
  1. Check if you've seeded correctly: run rake c and check what's the last instance of any of your class
  2. Go to ./app/yourAppName.rb and change that file's name and whatever is inside (the class name should correspond to what you wrote in .bin/run.rb on line 3)

Coding

  1. Create a dummy version of your logic -> hardcode it and don't yet make your code save anything to the database, just make sure that the logic works
  2. Test often by running the file or by binding.pry
  3. What I fould useful is drowing out every step I want to guide users through before coding - my whiteboard looked like this:
  4. Then I coded the dummy version (without saving to the database, just to see if all "if"s are working and all that jazz)
  5. Then I added the database manipulations.
  6. Then I beautified the code and the app to make it visually pleasing

APIs

Fun Gems For Your Projects

  • faker - randomly generated seed data fun
  • colorize - colored text output in your terminal
  • lolcat - enabling rainbow text coloring
  • rest-client - make HTTP requests and get data from APIs
  • tty-prompt - nice interface for prompting for user input
  • formatador - styling output information into a neat table
  • artii - creating text banners

Tutorials

ruby-cli-setup's People

Contributors

dependabot[bot] avatar sylwiavargas avatar

Watchers

 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.