Skip to content

Commit

Permalink
Added autoconfig of ip and port
Browse files Browse the repository at this point in the history
  • Loading branch information
presidenten committed Oct 25, 2013
1 parent 1f59234 commit 8764ea9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
24 changes: 22 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var sqlite3 = require('sqlite3').verbose();

var dbName = 'nest.db';
var serverLocation = 'ssh://localhost:9000';
var serverLocation = 'ssh://<ip-address>';

module.exports = function ( grunt ) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
Expand Down Expand Up @@ -137,4 +137,24 @@ module.exports = function ( grunt ) {
console.log('\nShutting down...\n');
}
});
};

grunt.registerTask('config', function(ip,port){
var gruntTextReplace = require('grunt-text-replace/lib/grunt-text-replace');
console.log(ip);
console.log(port);
gruntTextReplace.replace({
src: ['Gruntfile.js', 'bowers-nest.js', 'templates/.bowerrc'],
overwrite: true,
replacements: [
{
from:/<ip-address>/g,
to: ip
},
{
from:/<port>/g,
to: port
}
]
});
});
};
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Run tests and sync with official Bower repository

Configure server location

gedit Gruntfile.js
gedit templates/.bowerrc
grunt config:<ip-address>:port

Configure SSH on your server

Expand All @@ -61,7 +60,7 @@ Register package with name = unicorn

To register package with name and URL, please use curl like so

curl http://localhost:9000/packages/ -v -F 'name=package1' -F 'url=http://repo1.git'
curl http://<ip-adress>:<port>/packages/ -v -F 'name=package1' -F 'url=http://repo1.git'

Unregister package with name = unicorn

Expand Down Expand Up @@ -96,10 +95,10 @@ Sync with official Bower registry packages
### Manual commands through curl:
List packages, add package1 and package2, list package1, search for 1, remove one and list all

curl http://localhost:9000/packages/
curl http://localhost:9000/packages/ -v -F 'name=package1' -F 'url=http://repo1.git'
curl http://localhost:9000/packages/ -v -F 'name=package2' -F 'url=http://repo2.git'
curl http://localhost:9000/packages/package1
curl http://localhost:9000/packages/search/1
curl -v -X DELETE localhost:9000/packages/package1
curl http://localhost:9000/packages/
curl http://<ip-adress>:<port>/packages/
curl http://<ip-adress>:<port>/packages/ -v -F 'name=package1' -F 'url=http://repo1.git'
curl http://<ip-adress>:<port>/packages/ -v -F 'name=package2' -F 'url=http://repo2.git'
curl http://<ip-adress>:<port>/packages/package1
curl http://<ip-adress>:<port>/packages/search/1
curl -v -X DELETE <ip-adress>:<port>/packages/package1
curl http://<ip-adress>:<port>/packages/
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bowers-nest",
"main": "bowers-nest.js",
"version": "1.0.1",
"version": "1.0.0",
"homepage": "https://github.com/presidenten/bowers-nest",
"authors": [
"Johan Hernefeldt"
Expand Down
4 changes: 3 additions & 1 deletion bowers-nest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
var server = require('./server/server');

server.start();
var port = <port>;

server.start(port);
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bowers-nest",
"version": "1.0.1",
"version": "1.0.0",
"description": "A Bower registry written for node and express with SQLite3",
"main": "server.js",
"scripts": {
Expand Down Expand Up @@ -31,6 +31,7 @@
"jasmine-node": "~1.11.0",
"grunt-jasmine-node": "~0.1.0",
"grunt-curl": "~1.1.1",
"grunt-contrib-clean": "~0.5.0"
"grunt-contrib-clean": "~0.5.0",
"grunt-text-replace": "~0.3.8"
}
}
14 changes: 7 additions & 7 deletions templates/.bowerrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"directory": "bower_components",
"registry": "http://localhost:9000",
"registry.search": "http://localhost:9000",
"registry.register": "http://localhost:9000",
"registry.publish": "http://localhost:9000",
"proxy": ""
}
"directory": "bower_components",
"registry": "http://<ip-address>:<port>",
"registry.search": "http://<ip-address>:<port>",
"registry.register": "http://<ip-address>:<port>",
"registry.publish": "http://<ip-address>:<port>",
"proxy": ""
}

0 comments on commit 8764ea9

Please sign in to comment.