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 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.7
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, making XForge easier to use from Ruby build scripts.
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
- # $:.unshift('lib')
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.7"
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\.]+)\w*<\/strong>/
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
- version = "#{version}.0" if version =~ /[\d]+\.[\d]+\.$/
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"
@@ -68,7 +68,6 @@ module MetaProject
68
68
  xfiles.each_with_index do |xfile, i|
69
69
  first_file = i==0
70
70
  puts "Releasing #{xfile.basename}..."
71
-
72
71
  release_response = Net::HTTP.start(@host, 80) do |http|
73
72
  query_hash = if first_file then
74
73
  {
@@ -3,6 +3,8 @@ module MetaProject
3
3
  module XForge
4
4
  class XForgeBase < Base
5
5
 
6
+ attr_reader :host, :unix_name
7
+
6
8
  def initialize(host, unix_name, cvs_mod)
7
9
  @host = host
8
10
  @unix_name = unix_name
@@ -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
- attr_writer :user_name, :password
6
+ attr_accessor :user_name, :password, :changes_file
7
7
 
8
8
  def initialize(project)
9
9
  @project = project
10
10
 
11
- set_defaults
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.name} user: "
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.name} password: "
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
- begin
17
- vp = ::MetaProject::VersionParser.new
18
- version = vp.parse("CHANGES", PKG_VERSION)
19
- @details = version.release_notes
20
- rescue => e
21
- STDERR.puts("Couldn't parse release info from CHANGES")
22
- STDERR.puts(e.message)
23
- STDERR.puts(e.backtrace.join("\n"))
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 = ["pkg/#{PKG_FILE_NAME}.gem"] if defined? PKG_FILE_NAME
57
- @release_name = "#{PKG_NAME}-#{PKG_VERSION}" if (defined? PKG_NAME && defined? PKG_VERSION)
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
- begin
60
- vp = ::MetaProject::VersionParser.new
61
- version = vp.parse("CHANGES", PKG_VERSION)
62
- @release_notes = version.release_notes
63
- @release_changes = "* " + version.release_changes.join("\n* ")
64
- rescue => e
65
- STDERR.puts("Couldn't parse release info from CHANGES")
66
- STDERR.puts(e.message)
67
- STDERR.puts(e.backtrace.join("\n"))
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
metadata CHANGED
@@ -3,7 +3,7 @@ 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
6
+ version: 0.4.8
7
7
  date: 2005-09-06 00:00:00 -04:00
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths: