What's inside my rails ./bin directory?

后端 未结 2 1578
攒了一身酷
攒了一身酷 2021-02-12 09:40

Ruby on Rails 4 introduced* the ./bin directory. Inside of ./bin are a few executables: bundle, rails, rake,

2条回答
  •  日久生厌
    2021-02-12 10:27

    A bin (short for binary) is nothing more than an application. As you have noticed, these files are ruby files, but they do not have the .rb extension and can be run from your shell just as any shell command, without the need to start any ruby interpreter yourself.

    So what do theses programs do? I'm pretty sure you know already what rails rake bundle do.

    About spring, it's a gem that keeps your app running in the background (hence its need to be run independently from the app). More infos on their github.

    I see no reason to edit these files, but that being said, they're ruby files so you can do whatever you want with them. One example of why you may want editing can be found here.

    I personally do put some stuffs in the bin folder. Scripts to connect to remote servers, or ruby scripts I need but that I don't want to run as rake tasks since they're more general than my application.

提交回复
热议问题