rubyforge 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rubyforge.rb CHANGED
@@ -25,7 +25,7 @@ end
25
25
  class RubyForge
26
26
 
27
27
  # :stopdoc:
28
- VERSION = "0.2.1"
28
+ VERSION = "0.2.2"
29
29
  HOME = ENV["HOME"] || ENV["HOMEPATH"] || File::expand_path("~")
30
30
  RUBYFORGE_D = File::join HOME, ".rubyforge"
31
31
  CONFIG_F = File::join RUBYFORGE_D, "config.yml"
@@ -189,7 +189,8 @@ class RubyForge
189
189
  boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__')
190
190
  boundary = "multipart/form-data; boundary=___#{ boundary }___"
191
191
 
192
- run page, form, 'content-type' => boundary
192
+ html = run(page, form, 'content-type' => boundary)
193
+ html[/release_id=\d+/][/\d+/].to_i
193
194
  end
194
195
 
195
196
  def add_file(group_name, package_name, release_name, userfile)
@@ -235,7 +236,12 @@ class RubyForge
235
236
  page =~ %r/http/ ? page : "#{ @config['uri'] }/#{ page }"
236
237
  end
237
238
 
238
- response = client.post_content "#{ File.join(@config['uri'], page) }", form, extheader
239
+ uri = File.join(@config['uri'], page)
240
+ if $DEBUG then
241
+ puts "client.post_content #{uri.inspect}, #{form.inspect}, #{extheader.inspect}"
242
+ end
243
+
244
+ response = client.post_content uri, form, extheader
239
245
 
240
246
  @client = client if $TESTING
241
247
 
@@ -4,9 +4,12 @@ $TESTING = true
4
4
  require 'rubyforge'
5
5
 
6
6
  class FakeRubyForge < RubyForge
7
+ HTML = "blah blah <form action=\"/frs/admin/editrelease.php?group_id=440&release_id=6948&package_id=491\" method=\"post\"> blah blah"
8
+
7
9
  attr_accessor :page, :form, :extheader
8
10
  def run(page, form, extheader={})
9
11
  @page, @form, @extheader = page, form, extheader
12
+ HTML
10
13
  end
11
14
  end
12
15
 
@@ -15,6 +18,7 @@ class HTTPAccess2::Client
15
18
  alias :old_post_content :post_content
16
19
  def post_content(url, form, headers)
17
20
  @url, @form, @headers = url, form, headers
21
+ FakeRubyForge::HTML
18
22
  end
19
23
  end
20
24
 
@@ -162,8 +166,9 @@ class TestRubyForge < Test::Unit::TestCase
162
166
 
163
167
  def test_run
164
168
  util_new RubyForge
165
- @rubyforge.add_release(42, 666, '1.2.3', __FILE__)
169
+ result = @rubyforge.add_release(42, 666, '1.2.3', __FILE__)
166
170
 
171
+ assert_equal 6948, result
167
172
  extheader = {"content-type"=> "multipart/form-data; boundary=___00__03__03__39__09__19__21__36___"}
168
173
 
169
174
  form = {
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rubyforge
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.1
7
- date: 2006-09-14 00:00:00 -07:00
6
+ version: 0.2.2
7
+ date: 2006-09-19 00:00:00 -07:00
8
8
  summary: A simplistic script which automates a limited set of rubyforge operations
9
9
  require_paths:
10
10
  - lib