Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Desktop Developer

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « NSubstituteAutoMocker for StructureMapDon't test your mocking framework. »
    comments

    Introduction

    This weekend I felt the need to make myself an NSubstitute Automocker for StructureMap. The first thing to do was to download the sourcecode for StructureMap and NSubstitute. Both are being hosted on GitHub. because I wanted to fork StructureMap and add the Automocker to it I had to create an account on github, which is free. And then I had to install Git and download the code.

    For those people that don't know what Github is.
    According to wikipedia.

    GitHub is a web-based hosting service for projects that use the Git revision control system. It is written using Ruby on Rails by GitHub, Inc. (previously known as Logical Awesome) developers Chris Wanstrath, PJ Hyett, and Tom Preston-Werner. GitHub offers both commercial plans and free accounts for open source projects. According to the Git User's Survey in 2009, GitHub is the most popular Git hosting site.[2]

    The site provides social networking functionality like feeds, followers and the network graph to display how developers work on their versions of a repository.

    GitHub also operates a pastebin-style site, wikis for the individual repositories and web pages that can be edited through a git repository.

    As of January 2010[update], GitHub is operated under the name GitHub, Inc

    TortoiseGit

    I choose to install TortoiseGit to use as a client. But first you need to install PuTTy. And then you need to install msysgit. I installed the following version Git-1.7.0.2-preview20100309.

    I was helped by this article.

    Select the option Add “Git Bash here”

    Select the option Run Git from the Windows Command Prompt

    Select the option Use Windows style line endings

    If it asks for PLink, locate plink.exe in your PuTTY install directory (e.g. C:\Program Files\PuTTY\plink.exe)

    Then I installed TortoiseGit and rebooted.

    SSH keys

    GitHub uses SSH and so you need to generate keys. That's where PuTTy comes in. You use PuttyGen to Generate a key pair. Just click on the Generate button and move the mouse a little.

    Then Save the private key somewhere you can easily remember where you put it. And copy the text from the top textbox. Make sure you keep this text until you need it later on.

    Now also add the key to pageant. Just do add key and point it to the private key file you saved.

    GitHub

    Now you have to go to Github and create an account. Once you have your account you should first add the public key. You can add a public key in your account settings. You give it a name and you just copy in the public you copied a little earlier.

    Now that you have all this setup you can go to the http://github.com/structuremap/structuremap and click on the fork button. This will create a fork in your account. You can now go to you account and see the url you need to download it to you local repository.

    You should now create a directory where you want to save you sourcecode and then you right click on a directory somewhere and select TortoiseGit -> Settings. Then in Git -> config you set your name and emailaddress, the one you used to create your Github account.

    Clone

    Then I decided to clone my github fork to my local repository. You give it the git url that you can copy paste from the github page. You set your local repository. And you point it to the private key file we created earlier.

    For NSubstitute I just used the read only url and did not fork it since I don't really need to change that code for now.

    Conclusion

    Well it was a lot of work for something so simple. Downloading all the files and installing them will take some time. Configuring everything is pretty easy and everything works pretty smooth if you don't make any mistakes. But if you do make a mistake then be prepared to lose some time since error messages don't always say what they should.

    About the Author

    User bio imageChris is awesome.
    Social SitingsTwitterHomePageLTD RSS Feed
    InstapaperVote on HN

    13 comments

    Comment from: Stefano Ricciardi [Visitor] · http://www.stefanoricciardi.com
    Stefano Ricciardi Thank you for putting this together. This might come very helpful soon for me.
    08/16/10 @ 03:15
    Comment from: Tahir Khalid [Member] Email
    How are you finding github?

    Noticed quite a few people moving to it lately
    08/16/10 @ 08:46
    Comment from: Christiaan Baes (chrissie1) [Member]
    Christiaan Baes (chrissie1) It's free, what's not to like ;-).
    08/16/10 @ 11:34
    Comment from: Paul Keeble [Visitor]
    Paul Keeble I highly recommend learning the command line and using Cygwin with git. Git is available as a package and easy to install in normal cygwin.

    Then you can just setup an SSH key from within cygwin.
    08/17/10 @ 06:16
    Comment from: Patryk [Visitor]
    Patryk The cygwin approach is by far the easiest and most powerful option if you're familiar with Git, but because of the steep learning curve, I imagine you'd be better off with TortoiseGit.

    Did you really need to fork StructureMap using GitHub? I think that step (and all the associated setup and configuration) was actually optional for you, even if you planned to contribute code back to the project.

    Have a look at gitready.com - the tips there, as well as the amazing tutorials available online, will really help you take advantage of Git in your workflow. I've switched entirely to Git and I'm not looking back.
    08/17/10 @ 07:27
    Comment from: Christiaan Baes (chrissie1) [Member]
    Christiaan Baes (chrissie1) As you can read in my next post I did not NEED to fork structuremap but it seemed a good idea at the time to make it eassier to give something back to the project.
    08/17/10 @ 07:33
    Comment from: AkitaOnRails [Visitor] · http://www.akitaonrails.com
    AkitaOnRails I also highly recommend you to learn the command line tool, which you can use through the Git Bash (icon probably in your desktop right now). And also to not mirror SVN usage because the Git workflow is remarkably different. Tortoise can help you out in the beginning but you will soon feel the need to go further. I recommend websites such as Scott Chacon's Pro Git book (both paper and ebook versions) http://progit.org/

    Also take a look at Nick Quaranto's Git Ready website: http://www.gitready.com/

    And you don't need Putty, you can generate the ssh keys from the Git Bash doing just ssh-keygen -t rsa. The keys will be in ~/.ssh directory from where you can copy the public key in the id_rsa.pub file.
    08/17/10 @ 07:59
    Comment from: Tea [Visitor]
    Tea A GITHUB account is not required to clone open projects off of GITHUB.



    08/17/10 @ 08:11
    Comment from: Christiaan Baes (chrissie1) [Member]
    Christiaan Baes (chrissie1) I know Tea, but I wanted to fork StructureMap not just clone it. And I wanted to use Github, Git, ... To learn how it all works.
    08/17/10 @ 08:16
    Comment from: Steve Klabnik [Visitor] · http://steveklabnik.com
    Steve Klabnik You wouldn't even need to have a GitHub account to 'fork' it; your repository just needs to be available via either http:// or git://, and then you can send a pull request just like anyone else.

    Not that I wouldn't encourage you to have a GitHub account and use it; GitHub has really helped Open Source tremendously, and is just a really great service in general.
    08/17/10 @ 09:28
    Comment from: Bob Aman [Visitor] · http://sporkmonger.com/
    Bob Aman Wow, that's astonishingly complicated still. I suddenly remember why I don't ever use Windows for development work.
    08/17/10 @ 13:57
    Comment from: Zecc [Visitor]
    Zecc I sure hope you've generate a new key after you took those screenshots. Not wanting to insult your intelligence, but...
    08/17/10 @ 15:51
    Comment from: Christiaan Baes (chrissie1) [Member]
    Christiaan Baes (chrissie1) @Zecc, Yes I did create a new key after that. But I wouldn't really be all that disappointed if someone did hack the account. Afteral they would have to go through typing that key, just knowing someone could have changed it at any moment.
    08/18/10 @ 01:11

    Leave a comment


    Your email address will not be revealed on this site.

    To mislead the spambots.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)