What is the use of Gemfile in rails?

前端 未结 5 990
萌比男神i
萌比男神i 2020-11-29 21:31

What is the use of Gemfile in rails?

How to use Gemfile?

5条回答
  •  死守一世寂寞
    2020-11-29 22:02

    I'll try and give a simple answer

    Explanation by analogy

    Let's suppose you want to make a car. From scratch. Now that will be a nightmare. You need to build: the chasis, the engine, the corroborator, radiator, cooling, ventilation, etc etc. etc.

    Gems allow you to utilise car parts which other people have made before

    But you're not the only one building a car. Everyone's who's ever built a car has basically made the same things. There have been smart people who've gone out there and made combustion engines etc well before you were...........actually never mind.

    You needn't reinvent the wheel. Why make your own when you can simply get the best equipment straight off the shelf? What if you could get one of the best engines around, created by the most talented engineers in the world, without lifting a finger? Are you gonna spend a year trying to make your own?

    So basically rather than make everything yourself, you write down a shopping list of all the parts you need. And that is basically a gem file:

    • Rolls Royce Engine
    • AutoLive seatbelts
    • Michellin tyres.
    • PIAA Night headlights
    • etc etc.

    That my friend, is basically your gem file!

提交回复
热议问题