[rspec-users] GiT and RSpec

Christopher Bailey chris at cobaltedge.com
Tue Sep 2 17:56:34 EDT 2008


I would voice a word of caution on using submodules in Git.  Yes, they are
similar to svn:externals, but in my experience, they are very fragile.  The
fragility comes in when/if you need to switch the submodule URL/definition
from what it is currently to something else.  I've had no end of trouble
with this, as have several others.
My current take on Git submodules is that I either don't use them, or I fork
whatever it is I'd want as a submodule, and reference my fork as the
submodule.  That way, if I need to make changes, switch from someone's git
repo of something to someone else's or whatever, all that is contained in my
fork, instead of having to switch the submodule in my project.

On Tue, Sep 2, 2008 at 2:49 PM, Tim Haines <tmhaines at gmail.com> wrote:

> Hi James,
>
> Thanks for writing these instructions up in detail.  I've just followed
> them and will play around with them over the next few days.  A couple of
> questions
>
> 1) I assume with submodules I can create and switch to branches of the
> submodules if I want to try my app out with some patches applied to rspec or
> rails?  There's no hidden gotch'ya here?
>
> 2) When I'm getting near deployment for production (a few months away yet)
> I'm thinking of freezing to a tagged version of Rails.  (Not sure this
> terminology is still correct with Git - but basically I might stick with
> Rails 2.2 or something - but I'm not sure this has benefits anymore).  How
> would you go about this?
>
> Cheers,
>
> Tim.
>
> On Tue, Jun 3, 2008 at 3:14 AM, James B. Byrne <byrnejb at harte-lyne.ca>wrote:
>
>>
>> >
>> > Message: 2
>> > Date: Thu, 29 May 2008 06:35:01 -0700
>> > From: David Chelimsky <dchelimsky at gmail.com>
>> > Subject: Re: [rspec-users] Coloured output in rspec 1.1.4
>> > To: rspec-users at rubyforge.org
>> > Message-ID: <175B70FE-B706-4C03-8B20-C5B207268AD6 at gmail.com>
>> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>> >
>> > On May 29, 2008, at 6:32 AM, Juanma Cervera wrote:
>> >
>> >> David Chelimsky wrote:
>> >>>
>> >>> Actually - that is not from 1.1.4 - it's a patch that was introduced
>> >>> after the 1.1.4 release. Did you follow the install directions at
>> >>> http://github.com/dchelimsky/rspec-rails/wikis?
>> >>
>> >> More or less.
>> >> I have git-cloned from github repositories instead of make
>> >> "script/plugin install"
>> >
>> > script/plugin install doesn't support getting a specific version from
>> > git yet. To do that you have to use 'git clone' and then 'git checkout
>> > 1.1.4' (in this case).
>> >
>>
>> As an alternative to script/plugin or git-clone, you can employ
>> git-submodules
>> (on GiT v1.5.3 or later) to obtain the effect of subversion externals.
>>  For
>> example:
>>
>> --->
>>
>> $ git-submodule add \
>>    git://github.com/dchelimsky/rspec.git \
>>    vendor/plugins/rspec
>>
>> Initialized empty Git repository in
>> /home/byrnejb/projects/proforma.git/vendor/plugins/rspec/.git/
>> remote: Counting objects: 46810, done.
>> remote: Compressing objects: 100% (10646/10646), done.
>> remote: Total 46810 (delta 33521), reused 46810 (delta 33521)
>> Receiving objects: 100% (46810/46810), 5.99 MiB | 103 KiB/s, done.
>> Resolving deltas: 100% (33521/33521), done.
>>
>> $ ll vendor/plugins
>> total 16
>> drwxrwxr-x  6 byrnejb byrnejb 4096 May 28 14:06 routing_navigator
>> drwxrwxr-x 12 byrnejb byrnejb 4096 Jun  2 10:09 rspec
>>
>> $ git-submodule add \
>>    git://github.com/dchelimsky/rspec-rails.git \
>>    vendor/plugins/rspec-rails
>>
>> Initialized empty Git repository in
>> /home/byrnejb/projects/proforma.git/vendor/plugins/rspec-rails/.git/
>> remote: Counting objects: 46530, done.
>> remote: Compressing objects: 100% (10649/10649), done.
>> remote: Total 46530 (delta 33241), reused 46530 (delta 33241)
>> Receiving objects: 100% (46530/46530), 5.94 MiB | 63 KiB/s, done.
>> Resolving deltas: 100% (33241/33241), done.
>>
>> $ git-status
>> # On branch master
>> # Changes to be committed:
>> #   (use "git reset HEAD <file>..." to unstage)
>> #
>> #       modified:   .gitmodules
>> #       new file:   vendor/plugins/rspec
>> #       new file:   vendor/plugins/rspec-rails
>> #
>>
>> $ git-submodule init
>>
>> Submodule 'vendor/plugins/rspec' (git://github.com/dchelimsky/rspec.git)
>> registered for path 'vendor/plugins/rspec'
>> Submodule 'vendor/plugins/rspec-rails'
>> (git://github.com/dchelimsky/rspec-rails.git) registered for path
>> 'vendor/plugins/rspec-rails'
>>
>> $ git-status
>> # On branch master
>> # Changes to be committed:
>> #   (use "git reset HEAD <file>..." to unstage)
>> #
>> #       modified:   .gitmodules
>> #       new file:   vendor/plugins/rspec
>> #       new file:   vendor/plugins/rspec-rails
>> #
>>
>> $ git-commit -m "Added Rspec and Rspec-Rails as submodules"
>>
>> Created commit b4d1133: Added Rspec and Rspec-Rails as submodules
>>  3 files changed, 8 insertions(+), 0 deletions(-)
>>  create mode 160000 vendor/plugins/rspec
>>  create mode 160000 vendor/plugins/rspec-rails
>>
>> $ git-status
>> # On branch master
>> nothing to commit (working directory clean)
>>
>> $ git-push # over ssh
>> !!Warning!! -   Any attempt to obtain access to this device without
>>                authorization is a criminal act.
>> byrnejb at vcs-git.hamilton.harte-lyne.ca's password:
>> Counting objects: 9, done.
>> Compressing objects: 100% (5/5), done.
>> Writing objects: 100% (5/5), 607 bytes, done.
>> Total 5 (delta 1), reused 0 (delta 0)
>> To ssh://
>> byrnejb at vcs-git.hamilton.harte-lyne.ca/var/data/vcs-git/hll/proforma.git
>>   ab5353b..b4d1133  master -> master
>>
>> $
>>
>> <---
>>
>> Now, when anyone pulls from the canonical repository they will get Rspec
>> and
>> Rspec-on-Rails as well, but as submodules pulled directly from the RSpec
>> repositories.  Further, updating all submodules thereafter requires just
>> these
>> three steps:
>>
>> $git-submodule update
>> $git-commit
>> $git-push
>>
>> This is how I load edge rails as well, as a submodule:
>>
>> $ git-submodule add git://github.com/rails/rails.git vendor/rails
>> $ git-submodule init
>> $ git-commit
>> $ git-push
>>
>> Once you do this you can locally checkout any version or branch that is
>> available in the submodule.
>>
>> Regards,
>>
>> --
>> ***          E-Mail is NOT a SECURE channel          ***
>> James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
>> Harte & Lyne Limited          http://www.harte-lyne.ca
>> 9 Brockley Drive              vox: +1 905 561 1241
>> Hamilton, Ontario             fax: +1 905 561 0757
>> Canada  L8E 3C3
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
Christopher Bailey
Cobalt Edge LLC
http://cobaltedge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080902/b195ac9e/attachment.html>


More information about the rspec-users mailing list