xforge 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,12 @@
1
1
  = XForge Changelog
2
2
 
3
+ == Version 0.2.1
4
+
5
+ This XForge release adds support for tracker meta info
6
+
7
+ * Added Project.tracker method
8
+ * Require Rake tasks from toplevel xforge.rb
9
+
3
10
  == Version 0.2.0
4
11
 
5
12
  First stable release of the XForge QRS.
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ require 'rake/rdoctask'
24
24
  #
25
25
  # REMEMBER TO KEEP PKG_VERSION IN SYNC WITH CHANGELOG
26
26
  PKG_NAME = "xforge"
27
- PKG_VERSION = "0.2.0"
27
+ PKG_VERSION = "0.2.1"
28
28
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
29
29
  PKG_FILES = FileList[
30
30
  '[A-Z]*',
@@ -117,7 +117,12 @@ task :todo do
117
117
  egrep /#.*(FIXME|TODO|TBD)/
118
118
  end
119
119
 
120
- task :release => [:release_files, :publish_doc, :publish_news, :tag]
120
+ task :release => [:verify_env_vars, :release_files, :publish_doc, :publish_news]
121
+
122
+ task :verify_env_vars do
123
+ raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
124
+ raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD']
125
+ end
121
126
 
122
127
  task :publish_doc => [:rdoc] do
123
128
  publisher = Rake::RubyForgePublisher.new(PKG_NAME, ENV['RUBYFORGE_USER'])
@@ -0,0 +1,9 @@
1
+ module Tracker
2
+ class Issue
3
+ attr_reader :uri, :summary
4
+
5
+ def initialize(uri, summary)
6
+ @uri, @summary = uri, summary
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,63 @@
1
+ module Tracker
2
+ class RubyForge
3
+ attr_reader :uri, :project
4
+
5
+ def initialize(uri, project)
6
+ @uri, @project = uri, project
7
+ end
8
+
9
+ def issue(identifier)
10
+ sub_trackers = atids.collect {|atid| SubTracker.new(self, atid)}
11
+ sub_trackers.each do |sub_tracker|
12
+ issue = sub_tracker.issue(identifier)
13
+ return issue unless issue.nil?
14
+ end
15
+ nil
16
+ end
17
+
18
+ class SubTracker
19
+ attr_reader :uri
20
+
21
+ def initialize(rubyforge, atid)
22
+ @rubyforge = rubyforge
23
+ @atid = atid
24
+ # FIXME: This will only show open items.
25
+ @uri = "#{rubyforge.uri}&atid=#{atid}&func=browse"
26
+ end
27
+
28
+ def issue(identifier)
29
+ html = open(uri) { |data| data.read }
30
+
31
+ regexp = /<a href=\"\/tracker\/index.php\?func=detail&aid=#{identifier}&group_id=\d+&atid=\d+\">(.*)<\/a>/
32
+ if(html =~ regexp)
33
+ issue_uri = @rubyforge.project.group_id_uri("tracker/index.php", "&atid=#{@atid}&func=detail&aid=#{identifier}")
34
+ return Issue.new(issue_uri, $1)
35
+ end
36
+ nil
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ # The ids of the subtrackers
43
+ def atids
44
+ html = open(uri) { |data| data.read }
45
+
46
+ # TODO: there has to be a better way to extract the atids from the HTML!
47
+ atids = []
48
+ offset = 0
49
+ look_for_atid = true
50
+ while(look_for_atid)
51
+ match_data = /\/tracker\/\?atid=(\d+)&group_id=\d*&func=browse/.match(html[offset..-1])
52
+ if(match_data)
53
+ offset += match_data.begin(1)
54
+ atids << match_data[1]
55
+ else
56
+ look_for_atid = false
57
+ end
58
+ end
59
+ atids
60
+ end
61
+
62
+ end
63
+ end
data/lib/xforge.rb CHANGED
@@ -6,3 +6,6 @@ require 'xforge/project'
6
6
  require 'xforge/session'
7
7
  require 'xforge/xfile'
8
8
  require 'scm_web/view_cvs'
9
+ require 'tracker/rubyforge'
10
+ require 'tracker/issue'
11
+ require 'rake/contrib/xforge'
@@ -45,8 +45,8 @@ module XForge
45
45
  def group_id
46
46
  unless(@group_id)
47
47
  regexp = /stats\/[?&]group_id=(\d+)/
48
- project_data = open(project_uri) { |data| data.read }
49
- @group_id = project_data[regexp, 1]
48
+ html = open(project_uri) { |data| data.read }
49
+ @group_id = html[regexp, 1]
50
50
  raise "Couldn't get group_id" unless @group_id
51
51
  end
52
52
  @group_id
@@ -61,16 +61,23 @@ module XForge
61
61
  "http://#{@host.name}/projects/#{@unix_name}/"
62
62
  end
63
63
 
64
+ def group_id_uri(path, postfix="")
65
+ "http://#{@host.name}/#{path}/?group_id=#{group_id}#{postfix}"
66
+ end
67
+
64
68
  # The home page of this project
65
69
  def home_page_uri
66
- # This regexp seems a little volatile...
67
70
  unless(@home_page)
68
- project_data = open(project_uri) { |data| data.read }
69
- @home_page = project_data[@host.home_page_regexp, 1]
71
+ html = open(project_uri) { |data| data.read }
72
+ @home_page = html[@host.home_page_regexp, 1]
70
73
  raise "Couldn't get home_page" unless @home_page
71
74
  end
72
75
  @home_page
73
76
  end
77
+
78
+ def tracker
79
+ @tracker ||= Tracker::RubyForge.new(group_id_uri("tracker"), self)
80
+ end
74
81
  end
75
82
 
76
83
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.8
2
+ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: xforge
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2005-08-14
6
+ version: 0.2.1
7
+ date: 2005-08-14 00:00:00 -04:00
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib
@@ -25,6 +25,8 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  version: 0.0.0
26
26
  version:
27
27
  platform: ruby
28
+ signing_key:
29
+ cert_chain:
28
30
  authors:
29
31
  - Aslak Hellesoy
30
32
  files:
@@ -39,6 +41,8 @@ files:
39
41
  - lib/rake/contrib/xforge/news_publisher.rb
40
42
  - lib/rake/contrib/xforge/release.rb
41
43
  - lib/scm_web/view_cvs.rb
44
+ - lib/tracker/issue.rb
45
+ - lib/tracker/rubyforge.rb
42
46
  - lib/xforge/host.rb
43
47
  - lib/xforge/project.rb
44
48
  - lib/xforge/rubyforge.rb