Git adding, committing, and pushing from a website - javascript

I'm making a website as a collaboration tool. Several people could be using it, and I need the ability to, from the website, be able to add, commit, and push to git for all users. I had several ideas, but don't know how they'll pan out. Here are some of them:
Create an external Python program waiting for an event from the website. Then the Python program could access the terminal on the local machine and run the necessary commands to add, commit, and push to git.
 The issue with that is that the Python program would have to be running constantly on the local machine of every user of the website. I don't plan to have too many, but I think this would be VERY inconvenient.
Use some complicated JavaScript program to scrape GitHub and automate add, commit, and push through there. Don't think this is a good idea, but I'm open to it.
Will any of these work for what I need? If so, how would I implement them? Is there a formal way of adding, committing, and pushing to Git over the internet that I'm oblivious to? I've done a ton of research and come up empty-handed.
EDIT
Somebody in the comments suggested using the Github API. I didn't find anything useful, but if I'm not seeing something please point it out. I'm specifically looking for something to replace the usual git add ., git commit -m "message" and git push commands, but for my website to automate this.

Related

How to know which site are running my module?

I am about to sell a module that I coded for e-commerce websites, and I was wondering if it's possible, to insert some extra code in it in order to know which websites are running the module.
In other words, let's say a customer buys my module, then install it on its website, is there a way for me to know which website it is ?
I don't want any other info than "which website", my goal is not to trace users, but simply to have a statistic of the number of websites where my module is installed (because, it can be for instance that a customer buy the module then install it on several other websites...)
Thanks for your help
Aymeric
Difficult to answer without knowing what you are running, PHP, JS, etc. but when I created a similar plugin for WordPress there are some hooks for when a plugin is activated/deactivated. I just put an HTTP call into my API that told me when someone activated or deactivated the plugin and I got a rough idea. I mean, if they don't deactivate it properly, e.g. delete the files, then you would get a false positive of them using it, but not many folk do that.

How to interact with social websites (auto youtube posting, finding titles of new videos etc.) from the command line

I would like to write a script to access data on a website, such as:
1) automatically searching a youtuber's profile for a new posting, and printing the title of it to stdout.
2) automatically posting a new video, question, or comment to a website at a specified time. For a lot of sites, there is a required login, so that is something that would need to be automated as well.
I would like to able to do all this stuff from the command line.
What set of tools should I use for this? I was intending to use Bash, mostly because I am in the process of learning it, but if there are other options, like Python or Javascript, please let me know.
In a more general sense, it would be nice to know how to read and directly interact with a website's JS; I've tried looking at the browser console, but I can't make much sense of it.
Python or Node (JS) will probably be a lot easier for this task than Bash, primarily because you're going to have to do OAuth to get access to the social network.
Or, if you're willing to get a bit "hacky", you could issue scripts to PhantomJS, and automate the interaction with the sites in question...

Node.js Touchless (XCOPY) Install on Windows

This may be the wrong forum to ask this question, however is it possible to do a "touchless" node.js deployment? For example, is it possible to push a copy of node.exe and the required packages to a physical location on the drive (assume the machine is generally in a disconnected state) then have a shortcut that executes the appropriate commandline to get the node process running?
I know that this is a loaded question, because without being physically installed on the box, and then running within a Windows Service, you lose all the lifetime management, and that is just scratching the surface of the things that need to be considered. Anyway, I truly appreciate the help and opinions.
Just coming back to clean up this answer. Yes this is possible, but not always advisable. Better to do an installation or leverage containers.

How can I calculate UPS shipping using NodeJS?

I'm developing a public e-commerce site in NodeJS and MongoDB, and I'm using forever instead of nginx or anything like that. (please let me know if I'm totally insane for doing this and why before I get too far along :)
As part of this site I need to calculate shipping, but I need to know that the numbers are spot on because I want to charge customers at checkout.
How could I set this up with Node.js?
I kind of have one solution, but I have no guarantee that it's accurate. Has anyone dealt with the UPS APIs using Node?
Thanks in advance for your help
Someone named Jesse D. Pate has developed a native UPS API. I have no idea if it's worthwhile, but the github repo is here, and it can be installed and toyed around with via
npm install ups_node
I think I've got it figured out ...now to start a Github project
This is a universal way to do it:
I modified the ./RatingPackage/PACKAGEXMLTools/Rate_Tool_SampleRequest.xml to include my information then I saved it as testRequest.xml then I posted it to https://wwwcie.ups.com/ups.app/xml/Rate (their test server) using the command
curl -X POST -d "`less testRequest.xml`" https://wwwcie.ups.com/ups.app/xml/Rate
and it returns an XML document that can then be converted to the (superior) json format and used in a web app.
I developed a node module with support for more functionality (and will continue improving) of the UPS API. With this module you can provide rating information, create a shipment, produce a label, void a shipment, track shipments, and perform address validation.
Check it out:
npm install shipping-ups
Read docs here: https://github.com/typefoo/node-shipping-ups

Javascript Git client

Is there a Javascript implementation of Git?
I'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests.
Check out: https://github.com/danlucraft/git.js
A pure js implementation of git in javascript.
This https://github.com/creationix/js-git is and will be the future!
It is backed by a kickstarter campaign and has a very sound software design.
Many of the client use-cases such as git clone have been implemented
According the answer to my question on the issue tracker [1]. The author also plans to implement parts of the server side stuff to allow you to build a server with it.
https://github.com/creationix/js-git/issues/33
You can use https://github.com/isomorphic-git/isomorphic-git
isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read and write to git repositories, fetch from and push to git remotes (such as GitHub), all without any native C++ module
isomorphic-git is a continuation of https://github.com/creationix/js-git
isomorphic-git would not have been possible without the pioneering work by
#creationix and #chrisdickinson. Git is a tricky binary mess, and without
their examples (and their modules!) I would not have been able to come even
close to finishing this. They are geniuses ahead of their time.
Related questions:
Run git push from javascript hosted in static site
How to implement Git in pure Javascript to create a GUI?
I guess it depends on what you need, but there's a few related projects out there.
The most "robust" implementation I can think of is this one by the 280North crew (of Cappuccino fame).
There's also some server-side JavaScript projects underway (e.g., http://github.com/ajaxorg/node-github), but that won't run entirely within a browser client.
Update (for anyone else who comes across this):
Please be sure to check out vanthome's answer. Tim Caswell's js-git project is well funded and undoubtedly the best answer here at this time.
I just recently wrote a Git client called Nougit. Maybe this resembles something you are looking for?
$ npm install nougit
https://github.com/gordonwritescode/nougit
This is a full GUI, but the module inside named "git.js" is an API I wrote specifically to do what you are describing. Yank out the file, and you can use express to handle the http routes.

Categories