Permalink
Browse files

Fixing Minor problems with Perforce SCM

Remove rdoc generation from Cerberus gem


git-svn-id: svn+ssh://rubyforge.org/var/svn/cerberus@121 65aa75ef-ce15-0410-bc34-cdc86d5f77e6
  • Loading branch information...
1 parent 22e2ea5 commit b429e8b05547503761510379cbfb92b94a482dc6 anatol committed Dec 1, 2006
Showing with 1 addition and 108 deletions.
  1. +1 −3 Rakefile
  2. +0 −83 lib/cerberus/scm/perforce.rb
  3. +0 −22 test/perforce_scm_test.rb
View
@@ -65,9 +65,7 @@ GEM_SPEC = Gem::Specification.new do |s|
s.require_path = 'lib'
- s.has_rdoc = true
- s.extra_rdoc_files = [ "README" ]
- s.rdoc_options = [ "--main", "README" ]
+ s.has_rdoc = false
s.test_suite_file = "test/integration_test.rb"
@@ -81,86 +81,3 @@ def client_spec
EOF
end
end
-require 'cerberus/utils'
-
-class Cerberus::SCM::Perforce
- include Cerberus::Utils
- CHANGES_LOG_REGEXP = /^Change (\d+) on (.*) by (.*)\n\n(.*)/m
-
- def initialize(path, config = {})
- @config = config
- @path = path.strip
-
- @p4_view = @config[:scm, :view]
- @client_name = Socket.gethostname + ":" + @path.gsub(' ', ':')
- end
-
- def installed?
- exec_successful? "#{@config[:bin_path]}p4 info"
- end
-
- def update!
- FileUtils.mkpath(@path) unless test(?d,@path)
- create_client
-
- @status = execute("sync")
- end
-
- def has_changes?
- !@status.include?('file(s) up-to-date.')
- end
-
- def url
- @view
- end
-
- attr_reader :current_revision
- attr_reader :last_author
- attr_reader :last_commit_message
-
- private
- def last_revision
- unless @calculated
- msg = execute("changes -m 1 -l")
- msg =~ CHANGES_LOG_REGEXP
-
- @current_revision = $1
- #date = $2
- @last_author = $3
- @last_commit_message = $4.strip
-
- @calculated = true
- end
- end
-
- def execute(command)
- `#{@config[:bin_path]}p4 #{p4_opts()} #{command} #{@p4_view} 2>&1`
- end
-
- def p4_opts
- user_opt = @config[:scm, :user_name].to_s.empty? ? "" : "-u #{@config[:scm, :user_name]}"
- password_opt = @config[:scm, :password].to_s.empty? ? "" : "-P #{@config[:scm, :password]}"
- client_opt = "-c #{@client_name}"
- "#{user_opt} #{password_opt} #{client_opt}"
- end
-
- def create_client
- IO.popen("p4 #{p4_opts} client -i", "w+") do |io|
- io.puts(client_spec)
- io.close_write
- end
- end
-
- def client_spec
- <<-EOF
-Client: #{@client_name}
-Owner: #{@config[:scm, :user_name]}
-Host: #{Socket.gethostname}
-Description: Cerberus client
-Root: #{@path}
-Options: noallwrite noclobber nocompress unlocked nomodtime normdir
-LineEnd: local
-View: #{@p4_view} //#{@client_name}/...
-EOF
- end
-end
@@ -20,25 +20,3 @@ def test_log_parser
just test
END
end
-require File.dirname(__FILE__) + '/test_helper'
-
-require 'cerberus/cli'
-require 'cerberus/scm/perforce'
-
-class PerforceSCMTest < Test::Unit::TestCase
- def test_log_parser
- MSG =~ Cerberus::SCM::Perforce::CHANGES_LOG_REGEXP
-
- assert_equal '264179', $1
- assert_equal '2006/11/29', $2
- assert_equal 'someuser@someuser_SOMEUSER', $3
- assert_equal "dbcis-2356\njust test", $4.strip
- end
-
- MSG =<<END
-Change 264179 on 2006/11/29 by someuser@someuser_SOMEUSER
-
- dbcis-2356
-just test
-END
-end

0 comments on commit b429e8b

Please sign in to comment.