Jamis Buck wrote:
> cap isn't like Rails, with the magic auto-loading. You need to 
> manually require the base class:
>
>   require 'capistrano/recipes/deploy/scm/base'
>
> - Jamis
>
> On Oct 24, 2007, at 9:19 AM, Chuck Remes wrote:
>
>>
>> I checked through the list archives I see that capistrano requires
>> the usage of a "real" SCM. I have a very specific requirement where I
>> need to deploy the contents of a directory to a set of servers. Based
>> on the advice given in those earlier threads, I am writing a custom
>> SCM to mimic a "cp" so I can leverage the existing code in the
>> framework to handle the remainder of the deployment.
>>
>> However, I am having a problem getting my custom class to load. For
>> the sake of simplicity early on, I am putting the code into ~/.caprc.
>>
>> The approach I took is I subclassed Capistrano::Deploy::SCM::Base and
>> overrode the +checkout+ method. When I run 'cap -T' just to verify
>> capistrano is still working, I get a NameError. Here it is:
>>
>> /Users/cremes/.caprc:8:in `load': uninitialized constant #<Class:
>> 0x14b55f4>::Capistrano::Deploy::SCM::Base (NameError)
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/configuration/loading.rb:173:in `load_from_file'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/configuration/loading.rb:89:in `load'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/configuration/loading.rb:86:in `load'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/configuration/loading.rb:86:in `each'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/configuration/loading.rb:86:in `load'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/cli/execute.rb:60:in `load_recipes'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/cli/execute.rb:28:in `execute!'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> lib/capistrano/cli/execute.rb:14:in `execute'
>>          from /Users/cremes/lib/ruby/gems/1.8/gems/capistrano-2.1.0/
>> bin/cap:4
>>          from /Users/cremes/bin/cap:16:in `load'
>>          from /Users/cremes/bin/cap:16
>>
>> Here is the code it is complaining about (the entire contents
>> of .caprc):
>>
>> module Capistrano
>>    module Deploy
>>      module SCM
>>
>>        # Implements the Capistrano SCM interface for using a plain old
>>        # directory to do deployment. It fakes out all the usual SCM
>> commands
>>        # so we can use the other infrastructure to copy & deploy a
>> tarball
>>        class Directory < Base
>>          # Sets the default command name for this SCM. Users may
>> override this
>>          # by setting the :scm_command variable.
>>          default_command "cp"
>>
>>          # Returns the command that will check out the given revision
>> to the
>>          # given destination.
>>          def checkout(revision, destination)
>>            switches = '-Rp'
>>            scm :cp, verbose, switches, repository, destination
>>          end
>>
>>        end
>>      end #SCM
>>    end #Deploy
>> end #Capistrano
>>
>> I know I am getting this because of a file load ordering issue, but I
>> don't know where I should place this code. What is the recommended
>> approach for creating custom SCMs?
>>
>> Environment:
>> OSX 10.4.10
>> ruby 1.8.6 from macports
>> capistrano-2.1.0 gem
You know, something like this should probably go into Capistrano core...

I wished something like this since ages ago :-D

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to