Skip to content

Commit ca3d66f

Browse files
committed
Merge pull request #13 from tenderlove/bundler
Use Bundler task and fix broken tests
2 parents 62f2a82 + a55c22e commit ca3d66f

7 files changed

Lines changed: 44 additions & 120 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
lib/syck.bundle
22
pkg
33
tmp
4+
/Gemfile.lock

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gemspec

Manifest.txt

Lines changed: 0 additions & 51 deletions
This file was deleted.

Rakefile

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
1-
# -*- ruby -*-
1+
require 'bundler/gem_tasks'
2+
require 'rake/extensiontask'
3+
require 'rake/testtask'
24

3-
require 'rubygems'
4-
require 'hoe'
5+
CLEAN = Rake::FileList["lib/syck.bundle", "tmp"]
56

6-
Hoe.plugins.delete :rubyforge
7-
Hoe.plugin :gemspec # `gem install hoe-gemspec`
8-
Hoe.plugin :git # `gem install hoe-git`
9-
10-
gem 'rake-compiler', '>= 0.4.1'
11-
require "rake/extensiontask"
12-
13-
Hoe.spec 'syck' do
14-
developer('Aaron Patterson', 'aaron@tenderlovemaking.com')
15-
self.readme_file = 'README.rdoc'
16-
self.history_file = 'CHANGELOG.rdoc'
17-
self.extra_rdoc_files = FileList['*.rdoc']
18-
19-
extra_dev_deps << ['rake-compiler', '>= 0.4.1']
20-
21-
self.spec_extras = {
22-
:extensions => ["ext/syck/extconf.rb"],
23-
:required_ruby_version => '>= 2.0.0'
24-
}
25-
26-
Rake::ExtensionTask.new "syck", spec do |ext|
27-
ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
28-
end
7+
Rake::TestTask.new(:test) do |t|
8+
t.libs << "test"
9+
t.libs << "lib"
10+
t.test_files = FileList['test/**/test_*.rb']
2911
end
12+
Rake::ExtensionTask.new('syck')
3013

31-
# vim: syntax=ruby
14+
task :default => [:compile, :test]

lib/syck/rubytypes.rb

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def yaml_initialize( tag, val )
3737
end
3838
end
3939
def to_yaml( opts = {} )
40-
return super unless YAML::ENGINE.syck?
40+
return super unless YAML == Syck
4141
Syck::quick_emit( self, opts ) do |out|
4242
out.map( taguri, to_yaml_style ) do |map|
4343
each do |k, v|
@@ -86,7 +86,7 @@ def self.yaml_new( klass, tag, val )
8686
end
8787
end
8888
def to_yaml( opts = {} )
89-
return super unless YAML::ENGINE.syck?
89+
return super unless YAML == Syck
9090
Syck::quick_emit( self, opts ) do |out|
9191
#
9292
# Basic struct is passed as a YAML map
@@ -108,7 +108,7 @@ class Array
108108
yaml_as "tag:yaml.org,2002:seq"
109109
def yaml_initialize( tag, val ); concat( val.to_a ); end
110110
def to_yaml( opts = {} )
111-
return super unless YAML::ENGINE.syck?
111+
return super unless YAML == Syck
112112
Syck::quick_emit( self, opts ) do |out|
113113
out.seq( taguri, to_yaml_style ) do |seq|
114114
each do |x|
@@ -130,7 +130,7 @@ def Exception.yaml_new( klass, tag, val )
130130
o
131131
end
132132
def to_yaml( opts = {} )
133-
return super unless YAML::ENGINE.syck?
133+
return super unless YAML == Syck
134134
Syck::quick_emit( self, opts ) do |out|
135135
out.map( taguri, to_yaml_style ) do |map|
136136
map.add( 'message', message )
@@ -168,7 +168,7 @@ def String.yaml_new( klass, tag, val )
168168
end
169169
end
170170
def to_yaml( opts = {} )
171-
return super unless YAML::ENGINE.syck?
171+
return super unless YAML == Syck
172172
Syck::quick_emit( is_complex_yaml? ? self : nil, opts ) do |out|
173173
if is_binary_data?
174174
out.scalar( "tag:yaml.org,2002:binary", [self].pack("m"), :literal )
@@ -198,7 +198,7 @@ def Symbol.yaml_new( klass, tag, val )
198198
end
199199
end
200200
def to_yaml( opts = {} )
201-
return super unless YAML::ENGINE.syck?
201+
return super unless YAML == Syck
202202
Syck::quick_emit( nil, opts ) do |out|
203203
out.scalar( "tag:yaml.org,2002:str", self.inspect, :plain )
204204
end
@@ -236,7 +236,7 @@ def Range.yaml_new( klass, tag, val )
236236
end
237237
end
238238
def to_yaml( opts = {} )
239-
return super unless YAML::ENGINE.syck?
239+
return super unless YAML == Syck
240240
Syck::quick_emit( self, opts ) do |out|
241241
# if self.begin.is_complex_yaml? or self.begin.respond_to? :to_str or
242242
# self.end.is_complex_yaml? or self.end.respond_to? :to_str or
@@ -287,7 +287,7 @@ def Regexp.yaml_new( klass, tag, val )
287287
end
288288
end
289289
def to_yaml( opts = {} )
290-
return super unless YAML::ENGINE.syck?
290+
return super unless YAML == Syck
291291
Syck::quick_emit( nil, opts ) do |out|
292292
if to_yaml_properties.empty?
293293
out.scalar( taguri, self.inspect, :plain )
@@ -322,7 +322,7 @@ def Time.yaml_new( klass, tag, val )
322322
end
323323
end
324324
def to_yaml( opts = {} )
325-
return super unless YAML::ENGINE.syck?
325+
return super unless YAML == Syck
326326
Syck::quick_emit( self, opts ) do |out|
327327
tz = "Z"
328328
# from the tidy Tobias Peters <t-peters@gmx.de> Thanks!
@@ -360,7 +360,7 @@ def to_yaml( opts = {} )
360360
class Date
361361
yaml_as "tag:yaml.org,2002:timestamp#ymd"
362362
def to_yaml( opts = {} )
363-
return super unless YAML::ENGINE.syck?
363+
return super unless YAML == Syck
364364
Syck::quick_emit( self, opts ) do |out|
365365
out.scalar( "tag:yaml.org,2002:timestamp", self.to_s, :plain )
366366
end
@@ -370,7 +370,7 @@ def to_yaml( opts = {} )
370370
class Integer
371371
yaml_as "tag:yaml.org,2002:int"
372372
def to_yaml( opts = {} )
373-
return super unless YAML::ENGINE.syck?
373+
return super unless YAML == Syck
374374
Syck::quick_emit( nil, opts ) do |out|
375375
out.scalar( "tag:yaml.org,2002:int", self.to_s, :plain )
376376
end
@@ -380,7 +380,7 @@ def to_yaml( opts = {} )
380380
class Float
381381
yaml_as "tag:yaml.org,2002:float"
382382
def to_yaml( opts = {} )
383-
return super unless YAML::ENGINE.syck?
383+
return super unless YAML == Syck
384384
Syck::quick_emit( nil, opts ) do |out|
385385
str = self.to_s
386386
if str == "Infinity"
@@ -405,7 +405,7 @@ def Rational.yaml_new( klass, tag, val )
405405
end
406406
end
407407
def to_yaml( opts = {} )
408-
return super unless YAML::ENGINE.syck?
408+
return super unless YAML == Syck
409409
Syck::quick_emit( self, opts ) do |out|
410410
out.map( taguri, nil ) do |map|
411411
map.add( 'denominator', denominator )
@@ -425,7 +425,7 @@ def Complex.yaml_new( klass, tag, val )
425425
end
426426
end
427427
def to_yaml( opts = {} )
428-
return super unless YAML::ENGINE.syck?
428+
return super unless YAML == Syck
429429
Syck::quick_emit( self, opts ) do |out|
430430
out.map( taguri, nil ) do |map|
431431
map.add( 'image', imaginary )
@@ -438,7 +438,7 @@ def to_yaml( opts = {} )
438438
class TrueClass
439439
yaml_as "tag:yaml.org,2002:bool#yes"
440440
def to_yaml( opts = {} )
441-
return super unless YAML::ENGINE.syck?
441+
return super unless YAML == Syck
442442
Syck::quick_emit( nil, opts ) do |out|
443443
out.scalar( taguri, "true", :plain )
444444
end
@@ -448,7 +448,7 @@ def to_yaml( opts = {} )
448448
class FalseClass
449449
yaml_as "tag:yaml.org,2002:bool#no"
450450
def to_yaml( opts = {} )
451-
return super unless YAML::ENGINE.syck?
451+
return super unless YAML == Syck
452452
Syck::quick_emit( nil, opts ) do |out|
453453
out.scalar( taguri, "false", :plain )
454454
end
@@ -458,10 +458,9 @@ def to_yaml( opts = {} )
458458
class NilClass
459459
yaml_as "tag:yaml.org,2002:null"
460460
def to_yaml( opts = {} )
461-
return super unless YAML::ENGINE.syck?
461+
return super unless YAML == Syck
462462
Syck::quick_emit( nil, opts ) do |out|
463463
out.scalar( taguri, "", :plain )
464464
end
465465
end
466466
end
467-

syck.gemspec

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,26 @@
11
# -*- encoding: utf-8 -*-
22

3-
require 'time'
43
Gem::Specification.new do |s|
54
s.name = "syck"
65
s.version = "1.0.5"
76

8-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9-
s.authors = ["Aaron Patterson", "Mat Brown"]
7+
s.summary = "A gemified version of Syck from Ruby's stdlib"
108
s.description = "A gemified version of Syck from Ruby's stdlib. Syck has been removed from\nRuby's stdlib, and this gem is meant to bridge the gap for people that haven't\nupdated their YAML yet."
11-
s.email = ["aaron@tenderlovemaking.com"]
9+
s.authors = ["Hiroshi SHIBATA", "Aaron Patterson", "Mat Brown"]
10+
s.email = ["hsbt@ruby-lang.org", "aaron@tenderlovemaking.com"]
11+
s.homepage = "https://github.com/tenderlove/syck"
12+
s.require_paths = ["lib"]
1213
s.extensions = ["ext/syck/extconf.rb"]
13-
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "CHANGELOG.rdoc", "README.rdoc"]
1414
s.files = Dir["[A-Z]*", "ext/**/*", "lib/**/*.rb", "test/**/*.rb"]
15-
s.homepage = "https://github.com/RapGenius/syck"
15+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "CHANGELOG.rdoc", "README.rdoc"]
16+
s.test_files = Dir["test/**/*.rb"]
1617
s.rdoc_options = ["--main", "README.rdoc"]
17-
s.require_paths = ["lib"]
1818
s.required_ruby_version = Gem::Requirement.new(">= 2.0.0")
19-
s.rubyforge_project = "syck"
19+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
2020
s.rubygems_version = "2.0.3"
21-
s.summary = "A gemified version of Syck from Ruby's stdlib"
22-
s.test_files = Dir["test/**/*.rb"]
23-
24-
if s.respond_to? :specification_version then
25-
s.specification_version = 4
2621

27-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28-
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
29-
s.add_development_dependency(%q<rake-compiler>, [">= 0.4.1"])
30-
else
31-
s.add_dependency(%q<rdoc>, ["~> 4.0"])
32-
s.add_dependency(%q<rake-compiler>, [">= 0.4.1"])
33-
end
34-
else
35-
s.add_dependency(%q<rdoc>, ["~> 4.0"])
36-
s.add_dependency(%q<rake-compiler>, [">= 0.4.1"])
37-
end
22+
s.add_development_dependency(%q<bundler>, ["~> 1.11"])
23+
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
24+
s.add_development_dependency(%q<test-unit>, ["~> 3.1"])
25+
s.add_development_dependency(%q<rake-compiler>, [">= 0.4.1"])
3826
end

test/test_yaml.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# encoding: ASCII-8BIT
12
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4; indent-tabs-mode: t -*-
23
# vim:sw=4:ts=4
34
# $Id$

0 commit comments

Comments
 (0)