0.0.1 • Published 10 years ago

gitsvn v0.0.1

Weekly downloads
1
License
-
Repository
github
Last release
10 years ago

Gsproxy

Build Status Dependecies Status

Warning: experiment

Gsproxy is currently for internal use. It has some exclusive code for renren, so can not be use widely. If you intrest, fork the repository and make some changes for your own project.

Intro

Gsproxy is a repo synchronizer for frontend developer. It encourages using multiple repositories(Git recommend) for development and one repository for production to make code clean. Multiple repositories make project granulate, which is especially great for frontend. Gsproxy allow static resource files(like javascript and css files) combining across repositories, so everyone can work independently and share the great ideas. More importantly, multiple repositories can be easly integrated with other tools like JIRA and Phabraicator, which is very suitable for agile development.

Gsproxy uses VCS hooks(pre-commit) to integrate lint and unit tests, besides it support coffee and less autocompiling.

Installation

Gsproxy has two daemon server program, one is normally installed in server for synchronizing files from development repositories to production repository, the other is installed in local where programmer coding for generating temple files based on static resource requst, and more, it can accomplish some tasks like lint and unit tests before commiting changes.

First, install the application with: npm install -g gsproxy.

The server part

  1. The server part use gspadmin command.
  2. Make a directory contains two files: repos.json and members.json.
  3. Run gspadmin start on directory above to start a daemon for synchronizing repositories.

repos.json

{
    development: [
        git@github.com:renrenfed/d1.git,
        git@github.com:renrenfed/d2.git
    ],
    production: git@github.com:renrenfed/p.git
}

members.json

{
    administrator: ['viclm'],
    users: {
        viclm: 'password'
    }
}

The client part

  1. Run gsp pull in a new directory(path/to/workspace, for example) to clone all the development repositories.
  2. Run gsp start on directory above to start a local server for static resource requst
  3. Config a webserver(nginx/apache/lighttpd) and start

Configs for nginx

# Gsproxy use gsproxy.com for connectting server and clients, you need to specify a proxy for this.
server {
    listen       80;
    server_name  gsproxy.com;

    location / {
        # The port of server server is 7071
        proxy_pass http://server:7071;
    }
}
# Local static resource request prioxy.
server {
    listen       80;
    server_name  customdomain.com;
    charset utf-8;
    autoindex       on;
    autoindex_exact_size    on;

    rewrite ^/a?([0-9])+/(.*)$ /$2 last;
    rewrite (.*)\.[0-9]+\.css /$1.css;
    rewrite (.*)\.[0-9]+\.js /$1.js;

    location / {
        index   index.html index.htm;
    }

    location ~* /.+\.(css|js)$ {
        proxy_set_header x-request-filename $request_filename;
        # The port of local server is 7070
        proxy_pass http://127.0.0.1:7070;
    }
}

Repository configuration

Every development repository should contain a .gspconfig file.

{
  "id" : "project_id",
  "publish_dir" : "dist",
  "lint": {
    "js": {
      "engine": "eslint",
      "config": "eslint.json"
    },
    "css": {
      "engine": "csslint",
      "config": "csslint.json"
    }
  }
}

Commands

  1. Run with --help or -h for options.
  2. gsp start - Start a local server
  3. gsp pull - Clone/pull all development repositories
  4. gsp lint - Lint on changed files
  5. gsp test - Run unit tests on changed files
  6. gsp init - Project scaffolding
  7. gsp publish - Ask server to synchronize repositories
  8. gspadmin start - Start a server daemon
  9. gspadmin init - Init setting, add new repositories

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

License

Copyright (c) 2014 viclm Licensed under the MIT license.