gitsvn
v0.0.1
Published
Proxy for synchronizing repositories between git and Subversion.
Downloads
8
Readme
Gsproxy
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
- The server part use
gspadmin
command. - Make a directory contains two files:
repos.json
andmembers.json
. - Run
gspadmin start
on directory above to start a daemon for synchronizing repositories.
repos.json
{
development: [
[email protected]:renrenfed/d1.git,
[email protected]:renrenfed/d2.git
],
production: [email protected]:renrenfed/p.git
}
members.json
{
administrator: ['viclm'],
users: {
viclm: 'password'
}
}
The client part
- Run
gsp pull
in a new directory(path/to/workspace, for example) to clone all the development repositories. - Run
gsp start
on directory above to start a local server for static resource requst - 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
- Run with --help or -h for options.
- gsp start - Start a local server
- gsp pull - Clone/pull all development repositories
- gsp lint - Lint on changed files
- gsp test - Run unit tests on changed files
- gsp init - Project scaffolding
- gsp publish - Ask server to synchronize repositories
- gspadmin start - Start a server daemon
- 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.