Package a Wordpress Plugin that is being Source Controlled using Git - php

I am using php to build a plugin for wordpress in eclipse and using git for source control. Eclipse's workspace is in my google drive.
I have completed writing all the code for the plugin now i want to put that code in my wordpress installation and this is what i am unable to figure out. I have seen the files in my google drive, they obviously do not have all the work i have done.
I understand the concept of stage, commit and branch. I have done some reading on "http://git-scm.com/".
Maybe i am misunderstanding a concept or just not search for the right keywords.
Can you please explain how to move the actual code to the wp installation?

I assume you want to create a zip file from your repository, git supports that:
$ git archive --format zip --output /full/path/to/zipfile.zip master
See exporting your repository - git ready - you can then upload that zipfile in your wordpress admin interface to install it as a new plugin.

Related

local git repository and how to upload HTML and PHP code to webserver

I'm new with git and still a bit confused how to best manage a local repository with a webserver. Until now, I've just used a plain text editor and FileZilla to upload HTML and PHP code to webserver.
Now I would like to use git for versioning and I've created a local repository on my Ubuntu desktop and made some changes to my code. Do I still have to use FileZilla to upload code to webserver or is there a more comfortable way with a git command? - All I found on the web was to use push and pull, but only in conjunction with GitHub - since I don't need to share my code it with others, I don't want to make my code public on GitHub.
Is there a git command to upload commited HTML and PHP files to webserver? Or have I misunderstood something? - Or shall I think about it that my repository is the code on the webserver?
Any help welcome.
Have you git installed on your server?
Push your code to your account repository on GitHub / Gitlab or Bitbucket
2.In your html_public directory, run these commands
To initialize git in the folder
git init
To add your main remote where you will pull / push etc your code
git remote add origin https://your_remote_url.git
Recover the remote code
git pull origin the_branch_you_want_to_recover
or
git clone https://your_remote_url.git
or
git clone -u https://your_remote_url.git the_branch_you_want_to_recover
After intensive research today, I found git-ftp and I think that this add-on is exactly what I was looking for.

Jenkins trying to delete the PHP project

We created a clone from the dev server for the jenkis CI to improve our work, we configurated it and the tests started working as we wanted. Then we find out that the git plugin in the jenkins is not liked with the project's workspace. It's a PHP REST api project, every server has it's own configuration. So we gave to the jenkins the path of the project to use that - this is the "Checkout to a sub-directiory" option. Then when a new PR is created, then jenkins is tiggered and it's start the build, and at first it's trying to delete the complete workspace.
I wouldn't think that it would be impossible to run tests on an already existing project with the jenkins, but this is ablosutly not the way how to do it. Every server has it's own configurations, so those are not part of the git repo, plus there is a base installation for the framework, and that's also not part of the git repository.
Now my question is what information are we missing, and how could we configure the git pluggin to make the jenkins start working on our existing project?
Ensure that you have the GitHub plugin and Git Pull Request Plugin installed in your jenkins workspace, now all you have check these 2 option
Also note that you have to add your public in Git which you would have done I'm guessing, now a hook will be created and you can send a request from Git and if you have a green tick ALL GOOD, else you have to debug it try this link Github webhook URL config issue? How to fix it?

Plugin handshake timeout for $myHttpURLforOrionPlugin

I followed these steps from the guide found at http://planetorion.org/news/2012/01/writing-a-content-assist-plugin-for-orion/ and modified the Ruby plugin to handle keyword assist for some PHP keywords. I copied the git repo and have an almost identic repo at https://github.com/oscaralmgrenibm/orion.php.git
Now I've also installed and uploaded my files to a placeholder app running at http://oscarorionplugin.mybluemix.net/phpEditor.html. Using that link in my DevOps Services Eclipse Orion WebIDE, I get the following error:
Plugin handshake timeout for: http://oscarorionplugin.mybluemix.net/phpEditor.html
Anyone had similar issues and figured out what needs to be done?
Current Solution
Create a new public project on IBM DevOps Services, init git repo and put all files related to the plugin there.
Browse project and open up yourPlugin.html in web editor (Edit code)
Right-click file and choose View in Browser
Copy URL from browser
Paste in Install Plugin button URL
It seems to be related to HTTPS and I have no further details at this moment on how to do it in a simpler way.

Generate a version number of my site with git?

I am building a PHP/Yii application. While developing and testing on different machines, I'd like to be able to quickly see in the footers if the version I am seeing is the latest. So basically I want to generate some kind of version number every time I modify something.
I was thinking since I use Git (and GitHub) I could use some of the meta data generated at every commit?
How could I achieve this?
Note: I'd like to avoid using command-line stuff as my current hosting won't allow me to do this.
Add a git hook to create a txt file in the root folder of your app to keep track of the version (or tag, or whatever) of the current deployed code.
Just a 30 sec. example (search google for more details and how to use hooks in git) put in the .git/hooks folder a file named pre-commit and add this shell code:
#!/bin/sh
rm version.txt -i
git describe --tags >> version.txt
git add version.txt
If you deploy with Capistrano, one very serious possibility is to read the 'REVISION' file from the base of the site. If you deploy from a git repo, it will be the commit SHA.

How to create Eclipse project from existing git repo

I have an existing project utilizing git and have just installed eclipse along with egit. I pointed to the git repository with egit and can see all my files, my existing branches and can switch between branches.
When I open a file from the view of the git repository it does not seem to recognize that it is a php file, doesn't show me the classes within it and doesn't do code completion. If I just drag a file in from explorer it at least recognizes that file as php, but doesn't understand the project well enough to show me code completion from installed libraries. I think I need to configure eclipse to understand the projects home directory, but am a bit lost. Any help would be appreciated.
Your answer may fall within this guide to change the "nature" of your project. It's at least worth exploring. I will be attempting to do the exact thing you've described some time this week so hopefully it will work. The wiki doc also suggests that certain "natures" may conflict with each other but hopefully that won't be the case here. Link -->
http://wiki.eclipse.org/IRC_FAQ#How_do_I_manually_assign_a_project_Nature_or_BuildCommand.3F
After just trying to reproduce your steps I am having the exact same experience. I believe this may be "expected" behavior. For clarity, when I open a php file from the "PHP Explorer" view everything seems to work fine but when I open a php file from the "Git Repositories" view Eclipse treats it as a text file (no code highlighting etc.). I suggest that you work from the PHP Explorer view and leave the Git Repositories view open separately only to watch/monitor the repository not as a working view of files to edit and what not.
You need to open it as a PHP Project from existing source (GIT working folder) then share the project with Git, ie, right-click on the project, go to Team > Share project, click on Git.
See http://www.youtube.com/watch?v=-Zba8iAnLms for a demo.
Did you install the pdt plugin in eclipse? It should recognize any .php file opened. Shouldn't matter where it's located.

Categories