Skip to content

Commit

Permalink
Remove Rubyforge references
Browse files Browse the repository at this point in the history
Everywhere they don't belong, including examples to avoid confusion

Also closes #484
  • Loading branch information
leejarvis committed Feb 11, 2019
1 parent 4699bd2 commit a6cbd57
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 101 deletions.
25 changes: 1 addition & 24 deletions EXAMPLES.rdoc
Expand Up @@ -24,29 +24,6 @@ example, <code>do ... end.submit</code> is the same as <code>{ ...
end
end

== Rubyforge

require 'rubygems'
require 'mechanize'

a = Mechanize.new
a.get('http://rubyforge.org/') do |page|
# Click the login link
login_page = a.click(page.link_with(:text => /Log In/))

# Submit the login form
my_page = login_page.form_with(:action => '/account/login.php') do |f|
f.form_loginname = ARGV[0]
f.form_pw = ARGV[1]
end.click_button

my_page.links.each do |link|
text = link.text.strip
next unless text.length > 0
puts text
end
end

== File Upload

Upload a file to flickr.
Expand Down Expand Up @@ -129,7 +106,7 @@ This example also demonstrates subclassing Mechanize.

class TestMech < Mechanize
def process
get 'http://rubyforge.org/'
get 'http://rubygems.org/'
search_form = page.forms.first
search_form.words = 'WWW'
submit search_form
Expand Down
2 changes: 1 addition & 1 deletion README.rdoc
Expand Up @@ -48,7 +48,7 @@ Copyright (c) 2005 by Michael Neumann (mneumann@ntecs.de)

Copyright (c) 2006-2011:

* {Aaron Patterson}[http://tenderlovemaking.com] (aaronp@rubyforge.org)
* {Aaron Patterson}[http://tenderlovemaking.com] (aaron.patterson@gmail.com)
* {Mike Dalessio}[http://mike.daless.io] (mike@csa.net)

Copyright (c) 2011-2015:
Expand Down
4 changes: 2 additions & 2 deletions examples/rubygems.rb
@@ -1,4 +1,4 @@
# This example logs a user in to rubyforge and prints out the body of the
# This example logs a user in to rubygems and prints out the body of the
# page after logging the user in.
require 'rubygems'
require 'mechanize'
Expand All @@ -9,7 +9,7 @@
mech.log = Logger.new $stderr
mech.agent.http.debug_output = $stderr

# Load the rubyforge website
# Load the rubygems website
page = mech.get('https://rubygems.org/')
page = mech.click page.link_with(:text => /Sign in/) # Click the login link
form = page.forms[1] # Select the first form
Expand Down
2 changes: 1 addition & 1 deletion mechanize.gemspec
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.email =
[
'drbrain@segment7.net',
'aaronp@rubyforge.org',
'aaron.patterson@gmail.com',
'mike.dalessio@gmail.com',
'knu@idaemons.org',
'ljjarvis@gmail.com'
Expand Down
2 changes: 1 addition & 1 deletion test/htdocs/tc_links.html
Expand Up @@ -7,7 +7,7 @@
<a href="thing.html" class="thing_link">Thing!</a>
<a href="thing.html">Ruby <b>Rocks!</b></a>
<!-- Testing a bug with escaped stuff in links:
http://rubyforge.org/pipermail/mechanize-users/2006-September/000002.html
http://rubygems.org/pipermail/mechanize-users/2006-September/000002.html
-->
<a href="link%20with%20space.html">encoded space</a>
<a href="link with space.html">not encoded space</a>
Expand Down
38 changes: 19 additions & 19 deletions test/test_mechanize_cookie.rb
Expand Up @@ -141,7 +141,7 @@ def test_parse_bad_max_age
def test_parse_date_fail
url = URI.parse('http://localhost/')

dates = [
dates = [
"20/06/95 21:07",
]

Expand Down Expand Up @@ -290,16 +290,16 @@ def test_parse_many
end

def test_parse_valid_cookie
url = URI.parse('http://rubyforge.org/')
url = URI.parse('http://rubygems.org/')
cookie_params = {}
cookie_params['expires'] = 'expires=Sun, 27-Sep-2037 00:00:00 GMT'
cookie_params['path'] = 'path=/'
cookie_params['domain'] = 'domain=.rubyforge.org'
cookie_params['domain'] = 'domain=.rubygems.org'
cookie_params['httponly'] = 'HttpOnly'
cookie_value = '12345%7D=ASDFWEE345%3DASda'

expires = Time.parse('Sun, 27-Sep-2037 00:00:00 GMT')

cookie_params.keys.combine.each do |c|
cookie_text = "#{cookie_value}; "
c.each_with_index do |key, idx|
Expand All @@ -325,16 +325,16 @@ def test_parse_valid_cookie
end

def test_parse_valid_cookie_empty_value
url = URI.parse('http://rubyforge.org/')
url = URI.parse('http://rubygems.org/')
cookie_params = {}
cookie_params['expires'] = 'expires=Sun, 27-Sep-2037 00:00:00 GMT'
cookie_params['path'] = 'path=/'
cookie_params['domain'] = 'domain=.rubyforge.org'
cookie_params['domain'] = 'domain=.rubygems.org'
cookie_params['httponly'] = 'HttpOnly'
cookie_value = '12345%7D='

expires = Time.parse('Sun, 27-Sep-2037 00:00:00 GMT')

cookie_params.keys.combine.each do |c|
cookie_text = "#{cookie_value}; "
c.each_with_index do |key, idx|
Expand All @@ -361,16 +361,16 @@ def test_parse_valid_cookie_empty_value

# If no path was given, use the one from the URL
def test_cookie_using_url_path
url = URI.parse('http://rubyforge.org/login.php')
url = URI.parse('http://rubygems.org/login.php')
cookie_params = {}
cookie_params['expires'] = 'expires=Sun, 27-Sep-2037 00:00:00 GMT'
cookie_params['path'] = 'path=/'
cookie_params['domain'] = 'domain=.rubyforge.org'
cookie_params['domain'] = 'domain=.rubygems.org'
cookie_params['httponly'] = 'HttpOnly'
cookie_value = '12345%7D=ASDFWEE345%3DASda'

expires = Time.parse('Sun, 27-Sep-2037 00:00:00 GMT')

cookie_params.keys.combine.each do |c|
next if c.find { |k| k == 'path' }
cookie_text = "#{cookie_value}; "
Expand Down Expand Up @@ -398,16 +398,16 @@ def test_cookie_using_url_path

# Test using secure cookies
def test_cookie_with_secure
url = URI.parse('http://rubyforge.org/')
url = URI.parse('http://rubygems.org/')
cookie_params = {}
cookie_params['expires'] = 'expires=Sun, 27-Sep-2037 00:00:00 GMT'
cookie_params['path'] = 'path=/'
cookie_params['domain'] = 'domain=.rubyforge.org'
cookie_params['domain'] = 'domain=.rubygems.org'
cookie_params['secure'] = 'secure'
cookie_value = '12345%7D=ASDFWEE345%3DASda'

expires = Time.parse('Sun, 27-Sep-2037 00:00:00 GMT')

cookie_params.keys.combine.each do |c|
next unless c.find { |k| k == 'secure' }
cookie_text = "#{cookie_value}; "
Expand Down Expand Up @@ -435,16 +435,16 @@ def test_cookie_with_secure
end

def test_parse_cookie_no_spaces
url = URI.parse('http://rubyforge.org/')
url = URI.parse('http://rubygems.org/')
cookie_params = {}
cookie_params['expires'] = 'expires=Sun, 27-Sep-2037 00:00:00 GMT'
cookie_params['path'] = 'path=/'
cookie_params['domain'] = 'domain=.rubyforge.org'
cookie_params['domain'] = 'domain=.rubygems.org'
cookie_params['httponly'] = 'HttpOnly'
cookie_value = '12345%7D=ASDFWEE345%3DASda'

expires = Time.parse('Sun, 27-Sep-2037 00:00:00 GMT')

cookie_params.keys.combine.each do |c|
cookie_text = "#{cookie_value};"
c.each_with_index do |key, idx|
Expand Down Expand Up @@ -511,13 +511,13 @@ def o.to_str
end

def test_cookie_httponly
url = URI.parse('http://rubyforge.org/')
url = URI.parse('http://rubygems.org/')
cookie_params = {}
cookie_params['httponly'] = 'HttpOnly'
cookie_value = '12345%7D=ASDFWEE345%3DASda'

expires = Time.parse('Sun, 27-Sep-2037 00:00:00 GMT')

cookie_params.keys.combine.each do |c|
cookie_text = "#{cookie_value}; "
c.each_with_index do |key, idx|
Expand All @@ -532,7 +532,7 @@ def test_cookie_httponly

assert_equal(true, cookie.httponly)


# if expires was set, make sure we parsed it
if c.find { |k| k == 'expires' }
assert_equal(expires, cookie.expires)
Expand Down

0 comments on commit a6cbd57

Please sign in to comment.