xforge 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,13 @@
1
1
  = XForge Changelog
2
2
 
3
+ == Version 0.3.5
4
+
5
+ This is a bugfix release that fixes some bugs in ViewCvs.
6
+
7
+ * Changed the way the server path of RSCM::Cvs objects are initialised from ViewCvs to fix a subtle bug.
8
+ * Factored out generic file_uri to ScmWeb::FileUri.
9
+ * Fixed bug in RubyForge's recognition of modules in ViewCvs.
10
+
3
11
  == Version 0.3.4
4
12
 
5
13
  This release simplifies ViewCvs configuration
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ require 'rake/rdoctask'
24
24
  #
25
25
  # REMEMBER TO KEEP PKG_VERSION IN SYNC WITH THE CHANGES FILE!
26
26
  PKG_NAME = "xforge"
27
- PKG_VERSION = "0.3.4"
27
+ PKG_VERSION = "0.3.5"
28
28
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
29
29
  PKG_FILES = FileList[
30
30
  '[A-Z]*',
data/lib/scm_web/base.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module ScmWeb
2
2
  class Base
3
+ include FileUri
4
+
3
5
  def self.classes
4
6
  [
5
7
  ViewCvs,
@@ -0,0 +1,21 @@
1
+ module ScmWeb
2
+ module FileUri
3
+ # TODO: rename to file_uri to avoid the clash that is currently in Trac
4
+ # Returns the URI for the file at +path+.
5
+ # Options are:
6
+ # :type (can be one of :overview, :raw or :html)
7
+ # :revision (the revision of the file. must be specified when :type is :raw or :html)
8
+ def file_uri(path="", options={:type=>"overview"})
9
+ type = options[:type]
10
+ raise "No :type specified" unless type
11
+ uri_spec = uri_specs[type]
12
+ raise "No uri_spec for #{type}" unless uri_spec
13
+
14
+ project_unix_name = @project_unix_name
15
+ path_prefix = options[:path_prefix]
16
+ revision = options[:revision]
17
+ previous_revision = options[:previous_revision]
18
+ eval("\"#{uri_spec}\"", binding)
19
+ end
20
+ end
21
+ end
@@ -1,31 +1,35 @@
1
1
  module ScmWeb
2
- # The variables to use in uri_specs are:
3
- #
4
- # * path
5
- # * revision
6
- # * previous_revision
7
- #
8
2
  class ViewCvs < Base
9
3
 
10
4
  attr_accessor :uri_specs, :cvs_host_name, :cvs_server_path, :project_unix_name, :module_regexp
11
5
 
12
- def initialize(uri_specs=nil, cvs_host_name=nil, cvs_server_path=nil, project_unix_name=nil, module_regexp=nil)
6
+ def initialize(uri_specs={}, cvs_host_name=nil, cvs_server_path=nil, project_unix_name=nil, module_regexp=nil)
13
7
  @uri_specs, @cvs_host_name, @cvs_server_path, @project_unix_name, @module_regexp =
14
8
  uri_specs, cvs_host_name, cvs_server_path, project_unix_name, module_regexp
15
9
  end
10
+
11
+ # The variables to use in uri_specs are:
12
+ #
13
+ # * path
14
+ # * revision
15
+ # * previous_revision
16
+ #
17
+ def uri_specs
18
+ @uri_specs ||= {}
19
+ end
16
20
 
17
21
  def scms
18
22
  unless(@scms)
19
23
  require 'rscm'
20
24
 
21
25
  @scms = []
22
- cvs_root = open(uri) do |data|
26
+ cvs_root = open(file_uri) do |data|
23
27
  data.each_line do |line|
24
28
  if line =~ @module_regexp
25
29
  mod = $1
26
30
  unless(mod == "CVSROOT")
27
31
  scm = RSCM::Cvs.new
28
- scm.root = ":pserver:anonymous@#{cvs_host_name}:#{cvs_server_path}/#{mod}" #TODO: is this right?
32
+ scm.root = ":pserver:anonymous@#{cvs_host_name}:#{cvs_server_path}"
29
33
  scm.mod = mod
30
34
  @scms << scm
31
35
  end
@@ -36,20 +40,5 @@ module ScmWeb
36
40
  @scms
37
41
  end
38
42
 
39
- # Returns the URI for the file at +path+.
40
- # Options are:
41
- # :type (can be one of :overview, :raw or :html)
42
- # :revision (the revision of the file. must be specified when :type is :raw or :html)
43
- def uri(path="", options={:type=>"overview"})
44
- type = options[:type]
45
- raise "No :type specified" unless type
46
- uri_spec = @uri_specs[type]
47
- raise "No uri_spec for #{type}" unless uri_spec
48
-
49
- project_unix_name = @project_unix_name
50
- revision = options[:revision]
51
- previous_revision = options[:previous_revision]
52
- eval("\"#{uri_spec}\"", binding)
53
- end
54
43
  end
55
44
  end
@@ -8,5 +8,15 @@ module Tracker
8
8
  def identifier_examples
9
9
  ["#1926", "#1446"]
10
10
  end
11
+
12
+ # TODO: find a way to extract just the issue summaries so they can be stored in dc as an array
13
+ # embedded in the revision object. that way we don't alter the original commit message
14
+ def markup(text)
15
+ text.gsub(identifier_regexp) do |match|
16
+ issue_identifier = $1
17
+ issue = issue(issue_identifier)
18
+ issue ? "<a href=\"#{issue.uri}\">#{issue.summary}</a>" : "\##{issue_identifier}"
19
+ end
20
+ end
11
21
  end
12
22
  end
@@ -2,6 +2,7 @@ module Tracker
2
2
  module Trac
3
3
  class TracProject < Base
4
4
  include DigitIssues
5
+ include ::ScmWeb::FileUri
5
6
 
6
7
  attr_accessor :uri, :svn_path
7
8
  def initialize(uri=nil, svn_path=nil)
@@ -19,34 +20,16 @@ module Tracker
19
20
  end
20
21
  end
21
22
 
22
- def markup(text)
23
- text.gsub(identifier_regexp) do |match|
24
- issue_identifier = $1
25
- issue = issue(issue_identifier)
26
- issue ? "<a href=\"#{issue.uri}\">#{issue.summary}</a>" : "\##{issue_identifier}"
27
- end
28
- end
29
-
30
23
  OVERVIEW = "\#{@uri}/log/\#{@svn_path}/\#{path}"
31
24
  HTML = "\#{@uri}/file/\#{@svn_path}/\#{path}?rev=\#{revision}"
32
25
  RAW = "#{HTML}&format=txt"
33
26
  DIFF = "\#{@uri}/changeset/\#{revision}"
34
27
  URI_SPECS = {"overview" => OVERVIEW, "raw" => RAW, "html" => HTML, "diff" => DIFF}
35
-
36
- # This method can mean two things, since this class both implements the ScmWeb and Tracker API
37
- # If called with no arguments, returns the uri of the project page, otherwise the uri of a file
38
- # in the scm
39
- def uri(path=nil, options={:type => "overview"})
40
- return @uri unless path
41
-
42
- type = options[:type]
43
- uri_spec = URI_SPECS[type]
44
28
 
45
- revision = options[:revision]
46
- previous_revision = options[:previous_revision]
47
- eval("\"#{uri_spec}\"", binding)
29
+ def uri_specs
30
+ URI_SPECS
48
31
  end
49
-
32
+
50
33
  end
51
34
  end
52
35
  end
data/lib/xforge.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'scm_web/file_uri'
1
2
  require 'scm_web/base'
2
3
  require 'scm_web/view_cvs'
3
4
 
@@ -8,8 +8,8 @@ module XForge
8
8
  80
9
9
  end
10
10
 
11
- def cvs_server_path
12
- "/var/cvs"
11
+ def cvs_server_path(project_unix_name)
12
+ "/var/cvs/#{project_unix_name}"
13
13
  end
14
14
 
15
15
  def cvs_host_name
@@ -27,11 +27,11 @@ module XForge
27
27
  html = "#{view_cvs}#{path_cvs_root_rev}&content-type=text/vnd.viewcvs-markup"
28
28
  diff = "#{view_cvs}\#{path}.diff#{cvsroot}&r1=\#{previous_revision}&r2=\#{revision}"
29
29
 
30
- module_regexp = /href=\"(\w+)\/\?cvsroot=#{project.unix_name}/
30
+ module_regexp = /href=\"(.+)\/\?cvsroot=#{project.unix_name}/
31
31
  ::ScmWeb::ViewCvs.new(
32
32
  {"overview" => overview, "raw" => raw, "html" => html, "diff" => diff},
33
33
  cvs_host_name,
34
- cvs_server_path,
34
+ cvs_server_path(project.unix_name),
35
35
  project.unix_name,
36
36
  module_regexp
37
37
  )
@@ -8,8 +8,8 @@ module XForge
8
8
  443
9
9
  end
10
10
 
11
- def cvs_server_path
12
- "/cvsroot"
11
+ def cvs_server_path(project_unix_name)
12
+ "/cvsroot/#{project_unix_name}"
13
13
  end
14
14
 
15
15
  def cvs_host_name
@@ -30,7 +30,7 @@ module XForge
30
30
  ::ScmWeb::ViewCvs.new(
31
31
  {"overview" => overview, "raw" => raw, "html" => html, "diff" => diff},
32
32
  cvs_host_name,
33
- cvs_server_path,
33
+ cvs_server_path(project.unix_name),
34
34
  project.unix_name,
35
35
  module_regexp
36
36
  )
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: xforge
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.4
7
- date: 2005-08-17 00:00:00 -04:00
6
+ version: 0.3.5
7
+ date: 2005-08-20 00:00:00 -04:00
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib
@@ -41,6 +41,7 @@ files:
41
41
  - lib/rake/contrib/xforge/news_publisher.rb
42
42
  - lib/rake/contrib/xforge/release.rb
43
43
  - lib/scm_web/base.rb
44
+ - lib/scm_web/file_uri.rb
44
45
  - lib/scm_web/view_cvs.rb
45
46
  - lib/tracker/base.rb
46
47
  - lib/tracker/digit_issues.rb