xforge 0.3.1 → 0.3.2

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.2
4
+
5
+ This release adds more support for other issue trackers ans scm browsers.
6
+
7
+ * Fixed #2242
8
+ * Added a lot of tracker and scm_web classes (factored out from DamageControl)
9
+ * Decoupled view_cvs from rubyforge/sourceforge
10
+
3
11
  == Version 0.3.1
4
12
 
5
13
  This XForge release adds initial support for Trac and JIRA.
data/Rakefile CHANGED
@@ -22,9 +22,9 @@ require 'rake/rdoctask'
22
22
  # PATCH is bumped for every API addition and/or bugfix (ideally for every commit)
23
23
  # Later DamageControl can bump PATCH automatically.
24
24
  #
25
- # REMEMBER TO KEEP PKG_VERSION IN SYNC WITH CHANGELOG
25
+ # REMEMBER TO KEEP PKG_VERSION IN SYNC WITH THE CHANGES FILE!
26
26
  PKG_NAME = "xforge"
27
- PKG_VERSION = "0.3.1"
27
+ PKG_VERSION = "0.3.2"
28
28
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
29
29
  PKG_FILES = FileList[
30
30
  '[A-Z]*',
@@ -0,0 +1,10 @@
1
+ module ScmWeb
2
+ class Base
3
+ def self.classes
4
+ [
5
+ ViewCvs,
6
+ ::Tracker::Trac::Project
7
+ ]
8
+ end
9
+ end
10
+ end
@@ -1,11 +1,17 @@
1
1
  module ScmWeb
2
- # TODO: implement RSCM API via HTTP ala CVSGrab
3
- class ViewCvs
2
+ # The variables to use in uri_specs are:
3
+ #
4
+ # * project_unix_name
5
+ # * revision
6
+ # * previous_revision
7
+ #
8
+ class ViewCvs < Base
4
9
 
5
- attr_reader :project
10
+ attr_accessor :uri_specs, :cvs_host_name, :cvs_server_path, :project_unix_name, :module_regexp
6
11
 
7
- def initialize(uri_specs, project, module_regexp)
8
- @uri_specs, @project, @module_regexp = uri_specs, project, module_regexp
12
+ def initialize(uri_specs=nil, cvs_host_name=nil, cvs_server_path=nil, project_unix_name=nil, module_regexp=nil)
13
+ @uri_specs, @cvs_host_name, @cvs_server_path, @project_unix_name, @module_regexp =
14
+ uri_specs, cvs_host_name, cvs_server_path, project_unix_name, module_regexp
9
15
  end
10
16
 
11
17
  def scms
@@ -19,8 +25,8 @@ module ScmWeb
19
25
  mod = $1
20
26
  unless(mod == "CVSROOT")
21
27
  scm = RSCM::Cvs.new
22
- scm.root = ":pserver:anonymous@#{project.host.cvs_host_name}:#{project.host.cvs_path}/#{mod}"
23
- scm.mod = project.unix_name
28
+ scm.root = ":pserver:anonymous@#{cvs_host_name}:#{cvs_server_path}/#{mod}" #TODO: is this right?
29
+ scm.mod = mod
24
30
  @scms << scm
25
31
  end
26
32
  end
@@ -40,7 +46,7 @@ module ScmWeb
40
46
  uri_spec = @uri_specs[type]
41
47
  raise "No uri_spec for #{type}" unless uri_spec
42
48
 
43
- project_unix_name = project.unix_name
49
+ project_unix_name = @project_unix_name
44
50
  revision = options[:revision]
45
51
  previous_revision = options[:previous_revision]
46
52
  eval("\"#{uri_spec}\"", binding)
@@ -0,0 +1,16 @@
1
+ module Tracker
2
+
3
+ # Tracker objects are responsible for interacting with issue trackers (bug trackers).
4
+ # They know how to recognise issue identifiers in strings (typically from SCM commit
5
+ # messages) and turn these into HTML links that point to the associated issue on an
6
+ # issue tracker installation running somewhere else.
7
+ class Base
8
+ def self.classes
9
+ [
10
+ ::Tracker::Jira::Project,
11
+ ::Tracker::XForge::RubyForge,
12
+ ::Tracker::Trac::Project
13
+ ]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ module Tracker
2
+ module Bugzilla
3
+ class Project < Base
4
+ include DigitIssues
5
+
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ module Tracker
2
+ # This module should be included by trackers that follow a digit-based issue scheme
3
+ module DigitIssues
4
+ def identifier_regexp
5
+ /#(\d+)/
6
+ end
7
+
8
+ def identifier_examples
9
+ ["#1926", "#1446"]
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ module Tracker
2
+ module FogBugz
3
+ class Project < Base
4
+ include DigitIssues
5
+
6
+ end
7
+ end
8
+ end
@@ -1,7 +1,9 @@
1
1
  module Tracker
2
2
  module Jira
3
- class Project
4
- def initialize(host, identifier)
3
+ class Project < Base
4
+ attr_accessor :host, :identifier
5
+
6
+ def initialize(host=nil, identifier=nil)
5
7
  @host, @identifier = host, identifier
6
8
  end
7
9
 
@@ -0,0 +1,8 @@
1
+ module Tracker
2
+ module Mantis
3
+ class Project < Base
4
+ include DigitIssues
5
+
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Tracker
2
+ module Scarab
3
+ class Project < Base
4
+ include DigitIssues
5
+
6
+ end
7
+ end
8
+ end
@@ -1,16 +1,11 @@
1
1
  module Tracker
2
2
  module Trac
3
- class Project
4
- def initialize(uri)
5
- @uri = uri
6
- end
7
-
8
- def identifier_regexp
9
- /#(\d+)/
10
- end
3
+ class Project < Base
4
+ include DigitIssues
11
5
 
12
- def identifier_examples
13
- ["#1926", "#1446"]
6
+ attr_reader :uri, :svn
7
+ def initialize(uri=nil, svn=nil)
8
+ @uri, @svn = uri, svn
14
9
  end
15
10
 
16
11
  def issue(issue_identifier)
@@ -31,6 +26,26 @@ module Tracker
31
26
  issue ? "<a href=\"#{issue.uri}\">#{issue.summary}</a>" : "\##{issue_identifier}"
32
27
  end
33
28
  end
29
+
30
+ OVERVIEW = "\#{@uri}/log/\#{@svn.path}/\#{path}"
31
+ HTML = "\#{@uri}/file/\#{@svn.path}/\#{path}?rev=\#{revision}"
32
+ RAW = "#{HTML}&format=txt"
33
+ DIFF = "\#{@uri}/changeset/\#{revision}"
34
+ 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
+
45
+ revision = options[:revision]
46
+ previous_revision = options[:previous_revision]
47
+ eval("\"#{uri_spec}\"", binding)
48
+ end
34
49
 
35
50
  end
36
51
  end
@@ -1,19 +1,12 @@
1
1
  module Tracker
2
2
  module XForge
3
3
  # TODO: rename to Project
4
- class Base
5
- attr_reader :uri, :project
4
+ class Base < ::Tracker::Base
5
+ include DigitIssues
6
6
 
7
- def identifier_regexp
8
- /#(\d+)/
9
- end
10
-
11
- # Examples of what will be recognised as issue identifiers in #markup
12
- def identifier_examples
13
- ["#1462", "#872"]
14
- end
7
+ attr_accessor :uri, :project
15
8
 
16
- def initialize(uri, project)
9
+ def initialize(uri=nil, project=nil)
17
10
  @uri, @project = uri, project
18
11
  end
19
12
 
data/lib/xforge.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'scm_web/base'
2
+ require 'scm_web/view_cvs'
3
+
1
4
  require 'xforge/version_parser'
2
5
  require 'xforge/host'
3
6
  require 'xforge/rubyforge'
@@ -5,8 +8,10 @@ require 'xforge/sourceforge'
5
8
  require 'xforge/project'
6
9
  require 'xforge/session'
7
10
  require 'xforge/xfile'
8
- require 'scm_web/view_cvs'
11
+
12
+ require 'tracker/digit_issues'
9
13
  require 'tracker/issue'
14
+ require 'tracker/base'
10
15
  require 'tracker/xforge'
11
16
  require 'tracker/jira'
12
17
  require 'tracker/trac'
@@ -18,7 +18,7 @@ module XForge
18
18
  80
19
19
  end
20
20
 
21
- def cvs_path
21
+ def cvs_server_path
22
22
  "/var/cvs"
23
23
  end
24
24
 
@@ -28,7 +28,13 @@ module XForge
28
28
 
29
29
  def scm_web(project)
30
30
  module_regexp = /href=\"(\w+)\/\?cvsroot=#{project.unix_name}/
31
- ::ScmWeb::ViewCvs.new({:overview => OVERVIEW, :raw => RAW, :html => HTML, :diff => DIFF}, project, module_regexp)
31
+ ::ScmWeb::ViewCvs.new(
32
+ {:overview => OVERVIEW, :raw => RAW, :html => HTML, :diff => DIFF},
33
+ cvs_host_name,
34
+ cvs_server_path,
35
+ project.unix_name,
36
+ module_regexp
37
+ )
32
38
  end
33
39
 
34
40
  # Regexp used to find projects' home page
@@ -17,7 +17,7 @@ module XForge
17
17
  443
18
18
  end
19
19
 
20
- def cvs_path
20
+ def cvs_server_path
21
21
  "/cvsroot"
22
22
  end
23
23
 
@@ -27,7 +27,13 @@ module XForge
27
27
 
28
28
  def scm_web(project)
29
29
  module_regexp = /viewcvs\.py\/#{project.unix_name}\/(\w+)\//
30
- ::ScmWeb::ViewCvs.new({:overview => OVERVIEW, :raw => RAW, :html => HTML, :diff => DIFF}, project, module_regexp)
30
+ ::ScmWeb::ViewCvs.new(
31
+ {:overview => OVERVIEW, :raw => RAW, :html => HTML, :diff => DIFF},
32
+ cvs_host_name,
33
+ cvs_server_path,
34
+ project.unix_name,
35
+ module_regexp
36
+ )
31
37
  end
32
38
 
33
39
  # Regexp used to find projects' home page
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.1
7
- date: 2005-08-15 00:00:00 -04:00
6
+ version: 0.3.2
7
+ date: 2005-08-16 00:00:00 -04:00
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib
@@ -40,13 +40,20 @@ files:
40
40
  - lib/rake/contrib/xforge/base.rb
41
41
  - lib/rake/contrib/xforge/news_publisher.rb
42
42
  - lib/rake/contrib/xforge/release.rb
43
+ - lib/scm_web/base.rb
43
44
  - lib/scm_web/view_cvs.rb
45
+ - lib/tracker/base.rb
46
+ - lib/tracker/digit_issues.rb
44
47
  - lib/tracker/issue.rb
45
48
  - lib/tracker/jira.rb
46
49
  - lib/tracker/trac.rb
47
50
  - lib/tracker/xforge.rb
51
+ - lib/tracker/bugzilla/project.rb
52
+ - lib/tracker/fog_bugz/project.rb
48
53
  - lib/tracker/jira/host.rb
49
54
  - lib/tracker/jira/project.rb
55
+ - lib/tracker/mantis/project.rb
56
+ - lib/tracker/scarab/project.rb
50
57
  - lib/tracker/trac/project.rb
51
58
  - lib/tracker/xforge/base.rb
52
59
  - lib/tracker/xforge/rubyforge.rb