For iOS, is it possible to run git command? - ios

I want to run git command in my app, so I can git pull/commit/clone with the repo. Is it possible? How to do? I search for google for the topic , and cannot find the answer. Any idea, thanks a lot.!

Git is not available on iOS like it is available on OS X. On OS X you can call any command line command using NSTask, but NSTask is not available on iOS.
The only way to achieve what you want to do is get the Git source code and include it in your app.
Remember that normally the user interfaces with the app by executing the program 'git' and giving as arguments for instance clone <myRepo>. This means that the program 'git' gets two args in the main function and from their does what needs to be done. The program git does not exist in you case, as that is now your app, and the arguments can still be the same, e.g. via textfields.

Git is open source https://github.com/git/git and written in C. So in theory you could include it as library in your application.
There is a git client on AppStore so its definitely doable https://itunes.apple.com/us/app/working-copy-powerful-git/id896694807?mt=8
But I don't image that it will be super straight forward and would not recommend it unless you have a lot of time on your hands

Related

How to display configuration differences between two jenkins Jenkins builds?

I want to display non-code differences between current build and the latest known successful build on Jenkins.
By non-code differences I mean things like:
Environment variables (includes Jenkins parameters) (set), maybe with some filter
Version of system tool packages (rpm -qa | sort)
Versions of python packages installed (pip freeze)
While I know how to save and archive these files as part of the build, the only part that is not clear is how to generate the diff/change-report regarding differences found between current build and the last successful build.
Please note that I am looking for a pipeline compatible solution and ideally I would prefer to make this report easily accessible on Jenkins UI, like we currently have with SCM changelogs.
Or to rephrase this, how do I create build manifest and diff it against last known successful one? If anyone knows a standard manifest format that can easily be used to combine all these information it would be great.
you always ask the most baller questions, nice work. :)
we always try to push as many things into code as possible because of the same sort of lack of traceability you're describing with non-code configuration. we start with using Jenkinsfiles, so we capture a lot of the build configuration there (in a way that still shows changes in source control). for system tool packages, we get that into the app by using docker and by inheriting from a specific tag of the docker base image. so even if we want to change system packages or even the python version, for example, that would manifest as an update of the FROM line in the app's Dockerfile. Even environment variables can be micromanaged by docker, to address your other example. There's more detail about how we try to sidestep your question at https://jenkins.io/blog/2017/07/13/speaker-blog-rosetta-stone/.
there will always be things that are hard to capture as code, and builds will therefore still fail and be hard to debug occasionally, so i hope someone pipes up with a clean solution to your question.

Creating an app as a Team so both parties can edit code

My friend and I are creating an app and we are wondering if there is a way where we can both edit the code at the same time?
Don't use SVN. You will see how easy version control could be and later everywhere on the job people will use Git because it is "better" and you will get frustrated.
Just use Git from the beginning, stay happy, you will love it. Really! 😏
The default in Xcode is Git too, so it can't be wrong.
Just be aware that the interface in Xcode is offering you a filtered version of the Git commands. As soon as you really need it for anything you will end up on the command line.
Whatever you try there, the first few times it will fail until you have learned the propper syntax and all side effects. So just make a copy of the folder, or zip or tar it before you try it a simple git command.
Also SourceTree is nice, but same problem there, learn what every command really does.
Use git! Lets people edit code and track the progress of the project (among many other useful tools).
Git Tutorial
If you are looking for more of a 'Google Docs' atmosphere, I would look into Codr or Cloud9
You can use SourceTree a free git repository handler.

How can I copy ROR application to my local drive [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I am building web app with one guy based on my idea (trying to avoid overused word 'startup'), I'm responsible for the front end, he is/was doing back end using ROR. On top of delaying the launch (January, May, now August and no way it's going to happen), recently he also stopped being responsive, hasn't touch the project for 3 weeks, ignores my questions, so I am thinking of moving on and look for another cofounder.
I am affraid he might not give me access to the application if I decide to sack him. Currently we are using c9.com for a dev version and we push changes to git repository, so the version on c9 is the most updated one.
I'm not the back end guy so is there a way I can secure the work / minimise the losses if I need to find a new cofounder, so that the new one will be able to fairly quickly recover the app? I can obviously copy all the erb files and folder structure (database isn't big so if I loose that part - not a big drama), but is there a smarter way?
I don't know c9 well, but assuming you have access to the c9 repo, you should be able clone it directly to your machine (several documentation points available) and then re-push it to a GitHub or Bitbucket repo. c9 may allow you to integrate to Github (or Bitbucket) and do it that way without a local clone. Be sure to make your repo private unless you want it visible publically.
Assuming you can delete the c9 account once you've cloned it, then your wayward co-founder wouldn't have access once it's down (but could still have a local clone from it -- probably nothing you can do about that). In any case, I'd clone it rather than trying to copy files manually (though you could -- not that bad to do with RoR).
If you don't have access to the c9 repo, then it's much more difficult. He'd either have to add you or you'd need to get access some other way.
Most developers I know that behave as you've described are probably more embarrassed or feeling guilty than anything, so if you "let him off the hook", (s)he'll probably be relieved and happy to hand it back to you, albeit sheepishly.
To connect your Cloud 9 repo to Github or Bitbucket, please look at this site: https://docs.c9.io/docs/setting-up-github-workspace. In short, the steps are to establish a Github or Bitbucket account. From C9, connect to that Github or Bitbucket repo. It is then integrated into the C9 interface and from there you can use c9 to push your code into the cloud account repo.
Once your code is on Github or Bitbucket, you can then then just use those services to bring the entire code base to your local machine. First, realize that once the code is on Github or Bitbucket, you essentially now have the whole thing so that it may not be necessary to locally clone if you don't want to. And it would be safe to end the c9 account since the code will now be on Github or bitbucket (you may not want to, but you could).
To clone from either, the command line phrase (either from Mac's command line interface or a Linux command line) is $ git clone <url> <name>. You do this from the directory where you want to create a subdirectory for your project in. The <url> is provided to you by Github or Bitbucket (just look for the area on the screen that says clone and choose the git option -- it should be easy to find). The <name> portion is optional but gives you an opportunity to name your project subdirectory something other than the name of cloud repository. Both GitHub and Bitbucket provide documentation for $ git clone.
I very much encourage you to not shy away from $ git clone. If it's new to you, then you'll appreciate having built a new and useful competency as a front-end developer and the command itself will be easy after the first time you use it. Also you can just erase the directory that the clone makes after you clone it in case you want to try again, so there is very little risk in just trying it.
Let me know if you need more and good luck!
This solutions work with nitrous.io, maybe work with c9.io.
Simply make an archive for the folder you want to download:
tar -zcvf myarchive.tar.gz mydirectory/
Now you got a *.gz file. Whichever folder your gz file is in, be there and type:
python3.3 -m http.server 8080
This started a cute little http server ready to serve you your download, now from the Preview menu click "Port 8080", this opens a new browser tab showing your gz file in the file listing. Now you can click your gz file and it will start downloading. Once done with the download, press Ctrl+C on the terminal to terminate the http server.
Hope it helps,

Xcode Environment Variables and Command Line Arguments

Background
I am developing an iOS app that connects to a server. We have a team of developers who run their own server with unique addresses for debugging. Our rule for source control is to only checkin the "production url".
In Android we have a solution that works really well. This solution won't work in iOS.
What I've Tried
Set a "Command line argument" or "Environment variable" in the Build Scheme. The problem with this is those are put into the "*.xcproject" file which get's checked in and causes merge conflicts. If it could be set at the user level it would be fine because we .gitignore xcuserdata.
I also tried referencing a "MyConfig.h" file that does not get checked in. But if it does not exist the project won't build.
What I want to do
If a developer wants to point at a different server they would set an environment variable on their mac. Something like "export MY_SERVER="http://domain.com/api/". In the project file we would add and environment or command line argument that is basically "MY_SERVER=$(MY_SERVER)".
Unfortunately I can't figure out how to get XCode to resolve the variable on my OSX machine. It seems environment variables are resolved on the device only. Command line arguments seem to be taken literally.
Research I've done
http://qualitycoding.org/production-url/ - does not really address the real issue
http://nshipster.com/launch-arguments-and-environment-variables/
Google, Apples developer forum and Stackoverflow post.
How do you do this in your projects ?
Is the only solution to use a backdoor or some file folks change and just try not to accidentally checkin?
As an update I found the solution that solves the problem for me. I am using https://github.com/xslim/mobileDeviceManager and a script that is checked in. The developer can create their custom configuration and copy it to the documents directory. Now we keep production checked in and have a runtime check for our custum configuration file.
Here is an example of the tools usage:
$ mobileDeviceManager -o copy -app "com.domain.MyApp" -from ~/.myAppConfig/app_override.plist
This way the developer can keep their custom configuration in their home directory (out of source control) without fear of accidental checkin. We already use process like this for other desktop and android apps so this fits our process really well. This has the added benefit that if a testers device is failing we can point it at a custom debug server with extra logging to simplify the debug process and not need to deploy a new binary to that device during internal testing.
I hope this can help someone else.

In PHPUnderControl, can I configure PHP_CodeSniffer to ignore specific directories?

I've recently been trying to set up PHPUnderControl, a Continuous Integration server based on CruisControl. Part of the checks I'd like to run is the PHP CodeSniffer (PHPCS) to detect "code smell". However, letting this run on my codebase results in an extreme amount of problems being detected. Most of these are found in libraries that I've included in my SVN repository through an svn:externals directive, and hence aren't under my control.
Is it possible to tell PHP_CodeSniffer to ignore part of my SVN repository, while still validating other parts?
Found the solution - one can add the --ignore switch to the set of arguments passed into phpcs.
[--ignore=<patterns>]
Use
$ phpcs --help
to displays all information about commandline usage.

Resources