meta_project 0.4.11 → 0.4.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/CHANGES +277 -269
  2. data/MIT-LICENSE +21 -21
  3. data/README +126 -126
  4. data/Rakefile +152 -152
  5. data/doc/base_attrs.rdoc +2 -2
  6. data/lib/meta_project.rb +11 -10
  7. data/lib/meta_project/core_ext/open_uri.rb +22 -22
  8. data/lib/meta_project/core_ext/pathname.rb +36 -36
  9. data/lib/meta_project/core_ext/string.rb +4 -4
  10. data/lib/meta_project/http/multipart.rb +32 -0
  11. data/lib/meta_project/patois/parser.rb +98 -98
  12. data/lib/meta_project/project.rb +4 -4
  13. data/lib/meta_project/project/base.rb +8 -8
  14. data/lib/meta_project/project/codehaus.rb +1 -1
  15. data/lib/meta_project/project/codehaus/codehaus_project_svn.rb +30 -30
  16. data/lib/meta_project/project/trac.rb +1 -1
  17. data/lib/meta_project/project/trac/trac_project.rb +53 -53
  18. data/lib/meta_project/project/xforge.rb +5 -5
  19. data/lib/meta_project/project/xforge/ruby_forge.rb +46 -48
  20. data/lib/meta_project/project/xforge/session.rb +177 -191
  21. data/lib/meta_project/project/xforge/source_forge.rb +49 -49
  22. data/lib/meta_project/project/xforge/xfile.rb +44 -44
  23. data/lib/meta_project/project/xforge/xforge_base.rb +81 -79
  24. data/lib/meta_project/project_analyzer.rb +35 -35
  25. data/lib/meta_project/release/freshmeat.rb +267 -267
  26. data/lib/meta_project/release/raa.rb +572 -572
  27. data/lib/meta_project/scm_web.rb +1 -1
  28. data/lib/meta_project/scm_web/browser.rb +111 -111
  29. data/lib/meta_project/scm_web/pathname.rb +88 -88
  30. data/lib/meta_project/tracker.rb +6 -6
  31. data/lib/meta_project/tracker/base.rb +23 -23
  32. data/lib/meta_project/tracker/digit_issues.rb +33 -32
  33. data/lib/meta_project/tracker/issue.rb +56 -52
  34. data/lib/meta_project/tracker/jira.rb +2 -2
  35. data/lib/meta_project/tracker/jira/jira_issues.rb +34 -33
  36. data/lib/meta_project/tracker/jira/jira_tracker.rb +123 -123
  37. data/lib/meta_project/tracker/trac.rb +1 -1
  38. data/lib/meta_project/tracker/trac/trac_tracker.rb +32 -32
  39. data/lib/meta_project/tracker/xforge.rb +3 -3
  40. data/lib/meta_project/tracker/xforge/ruby_forge_tracker.rb +17 -17
  41. data/lib/meta_project/tracker/xforge/source_forge_tracker.rb +17 -17
  42. data/lib/meta_project/tracker/xforge/xforge_tracker.rb +190 -105
  43. data/lib/meta_project/version_parser.rb +52 -52
  44. data/lib/rake/contrib/xforge.rb +3 -3
  45. data/lib/rake/contrib/xforge/base.rb +64 -64
  46. data/lib/rake/contrib/xforge/news_publisher.rb +97 -97
  47. data/lib/rake/contrib/xforge/release.rb +134 -134
  48. metadata +3 -3
  49. data/TODO +0 -9
data/doc/base_attrs.rdoc CHANGED
@@ -1,2 +1,2 @@
1
- * user_name
2
- * password
1
+ * user_name
2
+ * password
data/lib/meta_project.rb CHANGED
@@ -1,10 +1,11 @@
1
- require 'meta_project/core_ext/string'
2
- require 'meta_project/core_ext/pathname'
3
- require 'meta_project/core_ext/open_uri'
4
- require 'meta_project/project_analyzer'
5
- require 'meta_project/patois'
6
- require 'meta_project/project'
7
- require 'meta_project/tracker'
8
- require 'meta_project/scm_web'
9
- require 'meta_project/version_parser'
10
- require 'rake/contrib/xforge'
1
+ require 'meta_project/http/multipart'
2
+ require 'meta_project/core_ext/string'
3
+ require 'meta_project/core_ext/pathname'
4
+ require 'meta_project/core_ext/open_uri'
5
+ require 'meta_project/project_analyzer'
6
+ require 'meta_project/patois'
7
+ require 'meta_project/project'
8
+ require 'meta_project/tracker'
9
+ require 'meta_project/scm_web'
10
+ require 'meta_project/version_parser'
11
+ require 'rake/contrib/xforge'
@@ -1,22 +1,22 @@
1
- require 'open-uri'
2
-
3
- # Wrapper around Kernel.open from open-uri
4
- # that can retry and report better errors
5
- def better_open(url, headers=nil, retries=2, &block)
6
- begin
7
- # open-uri's open
8
- headers.nil? ? Kernel.open(url, &block) : Kernel.open(url, headers, &block)
9
- rescue Errno::ECONNREFUSED, EOFError => e
10
- if(retries > 0)
11
- STDERR.puts "Connection refused to #{url} - retrying in 1 sec."
12
- sleep 1
13
- better_open(url, headers, retries-1, &block)
14
- else
15
- e.message << " (URL:#{url})"
16
- raise e
17
- end
18
- rescue OpenURI::HTTPError => e
19
- e.message << " (URL:#{url})"
20
- raise e
21
- end
22
- end
1
+ require 'open-uri'
2
+
3
+ # Wrapper around Kernel.open from open-uri
4
+ # that can retry and report better errors
5
+ def better_open(url, headers=nil, retries=2, &block)
6
+ begin
7
+ # open-uri's open
8
+ headers.nil? ? Kernel.open(url, &block) : Kernel.open(url, headers, &block)
9
+ rescue Errno::ECONNREFUSED, EOFError => e
10
+ if(retries > 0)
11
+ STDERR.puts "Connection refused to #{url} - retrying in 1 sec."
12
+ sleep 1
13
+ better_open(url, headers, retries-1, &block)
14
+ else
15
+ e.message << " (URL:#{url})"
16
+ raise e
17
+ end
18
+ rescue OpenURI::HTTPError => e
19
+ e.message << " (URL:#{url})"
20
+ raise e
21
+ end
22
+ end
@@ -1,36 +1,36 @@
1
- require 'pathname'
2
-
3
- # TODO: extend this to find comments
4
- # http://ostermiller.org/findcomment.html
5
-
6
- module PathnameIterator
7
- def iterate(proc, &block)
8
- if directory?
9
- children.each do |c|
10
- c.iterate(proc)
11
- end
12
- else
13
- proc.call(self, &block)
14
- end
15
- end
16
-
17
- def egrep(regexp, &block)
18
- proc = Proc.new do |file|
19
- file.open do |io|
20
- count = 0
21
- while line = io.gets
22
- count += 1
23
- if line =~ regexp
24
- block.call("#{file.cleanpath}:#{count}:#{line}")
25
- end
26
- end
27
- end
28
- end
29
- iterate(proc, &block)
30
- end
31
-
32
- end
33
-
34
- class Pathname
35
- include PathnameIterator
36
- end
1
+ require 'pathname'
2
+
3
+ # TODO: extend this to find comments
4
+ # http://ostermiller.org/findcomment.html
5
+
6
+ module PathnameIterator
7
+ def iterate(proc, &block)
8
+ if directory?
9
+ children.each do |c|
10
+ c.iterate(proc)
11
+ end
12
+ else
13
+ proc.call(self, &block)
14
+ end
15
+ end
16
+
17
+ def egrep(regexp, &block)
18
+ proc = Proc.new do |file|
19
+ file.open do |io|
20
+ count = 0
21
+ while line = io.gets
22
+ count += 1
23
+ if line =~ regexp
24
+ block.call("#{file.cleanpath}:#{count}:#{line}")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ iterate(proc, &block)
30
+ end
31
+
32
+ end
33
+
34
+ class Pathname
35
+ include PathnameIterator
36
+ end
@@ -1,5 +1,5 @@
1
- class String
2
- def strip_trailing_slash
3
- self[-1..-1] == "/" ? self[0..-2] : self
4
- end
1
+ class String
2
+ def strip_trailing_slash
3
+ self[-1..-1] == "/" ? self[0..-2] : self
4
+ end
5
5
  end
@@ -0,0 +1,32 @@
1
+ module MetaProject
2
+ module HTTP
3
+ # TODO make this an extension of Net::HTTP and nicify the API
4
+ module Multipart
5
+ BOUNDARY = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor" #:nodoc:
6
+
7
+ def post_multipart(http, target, params, headers)
8
+ headers = headers.merge("Content-Type" => "multipart/form-data; boundary=#{BOUNDARY}")
9
+ http.post(target, post_data(params), headers)
10
+ end
11
+
12
+ # Converts an Array or Hash into HTTP POST params
13
+ def post_data(*params)
14
+ form = []
15
+ params.each do |param|
16
+ case param
17
+ when Array
18
+ form << param
19
+ when Hash
20
+ param.each do |key, value|
21
+ form <<
22
+ "--#{BOUNDARY}" <<
23
+ %Q(Content-Disposition: form-data; name="#{key}") <<
24
+ "" << value
25
+ end
26
+ end
27
+ end
28
+ form.flatten.join("\r\n")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,99 +1,99 @@
1
- module MetaProject
2
- # Patois is a domain specific language (DSL)
3
- # for configuration and release management. It was first implemented by
4
- # <a href="http://projects.edgewall.com/trac/browser/trunk/contrib/trac-post-commit-hook">Trac</a>
5
- # and this class is a Ruby port of that Python code.
6
- #
7
- # A similar idea was created by the DamageControl team in <a href="http://jira.codehaus.org/browse/DC-159">DC-159</a>
8
- # before it was implemented in Trac, but the Trac team beat the DamageControl to implement it.
9
- #
10
- # Anyhow, by giving this mini DSL a name and some better profiling we hope its adoption
11
- # will increase. Patois means:
12
- #
13
- # * a dialect other than the standard or literary dialect
14
- # * uneducated or provincial speech
15
- # * the characteristic special language of an occupational or social group
16
- #
17
- # Patois' intended usage is in SCM commit messages. A patois-aware system can parse the commit
18
- # messages and try to recognise patois expressions and take appropriate actions.
19
- #
20
- # Here is a little taste of what you can say and do with Patois.
21
- #
22
- # == General form
23
- #
24
- # command #1
25
- # command #1, #2
26
- # command #1 & #2
27
- # command #1 and #2 # == Closing issues in an issue tracker
28
- #
29
- # You can have more than one command in a message. The following commands
30
- # are supported. There is more than one spelling for each command, to make
31
- # this as user-friendly as possible.
32
- #
33
- # close, closed, closes, fix, fixed, fixes
34
- # The specified issues are closed with the contents of the
35
- # commit message being added to it.
36
- #
37
- # addresses, re, ref, references, refs, see
38
- # The specified issues are left in their current status, but
39
- # the contents of the commit message are added to their notes.
40
- #
41
- # A fairly complicated example of what you can do is with a commit message
42
- # of:
43
- #
44
- # Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.
45
- #
46
- # This will close #10 and #12, and add a note to #12
47
- #
48
- module Patois
49
-
50
- # Parses Patois
51
- #
52
- class Parser
53
-
54
- SUPPORTED_COMMANDS = {
55
- 'close' => ':close',
56
- 'closed' => ':close',
57
- 'closes' => ':close',
58
- 'fix' => ':close',
59
- 'fixed' => ':close',
60
- 'fixes' => ':close',
61
- 'addresses' => ':comment',
62
- 're' => ':comment',
63
- 'ref' => ':comment',
64
- 'references' => ':comment',
65
- 'refs' => ':comment',
66
- 'see' => ':comment'
67
- }
68
-
69
- # Creates a new parser that will parse commands with +command_pattern+
70
- # and emit individual commands with +issue_pattern+.
71
- def initialize(command_pattern, issue_pattern)
72
- @command_pattern = command_pattern
73
- @issue_pattern = issue_pattern
74
- end
75
-
76
- # Parses a patois String and yields commands.
77
- # TODO: Each operation can be executed with +execute+
78
- def parse(msg)
79
- msg.scan(@command_pattern) do |cmd_group|
80
- cmd = SUPPORTED_COMMANDS[cmd_group[0].downcase]
81
- if(cmd)
82
- cmd_group[1].scan(@issue_pattern) do |issue_id_array|
83
- yield Command.new(cmd, issue_id_array[0].upcase, msg)
84
- end
85
- end
86
- end
87
- end
88
-
89
- class Command
90
-
91
- attr_reader :cmd, :issue_id, :msg
92
-
93
- def initialize(cmd, issue_id, msg)
94
- @cmd, @issue_id, @msg = cmd, issue_id, msg
95
- end
96
- end
97
- end
98
- end
1
+ module MetaProject
2
+ # Patois is a domain specific language (DSL)
3
+ # for configuration and release management. It was first implemented by
4
+ # <a href="http://projects.edgewall.com/trac/browser/trunk/contrib/trac-post-commit-hook">Trac</a>
5
+ # and this class is a Ruby port of that Python code.
6
+ #
7
+ # A similar idea was created by the DamageControl team in <a href="http://jira.codehaus.org/browse/DC-159">DC-159</a>
8
+ # before it was implemented in Trac, but the Trac team beat the DamageControl to implement it.
9
+ #
10
+ # Anyhow, by giving this mini DSL a name and some better profiling we hope its adoption
11
+ # will increase. Patois means:
12
+ #
13
+ # * a dialect other than the standard or literary dialect
14
+ # * uneducated or provincial speech
15
+ # * the characteristic special language of an occupational or social group
16
+ #
17
+ # Patois' intended usage is in SCM commit messages. A patois-aware system can parse the commit
18
+ # messages and try to recognise patois expressions and take appropriate actions.
19
+ #
20
+ # Here is a little taste of what you can say and do with Patois.
21
+ #
22
+ # == General form
23
+ #
24
+ # command #1
25
+ # command #1, #2
26
+ # command #1 & #2
27
+ # command #1 and #2 # == Closing issues in an issue tracker
28
+ #
29
+ # You can have more than one command in a message. The following commands
30
+ # are supported. There is more than one spelling for each command, to make
31
+ # this as user-friendly as possible.
32
+ #
33
+ # close, closed, closes, fix, fixed, fixes
34
+ # The specified issues are closed with the contents of the
35
+ # commit message being added to it.
36
+ #
37
+ # addresses, re, ref, references, refs, see
38
+ # The specified issues are left in their current status, but
39
+ # the contents of the commit message are added to their notes.
40
+ #
41
+ # A fairly complicated example of what you can do is with a commit message
42
+ # of:
43
+ #
44
+ # Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.
45
+ #
46
+ # This will close #10 and #12, and add a note to #12
47
+ #
48
+ module Patois
49
+
50
+ # Parses Patois
51
+ #
52
+ class Parser
53
+
54
+ SUPPORTED_COMMANDS = {
55
+ 'close' => ':close',
56
+ 'closed' => ':close',
57
+ 'closes' => ':close',
58
+ 'fix' => ':close',
59
+ 'fixed' => ':close',
60
+ 'fixes' => ':close',
61
+ 'addresses' => ':comment',
62
+ 're' => ':comment',
63
+ 'ref' => ':comment',
64
+ 'references' => ':comment',
65
+ 'refs' => ':comment',
66
+ 'see' => ':comment'
67
+ }
68
+
69
+ # Creates a new parser that will parse commands with +command_pattern+
70
+ # and emit individual commands with +issue_pattern+.
71
+ def initialize(command_pattern, issue_pattern)
72
+ @command_pattern = command_pattern
73
+ @issue_pattern = issue_pattern
74
+ end
75
+
76
+ # Parses a patois String and yields commands.
77
+ # TODO: Each operation can be executed with +execute+
78
+ def parse(msg)
79
+ msg.scan(@command_pattern) do |cmd_group|
80
+ cmd = SUPPORTED_COMMANDS[cmd_group[0].downcase]
81
+ if(cmd)
82
+ cmd_group[1].scan(@issue_pattern) do |issue_id_array|
83
+ yield Command.new(cmd, issue_id_array[0].upcase, msg)
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ class Command
90
+
91
+ attr_reader :cmd, :issue_id, :msg
92
+
93
+ def initialize(cmd, issue_id, msg)
94
+ @cmd, @issue_id, @msg = cmd, issue_id, msg
95
+ end
96
+ end
97
+ end
98
+ end
99
99
  end
@@ -1,4 +1,4 @@
1
- require 'meta_project/project/base'
2
- require 'meta_project/project/xforge'
3
- require 'meta_project/project/trac'
4
- require 'meta_project/project/codehaus'
1
+ require 'meta_project/project/base'
2
+ require 'meta_project/project/xforge'
3
+ require 'meta_project/project/trac'
4
+ require 'meta_project/project/codehaus'
@@ -1,9 +1,9 @@
1
- module MetaProject
2
- module Project
3
- class Base
4
- attr_reader :scm, :scm_web, :tracker, :name, :home_page
5
- end
6
-
7
- class ProjectException < Exception; end
8
- end
1
+ module MetaProject
2
+ module Project
3
+ class Base
4
+ attr_reader :scm, :scm_web, :tracker, :name, :home_page
5
+ end
6
+
7
+ class ProjectException < Exception; end
8
+ end
9
9
  end
@@ -1 +1 @@
1
- require 'meta_project/project/codehaus/codehaus_project_svn'
1
+ require 'meta_project/project/codehaus/codehaus_project_svn'
@@ -1,31 +1,31 @@
1
- module MetaProject
2
- module Project
3
- module Codehaus
4
- class CodehausProjectSvn < Base
5
-
6
- def initialize(unix_name, svn_path, jira_id)
7
- @unix_name = unix_name
8
- @name = unix_name
9
- @scm = RSCM::Subversion.new("svn://svn.#{unix_name}.codehaus.org/#{unix_name}/scm/#{svn_path}", svn_path)
10
- @tracker = ::MetaProject::Tracker::Jira::JiraTracker.new("http://jira.codehaus.org", jira_id)
11
-
12
- dir = "http://svn.#{unix_name}.codehaus.org/#{svn_path}/\#{path}"
13
- history = dir
14
- raw = "#{history}?rev=\#{revision}"
15
- html = "#{raw}&view=markup"
16
- # http://svn.picocontainer.codehaus.org/java/picocontainer/trunk/container/project.xml?r1=2220&r2=2234&p1=java/picocontainer/trunk/container/project.xml&p2=java/picocontainer/trunk/container/project.xml
17
- diff = "#{history}?r1=\#{previous_revision}&r2=\#{revision}&p1=#{svn_path}/\#{path}&p2=#{svn_path}/\#{path}"
18
- child_dirs_pattern = /<a name="([^"]+)" href="([^"]+)">[\r\n\s]+<img src="\/icons\/small\/dir.gif"/
19
- child_files_pattern = /<a href="[^"]+\/([^\?]+)\?rev=([\d]+)&view=auto">/
20
-
21
- @scm_web = ScmWeb::Browser.new(dir, history, raw, html, diff, child_dirs_pattern, child_files_pattern)
22
- end
23
-
24
- def home_page
25
- "http://#{@unix_name}.codehaus.org/"
26
- end
27
-
28
- end
29
- end
30
- end
1
+ module MetaProject
2
+ module Project
3
+ module Codehaus
4
+ class CodehausProjectSvn < Base
5
+
6
+ def initialize(unix_name, svn_path, jira_id)
7
+ @unix_name = unix_name
8
+ @name = unix_name
9
+ @scm = RSCM::Subversion.new("svn://svn.#{unix_name}.codehaus.org/#{unix_name}/scm/#{svn_path}", svn_path)
10
+ @tracker = ::MetaProject::Tracker::Jira::JiraTracker.new("http://jira.codehaus.org", jira_id)
11
+
12
+ dir = "http://svn.#{unix_name}.codehaus.org/#{svn_path}/\#{path}"
13
+ history = dir
14
+ raw = "#{history}?rev=\#{revision}"
15
+ html = "#{raw}&view=markup"
16
+ # http://svn.picocontainer.codehaus.org/java/picocontainer/trunk/container/project.xml?r1=2220&r2=2234&p1=java/picocontainer/trunk/container/project.xml&p2=java/picocontainer/trunk/container/project.xml
17
+ diff = "#{history}?r1=\#{previous_revision}&r2=\#{revision}&p1=#{svn_path}/\#{path}&p2=#{svn_path}/\#{path}"
18
+ child_dirs_pattern = /<a name="([^"]+)" href="([^"]+)">[\r\n\s]+<img src="\/icons\/small\/dir.gif"/
19
+ child_files_pattern = /<a href="[^"]+\/([^\?]+)\?rev=([\d]+)&view=auto">/
20
+
21
+ @scm_web = ScmWeb::Browser.new(dir, history, raw, html, diff, child_dirs_pattern, child_files_pattern)
22
+ end
23
+
24
+ def home_page
25
+ "http://#{@unix_name}.codehaus.org/"
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
31
  end