Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Add new perforce variable - How to overload a Private method in the perforce.rb file?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
RandyInLA  
View profile  
 More options Apr 4 2012, 10:09 pm
From: RandyInLA <ra...@walkersystems.net>
Date: Wed, 4 Apr 2012 19:09:08 -0700 (PDT)
Local: Wed, Apr 4 2012 10:09 pm
Subject: Add new perforce variable - How to overload a Private method in the perforce.rb file?
Greetings!

My Perforce admin recently decided to force us to add the unicode
variable, "-C utf8", for all perforce transactions.  The unicode var
can't be part of :p4sync_flags, nor can it be added as any extra
options.  Per the Perforce syntax, it has to live within the existing
Capistrano authentication method.  I can hack the actual perforce.rb
file, adding the new variable & update the authentication Private
method to include it, but can't figure out how to overload/override
the authentication method in my recipes!  I'd rather either override
the methods in my recipe or submit a change to update Capistrano.  I
copied the perforce.rb file, made my changes and pulled out everything
else that shouldn't change:

--------------------------------------------------------------------------- --------------------------------
module Capistrano
  module Deploy
    module SCM

      class Perforce < Base
        private

          # override
          def authentication
            [ p4port        && "-p #{ p4port }",
              p4user       && "-u #{ p4user }",
              p4passwd  && "-P #{ p4passwd }",
              p4client     && "-c #{ p4client }",
              p4unicode && "-C #{ p4unicode }" ].compact.join(" ")
          end

          # new
          def p4unicode
            variable(:p4unicode)
          end

      end
    end
  end
end
--------------------------------------------------------------------------- --------------------------------

I've tried putting this in environment.rb, a separate file under /
initializers & deploy.rb, all without success.  I currently have it
working by hacking the original perforce.rb file in the rubygem and
that just feels dirty.  If anyone can help me override this via my
deploy.rb file or walk me through how to submit a change to
Capistrano, I'd be very grateful!

Thanks!
-=Randy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RandyInLA  
View profile  
 More options Apr 5 2012, 5:04 pm
From: RandyInLA <ra...@walkersystems.net>
Date: Thu, 5 Apr 2012 14:04:54 -0700 (PDT)
Local: Thurs, Apr 5 2012 5:04 pm
Subject: Re: Add new perforce variable - How to overload a Private method in the perforce.rb file?
After looking at the p4 help for this cli var, I see they call it
charset and not unicode.  Changes below:
--------------------------------------------------------------------------- --------------------------------
module Capistrano
  module Deploy
    module SCM

      class Perforce < Base
        private

          # override
          def authentication
            [ p4port        && "-p #{ p4port }",
              p4user       && "-u #{ p4user }",
              p4passwd  && "-P #{ p4passwd }",
              p4client     && "-c #{ p4client }",
              p4unicode && "-C #{ p4charset }" ].compact.join(" ")
          end

          # new
          def p4charset
            variable(:p4charset)
          end

      end
    end
  end
end
--------------------------------------------------------------------------- --------------------------------

And in case it wasn't clear, I would add the following to my deploy.rb
file:
set :p4charset, 'utf8'


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RandyInLA  
View profile  
 More options Nov 8 2012, 4:34 pm
From: RandyInLA <ra...@walkersystems.net>
Date: Thu, 8 Nov 2012 13:34:07 -0800 (PST)
Local: Thurs, Nov 8 2012 4:34 pm
Subject: Re: Add new perforce variable - How to overload a Private method in the perforce.rb file?

I just got bitten by this again today as I updated Capistrano this
morning.  I had to hack the perforce.rb file again to make it work.

Can anyone please help me override the private authentication method and
add a new variable via my code and not by hacking Capistrano?

Thank you,
-=Randy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lee Hambley  
View profile  
 More options Nov 14 2012, 11:51 am
From: Lee Hambley <lee.hamb...@gmail.com>
Date: Wed, 14 Nov 2012 17:51:31 +0100
Local: Wed, Nov 14 2012 11:51 am
Subject: Re: [capistrano] Re: Add new perforce variable - How to overload a Private method in the perforce.rb file?

Randy

Please open an issue at GH issues for this, and someone will take care of
it, eventually!

- Lee

On 8 November 2012 22:34, RandyInLA <ra...@walkersystems.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Walker, Randy  
View profile  
 More options Nov 14 2012, 12:37 pm
From: "Walker, Randy" <ra...@walkersystems.net>
Date: Wed, 14 Nov 2012 09:37:06 -0800
Local: Wed, Nov 14 2012 12:37 pm
Subject: Re: [capistrano] Re: Add new perforce variable - How to overload a Private method in the perforce.rb file?

Thanks for the reply, Lee!  I already forked, branched, patched the
perforce.rb file and created a pull request for Capistrano.  It was merged
into master before I woke the next day :)  Should be in the next release,
so I'll keep my local monkey patch of perforce.rb for now and won't have to
think about it anymore after installing the next version.

-=Randy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »