码迷,mamicode.com
首页 > 其他好文 > 详细

如何建立一个bower私库

时间:2014-06-30 16:54:31      阅读:296      评论:0      收藏:0      [点我收藏+]

标签:blog   http   java   2014   os   art   

本教程适用于centos

安装之前

检查nodejs

如果没安装nodejs按照以下步骤安装

$ su - 
$ yum install openssl-devel
$ cd /usr/local/src
$ wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz
$ tar zxvf node-v0.10.29.tar.gz
$ cd node-v0.10.29
$ ./configure
$ make
$ make install

查一下版本号,看有没有安装成功:  
$ node -v
v0.10.29


检查git

如果没安装,请按照以下步骤安装

$ sudo yum -y install git

开始安装bower私库

STEP 1 安装 git 和 git-deamon

$ sudo yum install -y git git-daemon

STEP 2 安装 private-bower

$ sudo npm install -g private-bower

STEP 3 设置 private-bower 

$ sudo su -
$ cd /data
$ mkdir private-bower
$ vim /data/private-bower-config.json


将以下内容粘贴进去:
{
    "port": 5678,
    "registryFile": "./private-bower/bowerRepository.json",
    "disablePublic": false,
    "publicRegistry": "http://bower.herokuapp.com/packages/",
    "repositoryCache": {
        "git": {
            "enabled": true,
            "cacheDirectory": "./private-bower/gitRepoCache",
            "host": "localhost",
            "port": 6789
        },
        "svn": {
            "enabled": true,
            "cacheDirectory": "./private-bower/svnRepoCache",
            "host": "localhost",
            "port": 7891
        }
    },
    "log4js" : {
        "enabled": true,
        "configPath" : "./private-bower/log4js.conf.json"
    }
}

$ vim /data/private-bower/log4js.conf.json

{
    "appenders": [
        {
            "type": "dateFile",
            "filename": "./private-bower/private-bower.log",
            "pattern": "-yyyy-MM-dd",
            "alwaysIncludePattern": false
        },
        {
            "type": "console"
        }
    ],
    "replaceConsole": true
}


启动 private-bower
$ sudo su -
$ cd /data
$ private-bower --config ./private-bower-config.json
[2014-06-30 10:00:22.481] [INFO] console - [bower]  Refreshing public packages...
[2014-06-30 10:00:22.512] [INFO] console - [bower]  Bower server started on port 5678
[2014-06-30 10:00:22.538] [INFO] console - [bower]  Starting git cache server
[2014-06-30 10:00:22.543] [INFO] console - [bower]  Starting svn cache server
[2014-06-30 10:01:09.167] [INFO] console - [bower]  Loaded public packages




确保 private-bower 正常启动:
打开一个新窗口来访问:
$ lynx http://localhost:5678/

会显示:
   
   Fork me on GitHub


Private Bower


   ____________________
   Docs Public Packages
   Private Bower service is down
   No private packages registered read docs about how to register packages.
   Loading Packages...


{{ package.name }}


   hits: {{ package.hits }}
   {{ package.repo }}


Created by


   BarnaToth


Barna Tóth


如果是这样,就安装完毕了




客户端测试

$ sudo su -
$ npm install -g bower
$ su - wlsuser
$ bower help
$ vim .bowerrc
{ "registry": "http://<your private repository ip>:5678" }
$ cd <testdir>
$ bower install jquery


如何建立一个bower私库,布布扣,bubuko.com

如何建立一个bower私库

标签:blog   http   java   2014   os   art   

原文地址:http://blog.csdn.net/nsrainbow/article/details/35988611

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!