Open-Source Project Directory Structure

最後編輯:2015-04-05 建立:2015-01-10 歷史紀錄

 

    陳幸延專案資料夾架構

陳幸延基本檔案

 

主程式

  • src/
  • core/ 與 plugins/ 搭配
  • bin/ 通常與 lib/ 或 src/ 搭配,如 python, ruby 的主程式可以去掉副檔名,放在 bin/ 中
    • bin/python/ 若有不同語言的實做,可建立不同語言的子資料夾
    • bin/java/

 

編譯所需標頭檔、函式庫

  • include/
  • lib/
  • deps/
    • deps/libxxx/

Plugins

  • plugins/ 與 core/ 搭配

Build Source 主程式與輔助工具

 

Build package

 

 

Release 版本

 

Patches

  • patches/

 

測試

  • test[s]/

 

CI 設定檔

  • .travis.yml

使用範例 (library 或 API 使用範例程式)

 

設定檔範例

  • conf/
  • etc/

 

文件

  • doc[s]/
  • man/

 

部署指令稿

  • Vagrantfile

 

開發時的輔助工具,或是第三方貢獻者使用的輔助工具,但與主程式通常沒有直接關係

 

貢獻

 

    陳幸延Makefile 常見選項

陳幸延all

install

install-html

install-dvi

install-pdf

install-ps

uninstall

install-strip

clean

distclean

mostlyclean

maintainer-clean

TAGS

info

dvi

html

pdf

ps

dist

check

installcheck

installdirs

 

    陳幸延常見安裝系統路徑

陳幸延Filesystem Hierarchy Standard (FHS)

/

  • /bin Essential user command binaries (for use by all users) 所有使用者使用的基本工具 (buzybox 工具等)
  • /etc Host-specific system configuration 系統服務與程式的主要設定檔位置
  • /lib Essential shared libraries and kernel modules 動態連結檔共用函式庫位置
  • /opt Add-on application software packages 程式獨立維護的安裝位置 /google、/teamviewer9
  • /sbin System binaries 系統管理使用的工具
  • /usr the second major section of the filesystem. 應用程式共用的表頭檔 (.h)、文件 (man) 或是不同版本的函式庫 (lib、local/lib) 等
  • /var variable data files 可儲存、可變動的程式資料檔

 

/usr

  • /usr/bin
  • /usr/include (*.h)
  • /usr/lib (*.so)
  • /usr/local
    • /usr/local/bin (ex : /usr/local/bin/virtualenv-2.7)
    • /usr/local/lib (ex : /usr/local/lib/python2.7/)
  • /usr/sbin (ex : /usr/sbin/visudo)
  • /usr/share (ex : /usr/share/applications)
  • /usr/src (ex : /usr/src/linux-headers-$(uname -r)/include)

 

/var

  • /var/cache (ex: /var/cache/apt/)
  • /var/log (ex: /var/log/syslog)
  • /var/run (ex: /var/run/apache2/apache2.pid)

 

    陳幸延語言範例

陳幸延C / C++

linux-test-project/ltp https://github.com/linux-test-project/ltp

mongodb/mongo https://github.com/mongodb/mongo

openssl/openssl https://github.com/openssl/openssl

antirez/redis https://github.com/antirez/redis

 

C#

nunit/nunit https://github.com/nunit/nunit

 

Go

docker/docker https://github.com/docker/docker

 

Python

  • setup.py (python setup.py install)
  • requirements.txt (pip install -r requirements.txt)
  • MANIFEST.in
  • bin/
  • libxxx/

 

mattharrison/poachplate https://github.com/mattharrison/poachplate

 

版本號

N.N[.N]+[{a|b|c|rc}N[.N]+][.postN][.devN]

PEP 386 - Changing the version comparison module in Distutils | Python.org

twisted/twisted https://github.com/twisted/twisted

django/django https://github.com/django/django/tree/master/django

qtile/qtile https://github.com/qtile/qtile

 

Open Sourcing a Python Project the Right Way

Interesting Things, Largely Python and Twisted Related: Filesystem structure of a Python project

6. Modules — Python 2.7.9 documentation

Packaging Your Code — The Hitchhiker's Guide to Python

 

PyPI

Python project layout

PyCon 2013 : Scripting to PyPi to GitHub and More (p28)

 

JAVA

jenkinsci/jenkins https://github.com/jenkinsci/jenkins

 

JAVA - Maven

Maven – Introduction to the Standard Directory Layout

 

Ruby

  • bin/
  • install.rb
  • Gemfile
  • Rakefile

 

rails/rails https://github.com/rails/rails

opscode/chef https://github.com/opscode/chef

puppetlabs/puppet https://github.com/puppetlabs/puppet

 

Directory layout for pure Ruby project - Stack Overflow

 

Ruby on Rails

sass/sass https://github.com/sass/sass

 

JavaScript /

  • .jshintrc
  • .jshintignore
  • Gruntfile.js
  • bower.json
  • package.json (npm install)

 

jquery/jquery https://github.com/jquery/jquery

 

What is the best directory structure for organizing an Open Source JavaScript project? - Quora

 

NodeJS

less/less.js https://github.com/less/less.js

strongloop/express https://github.com/strongloop/express

 

    陳幸延跨平臺程式

陳幸延ruby/ruby

go

 

    陳幸延參考網站

陳幸延Chapter 2: Project management and the GNU coding standards

Starting An Open-Source Project - Smashing Magazine

PyCon 2013 : Scripting to PyPi to GitHub and More