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
@@ -1,2 +1,2 @@
1
- require 'meta_project/scm_web/browser'
1
+ require 'meta_project/scm_web/browser'
2
2
  require 'meta_project/scm_web/pathname'
@@ -1,112 +1,112 @@
1
- module MetaProject
2
- module ScmWeb
3
-
4
- # A Browser instance is capable of generating URLs to various files and diffs
5
- # in an online scm web interface.
6
- #
7
- class Browser
8
-
9
- attr_accessor :dir_spec, :history_spec, :raw_spec, :html_spec, :diff_spec
10
-
11
- # The variables to use in +uri_specs+ are:
12
- #
13
- # * path
14
- # * revision
15
- # * previous_revision
16
- #
17
- def initialize(dir_spec=nil, history_spec=nil, raw_spec=nil, html_spec=nil, diff_spec=nil, child_dirs_pattern=nil, child_files_pattern=nil)
18
- self.dir_spec = dir_spec unless dir_spec.nil?
19
- self.history_spec = history_spec unless history_spec.nil?
20
- self.raw_spec = raw_spec unless raw_spec.nil?
21
- self.html_spec = html_spec unless html_spec.nil?
22
- self.diff_spec = diff_spec unless diff_spec.nil?
23
-
24
- @child_dirs_pattern = child_dirs_pattern
25
- @child_files_pattern = child_files_pattern
26
- end
27
-
28
- def dir_spec=(spec)
29
- validate_presence_of("dir_spec", spec, "path")
30
- @dir_spec = spec
31
- end
32
-
33
- def history_spec=(spec)
34
- validate_presence_of("history_spec", spec, "path")
35
- @history_spec = spec
36
- end
37
-
38
- def raw_spec=(spec)
39
- validate_presence_of("raw_spec", spec, "path")
40
- validate_presence_of("raw_spec", spec, "revision")
41
- @raw_spec = spec
42
- end
43
-
44
- def html_spec=(spec)
45
- validate_presence_of("html_spec", spec, "path")
46
- validate_presence_of("html_spec", spec, "revision")
47
- @html_spec = spec
48
- end
49
-
50
- def diff_spec=(spec)
51
- validate_presence_of("diff_spec", spec, "revision")
52
- # Can't assume path and previous_revision to be present (Trac doesn't use them)
53
- #validate_presence_of("diff_spec", @diff_spec, "path")
54
- #validate_presence_of("diff_spec", @diff_spec, "previous_revision")
55
- @diff_spec = spec
56
- end
57
-
58
- def dir(path)
59
- file_uri(path, nil, @dir_spec, nil)
60
- end
61
-
62
- def history(path)
63
- file_uri(path, nil, @history_spec, nil)
64
- end
65
-
66
- def raw(path, revision)
67
- file_uri(path, revision, @raw_spec, nil)
68
- end
69
-
70
- def html(path, revision)
71
- file_uri(path, revision, @html_spec, nil)
72
- end
73
-
74
- def diff(path, revision, previous_revision)
75
- file_uri(path, revision, @diff_spec, previous_revision)
76
- end
77
-
78
- # The regexp used to determine child directories of a directory
79
- def child_dirs_pattern
80
- @child_dirs_pattern
81
- end
82
-
83
- # The regexp used to determine child files of a directory
84
- def child_files_pattern
85
- @child_files_pattern
86
- end
87
-
88
- # Returns a Pathname representing the root directory of this browser.
89
- # NOTE: The root of the browser may be at a lower level than
90
- # the toplevel of the online scm web interface; It depends
91
- # on the configuration of this instance.
92
- def root
93
- Pathname.new(self, nil, "", nil, true)
94
- end
95
-
96
- private
97
-
98
- def validate_presence_of(spec_name, spec, var)
99
- raise "Missing \#{#{var}} in #{spec_name}: '#{spec}'" unless spec =~ /\#\{#{var}\}/
100
- end
101
-
102
- def file_uri(path, revision, spec, previous_revision)
103
- begin
104
- eval("\"#{spec}\"", binding)
105
- rescue NameError
106
- raise "Couldn't evaluate '#{spec}'"
107
- end
108
- end
109
-
110
- end
111
- end
1
+ module MetaProject
2
+ module ScmWeb
3
+
4
+ # A Browser instance is capable of generating URLs to various files and diffs
5
+ # in an online scm web interface.
6
+ #
7
+ class Browser
8
+
9
+ attr_accessor :dir_spec, :history_spec, :raw_spec, :html_spec, :diff_spec
10
+
11
+ # The variables to use in +uri_specs+ are:
12
+ #
13
+ # * path
14
+ # * revision
15
+ # * previous_revision
16
+ #
17
+ def initialize(dir_spec=nil, history_spec=nil, raw_spec=nil, html_spec=nil, diff_spec=nil, child_dirs_pattern=nil, child_files_pattern=nil)
18
+ self.dir_spec = dir_spec unless dir_spec.nil?
19
+ self.history_spec = history_spec unless history_spec.nil?
20
+ self.raw_spec = raw_spec unless raw_spec.nil?
21
+ self.html_spec = html_spec unless html_spec.nil?
22
+ self.diff_spec = diff_spec unless diff_spec.nil?
23
+
24
+ @child_dirs_pattern = child_dirs_pattern
25
+ @child_files_pattern = child_files_pattern
26
+ end
27
+
28
+ def dir_spec=(spec)
29
+ validate_presence_of("dir_spec", spec, "path")
30
+ @dir_spec = spec
31
+ end
32
+
33
+ def history_spec=(spec)
34
+ validate_presence_of("history_spec", spec, "path")
35
+ @history_spec = spec
36
+ end
37
+
38
+ def raw_spec=(spec)
39
+ validate_presence_of("raw_spec", spec, "path")
40
+ validate_presence_of("raw_spec", spec, "revision")
41
+ @raw_spec = spec
42
+ end
43
+
44
+ def html_spec=(spec)
45
+ validate_presence_of("html_spec", spec, "path")
46
+ validate_presence_of("html_spec", spec, "revision")
47
+ @html_spec = spec
48
+ end
49
+
50
+ def diff_spec=(spec)
51
+ validate_presence_of("diff_spec", spec, "revision")
52
+ # Can't assume path and previous_revision to be present (Trac doesn't use them)
53
+ #validate_presence_of("diff_spec", @diff_spec, "path")
54
+ #validate_presence_of("diff_spec", @diff_spec, "previous_revision")
55
+ @diff_spec = spec
56
+ end
57
+
58
+ def dir(path)
59
+ file_uri(path, nil, @dir_spec, nil)
60
+ end
61
+
62
+ def history(path)
63
+ file_uri(path, nil, @history_spec, nil)
64
+ end
65
+
66
+ def raw(path, revision)
67
+ file_uri(path, revision, @raw_spec, nil)
68
+ end
69
+
70
+ def html(path, revision)
71
+ file_uri(path, revision, @html_spec, nil)
72
+ end
73
+
74
+ def diff(path, revision, previous_revision)
75
+ file_uri(path, revision, @diff_spec, previous_revision)
76
+ end
77
+
78
+ # The regexp used to determine child directories of a directory
79
+ def child_dirs_pattern
80
+ @child_dirs_pattern
81
+ end
82
+
83
+ # The regexp used to determine child files of a directory
84
+ def child_files_pattern
85
+ @child_files_pattern
86
+ end
87
+
88
+ # Returns a Pathname representing the root directory of this browser.
89
+ # NOTE: The root of the browser may be at a lower level than
90
+ # the toplevel of the online scm web interface; It depends
91
+ # on the configuration of this instance.
92
+ def root
93
+ Pathname.new(self, nil, "", nil, true)
94
+ end
95
+
96
+ private
97
+
98
+ def validate_presence_of(spec_name, spec, var)
99
+ raise "Missing \#{#{var}} in #{spec_name}: '#{spec}'" unless spec =~ /\#\{#{var}\}/
100
+ end
101
+
102
+ def file_uri(path, revision, spec, previous_revision)
103
+ begin
104
+ eval("\"#{spec}\"", binding)
105
+ rescue NameError
106
+ raise "Couldn't evaluate '#{spec}'"
107
+ end
108
+ end
109
+
110
+ end
111
+ end
112
112
  end
@@ -1,89 +1,89 @@
1
- module MetaProject
2
- module ScmWeb
3
- # A subset of the
4
- # <a href="http://www.ruby-doc.org/stdlib/libdoc/pathname/rdoc/index.html">Pathname</a>
5
- # API which is suitable for slurping SCM contents off the web.
6
- #
7
- class Pathname
8
-
9
- def initialize(browser, parent, basename, revision_identifier, directory)
10
- @browser, @parent, @basename, @revision_identifier, @directory = browser, parent, basename, revision_identifier, directory
11
- end
12
-
13
- # The relative path from the root of the browser instance
14
- #
15
- # ""
16
- # "var"
17
- # "var/spool"
18
- def path_from_root
19
- parent_path_from_root = @parent ? @parent.path_from_root : ""
20
- parent_path_from_root == "" ? @basename : "#{parent_path_from_root}/#{@basename}"
21
- end
22
-
23
- # The revision of this file or nil if this is a directory
24
- def revision_identifier
25
- @revision_identifier
26
- end
27
-
28
- # Returns a Pathname at the +relative_path+ from this directory.
29
- # Note: This only works if this instance is a +directory?+
30
- def child(basename, revision_identifier=nil, directory=true)
31
- raise "Can't create children for files" unless @directory
32
- Pathname.new(@browser, self, basename, revision_identifier, directory)
33
- end
34
-
35
- # Stlib Pathname methods
36
-
37
- # The parent of this instance
38
- def parent
39
- @parent
40
- end
41
-
42
- # The basename of this instance
43
- def basename
44
- @basename
45
- end
46
-
47
- # Returns the full path on the web (to the dir page for directories, history page for files)
48
- def cleanpath
49
- directory? ? @browser.dir(path_from_root) : @browser.history(path_from_root)
50
- end
51
-
52
- def children
53
- result = []
54
- html = better_open(cleanpath).read
55
-
56
- html.scan(@browser.child_dirs_pattern) do |child_basename_rev_array|
57
- child_basename = child_basename_rev_array[0]
58
- child_revision_identifier = child_basename_rev_array[1] # nil for most browsers
59
- #puts "DIR:#{child_basename}:#{child_revision_identifier}"
60
- result << child(child_basename, child_revision_identifier, true)
61
- end
62
-
63
- html.scan(@browser.child_files_pattern) do |child_basename_rev_array|
64
- child_basename = child_basename_rev_array[0]
65
- child_revision_identifier = child_basename_rev_array[1]
66
- #puts "FILE:#{child_basename}:#{child_revision_identifier}"
67
- result << child(child_basename, child_revision_identifier, false)
68
- end
69
- result
70
- end
71
-
72
- def open(&block)
73
- url = @browser.raw(path_from_root, revision_identifier)
74
- begin
75
- better_open(url, &block)
76
- rescue Errno::ECONNREFUSED => e
77
- # TODO: retry 2-3 times
78
- e.message += "(URL:#{url})"
79
- raise e
80
- end
81
- end
82
-
83
- def directory?
84
- @directory
85
- end
86
-
87
- end
88
- end
1
+ module MetaProject
2
+ module ScmWeb
3
+ # A subset of the
4
+ # <a href="http://www.ruby-doc.org/stdlib/libdoc/pathname/rdoc/index.html">Pathname</a>
5
+ # API which is suitable for slurping SCM contents off the web.
6
+ #
7
+ class Pathname
8
+
9
+ def initialize(browser, parent, basename, revision_identifier, directory)
10
+ @browser, @parent, @basename, @revision_identifier, @directory = browser, parent, basename, revision_identifier, directory
11
+ end
12
+
13
+ # The relative path from the root of the browser instance
14
+ #
15
+ # ""
16
+ # "var"
17
+ # "var/spool"
18
+ def path_from_root
19
+ parent_path_from_root = @parent ? @parent.path_from_root : ""
20
+ parent_path_from_root == "" ? @basename : "#{parent_path_from_root}/#{@basename}"
21
+ end
22
+
23
+ # The revision of this file or nil if this is a directory
24
+ def revision_identifier
25
+ @revision_identifier
26
+ end
27
+
28
+ # Returns a Pathname at the +relative_path+ from this directory.
29
+ # Note: This only works if this instance is a +directory?+
30
+ def child(basename, revision_identifier=nil, directory=true)
31
+ raise "Can't create children for files" unless @directory
32
+ Pathname.new(@browser, self, basename, revision_identifier, directory)
33
+ end
34
+
35
+ # Stlib Pathname methods
36
+
37
+ # The parent of this instance
38
+ def parent
39
+ @parent
40
+ end
41
+
42
+ # The basename of this instance
43
+ def basename
44
+ @basename
45
+ end
46
+
47
+ # Returns the full path on the web (to the dir page for directories, history page for files)
48
+ def cleanpath
49
+ directory? ? @browser.dir(path_from_root) : @browser.history(path_from_root)
50
+ end
51
+
52
+ def children
53
+ result = []
54
+ html = better_open(cleanpath).read
55
+
56
+ html.scan(@browser.child_dirs_pattern) do |child_basename_rev_array|
57
+ child_basename = child_basename_rev_array[0]
58
+ child_revision_identifier = child_basename_rev_array[1] # nil for most browsers
59
+ #puts "DIR:#{child_basename}:#{child_revision_identifier}"
60
+ result << child(child_basename, child_revision_identifier, true)
61
+ end
62
+
63
+ html.scan(@browser.child_files_pattern) do |child_basename_rev_array|
64
+ child_basename = child_basename_rev_array[0]
65
+ child_revision_identifier = child_basename_rev_array[1]
66
+ #puts "FILE:#{child_basename}:#{child_revision_identifier}"
67
+ result << child(child_basename, child_revision_identifier, false)
68
+ end
69
+ result
70
+ end
71
+
72
+ def open(&block)
73
+ url = @browser.raw(path_from_root, revision_identifier)
74
+ begin
75
+ better_open(url, &block)
76
+ rescue Errno::ECONNREFUSED => e
77
+ # TODO: retry 2-3 times
78
+ e.message += "(URL:#{url})"
79
+ raise e
80
+ end
81
+ end
82
+
83
+ def directory?
84
+ @directory
85
+ end
86
+
87
+ end
88
+ end
89
89
  end
@@ -1,6 +1,6 @@
1
- require 'meta_project/tracker/base'
2
- require 'meta_project/tracker/digit_issues'
3
- require 'meta_project/tracker/issue'
4
- require 'meta_project/tracker/trac'
5
- require 'meta_project/tracker/xforge'
6
- require 'meta_project/tracker/jira'
1
+ require 'meta_project/tracker/base'
2
+ require 'meta_project/tracker/digit_issues'
3
+ require 'meta_project/tracker/issue'
4
+ require 'meta_project/tracker/trac'
5
+ require 'meta_project/tracker/xforge'
6
+ require 'meta_project/tracker/jira'
@@ -1,24 +1,24 @@
1
- module MetaProject
2
- module Tracker
3
-
4
- # Tracker objects are responsible for interacting with issue trackers (bug trackers).
5
- # They know how to recognise issue identifiers in strings (typically from SCM commit
6
- # messages) and turn these into HTML links that point to the associated issue on an
7
- # issue tracker installation running somewhere else.
8
- class Base
9
- def self.classes
10
- [
11
- Jira::JiraTracker,
12
- Trac::TracTracker,
13
- XForge::RubyForgeTracker,
14
- XForge::SourceForgeTracker,
15
- ]
16
- end
17
-
18
- def issue(issue_identifier)
19
- Issue.new(self, :identifier => issue_identifier)
20
- end
21
-
22
- end
23
- end
1
+ module MetaProject
2
+ module Tracker
3
+
4
+ # Tracker objects are responsible for interacting with issue trackers (bug trackers).
5
+ # They know how to recognise issue identifiers in strings (typically from SCM commit
6
+ # messages) and turn these into HTML links that point to the associated issue on an
7
+ # issue tracker installation running somewhere else.
8
+ class Base
9
+ def self.classes
10
+ [
11
+ Jira::JiraTracker,
12
+ Trac::TracTracker,
13
+ XForge::RubyForgeTracker,
14
+ XForge::SourceForgeTracker,
15
+ ]
16
+ end
17
+
18
+ def issue(issue_identifier)
19
+ Issue.new(self, :identifier => issue_identifier)
20
+ end
21
+
22
+ end
23
+ end
24
24
  end