Skip to content

A very basic git javascript wrapper for Adobe Air and Node.js

License

Notifications You must be signed in to change notification settings

tomgruner/jsgit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A very basic interface in javascript to manage git repositories for Adobe Air and Node.js (future)

It is still very fresh code, and needs a bit more work before it is really useful.

Example for Adobe Air 

//Start up a new repository and do a commit
var git = new jsgit({//js context (node, air, other??)
					 context          : 'AdobeAir',
                     //On air, an absolute path to git is required
					 gitCommand 	  : '/usr/local/git/bin/git',
					 //optional logging function
					 log              : log});

//Set the working directory
git.setDirectory(testDir);

//Send a direct call to git with an instance of git.Listener       	
git.callGit(['init'], new git.Listener({onComplete : function (data){
	log(data);
	git.callGit(['status'], new git.Listener());
	var testFile = air.File.documentsDirectory.resolvePath('jsgit/test/sampleFile.txt');
	var fs = new air.FileStream();
	fs.open(testFile, air.FileMode.WRITE);
	fs.writeUTFBytes('why hello');
	fs.close();
	git.callGit(['add', 'sampleFile.txt'], new git.Listener({onComplete : function (data) {
		log('add sampleFile.txt: ' + data);
		git.callGit(['commit', '-m', 'Initial Commit'], new git.Listener({onComplete : function (data) {
			log('commit -m "Initial Commit": ' + data);
			git.callGit(['log'],  new git.Listener({onComplete : function (data) {
				log('log: ' + data);
			}}));
		}}));
	}}));
}}));

About

A very basic git javascript wrapper for Adobe Air and Node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published