一个自动部署web开发环境的工具

代码在github上webDevConfig

目前仅做了mac os 加apache的支持,其他支持将在后续跟进。

配置文件说明(path.conf.json)

{
  "os": "osx",    //operating system e.g. osx windows linux
  "server": "apache",    //http server e.g. apache nginx iis
  "paths":
  {
    "vhosts": "/etc/apache2/other/",    //vhosts file path
    "hosts": "/etc/hosts",    //hosts file path
    "wwwRoot": "/Library/WebServer/Documents/"    //web root path
  },
  "indexPath":    //index file path for select
    [
      "/public",
      "/www/public",
      "/Public"
    ]
  ,
  "domain": ".dev.net"    //development domain
}

模板文件说明(vhosts.conf.temp)

<VirtualHost *:80>
    ServerName {serverName}    //{serverName} will be replaced by dev domain name
    DocumentRoot {appPath}/    //{serverName} will be replaced by web app path
    <Directory "{appPath}">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow From All
    </Directory>
</VirtualHost>

mac os 可以通过软连接直接使用

chmod a+x config.py
ln -s path to project/config.py /usr/local/bin/webconfig