rubyforge 1.0.5 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,77 +46,12 @@ class TestRubyForgeClient < Test::Unit::TestCase
46
46
  end
47
47
 
48
48
  def test_post_with_params
49
- @client.post_content('http://example.com', { :f => 'adsf aoeu'})
49
+ @client.post_content('http://example.com', { :f => 'adsf aoeu'}, {}, {"username" => "tom", "password" => "secret"})
50
50
  assert_equal('f=adsf+aoeu', RubyForge::FakeAgent.t_data)
51
51
 
52
- @client.post_content('http://example.com', { :a => 'b', :c => 'd' })
52
+ @client.post_content('http://example.com', { :a => 'b', :c => 'd' }, {}, {"username" => "tom", "password" => "secret"})
53
53
  assert_equal('a=b&c=d', RubyForge::FakeAgent.t_data)
54
54
  end
55
55
 
56
- def test_multipart_post_one_param
57
- random = Array::new(8){ "%2.2d" % rand(42) }.join('__')
58
- boundary = "multipart/form-data; boundary=___#{ random }___"
59
56
 
60
- expected = <<-END
61
- --___#{random}___\r
62
- Content-Disposition: form-data; name="a"\r\n\r
63
- a b c\r
64
- --___#{random}___--\r
65
- END
66
-
67
- @client.post_content( 'http://example.com',
68
- { :a => 'a b c' },
69
- { 'content-type' => boundary }
70
- )
71
- assert_equal(expected, RubyForge::FakeAgent.t_data)
72
- end
73
-
74
- def test_multipart_post_two_params
75
- random = Array::new(8){ "%2.2d" % rand(42) }.join('__')
76
- boundary = "multipart/form-data; boundary=___#{ random }___"
77
-
78
- request = <<-END
79
- --___#{random}___\r
80
- Content-Disposition: form-data; name="a"\r\n\r
81
- b\r
82
- --___#{random}___\r
83
- Content-Disposition: form-data; name="c"\r\n\r
84
- d\r
85
- --___#{random}___--\r
86
- END
87
-
88
- @client.post_content( 'http://example.com',
89
- { :a => 'b', :c => 'd' },
90
- { 'content-type' => boundary }
91
- )
92
- assert_equal(request, RubyForge::FakeAgent.t_data)
93
- end
94
-
95
- def test_multipart_io
96
- random = Array::new(8){ "%2.2d" % rand(42) }.join('__')
97
- boundary = "multipart/form-data; boundary=___#{ random }___"
98
-
99
- file_contents = 'blah blah blah'
100
- file = StringIO.new(file_contents)
101
- class << file
102
- def path
103
- '/one/two/three.rb'
104
- end
105
- end
106
-
107
- request = <<-END
108
- --___#{random}___\r
109
- Content-Disposition: form-data; name="userfile"; filename="three.rb"\r
110
- Content-Transfer-Encoding: binary\r
111
- Content-Type: text/plain\r\n\r
112
- #{file_contents}\r
113
- --___#{random}___--\r
114
- END
115
-
116
- @client.post_content( 'http://example.com',
117
- { :userfile => file },
118
- { 'content-type' => boundary }
119
- )
120
- assert_equal(request, RubyForge::FakeAgent.t_data)
121
- end
122
57
  end
metadata CHANGED
@@ -1,38 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyforge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
8
  - Eric Hodel
9
9
  - Ara T Howard
10
+ - Tom Copeland
10
11
  autorequire:
11
12
  bindir: bin
12
- cert_chain:
13
- - |
14
- -----BEGIN CERTIFICATE-----
15
- MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
16
- ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
17
- GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
18
- AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
19
- JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
20
- b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
21
- taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
22
- oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
23
- GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
24
- qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
25
- gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
26
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
27
- AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
28
- vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
29
- w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
30
- l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
31
- n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
32
- FBHgymkyj/AOSqKRIpXPhjC6
33
- -----END CERTIFICATE-----
13
+ cert_chain: []
34
14
 
35
- date: 2009-09-14 00:00:00 -07:00
15
+ date: 2009-09-21 00:00:00 -04:00
36
16
  default_executable:
37
17
  dependencies: []
38
18
 
@@ -45,14 +25,11 @@ description: |-
45
25
  * edit ~/.rubyforge/user-config.yml
46
26
  * rubyforge config
47
27
  * For all rubyforge upgrades, run 'rubyforge config' to ensure you have latest.
48
- * Don't forget to login! logging in will store a cookie in your
49
- .rubyforge directory which expires after a time. always run the
50
- login command before any operation that requires authentication,
51
- such as uploading a package.
52
28
  email:
53
29
  - ryand-ruby@zenspider.com
54
30
  - drbrain@segment7.net
55
31
  - ara.t.howard@gmail.com
32
+ - tom@infoether.com
56
33
  executables:
57
34
  - rubyforge
58
35
  extensions: []
@@ -69,10 +46,8 @@ files:
69
46
  - bin/rubyforge
70
47
  - lib/rubyforge.rb
71
48
  - lib/rubyforge/client.rb
72
- - lib/rubyforge/cookie_manager.rb
73
49
  - test/test_rubyforge.rb
74
50
  - test/test_rubyforge_client.rb
75
- - test/test_rubyforge_cookie_manager.rb
76
51
  has_rdoc: true
77
52
  homepage: http://codeforpeople.rubyforge.org/rubyforge/
78
53
  licenses: []
@@ -98,11 +73,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
73
  requirements: []
99
74
 
100
75
  rubyforge_project: codeforpeople
101
- rubygems_version: 1.3.5
76
+ rubygems_version: 1.3.4
102
77
  signing_key:
103
78
  specification_version: 3
104
79
  summary: A script which automates a limited set of rubyforge operations
105
80
  test_files:
106
81
  - test/test_rubyforge.rb
107
82
  - test/test_rubyforge_client.rb
108
- - test/test_rubyforge_cookie_manager.rb
data.tar.gz.sig DELETED
Binary file
@@ -1,60 +0,0 @@
1
- require 'yaml'
2
-
3
- class RubyForge
4
- class CookieManager
5
- class << self
6
- def load(path)
7
- cm = YAML.load_file(path) rescue CookieManager.new(path)
8
- cm = CookieManager.new(path) unless cm.is_a?(CookieManager)
9
- cm.clean_stale_cookies
10
- end
11
- end
12
-
13
- attr_accessor :cookies_file
14
- def initialize(cookies_file = nil)
15
- @jar = Hash.new { |hash,domain_name|
16
- hash[domain_name.downcase] = {}
17
- }
18
- @cookies_file = cookies_file
19
- end
20
-
21
- def [](uri)
22
- # FIXME we need to do more matching on hostname.... This is not
23
- # bulletproof
24
- uri = (URI === uri ? uri.host : uri).downcase
25
- @jar[uri] ||= {}
26
- end
27
-
28
- def clear uri
29
- self[uri].clear
30
- self.save!
31
- end
32
-
33
- def empty?
34
- @jar.empty? || @jar.all? { |k,v| v.empty? }
35
- end
36
-
37
- def save!
38
- clean_stale_cookies
39
- File.open(@cookies_file, 'wb') { |f|
40
- f.write(YAML.dump(self))
41
- }
42
- end
43
-
44
- def add(uri, cookie)
45
- no_dot_domain = cookie.domain.gsub(/^\./, '')
46
- return unless uri.host =~ /#{no_dot_domain}$/i
47
- @jar[no_dot_domain][cookie.name] = cookie
48
- clean_stale_cookies
49
- end
50
-
51
- def clean_stale_cookies
52
- @jar.each do |domain, cookies|
53
- cookies.each do |name, cookie|
54
- cookies.delete(name) if cookie.expires < Time.now
55
- end
56
- end
57
- self
58
- end
59
- end
60
- end
@@ -1,97 +0,0 @@
1
- require 'test/unit' unless defined? $ZENTEST and $ZENTEST
2
- require 'rubyforge'
3
- require 'time'
4
- require 'yaml'
5
- require 'tempfile'
6
-
7
- class TestRubyForgeCookieManager < Test::Unit::TestCase
8
- def setup
9
- cookie = cookie_string('session_ser', 'zzzzzzzzzzzzzzzzzz')
10
- @url = URI.parse('http://rubyforge.org/account/login.php')
11
- @cookie = WEBrick::Cookie.parse_set_cookie(cookie)
12
- @manager = RubyForge::CookieManager.new
13
- end
14
-
15
- def test_empty?
16
- manager = RubyForge::CookieManager.new
17
- assert(manager.empty?)
18
-
19
- assert_equal(0, manager[URI.parse('http://rubyforge.org/')].length)
20
- assert(manager.empty?)
21
- end
22
-
23
- def test_add
24
- manager = RubyForge::CookieManager.new
25
- assert(manager.empty?)
26
- manager.add(@url, @cookie)
27
- assert(!manager.empty?)
28
-
29
- cookie = manager[@url][@cookie.name]
30
- assert cookie
31
- assert_equal(@cookie.object_id, cookie.object_id)
32
- end
33
-
34
- def test_add_expired_cookie
35
- cookie = cookie_string('session_ser', 'zzzz',
36
- :expires => (Time.now - 10).strftime('%A, %d-%b-%Y %H:%M:%S %Z'))
37
- cookie = WEBrick::Cookie.parse_set_cookie(cookie)
38
-
39
- manager = RubyForge::CookieManager.new
40
- assert(manager.empty?)
41
- manager.add(@url, cookie)
42
- assert(manager.empty?)
43
- end
44
-
45
- def test_marshal
46
- @manager.add(@url, @cookie)
47
- assert(!@manager.empty?)
48
- m = YAML.load(YAML.dump(@manager))
49
- assert(!m.empty?)
50
- end
51
-
52
- def test_save!
53
- tmp = Tempfile.new('cookie_jar')
54
- @manager.cookies_file = tmp.path
55
- @manager.add(@url, @cookie)
56
- @manager.save!
57
-
58
- @manager = RubyForge::CookieManager.load(tmp.path)
59
- assert(! @manager.empty?)
60
- end
61
-
62
- def test_load_empty_file
63
- tmp = Tempfile.new('cookie_jar')
64
- manager = RubyForge::CookieManager.load(tmp.path)
65
- assert(manager.empty?)
66
- end
67
-
68
- def test_load_legacy_file
69
- tmp = Tempfile.new('cookie_jar')
70
- tmp.write([
71
- 'https://rubyforge.org/account/login.php',
72
- 'session_ser',
73
- 'zzzzzz',
74
- '123456',
75
- '.rubyforge.org',
76
- '/',
77
- '13'
78
- ].join("\t"))
79
- manager = RubyForge::CookieManager.load(tmp.path)
80
- assert(manager.empty?)
81
- end
82
-
83
- def test_cookies_file=
84
- tmp = Tempfile.new('cookie_jar')
85
- @manager.cookies_file = tmp.path
86
- assert(@manager.empty?)
87
- end
88
-
89
- def cookie_string(name, value, options = {})
90
- options = {
91
- :expires => (Time.now + 86400).strftime('%A, %d-%b-%Y %H:%M:%S %Z'),
92
- :path => '/',
93
- :domain => '.rubyforge.org',
94
- }.merge(options)
95
- "#{name}=#{value}; #{options.map { |o| o.join('=') }.join('; ')}"
96
- end
97
- end
metadata.gz.sig DELETED
Binary file