xforge 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,8 +1,15 @@
1
1
  = XForge Changelog
2
2
 
3
+ == Version 0.1.3
4
+
5
+ * Added logic for parsing of CHANGES files and include it in the release notes when publishing.
6
+
3
7
  == Version 0.1.2
4
8
 
9
+ This release is a minor release with fixes in the Rake script.
10
+
5
11
  * Fixed RDoc for gem
12
+ * Cleaned up documentation
6
13
 
7
14
  == Version 0.1.1
8
15
 
data/README CHANGED
@@ -35,7 +35,7 @@ See XForge and Rake::XForge::Release.
35
35
 
36
36
  [<b>David Heinemeier Hansson</b>] For the HTTP POST code and the idea to parse ids from project pages.
37
37
 
38
- [<b>Jim Weirich</b>] For Rake, making XForge functionality more available to Ruby developers.
38
+ [<b>Jim Weirich</b>] For Rake, making XForge easier to use from Ruby build scripts.
39
39
 
40
40
  == Support
41
41
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- # Rakefile for XForge -*- ruby -*-
1
+ # Rakefile for XForge
2
2
 
3
- # Copyright 2003, 2004 by Jim Weirich (jim@weirichhouse.org)
3
+ # Copyright 2005 by Aslak Hellesoy (aslak.hellesoy@gmail.org)
4
4
  # All rights reserved.
5
5
 
6
6
  # This file is may be distributed under an MIT style license. See
@@ -14,8 +14,16 @@ require 'rake/clean'
14
14
  require 'rake/testtask'
15
15
  require 'rake/rdoctask'
16
16
 
17
+ task :default => [:test, :gem]
18
+
19
+ Rake::TestTask.new do |t|
20
+ t.libs << "test"
21
+ t.test_files = FileList['**/*_test.rb']
22
+ t.verbose = true
23
+ end
24
+
17
25
  # Create a task to build the RDOC documentation tree.
18
- rd = Rake::RDocTask.new("rdoc") { |rdoc|
26
+ rd = Rake::RDocTask.new("rdoc") do |rdoc|
19
27
  rdoc.rdoc_dir = 'html'
20
28
  # rdoc.template = 'kilmer'
21
29
  # rdoc.template = 'css2'
@@ -25,14 +33,14 @@ rd = Rake::RDocTask.new("rdoc") { |rdoc|
25
33
  rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
26
34
  rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
27
35
  rdoc.rdoc_files.exclude('doc/**/*_attrs.rdoc')
28
- }
36
+ end
29
37
 
30
38
  # ====================================================================
31
39
  # Create a task that will package the Rake software into distributable
32
40
  # tar, zip and gem files.
33
41
 
34
42
  PKG_NAME = "xforge"
35
- PKG_VERSION = "0.1.2"
43
+ PKG_VERSION = "0.1.3"
36
44
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
37
45
  PKG_FILES = FileList[
38
46
  '[A-Z]*',
@@ -40,44 +48,41 @@ PKG_FILES = FileList[
40
48
  'doc/**/*'
41
49
  ]
42
50
 
43
- if ! defined?(Gem)
44
- puts "Package Target requires RubyGEMs"
45
- else
46
- spec = Gem::Specification.new do |s|
47
-
48
- #### Basic information.
49
-
50
- s.name = 'xforge'
51
- s.version = PKG_VERSION
52
- s.summary = "Ruby based make-like utility."
53
- s.description = <<-EOF
54
- XForge is a simple library to interact with RubyForge, SourceForge, GForge or other SourceForge clones.
55
- EOF
56
-
57
- s.files = PKG_FILES.to_a
58
- s.require_path = 'lib'
59
-
60
- #### Documentation and testing.
61
-
62
- s.has_rdoc = true
63
- s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
64
- s.rdoc_options <<
65
- '--title' << 'XForge' <<
66
- '--main' << 'README' <<
67
- '--line-numbers'
68
-
69
- #### Author and project details.
70
-
71
- s.author = "Aslak Hellesoy"
72
- s.email = "aslak.hellesoy@gmail.com"
73
- s.homepage = "http://xforge.rubyforge.org"
74
- s.rubyforge_project = "xforge"
75
- end
51
+ spec = Gem::Specification.new do |s|
52
+
53
+ #### Basic information.
76
54
 
77
- Rake::GemPackageTask.new(spec) do |pkg|
78
- pkg.need_zip = true
79
- pkg.need_tar = true
80
- end
55
+ s.name = PKG_NAME
56
+ s.version = PKG_VERSION
57
+ s.summary = "Ruby based make-like utility."
58
+ s.description = <<-EOF
59
+ XForge is a simple library to interact with RubyForge, SourceForge, GForge or other SourceForge clones.
60
+ EOF
61
+
62
+ s.files = PKG_FILES.to_a
63
+ s.require_path = 'lib'
64
+
65
+ #### Documentation and testing.
66
+
67
+ s.has_rdoc = true
68
+ s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
69
+ s.rdoc_options <<
70
+ '--title' << 'XForge' <<
71
+ '--main' << 'README' <<
72
+ '--line-numbers'
73
+
74
+ #### Author and project details.
75
+
76
+ s.author = "Aslak Hellesoy"
77
+ s.email = "aslak.hellesoy@gmail.com"
78
+ s.homepage = "http://xforge.rubyforge.org"
79
+ s.rubyforge_project = "xforge"
80
+ end
81
+
82
+ desc "Build Gem"
83
+ Rake::GemPackageTask.new(spec) do |pkg|
84
+ pkg.need_zip = true
85
+ pkg.need_tar = true
81
86
  end
82
87
 
83
88
  # Support Tasks ------------------------------------------------------
@@ -114,11 +119,12 @@ task :publish_files => [:gem] do
114
119
  "CHANGES"
115
120
  ]
116
121
 
117
- Rake::XForge::Release.new(PKG_NAME) do |xf|
122
+ Rake::XForge::Release.new(PKG_NAME) do |release|
118
123
  # Never hardcode user name and password in the Rakefile!
119
- xf.user_name = ENV['RUBYFORGE_USER']
120
- xf.password = ENV['RUBYFORGE_PASSWORD']
121
- xf.files = release_files.to_a
122
- xf.release_name = "XForge #{PKG_VERSION}"
123
- end
124
+ release.user_name = ENV['RUBYFORGE_USER']
125
+ release.password = ENV['RUBYFORGE_PASSWORD']
126
+ release.files = release_files.to_a
127
+ release.release_name = "XForge #{PKG_VERSION}"
128
+ # The rest of the options are defaults (among others, release_notes and release_changes, parsed from CHANGES)
129
+ end
124
130
  end
@@ -1,4 +1,4 @@
1
- require 'rake/contrib/xforge/release'
1
+ require 'xforge/version_parser'
2
2
 
3
3
  module Rake
4
4
  module XForge
@@ -36,7 +36,7 @@ module Rake
36
36
  # end
37
37
  # end
38
38
  #
39
- # This can be invoked with
39
+ # This can be invoked from the command line:
40
40
  #
41
41
  # rake release RUBYFORGE_USER=aslak_hellesoy RUBYFORGE_PASSWORD=nahnotreal
42
42
  #
@@ -57,13 +57,24 @@ module Rake
57
57
  def set_defaults
58
58
  @files = ["pkg/#{PKG_FILE_NAME}.gem"] if defined? PKG_FILE_NAME
59
59
  @release_name = "#{PKG_NAME}-#{PKG_VERSION}" if (defined? PKG_NAME && defined? PKG_VERSION)
60
+
61
+ begin
62
+ vp = ::XForge::VersionParser.new
63
+ version = vp.parse("CHANGES", PKG_VERSION)
64
+ @release_notes = version.release_notes
65
+ @release_changes = version.release_changes.join("\n")
66
+ rescue => e
67
+ STDERR.puts("Couldn't parse release info from CHANGES")
68
+ STDERR.puts(e.message)
69
+ STDERR.puts(e.backtrace.join("\n"))
70
+ end
60
71
  end
61
72
 
62
73
  def execute
63
74
  project = @host.project(@project_name)
64
75
  u = user_name
65
76
  session = project.login(u, password)
66
- session.release(@files, @release_name)
77
+ session.release(@release_name, @files, @release_notes, @release_changes)
67
78
  end
68
79
 
69
80
  end
@@ -101,10 +101,22 @@ module XForge
101
101
  # Optional parameters are +processor+ (which should be one of the Processor constants), +release_notes+,
102
102
  # +release_changes+ and +preformatted+ which will appear on the releas page of the associated project.
103
103
  #
104
- def release(filenames, release_name, processor=Processor::ANY, release_notes="", release_changes="", preformatted=true)
104
+ def release(release_name, filenames, release_notes="", release_changes="", preformatted=true, processor=Processor::ANY)
105
105
  release_date = Time.now.strftime("%Y-%m-%d %H:%M")
106
106
  release_id = nil
107
107
 
108
+ puts "About to release '#{release_name}'"
109
+ puts "=== Files ==="
110
+ puts " " + filenames.join("\n ")
111
+ puts "=== Release Notes ==="
112
+ puts release_notes
113
+ puts "=== Release Changes ==="
114
+ puts release_changes
115
+ puts "=== Release Settings ==="
116
+ puts "Preformatted: #{preformatted}"
117
+ puts "Processor: #{processor}"
118
+ puts "\nStarting release..."
119
+
108
120
  xfiles = filenames.collect{|filename| XFile.new(filename)}
109
121
  xfiles.each_with_index do |xfile, i|
110
122
  first_file = i==0
@@ -0,0 +1,43 @@
1
+ module XForge
2
+ class VersionParser
3
+ def parse(changes_file, version)
4
+ release_notes_first = nil
5
+ changes_first = nil
6
+ changes_last = nil
7
+
8
+ lines = File.open(changes_file).readlines
9
+ state = nil
10
+ lines.each_with_index do |line, n|
11
+ # parse state
12
+ if line =~ /#{version}/ && state.nil?
13
+ state = :in_release_notes
14
+ release_notes_first = n+1
15
+ end
16
+ if (line =~ /\*/ && (state == :in_release_notes))
17
+ state = :in_changes
18
+ changes_first = changes_last = n
19
+ end
20
+ if (line =~ /\*/ && (state == :in_changes))
21
+ changes_last = n
22
+ end
23
+ if line =~ /^==/ && state == :in_changes
24
+ state = :done
25
+ end
26
+ end
27
+
28
+ release_notes = lines[release_notes_first..changes_first-1].join("")
29
+ release_changes = lines[changes_first..changes_last].collect{|line| line[2..-1].chomp}
30
+ Version.new(release_notes, release_changes)
31
+ end
32
+ end
33
+
34
+ class Version
35
+ attr_reader :release_notes # String
36
+ attr_reader :release_changes # Array of String
37
+
38
+ def initialize(release_notes, release_changes)
39
+ puts release_notes
40
+ @release_notes, @release_changes = release_notes, release_changes
41
+ end
42
+ end
43
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: xforge
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.2
7
- date: 2005-07-18
6
+ version: 0.1.3
7
+ date: 2005-08-11
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib
@@ -37,6 +37,7 @@ files:
37
37
  - lib/rake/contrib/xforge.rb
38
38
  - lib/rake/contrib/xforge/base.rb
39
39
  - lib/rake/contrib/xforge/release.rb
40
+ - lib/xforge/version_parser.rb
40
41
  - doc/base_attrs.rdoc
41
42
  test_files: []
42
43
  rdoc_options: