Git bundled into Cocoa app cannot find helpers in bundle - macos

Context:
I have a Mac app. I want to include Git in this app because some functions of my app use Git and I don't want the user to have to install it on his machine.
I have downloaded Git from source. I edited the Makefile to declare these two lines:
NO_GETTEXT="yesPlease"
CURLDIR=/usr/local
The first line tells the build process to skip localizing and just use English.
The second line declares the path to where libcurl is installed. I downloaded libcurl_devel and built it from source. This is required to enable Git to pull/push from http and https repos.
Git builds successfully. I then copy all of the resulting files into my app's bundle. I'm using NSTask to run Git and attempt to pull an https://-based repo.
The Problem:
The error I get is:
fatal: Unable to find remote helper for 'https'
I googled this, and everyone said that as long as I had libcurl installed when I built Git, Git would work with HTTP and HTTPS addresses. And, in fact, if I run the installed Git from the command line, it does!
What I Need:
So, I must be missing a path setting or an environment variable or SOMETHING that tells Git where to find those remote helpers. They ARE in my app bundle; the screenshot below shows them:
So: what the hell do I need to set in order to resolve this problem when I run Git from within my application bundle?

Unbelievable. I've been trying to fix this for 8+ hours and five minutes after I finally break down and post this question, I figure it out:
Git has an option called --exec-path. I had been passing this argument to the NSTask like this (Where APP BUNDLE is replaced by the path to the application bundle on the user's machine):
--exec-path=[APP BUNDLE]/git/bin
Since bin was the folder where the Git binary was located, I figured that was the appropriate path. However, if I do this:
--exec-path=[APP BUNDLE]/git/libexec/git-core
It works.

Related

poetry on heroku: can't find (any!) modules after many tries

I'm trying to move to poetry as a system for python virtual environments, but I've never deployed it to heroku before, and am having no luck at all.
I've tried this now with two different fresh poetry projects, and two different fresh git repositories. I:
create a fresh poetry project
initialize it as a git repo
add all the relevant libraries (poetry add flask gunicorn etc)
add the SINGLE file that holds the entire app, and push it to heroku, which is configured with the poetry buildpack from https://elements.heroku.com/buildpacks/moneymeets/python-poetry-buildpack
When I try to run the file directly, my Procfile is "web: python project/website.py", I get "ModuleNotFoundError: No module named 'flask'" (which is imported in the first line of the file)
When I try to run the file indirectly (because maybe it makes a difference?) my Procfile is "web: gunicorn wsgi:app", I get "bash: gunicorn: command not found"
I am absolutely certain that the pyproject.toml is up to date, and have manually verified that the requirements.txt file it produces contains both flask, and gunicorn, by looking at the build files on the heroku server with "heroku run bash"
I have tried resetting the heroku cache, manually creating requirements.txt before build, emptying, and then re-filling requirements.txt, and other things I'm sure too. I get one of these two errors, every time. ALL of the questions I see about this issue just ask if the libraries are in the requirements files. Mine are. They are not being seen, or found, or noticed, or used, or something.
I have absolutely no idea what else to do. After this many tries the only sane thing would seem to be to just use pipenv, but the error seems so flagrant, and presumably simple, that it's driving me completely nuts.
EDITS (in response to comment): My file tree has changed through different attempts to make things work, so I've tried a number of configurations. Sometimes the Procfile and app file are in the same, top-level directory -- I've also tried having a runserver script at the top level, and putting the app script inside another directory.
I have also tried having, and not having, local requirements.txt files, in case poetry wasn't successfully creating them as it's supposed to, but the poetry build-back does appear to successfully build its own when launched on heroku. I examined that one, on the heroku machine, and it contained lines for both flask, and gunicorn (among others, but these are the specific two the system says are missing)
Test to run locally "poetry run flask run".

How to download (just the files) from another user's private Github repo using the command line on a Mac OS X?

I am on a Mac OS X Mojave. From the command line, I want to access a private repo (which I do not own but have access to) located at
https://github.com/<ORG_NAME>/<PROJECT-NAME>
By "access," I mean that I only need to download the project directory to my local machine. I only need the files and directory structure. I do not need to checkout the repo or get the .git history.
How can I do this from the command line?
This question is different because it deals with the scenario where I own the repo. Which I don't. Also that question uses the clone command. And I don't need a clone to checkout or the git history. I just need a copy of the files as previously stated.
This answer suggests the following.
git clone https://<username>:<password>#github.com/<ORG_NAME>/<PROJECT-NAME>.git
But they said you need to enter info at the prompt. I would like to avoid entering info at the prompt because this is part of a larger automation routine I'm making. So I'd like to have the command line instructions self-contained.
Edit: I also found this additional information, but I still can't figure it out from there.

Mac OSX, Adobe Brackets - Cannot find file (JS, part of Brackets) to edit "_staticHtmlFileExts"

Sorry if this isn't the place for this, I don't know where else I'd ask.
For Mac OSX El Capitan
I am trying to edit the property _staticHtmlFileExts
The variable used to be defined in src/file/FileUtils.js, but has since been moved to src/LiveDevelopment/LiveDevelopmentUtils.js.
When I go to Show Developer Tools within Brackets, I can view the sources, and very easily find /LiveDevelopment/ (and the child JS file)...
But any changes I make to the file are not saves on the system, and thus do not persist on successive opens of the Brackets app.
When I try to find the same file on my system, it is nowhere to be found...
I have hidden folders set to display (which they all do, when present), so I do not believe this to be the issue.
How come I can view the files in the Dev Tools, but not on my system? How, or where, can I make the change permanently?
The build installed with the Brackets.dmg installed minified, concatenated source file (main.js under ~/Application/Brackets.app/Contents/www/) along with a source map, which is why you can see the sources in developer tools, but you cannot see the original source files.
See the article How to hack on Brackets for instructions on setting up a development environment if you want to modify the files themselves.
For reference, the steps are as follows:
Install the latest Brackets build (this gives you the native shell binaries which you'll use in step 6)
Fork the brackets repo
Clone your fork of the repo: git clone https://github.com/<username>/brackets
Fetch submodules: cd brackets && git submodule update --init
Add an "upstream" remote: git remote add upstream https://github.com/adobe/brackets
Run setup_for_hacking script with tools/setup_for_hacking.sh "/Applications/Brackets.app"
Note that the steps 2 and 3 are optional if you are just making modifications for yourself. If so, you can just clone straight from the master (git clone https://github.com/adobe/brackets).

Install wkhtmltopdf on heroku using a java application

I manged to get my spring boot website online on Heroku. But I also use wkhtmltopdf to create a pdf. This works locally but now I have some problems.
Offline it works as follow :
ProcessBuilder pb = new ProcessBuilder
("cmd.exe",
"/c",
" cd C:\\Program Files\\wkhtmltopdf\\bin && wkhtmltopdf.exe "
+ "http://google.com C:\\MainWebApps\\TestApp\\src\\main\\resources\\userstorage\\Google2.pdf");
But how do I install this on Heroku?
Where do I store the temporarily html page so I can create a pdf from it ?
And where is wkhtmltopdf installed on Heroku ?
Can I call the wkhtmltopdf with a processbuilder on heroku?
EDIT
So after the comment of ceejayoz I googled a bit more and did find some interesting stuff.
So for Compile the binaries on Heroku I used this:
heroku run /bin/bash
Then I did a curl of wkhtmltopdf like this:
curl -O http://download.gna.org/wkhtmltopdf/0.12/0.12.0/wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz
Then I tried to extract it on the server but without success:
$ tar -xjvf wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz
tar (child): wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
EDIT2
I also found this https://github.com/dscout/wkhtmltopdf-buildpack on github.
So I did following :
heroku buildpacks:set 'https://github.com/heroku/heroku-buildpack-multi.git'
echo 'https://github.com/dscout/wkhtmltopdf-buildpack.git' >> .buildpacks
This created a file named .buildpacks but how do I proceed from there on ?
I also found this post but vulcan is deprecated and uses ruby
Using Wkhtmltopdf with Nodejs on Heroku
Can somebody provide me with good information because I am completely stuck with this?
You actually have two problems that you need to solve -
How to install/invoke the executable
How to handle the generated .pdf
Assuming you have the basics of Heroku deployment (push to the Heroku git remote), for #1, #ceejayoz is right - check the binary into your git repository. For example, under a ./bin directory. The root of your project (where the Procfile is) will be your working directory, and you should be able to invoke the program with ProcessBuilder using relative paths.
Caveat - since it looks like you are developing on Windows, you will need to pay attention to ensuring both platform-specific binaries are available, and add some logic to know which one to invoke (for example, by setting/checking a specific environment variable).
I recommend against trying to build with a custom build pack - you will spend a lot of energy for little to no benefit. Aside from the platform issue, you don't need to rebuild a third party tool when your code changes...
The second problem is that you can't leave the generated PDF in place. It will go away when the dyno is restarted (see https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem). Thus, the first thing you should do when the process completes is move the generated file to an external storage service (Amazon S3 is a good starting point).
Hope this helps.
You might want to use wkhtmltopdf-binary. With that solution, you do not need to put wkhtmltopdf executable into your VCS. You can use it for example with Maven or Gradle.

After updating Git Bash on Windows, still shows older version

On Git Bash's download site, it says you can clone it to update it. I downloaded it to install it, but I am starting to really get into Git and would like to clone it every time I want to update it from now on. I think I found the place where we need to clone it to, after much searching & less documentation than usual. If I am right, it is in the home directory, right under my nose the whole time!
I checked the version number with git --version beforehand, then cloned in that directory, then rechecked the version number Both times it said git version 1.8.3.msysgit.0, but on the download site it says the latest version is 1.8.4.3.
Have I not found the elusive git folder, or does the Git Bash team not let you directly clone the latest version until some time after it comes out? I know VirtualBox does that, for example.
I know this is sort of a duplicate of this question, but I tried its answer & the PATH variable didn't even have Git!
I would recommend to not try to update it, but simply download the portable version of msysgit and unzip it in a dedicated folder, that you then add to your path:
Current Portable msysgit download.
=> I unzip the latest one in (for instance) C:\prgs\git\PortableGit-1.8.4-preview20130916.
=> I add 'c:\prgs\git\PortableGit-1.8.4-preview20130916\bin' to my PATH.
Now if you want to automate that download/update process, I am building a Powershell script which does just that (for git and 30 other programs, including Mercurial, Subversion, but also Python, Ruby, Go, ...):
senv: download the zip archive of senv, unzip it in a path and call:
senv
The first time, you specify where you want all those programs to be downloaded: those are portable software only: no registry modification, no system variables modified.
If you don't want one of those program anymore, simply delete their installation folder.
That's it.
But each time you will call senv -u, it will check their respective web page and, if a new version is detected, it will download/upzip said new version in its dedicated folder, without removing the previous one.

Resources