rubyforge 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +7 -0
  2. data/lib/rubyforge.rb +20 -3
  3. metadata +2 -2
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ Version History:
2
+
3
+ * 0.4.1 / 2007-03-08:
4
+ * Verify that login succeeded and warn against if not (prolly should raise).
5
+ * Print a friendly error if you have the wrong package id.
6
+ * Handle upload error in add_release a bit better.
7
+
1
8
  * 0.4.0 / 2007-01-09:
2
9
  * config.yml split and moved to user-config.yml (up to the user to do).
3
10
  * auto-config.yml now generated via config command.
data/lib/rubyforge.rb CHANGED
@@ -26,7 +26,7 @@ end
26
26
  class RubyForge
27
27
 
28
28
  # :stopdoc:
29
- VERSION = "0.4.0"
29
+ VERSION = "0.4.1"
30
30
  HOME = ENV["HOME"] || ENV["HOMEPATH"] || File::expand_path("~")
31
31
  RUBYFORGE_D = File::join HOME, ".rubyforge"
32
32
  CONFIG_F = File::join RUBYFORGE_D, "user-config.yml"
@@ -141,7 +141,15 @@ class RubyForge
141
141
  "login" => "Login"
142
142
  }
143
143
 
144
- run page, form
144
+ response = run page, form
145
+
146
+ re = %r/personal\s+page\s+for:\s+#{ Regexp.escape username }/iom
147
+ unless response =~ re
148
+ warn("%s:%d: warning: potentially failed login using %s:%s" %
149
+ [__FILE__,__LINE__,username,password]) unless $TESTING
150
+ end
151
+
152
+ response
145
153
  end
146
154
 
147
155
  def create_package(group_id, package_name)
@@ -251,8 +259,17 @@ class RubyForge
251
259
  boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__')
252
260
  boundary = "multipart/form-data; boundary=___#{ boundary }___"
253
261
 
262
+
254
263
  html = run(page, form, 'content-type' => boundary)
255
- release_id = html[/release_id=\d+/][/\d+/].to_i
264
+ raise "Invalid package_id #{package_id}" if html[/Invalid package_id/]
265
+
266
+ release_id = html[/release_id=\d+/][/\d+/].to_i rescue nil
267
+
268
+ unless release_id then
269
+ puts html if $DEBUG
270
+ raise "Couldn't get release_id, upload failed\?"
271
+ end
272
+
256
273
  puts "RELEASE ID = #{release_id}" if $DEBUG
257
274
 
258
275
  files.each do |file|
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0.9
3
3
  specification_version: 1
4
4
  name: rubyforge
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.0
7
- date: 2007-01-10 00:00:00 -05:00
6
+ version: 0.4.1
7
+ date: 2007-03-08 00:00:00 -08:00
8
8
  summary: A simplistic script which automates a limited set of rubyforge operations
9
9
  require_paths:
10
10
  - lib