meta_project 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -0
- data/Rakefile +2 -2
- data/lib/meta_project/scm_web.rb +3 -1
- data/lib/meta_project/tracker/base.rb +4 -3
- data/lib/meta_project/tracker/jira/jira_tracker.rb +49 -8
- data/lib/meta_project/tracker/trac/trac_tracker.rb +5 -3
- data/lib/meta_project/tracker/xforge/xforge_tracker.rb +3 -3
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
= XForge Changelog
|
2
2
|
|
3
|
+
== Version 0.4.2
|
4
|
+
|
5
|
+
This is a minor release that accommodates fos some changes needed by DamageControl.
|
6
|
+
|
7
|
+
* Made tracker constructors empty so they can be used from DamageControl.
|
8
|
+
* Made ScmWeb constructor empty so it can be used from DamageControl.
|
9
|
+
* Made JiraTracker look for user/password in environment variables and log error if not defined.
|
10
|
+
|
3
11
|
== Version 0.4.1
|
4
12
|
|
5
13
|
This version renames xforge to meta_project. This is because the scope of this project
|
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 = "meta_project"
|
27
|
-
PKG_VERSION = "0.4.
|
27
|
+
PKG_VERSION = "0.4.2"
|
28
28
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
29
29
|
PKG_FILES = FileList[
|
30
30
|
'[A-Z]*',
|
@@ -125,7 +125,7 @@ task :verify_env_vars do
|
|
125
125
|
end
|
126
126
|
|
127
127
|
task :publish_doc => [:rdoc] do
|
128
|
-
publisher = Rake::RubyForgePublisher.new(
|
128
|
+
publisher = Rake::RubyForgePublisher.new('xforge', ENV['RUBYFORGE_USER'])
|
129
129
|
publisher.upload
|
130
130
|
end
|
131
131
|
|
data/lib/meta_project/scm_web.rb
CHANGED
@@ -4,13 +4,15 @@ module MetaProject
|
|
4
4
|
# in an online scm web interface.
|
5
5
|
class ScmWeb
|
6
6
|
|
7
|
+
attr_accessor :overview_spec, :history_spec, :raw_spec, :html_spec, :diff_spec
|
8
|
+
|
7
9
|
# The variables to use in +uri_specs+ are:
|
8
10
|
#
|
9
11
|
# * path
|
10
12
|
# * revision
|
11
13
|
# * previous_revision
|
12
14
|
#
|
13
|
-
def initialize(overview_spec, history_spec, raw_spec, html_spec, diff_spec)
|
15
|
+
def initialize(overview_spec=nil, history_spec=nil, raw_spec=nil, html_spec=nil, diff_spec=nil)
|
14
16
|
@overview_spec, @history_spec, @raw_spec, @html_spec, @diff_spec = overview_spec, history_spec, raw_spec, html_spec, diff_spec
|
15
17
|
end
|
16
18
|
|
@@ -8,9 +8,10 @@ module MetaProject
|
|
8
8
|
class Base
|
9
9
|
def self.classes
|
10
10
|
[
|
11
|
-
|
12
|
-
::
|
13
|
-
::
|
11
|
+
Jira::JiraTracker,
|
12
|
+
Trac::TracTracker,
|
13
|
+
XForge::RubyForgeTracker,
|
14
|
+
XForge::SourceForgeTracker,
|
14
15
|
]
|
15
16
|
end
|
16
17
|
end
|
@@ -3,11 +3,22 @@ require 'xmlrpc/client'
|
|
3
3
|
module MetaProject
|
4
4
|
module Tracker
|
5
5
|
module Jira
|
6
|
-
class JiraTracker
|
6
|
+
class JiraTracker < Base
|
7
7
|
JIRA_API = "jira1"
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
attr_accessor :rooturl, :identifier
|
10
|
+
|
11
|
+
# Creates a new JiraTracker. In order to successfully get issue info (via XMLRPC),
|
12
|
+
# two env vars must be defined. Example:
|
13
|
+
#
|
14
|
+
# JiraTracker.new("http://jira.codehaus.org", "DC")
|
15
|
+
#
|
16
|
+
# Then the following must be defined:
|
17
|
+
#
|
18
|
+
# JIRA_CODEHAUS_ORG_JIRA_USER
|
19
|
+
# JIRA_CODEHAUS_ORG_JIRA_PASSWORD
|
20
|
+
def initialize(rooturl=nil, identifier=nil)
|
21
|
+
@rooturl, @identifier = rooturl, identifier
|
11
22
|
end
|
12
23
|
|
13
24
|
def identifier_regexp
|
@@ -23,12 +34,17 @@ module MetaProject
|
|
23
34
|
end
|
24
35
|
|
25
36
|
def issue(issue_identifier)
|
26
|
-
session = login
|
27
37
|
begin
|
38
|
+
session = login
|
28
39
|
issue = session.getIssue(issue_identifier)
|
29
40
|
Issue.new("#{@rooturl}/browse/#{issue_identifier}", issue["summary"])
|
30
|
-
rescue XMLRPC::FaultException
|
31
|
-
# Probably bad issue number
|
41
|
+
rescue XMLRPC::FaultException => e
|
42
|
+
# Probably bad issue number or failed login
|
43
|
+
STDERR.puts("Couldn't get issue #{issue_identifier}: #{e.message}")
|
44
|
+
nil
|
45
|
+
rescue LoginException => e
|
46
|
+
# Missing env vars
|
47
|
+
STDERR.puts("Couldn't log in to JIRA at #{@rooturl}: #{e.message}")
|
32
48
|
nil
|
33
49
|
end
|
34
50
|
end
|
@@ -42,12 +58,37 @@ module MetaProject
|
|
42
58
|
end
|
43
59
|
|
44
60
|
private
|
45
|
-
|
61
|
+
|
46
62
|
def login
|
47
63
|
client = XMLRPC::Client.new2("#{@rooturl}/rpc/xmlrpc")
|
48
|
-
token = client.call("#{JIRA_API}.login",
|
64
|
+
token = client.call("#{JIRA_API}.login", user, password)
|
49
65
|
Session.new(client, token)
|
50
66
|
end
|
67
|
+
|
68
|
+
def user
|
69
|
+
var = "#{login_env_var_prefix}_JIRA_USER"
|
70
|
+
ENV[var] || login_error(var)
|
71
|
+
end
|
72
|
+
|
73
|
+
def password
|
74
|
+
var = "#{login_env_var_prefix}_JIRA_PASSWORD"
|
75
|
+
ENV[var] || login_error(var)
|
76
|
+
end
|
77
|
+
|
78
|
+
def login_env_var_prefix
|
79
|
+
if(rooturl =~ /http:\/\/([^\/]+)/)
|
80
|
+
$1.gsub(/\./, "_").upcase
|
81
|
+
else
|
82
|
+
raise "Bad root url: #{rooturl}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def login_error(var)
|
87
|
+
raise LoginException.new("#{var} environment variable not defined")
|
88
|
+
end
|
89
|
+
|
90
|
+
class LoginException < Exception
|
91
|
+
end
|
51
92
|
|
52
93
|
# This wrapper around XMLRPC::Client that allows simpler method calls
|
53
94
|
# via method_missing and doesn't require to manage the token
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module MetaProject
|
2
2
|
module Tracker
|
3
3
|
module Trac
|
4
|
-
class TracTracker <
|
5
|
-
include
|
4
|
+
class TracTracker < Base
|
5
|
+
include DigitIssues
|
6
6
|
|
7
|
-
|
7
|
+
attr_accessor :trac_base_url
|
8
|
+
|
9
|
+
def initialize(trac_base_url=nil)
|
8
10
|
@trac_base_url = trac_base_url
|
9
11
|
end
|
10
12
|
|
@@ -6,12 +6,12 @@ module MetaProject
|
|
6
6
|
module Tracker
|
7
7
|
module XForge
|
8
8
|
class XForgeTracker < Base
|
9
|
-
include
|
9
|
+
include DigitIssues
|
10
10
|
|
11
11
|
attr_accessor :overview, :project
|
12
12
|
|
13
|
-
# TODO: don't pass in project!! pass in hostname and id!
|
14
|
-
def initialize(overview, project)
|
13
|
+
# TODO: don't pass in project!! pass in hostname and id! This won't work from DC!!
|
14
|
+
def initialize(overview=nil, project=nil)
|
15
15
|
@overview, @project = overview, project
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: meta_project
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2005-08-
|
6
|
+
version: 0.4.2
|
7
|
+
date: 2005-08-23 00:00:00 -04:00
|
8
8
|
summary: Ruby based make-like utility.
|
9
9
|
require_paths:
|
10
10
|
- lib
|