meta_project 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/README +29 -3
- data/Rakefile +3 -2
- data/lib/meta_project/core_ext/open_uri.rb +3 -3
- data/lib/meta_project/project/trac/trac_project.rb +3 -3
- data/lib/meta_project/project/xforge/session.rb +0 -1
- data/lib/meta_project/project/xforge/xforge_base.rb +2 -0
- data/lib/meta_project/version_parser.rb +4 -0
- data/lib/rake/contrib/xforge/base.rb +6 -4
- data/lib/rake/contrib/xforge/news_publisher.rb +13 -9
- data/lib/rake/contrib/xforge/release.rb +22 -11
- metadata +1 -1
data/CHANGES
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= MetaProject Changelog
|
2
2
|
|
3
|
+
== Version 0.4.8
|
4
|
+
|
5
|
+
This release fixes some bugs with XForge (RubyForge) Rake tasks.
|
6
|
+
|
7
|
+
* Documented how to avoid parsing of CHANGES.
|
8
|
+
* Fixed a bug in interactive modus for user name and password prompts.
|
9
|
+
* Fixed a bug in retrieval of package_id when releasing to RubyForge.
|
10
|
+
* Fixed bug in open-uri extension that clobbered HTTP request headers failing login.
|
11
|
+
* Fixed a bug in the determination of Trac version.
|
12
|
+
|
3
13
|
== Version 0.4.7
|
4
14
|
|
5
15
|
This release makes HTTP access more robust and improves the Pathname API.
|
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= MetaProject 0.4.
|
1
|
+
= MetaProject 0.4.8
|
2
2
|
|
3
3
|
MetaProject (formerly XForge) is a library that allows interaction with various project hosting servers, issue trackers, SCMs and SCM browsers through a common API.
|
4
4
|
|
@@ -70,15 +70,41 @@ If you're writing an application that interacts with MetaProject, please refer t
|
|
70
70
|
|
71
71
|
---
|
72
72
|
|
73
|
+
== FAQ
|
74
|
+
|
75
|
+
=== I don't have a CHANGES file that MetaProject's Rake tasks understands. How do I disable it?
|
76
|
+
When using the Rake tasks Rake::XForge::Release and Rake::XForge::NewsPublisher, you can omit parsing
|
77
|
+
of the CHANGES file by telling the task to omit it. In this case, you also have to specify +release_notes+
|
78
|
+
and +release_changes+ to the task. Example:
|
79
|
+
|
80
|
+
task :release_files => [:gem] do
|
81
|
+
release_files = FileList[
|
82
|
+
"pkg/#{PKG_FILE_NAME}.gem"
|
83
|
+
]
|
84
|
+
|
85
|
+
Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new('xforge')) do |release|
|
86
|
+
# If you omit user_name and/or password, you'll be prompted at the command line.
|
87
|
+
release.user_name = ENV['RUBYFORGE_USER']
|
88
|
+
release.password = ENV['RUBYFORGE_PASSWORD']
|
89
|
+
release.files = release_files.to_a
|
90
|
+
release.release_name = "MetaProject #{PKG_VERSION}"
|
91
|
+
|
92
|
+
# The code below is for disabling parsing of CHANGES
|
93
|
+
release.changes_file = nil
|
94
|
+
release.release_notes = "This is release notes. They will show up at the release summary"
|
95
|
+
release.release_changes = ["This is", "a list of String", "and will also show up", "under the release summary"]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
73
99
|
== Credits
|
74
100
|
|
75
101
|
(In alphabetical order)
|
76
102
|
|
77
103
|
[<b>Aslak Hellesoy</b>] Maintainer of this project.
|
78
104
|
|
79
|
-
[<b>David Heinemeier Hansson</b>] For the HTTP POST code and the idea to parse ids from project pages.
|
105
|
+
[<b>David Heinemeier Hansson</b>] For the HTTP POST code and the idea to parse XForge ids from project pages.
|
80
106
|
|
81
|
-
[<b>Jim Weirich</b>] For Rake
|
107
|
+
[<b>Jim Weirich</b>] For Rake and feedback on some problems with the Rake tasks.
|
82
108
|
|
83
109
|
[<b>Thomas Leitner</b>] For Freshmeat and RAA support.
|
84
110
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# This file is may be distributed under an MIT style license. See
|
7
7
|
# MIT-LICENSE for details.
|
8
8
|
|
9
|
-
|
9
|
+
$:.unshift('lib')
|
10
10
|
require 'meta_project'
|
11
11
|
require 'rake/gempackagetask'
|
12
12
|
require 'rake/contrib/rubyforgepublisher'
|
@@ -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.8"
|
28
28
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
29
29
|
PKG_FILES = FileList[
|
30
30
|
'[A-Z]*',
|
@@ -34,6 +34,7 @@ PKG_FILES = FileList[
|
|
34
34
|
|
35
35
|
task :default => [:gem]
|
36
36
|
|
37
|
+
desc "Execute RSpec specifications (rspec gem must be installed)"
|
37
38
|
task :spec do
|
38
39
|
ruby 'behaviours/suite.rb'
|
39
40
|
end
|
@@ -2,15 +2,15 @@ require 'open-uri'
|
|
2
2
|
|
3
3
|
# Wrapper around Kernel.open from open-uri
|
4
4
|
# that can retry and report better errors
|
5
|
-
def better_open(url, retries=2, &block)
|
5
|
+
def better_open(url, headers=nil, retries=2, &block)
|
6
6
|
begin
|
7
7
|
# open-uri's open
|
8
|
-
Kernel.open(url, &block)
|
8
|
+
headers.nil? ? Kernel.open(url, &block) : Kernel.open(url, headers, &block)
|
9
9
|
rescue Errno::ECONNREFUSED, EOFError => e
|
10
10
|
if(retries > 0)
|
11
11
|
STDERR.puts "Connection refused to #{url} - retrying in 1 sec."
|
12
12
|
sleep 1
|
13
|
-
better_open(url, retries-1, &block)
|
13
|
+
better_open(url, headers, retries-1, &block)
|
14
14
|
else
|
15
15
|
e.message << " (URL:#{url})"
|
16
16
|
raise e
|
@@ -10,7 +10,7 @@ module MetaProject
|
|
10
10
|
@tracker = ::MetaProject::Tracker::Trac::TracTracker.new(@trac_base_url)
|
11
11
|
end
|
12
12
|
|
13
|
-
TRAC_VERSION_PATTERN = /<strong>Trac ([\d\.]+)
|
13
|
+
TRAC_VERSION_PATTERN = /<strong>Trac ([\d\.]+)[^<]*<\/strong>/
|
14
14
|
|
15
15
|
def scm_web
|
16
16
|
unless @scm_web
|
@@ -18,9 +18,9 @@ module MetaProject
|
|
18
18
|
front_page = better_open(@trac_base_url).read
|
19
19
|
if(front_page =~ TRAC_VERSION_PATTERN)
|
20
20
|
version = $1
|
21
|
-
|
21
|
+
# If there is no minor version part, add 0
|
22
|
+
version = "#{version}.0" if version =~ /^[\d]+\.[\d]+$/
|
22
23
|
version = version.gsub(/\./, "").to_i
|
23
|
-
|
24
24
|
if(version >= 90)
|
25
25
|
html = "#{@trac_base_url}/browser/#{@svn_path}/\#{path}?rev=\#{revision}"
|
26
26
|
raw = "#{@trac_base_url}/browser/#{@svn_path}/\#{path}?rev=\#{revision}&format=txt"
|
@@ -30,9 +30,13 @@ module MetaProject
|
|
30
30
|
end
|
31
31
|
|
32
32
|
release_notes = lines[release_notes_first..changes_first-1].join("")
|
33
|
+
raise "Release notes for #{version} couldn't be parsed from #{changes_file}" if release_notes.strip == ""
|
34
|
+
|
33
35
|
release_changes = lines[changes_first..changes_last].collect do |line|
|
34
36
|
line.length >= 2 ? line[2..-1].chomp : line
|
35
37
|
end
|
38
|
+
raise "Release changes for #{version} couldn't be parsed from #{changes_file}" if release_changes.length == 0
|
39
|
+
|
36
40
|
Version.new(release_notes, release_changes)
|
37
41
|
end
|
38
42
|
end
|
@@ -3,15 +3,17 @@ module Rake
|
|
3
3
|
|
4
4
|
# Base class for XForge tasks
|
5
5
|
class Base
|
6
|
-
|
6
|
+
attr_accessor :user_name, :password, :changes_file
|
7
7
|
|
8
8
|
def initialize(project)
|
9
9
|
@project = project
|
10
10
|
|
11
|
-
|
11
|
+
@changes_file = "CHANGES"
|
12
|
+
@version = PKG_VERSION if defined? PKG_VERSION
|
12
13
|
|
13
14
|
if(block_given?)
|
14
15
|
yield self
|
16
|
+
set_defaults
|
15
17
|
execute
|
16
18
|
end
|
17
19
|
end
|
@@ -23,7 +25,7 @@ module Rake
|
|
23
25
|
|
24
26
|
def user_name
|
25
27
|
if(@user_name.nil?)
|
26
|
-
print "#{@host
|
28
|
+
print "#{@project.host} user: "
|
27
29
|
@user_name = STDIN.gets.chomp
|
28
30
|
end
|
29
31
|
@user_name
|
@@ -31,7 +33,7 @@ module Rake
|
|
31
33
|
|
32
34
|
def password
|
33
35
|
if(@password.nil?)
|
34
|
-
print "#{@host
|
36
|
+
print "#{@project.host} password: "
|
35
37
|
@password = STDIN.gets.chomp
|
36
38
|
end
|
37
39
|
@password
|
@@ -11,20 +11,24 @@ module Rake
|
|
11
11
|
protected
|
12
12
|
|
13
13
|
def set_defaults
|
14
|
-
@subject = "#{PKG_NAME}-#{PKG_VERSION} released"
|
14
|
+
@subject = "#{PKG_NAME}-#{PKG_VERSION} released" unless @subject
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
if(@changes_file && @version)
|
17
|
+
begin
|
18
|
+
vp = ::MetaProject::VersionParser.new
|
19
|
+
version = vp.parse(@changes_file, @version)
|
20
|
+
@details = version.release_notes unless @details
|
21
|
+
rescue => e
|
22
|
+
STDERR.puts("Couldn't parse release info from #{@changes_file}")
|
23
|
+
STDERR.puts(e.message)
|
24
|
+
STDERR.puts(e.backtrace.join("\n"))
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
29
|
def execute
|
30
|
+
raise "'details' not defined." unless @details
|
31
|
+
raise "'subject' not defined." unless @subject
|
28
32
|
session = @project.login(user_name, password)
|
29
33
|
session.publish_news(@subject, @details)
|
30
34
|
end
|
@@ -53,22 +53,33 @@ module Rake
|
|
53
53
|
protected
|
54
54
|
|
55
55
|
def set_defaults
|
56
|
-
@files
|
57
|
-
|
56
|
+
if(@files.nil?)
|
57
|
+
@files = ["pkg/#{PKG_FILE_NAME}.gem"] if defined? PKG_FILE_NAME
|
58
|
+
end
|
59
|
+
|
60
|
+
if(@release_name.nil?)
|
61
|
+
@release_name = "#{PKG_NAME}-#{PKG_VERSION}" if (defined? PKG_NAME && defined? PKG_VERSION)
|
62
|
+
end
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
if(@changes_file && @version)
|
65
|
+
begin
|
66
|
+
vp = ::MetaProject::VersionParser.new
|
67
|
+
version = vp.parse(@changes_file, @version)
|
68
|
+
@release_notes = version.release_notes unless @release_notes
|
69
|
+
@release_changes = "* " + version.release_changes.join("\n* ") unless @release_changes
|
70
|
+
rescue => e
|
71
|
+
STDERR.puts("Couldn't parse release info from #{@changes_file}")
|
72
|
+
STDERR.puts(e.message)
|
73
|
+
STDERR.puts(e.backtrace.join("\n"))
|
74
|
+
end
|
68
75
|
end
|
69
76
|
end
|
70
77
|
|
71
78
|
def execute
|
79
|
+
raise "'release_name' not defined." unless @release_name
|
80
|
+
raise "'files' not defined." unless @files
|
81
|
+
raise "'release_notes' not defined." unless @release_notes
|
82
|
+
raise "'release_changes' not defined." unless @release_changes
|
72
83
|
session = @project.login(user_name, password)
|
73
84
|
session.release(@release_name, @files, @release_notes, @release_changes)
|
74
85
|
end
|