Showing posts with label Tips & Tricks. Show all posts
Showing posts with label Tips & Tricks. Show all posts

2014-04-12

How to install GIT in Windows

In this article, we are going to learn about how to install GIT system in windows. Specifically Git and GitHub Client. The main goal is to make a software development environment with GIT.

As we know, GIT is a file management system with version controlling. We will use git to manage our developed source files. And, as Git maintain repository(public free, private paid), we will use them. I will make separate posts for GIT architecture and Git Commands.

So, For installing GIT System( lets call is system because it consists of more than one software). we need to download these two installers.

A. Git Environment Installer : We need that to support git commands in the system . Use latest build. I will use 1.9
B. Git- Hub windows client : We will use the GUI to manage out repository(folder in git hub & Local)
And, dont’ forget to have a account in github.com. Its free. Now, lets get started with following steps.

Step 1.
Run Git-1.9.0-preview20140217.exe installer in windows( I am using windows 7x64). Follow the full process of installation. In the process you have to take care of following things.

a. Select the advance context menu
image
b.  I like to use Windows Command Prompt rather than others
image

c. I prefer windows style for checking & commit.
image

d. Though the application will include in the path but make sure that you have this in your path variable.
image

Please check that you have installed Git. To do that, open command prompt and type git –version
And you will see git version number

image

We will get Git-Bash and Git Gui in program files. Git Gui is gui control of git command. We can create SSH key , repository using GUI also.  We will use Git hub client to do that.
So, we have successfully Installed Git in the system. Now, it is time to install Git Hub client.

Step 2.
Run Git hub windows client (GitHubSetup.exe). And follow steps that required to complete setup.

a. Log in with exist username /password or create a new account in GitHub.
image

b, After log in, We will see that our Windows Client has already add a SSH key with PC Name. If we go to this link with our account , we see a new entry. I will provide another post for how to create and use custom SSH key with key generation tool.

image

c. Now, we have define the Local directory where our repository will be downloaded. To do that,image

we have to go to Tools –> Option, Then we get the default location and PowerShell as default shell. This part is fully optional, I like Git Bash, so I use GitBash(some time I use Cmd also).
image
Now, press Update and we have completed the Github Windows Client setup.
We can Get our repositories from left panel of client and select the project/repository and click Clone. (actually cloning the repository)
image image

I will provide a separate blog for Git Architecture, Terms as well as Commands. 

Note : We may use TortoiseGIT which is very handy. If you are too much familiar with TortoiseSVN, I would recommend to use TortoiseGIT.

Thanks.. :)

2014-03-14

What is composer? How to install composer in windows?

In this article we are going know about Composer and how to use composer. I am writing this because we will need composer for installing dependency packages for Codeception.

What is Composer? 
Composer is a PHP dependency manager. You may find similar to Maven for java. The main difference is , Maven use XML where Composer use JSON file to write dependencies. And, in Maven we can manage the package but composer deals with framework/libraries.

Composer finds out specific version of a package needs to be installed and install it with its dependent packages.

Requirements : 
Composer needs minimum PHP 5.3.2.
PC should have cUrl with PHP installed(not only for composer, other tools also)

How to install ?
Step 1 : There are several ways to download, but as I use Windows, I download this and install in windows. 
Step 2 : Set installed folder location (C:\ProgramData\ComposerSetup\bin) in system's path variable.( get help from this post) 

How to Declare Dependencies? 
Declaring composer is very simple. In the project root, create a file composer.json . Edit that json file with text editor start like this .
{
"require" : {

                   }
{

Then we add our dependency packages along with version number in the require braces. Ex: for installing codeception, we have to write like this
{
    "require": {
        "codeception/codeception": "*"
    }
}

 
To write package, we have to follow JSON way. Like "Vendor Name/Package Name" : "Version Number".  In version number ,
* = any version,
1.3.*=  any version start with 1.3.

And , to install that dependencies, we need write this in command line
cd <project folder where composer.json is present>
composer update


Note : Here we have manually added composer.json. If we use composer init in command prompt, we will get a wizard in command line to create composer.json file with specific package. 
 
 
We can use Auto loading(before launching application)  with composer

When we use? 
1. When we have a project which is dependent on a number of Libraries
2. Some of those libraries are dependent on other libraries.
3. We might have our own custom dependent libraries


To get more detail, you may read this PDF.

Thanks..:)