xforge 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,8 +1,14 @@
1
1
  = XForge Changelog
2
2
 
3
+ == Version 0.1.9
4
+
5
+ This release adds more functionality for news publishing
6
+
7
+ * Added Session.publish_news
8
+
3
9
  == Version 0.1.8
4
10
 
5
- XForge projects now know the home page
11
+ This release adds more functionality for RubyForge projects' home page
6
12
 
7
13
  * Added Project.home_page_uri and Project.project_uri
8
14
 
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ require 'rake/rdoctask'
24
24
  #
25
25
  # REMEMBER TO KEEP PKG_VERSION IN SYNC WITH CHANGELOG
26
26
  PKG_NAME = "xforge"
27
- PKG_VERSION = "0.1.8"
27
+ PKG_VERSION = "0.1.9"
28
28
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
29
29
  PKG_FILES = FileList[
30
30
  '[A-Z]*',
@@ -117,7 +117,7 @@ task :todo do
117
117
  egrep /#.*(FIXME|TODO|TBD)/
118
118
  end
119
119
 
120
- task :release => [:release_files, :publish_doc]
120
+ task :release => [:release_files, :publish_doc, :publish_news]
121
121
 
122
122
  task :publish_doc => [:rdoc] do
123
123
  publisher = Rake::RubyForgePublisher.new(PKG_NAME, ENV['RUBYFORGE_USER'])
@@ -139,3 +139,16 @@ task :release_files => [:gem] do
139
139
  # The rest of the options are defaults (among others, release_notes and release_changes, parsed from CHANGES)
140
140
  end
141
141
  end
142
+
143
+ desc "Publish news on RubyForge"
144
+ task :publish_news => [:gem] do
145
+ release_files = FileList[
146
+ "pkg/#{PKG_FILE_NAME}.gem"
147
+ ]
148
+
149
+ Rake::XForge::NewsPublisher.new(PKG_NAME) do |news|
150
+ # Never hardcode user name and password in the Rakefile!
151
+ news.user_name = ENV['RUBYFORGE_USER']
152
+ news.password = ENV['RUBYFORGE_PASSWORD']
153
+ end
154
+ end
@@ -0,0 +1,38 @@
1
+ require 'xforge/version_parser'
2
+
3
+ module Rake
4
+ module XForge
5
+
6
+ # This Rake task publishes news entries for a project.
7
+ # Publishing news is a good way to make your project visible
8
+ # on the main RubyForge page.
9
+ class NewsPublisher < Base
10
+
11
+ attr_accessor :subject, :details
12
+
13
+ protected
14
+
15
+ def set_defaults
16
+ @subject = "#{PKG_NAME}-#{PKG_VERSION} released"
17
+
18
+ begin
19
+ vp = ::XForge::VersionParser.new
20
+ version = vp.parse("CHANGES", PKG_VERSION)
21
+ @details = version.release_notes
22
+ rescue => e
23
+ STDERR.puts("Couldn't parse release info from CHANGES")
24
+ STDERR.puts(e.message)
25
+ STDERR.puts(e.backtrace.join("\n"))
26
+ end
27
+ end
28
+
29
+ def execute
30
+ project = @host.project(@project_name)
31
+ u = user_name
32
+ session = project.login(u, password)
33
+ session.publish_news(@subject, @details)
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -1,2 +1,3 @@
1
1
  require 'rake/contrib/xforge/base'
2
2
  require 'rake/contrib/xforge/release'
3
+ require 'rake/contrib/xforge/news_publisher'
@@ -94,9 +94,7 @@ module XForge
94
94
  }
95
95
  end
96
96
 
97
- query = "?" + query_hash.map do |(name, value)|
98
- [name, URI.encode(value.to_s)].join("=")
99
- end.join("&")
97
+ query = query(query_hash)
100
98
 
101
99
  data = [
102
100
  "--" + BOUNDARY,
@@ -106,12 +104,12 @@ module XForge
106
104
  "", xfile.data, ""
107
105
  ].join("\x0D\x0A")
108
106
 
109
- release_headers = @headers.merge(
107
+ headers = @headers.merge(
110
108
  "Content-Type" => "multipart/form-data; boundary=#{BOUNDARY}"
111
109
  )
112
110
 
113
111
  target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
114
- http.post(target + query, data, release_headers)
112
+ http.post(target + query, data, headers)
115
113
  end
116
114
 
117
115
  if first_file then
@@ -120,5 +118,32 @@ module XForge
120
118
  end
121
119
  end
122
120
  end
121
+
122
+ def publish_news(subject, details)
123
+ release_response = Net::HTTP.start(@host.name, 80) do |http|
124
+ query_hash = {
125
+ "group_id" => @project.group_id,
126
+ "package_id" => package_id,
127
+ "post_changes" => "y",
128
+ "summary" => subject,
129
+ "details" => details
130
+ }
131
+
132
+ target = "/news/submit.php"
133
+ headers = @headers.merge(
134
+ "Content-Type" => "multipart/form-data"
135
+ )
136
+ http.post(target + query(query_hash), "", headers)
137
+ end
138
+ end
139
+
140
+ private
141
+
142
+ def query(query_hash)
143
+ "?" + query_hash.map do |(name, value)|
144
+ [name, URI.encode(value.to_s)].join("=")
145
+ end.join("&")
146
+ end
147
+
123
148
  end
124
149
  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.8
7
- date: 2005-08-13
6
+ version: 0.1.9
7
+ date: 2005-08-14
8
8
  summary: Ruby based make-like utility.
9
9
  require_paths:
10
10
  - lib
@@ -36,6 +36,7 @@ files:
36
36
  - lib/xforge.rb
37
37
  - lib/rake/contrib/xforge.rb
38
38
  - lib/rake/contrib/xforge/base.rb
39
+ - lib/rake/contrib/xforge/news_publisher.rb
39
40
  - lib/rake/contrib/xforge/release.rb
40
41
  - lib/scm_web/view_cvs.rb
41
42
  - lib/xforge/host.rb