Skip to content

Commit 4b6d839

Browse files
committed
A few cleanups:
- Update gem dependencies to latest versions - Update to require ruby 2.0 in Gemfile - Clean up specs a bit to no longer require custom config - Change contributors.yaml to contributors.json
1 parent 1f94a76 commit 4b6d839

9 files changed

+41
-64
lines changed

Gemfile

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
source "http://rubygems.org"
2+
ruby "2.0.0"
23

3-
group :build do
4-
gem "yard"
5-
end
6-
7-
group :test do
8-
gem "json"
9-
gem "rspec", "~>1.3.2"
10-
end
4+
gemspec

Rakefile

+8-38
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
require 'rubygems'
2-
require 'bundler'
3-
Bundler.setup(:default,:build,:test)
4-
51
require 'rake'
2+
63
require 'rake/clean'
7-
require 'rake/gempackagetask'
4+
require 'rake/packagetask'
85
require 'yard'
96
require 'yard/rake/yardoc_task'
7+
108
require 'fileutils'
119
include FileUtils
1210

@@ -21,41 +19,13 @@ YARD::Rake::YardocTask.new do |t|
2119
end
2220

2321
begin
24-
require 'spec/rake/spectask'
22+
require 'rspec/core/rake_task'
2523

26-
Spec::Rake::SpecTask.new do |t|
27-
t.libs << 'lib'
28-
t.spec_files = FileList['test/**/*_test.rb']
24+
RSpec::Core::RakeTask.new do |t|
25+
# t.libs << 'lib'
26+
# t.pattern = 'test/**/*_test.rb'
2927
end
28+
task :test => :spec
3029
rescue LoadError
3130
puts "Warning: unable to load rspec tasks"
3231
end
33-
task :test => :spec
34-
35-
spec = Gem::Specification.new do |s|
36-
s.name = 'cookiejar'
37-
s.version = '0.3.0'
38-
s.summary = "Client-side HTTP Cookie library"
39-
s.description =
40-
%{Allows for parsing and returning cookies in Ruby HTTP client code}
41-
s.files = Dir['lib/**/*.rb'] + Dir['test/**/*.rb']
42-
s.require_path = 'lib'
43-
s.has_rdoc = true
44-
# s.extra_rdoc_files = Dir['[A-Z]*']
45-
s.rdoc_options << '--title' << 'CookieJar -- Client-side HTTP Cookies'
46-
s.author = "David Waite"
47-
s.email = "[email protected]"
48-
s.homepage = "http://alkaline-solutions.com"
49-
end
50-
51-
Rake::GemPackageTask.new(spec) do |pkg|
52-
pkg.need_zip = true
53-
pkg.need_tar = true
54-
end
55-
56-
desc "create a .gemspec file"
57-
task :gemspec do
58-
File.open("#{spec.name}.gemspec", 'w') do |f|
59-
f.write spec.to_ruby
60-
end
61-
end

contributors.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"author": {
4+
"github": "http://github.com/secobarbital",
5+
"name": "Seggy Umboh"
6+
},
7+
"contributions": [
8+
"widen supported IP addresses",
9+
"fix case-sensitivity issue with HTTP headers",
10+
"correct issue when running under Ruby 1.8.x",
11+
"made Jar act more like a browser (dropping cookies w/o exception)"
12+
]
13+
}
14+
]

contributors.yaml

-9
This file was deleted.

cookiejar.gemspec

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# -*- encoding: utf-8 -*-
22

33
Gem::Specification.new do |s|
4-
s.name = %q{cookiejar}
4+
s.name = "cookiejar"
55
s.version = "0.3.0"
66

77
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
88
s.authors = ["David Waite"]
9-
s.date = %q{2010-06-12}
10-
s.description = %q{Allows for parsing and returning cookies in Ruby HTTP client code}
11-
s.email = %q{[email protected]}
9+
s.date = "2010-06-12"
10+
s.description = "Allows for parsing and returning cookies in Ruby HTTP client code"
11+
s.email = "[email protected]"
1212
s.files = [
1313
"LICENSE",
1414
"README.markdown",
@@ -22,11 +22,11 @@ Gem::Specification.new do |s|
2222
"test/cookie_validation_test.rb",
2323
"test/jar_test.rb"
2424
]
25-
s.homepage = %q{http://alkaline-solutions.com}
25+
s.homepage = "https://alkaline-solutions.com"
2626
s.rdoc_options = ["--title", "CookieJar -- Client-side HTTP Cookies"]
2727
s.require_paths = ["lib"]
28-
s.rubygems_version = %q{1.3.7}
29-
s.summary = %q{Client-side HTTP Cookie library}
28+
s.rubygems_version = "2.1.10"
29+
s.summary = "Client-side HTTP Cookie library"
3030

3131
if s.respond_to? :specification_version then
3232
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -37,4 +37,9 @@ Gem::Specification.new do |s|
3737
end
3838
else
3939
end
40+
s.add_dependency "json", "~> 1.8.1"
41+
42+
s.add_development_dependency "rake", "~> 10.1.0"
43+
s.add_development_dependency "rspec", "~> 2.14.1"
44+
s.add_development_dependency "yard", "~> 0.8.7.2"
4045
end

lib/cookiejar/jar.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,13 @@ def to_json *a
161161
# @param o [Hash] the expanded JSON object
162162
# @return [CookieJar] a new CookieJar instance
163163
def self.json_create o
164+
if o.is_a? String
165+
o = JSON.parse(o)
166+
end
164167
if o.is_a? Hash
165168
o = o['cookies']
166169
end
167-
cookies = JSON.parse(o).inject [] do |result, cookie_json|
170+
cookies = o.inject([]) do |result, cookie_json|
168171
result << (Cookie.json_create cookie_json)
169172
end
170173
self.from_a cookies
File renamed without changes.
File renamed without changes.

test/jar_test.rb renamed to spec/jar_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
it "should deserialize a JSON array to a jar" do
210210
json = "[{\"name\":\"foo\",\"value\":\"bar\",\"domain\":\"localhost.local\",\"path\":\"\\/\",\"created_at\":\"2009-09-11 12:51:03 -0600\",\"expiry\":\"2028-11-01 12:00:00 GMT\",\"secure\":true}]"
211211
array = JSON.parse json
212-
212+
213213
jar = Jar.json_create array
214214
jar.get_cookies('https://localhost/').should have(1).items
215215
end

0 commit comments

Comments
 (0)