本文介绍了纯Ruby项目的目录布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开始学习红宝石。我也是日常C ++开发人员。
对于C ++项目,我通常使用以下目录结构
I'm starting to learn ruby. I'm also a day-to-day C++ dev.For C++ projects I usually go with following dir structure
/
-/bin <- built binaries
-/build <- build time temporary object (eg. .obj, cmake intermediates)
-/doc <- manuals and/or Doxygen docs
-/src
--/module-1
--/module-2
-- non module specific sources, like main.cpp
- IDE project files (.sln), etc.
Ruby建议使用什么目录布局(非Rails,non-Merb)使其保持整洁,简单和
What dir layout for Ruby (non-Rails, non-Merb) would you suggest to keep it clean, simple and maintainable?
推荐答案
捆绑器包括生成gem的必要基础结构:
Bundler includes the necessary infrastructure to generate a gem:
$ bundle gem --coc --mit --test=minitest --exe spider
Creating gem 'spider'...
MIT License enabled in config
Code of conduct enabled in config
create spider/Gemfile
create spider/lib/spider.rb
create spider/lib/spider/version.rb
create spider/spider.gemspec
create spider/Rakefile
create spider/README.md
create spider/bin/console
create spider/bin/setup
create spider/.gitignore
create spider/.travis.yml
create spider/test/test_helper.rb
create spider/test/spider_test.rb
create spider/LICENSE.txt
create spider/CODE_OF_CONDUCT.md
create spider/exe/spider
Initializing git repo in /Users/francois/Projects/spider
Gem 'spider' was successfully created. For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html
然后,在lib /中,根据需要创建模块:
Then, in lib/, you create modules as needed:
lib/
spider/
base.rb
crawler/
base.rb
spider.rb
require "spider/base"
require "crawler/base"
阅读手册页,其中,以获取有关-coc
,-exe
和-mit
选项。
Read the manual page for bundle gem for details on the --coc
, --exe
and --mit
options.
这篇关于纯Ruby项目的目录布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!