문제

Assuming I'm creating a vanilla Ruby project that isn't necessarily a web project, what should my file structure look like? My requirements are:

  • Has a mechanism for including gems (Gemfile in the root most likely)
  • Allows me to run the Ruby file directly but also can serve as a library

My stab at the idea is:

proj
--> .ruby-version
--> .ruby-gemset
--> lib
----> proj.rb
--> Gemfile
--> README
--> run.rb (which requires the proj.rb in lib/ and uses it to do work)

Are there any considerations I should take into account if I plan to make a Ruby Gem?

도움이 되었습니까?

해결책

There isn't necessarily any set way to define a Ruby project. But, generally RubyGems have this file structure:

.
├── bin
│   └── mygem
├── Gemfile
├── lib
│   ├── mygem
│   │   └── version.rb
│   └── mygem.rb
├── LICENSE
├── mygem.gemspec
├── Rakefile
└── README.md

Of course, there is also other directories and files in the project root, for tests, .ruby-version, etc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top