core_ex 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +79 -0
- data/NEWS +9 -2
- data/README +6 -0
- data/Rakefile +3 -2
- data/SPEC.dyn.yml +5 -5
- data/SPEC.gemspec +3 -3
- data/SPEC.yml +4 -3
- data/lib/core_ex/module/in_place.rb +28 -0
- data/lib/core_ex/object/singleton_class.rb +3 -2
- data/lib/core_ex/object/the_first_time.rb +3 -3
- data/lib/core_ex/pathname.rb +2 -2
- data/lib/core_ex/proc.rb +2 -2
- data/lib/core_ex/rakefile_base.rf +66 -30
- data/lib/core_ex/yaml.rb +98 -57
- data/lib/core_ex.rb +74 -11
- data/lib/dumpable_proc.rb +10 -1
- data/lib/yaml_extension.rb +32 -11
- data/test/check-pkg-core_ex.yml +2 -1
- data/test/sanity/multiple-requires.yml +1 -1
- data/test/sanity/single-requires.yml +1 -1
- metadata +5 -5
data/ChangeLog
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
2005-10-03 Nicolas Pouillard <ertai@lrde.epita.fr>
|
2
|
+
|
3
|
+
Bump to 0.4.
|
4
|
+
|
5
|
+
* SPEC.dyn.yml: Update.
|
6
|
+
* SPEC.yml: Just use ci.
|
7
|
+
* NEWS: Add the 0.4 section.
|
8
|
+
|
9
|
+
2005-10-03 Nicolas Pouillard <ertai@lrde.epita.fr>
|
10
|
+
|
11
|
+
Some fixes before the release.
|
12
|
+
|
13
|
+
* lib/core_ex/rakefile_base.rf: Fix a missing uttk renaming.
|
14
|
+
Make vendor_dev recursive for vcs based dependencies.
|
15
|
+
* lib/core_ex.rb: Change a default value in core_ex_require.
|
16
|
+
* SPEC.yml: Remove the 'commit_dir: ..'.
|
17
|
+
|
18
|
+
2005-10-02 Nicolas Pouillard <ertai@lrde.epita.fr>
|
19
|
+
|
20
|
+
Improve rakefile_base.rf to support developper version of vendor.
|
21
|
+
|
22
|
+
* lib/core_ex/rakefile_base.rf: Add vendor_dev, revendor_dev,
|
23
|
+
clobber_vendor_dev. Dependencies in SPEC.yml can now be hashes.
|
24
|
+
* SPEC.yml: Update to the hash mode for dependencies.
|
25
|
+
|
26
|
+
2005-10-02 Nicolas Pouillard <ertai@lrde.epita.fr>
|
27
|
+
|
28
|
+
CoreEx now support YAML in ruby 1.8.3.
|
29
|
+
|
30
|
+
* lib/yaml_extension.rb,
|
31
|
+
* lib/core_ex/pathname.rb,
|
32
|
+
* lib/core_ex/yaml.rb,
|
33
|
+
* lib/core_ex/proc.rb,
|
34
|
+
* lib/core_ex.rb: Adapt to taguri and add some dynamic fixes.
|
35
|
+
Use a global variable for CORE_EX_VENDORS.
|
36
|
+
|
37
|
+
2005-10-02 Nicolas Pouillard <ertai@lrde.epita.fr>
|
38
|
+
|
39
|
+
Two fixes in object extensions.
|
40
|
+
|
41
|
+
* lib/core_ex/object/the_first_time.rb: Rename just_one_time to
|
42
|
+
just_once.
|
43
|
+
* lib/core_ex/object/singleton_class.rb: Adapt the test to the new
|
44
|
+
behavior of superclass in ruby 1.8.3.
|
45
|
+
|
46
|
+
2005-10-02 Nicolas Pouillard <ertai@lrde.epita.fr>
|
47
|
+
|
48
|
+
Add a module extension to ease the use of in place methods.
|
49
|
+
|
50
|
+
* lib/core_ex/module/in_place.rb: New. Simply make a new method which
|
51
|
+
dup the object and call the in place method on it.
|
52
|
+
|
53
|
+
2005-09-29 Nicolas Pouillard <ertai@lrde.epita.fr>
|
54
|
+
|
55
|
+
Rename TTK to Uttk.
|
56
|
+
|
57
|
+
* lib/core_ex.rb: Raise a LoadError if rubygems cannot be really loaded.
|
58
|
+
|
59
|
+
* test/check-pkg-core_ex.yml,
|
60
|
+
* lib/core_ex/rakefile_base.rf,
|
61
|
+
* vcs/vcs_core_ex.rb: Renaming.
|
62
|
+
|
63
|
+
2005-09-25 Nicolas Pouillard <ertai@lrde.epita.fr>
|
64
|
+
|
65
|
+
Use <<ruby>> instead of ruby.
|
66
|
+
|
67
|
+
* test/sanity/multiple-requires.yml: Update.
|
68
|
+
|
69
|
+
2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
|
70
|
+
|
71
|
+
Some packaging changes.
|
72
|
+
|
73
|
+
* ChangeLog: New.
|
74
|
+
* vcs/vcs_core_ex.rb: New. Methods are cxci, core_ex_commit but
|
75
|
+
just commit or ci works too (Vcs 0.4).
|
76
|
+
|
77
|
+
* test/sanity/single-requires.yml: Use <<ruby>> instead of ruby.
|
78
|
+
|
79
|
+
See ../ChangeLog for previous entries.
|
data/NEWS
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
= New in 0.4, 2005-10-03:
|
2
|
+
|
3
|
+
This release is mainly a bugfix release compatible with ruby 1.8.3!
|
4
|
+
|
5
|
+
* CoreEx::Module::InPlace:
|
6
|
+
Add a module extension to ease the use of in place methods.
|
7
|
+
|
1
8
|
= New in 0.3, 2005-09-15:
|
2
9
|
|
3
10
|
* Architecture:
|
@@ -53,8 +60,8 @@
|
|
53
60
|
= New in 0.1, 2005-05-31:
|
54
61
|
|
55
62
|
CoreEx is designed to provides a simple but quite useful extension of the
|
56
|
-
standard library
|
57
|
-
Enumerable, Exception, FileUtils, String,
|
63
|
+
standard library of Ruby. Thus some classes and modules like Pathname, Time,
|
64
|
+
Enumerable, Exception, FileUtils, String, and YAML are extended. There are
|
58
65
|
also some new features like attr_once, DTime, TempPath, Version,
|
59
66
|
embedded_tests, filelist (almost from rake), a common Rakefile, and an
|
60
67
|
extension of the require system.
|
data/README
CHANGED
@@ -1 +1,7 @@
|
|
1
|
+
CoreEx is designed to provides a simple but quite useful extension of the
|
2
|
+
standard library of Ruby. Thus some classes and modules like Pathname,
|
3
|
+
Enumerable, Exception, FileUtils, String, YAML, Module, Class and Object are
|
4
|
+
extended. There are also some new features like DTime, TempPath, Version,
|
5
|
+
embedded_tests, FileList (almost from rake), and a common Rakefile.
|
6
|
+
|
1
7
|
Coming Soon.
|
data/Rakefile
CHANGED
data/SPEC.dyn.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:OpenStruct
|
2
2
|
table:
|
3
|
-
:url: svn://svn.feydakins.org/ruby_ex/trunk/core_ex
|
4
3
|
:version_id: ''
|
4
|
+
:date: "Mon, 03 Oct 2005"
|
5
5
|
:version: !ruby/object:Version
|
6
|
-
build:
|
6
|
+
build: 0
|
7
7
|
major: 0
|
8
|
-
minor:
|
9
|
-
revision:
|
10
|
-
:
|
8
|
+
minor: 4
|
9
|
+
revision: 387
|
10
|
+
:url: svn://svn.feydakins.org/ruby_ex/trunk/core_ex
|
data/SPEC.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{core_ex}
|
3
|
-
s.version = "0.
|
4
|
-
s.date = %q{2005-
|
3
|
+
s.version = "0.4.0"
|
4
|
+
s.date = %q{2005-10-03}
|
5
5
|
s.summary = %q{CoreEx is a proposal for a standard library extension.}
|
6
6
|
s.email = ["nicolas.despres@gmail.com", "ertai@feydakins.org"]
|
7
7
|
s.homepage = %q{http://api.feydakins.org/core_ex}
|
8
8
|
s.rubyforge_project = %q{core_ex}
|
9
9
|
s.description = %q{CoreEx is designed to provides a simple but quite useful extension of the standard library of Ruby. So some classes and modules like Pathname, Time, Enumerable, Exception, FileUtils, String, and YAML are extended. There is also some new features like attr_once, DTime, TempPath, Version, embedded_tests, filelist (almost from rake), a common Rakefile, and an extension of the require system.}
|
10
10
|
s.authors = ["Nicolas Despr\350s", "Nicolas Pouillard"]
|
11
|
-
s.files = ["lib/core_ex.rb", "lib/d_time.rb", "lib/dumpable_proc.rb", "lib/path_list.rb", "lib/temp_path.rb", "lib/version.rb", "lib/yaml_extension.rb", "lib/core_ex/embedded_tests.rb", "lib/core_ex/enumerable.rb", "lib/core_ex/exception.rb", "lib/core_ex/file_utils.rb", "lib/core_ex/pathname.rb", "lib/core_ex/proc.rb", "lib/core_ex/rakefile_base.rf", "lib/core_ex/require.rb", "lib/core_ex/string.rb", "lib/core_ex/time.rb", "lib/core_ex/try_dup.rb", "lib/core_ex/yaml.rb", "lib/core_ex/dependencies_ext/constant_load_path.rb", "lib/core_ex/module/attr_once.rb", "lib/core_ex/module/import.rb", "lib/core_ex/module/mix_in_with_args.rb", "lib/core_ex/object/instance_eval_with_args.rb", "lib/core_ex/object/singleton_class.rb", "lib/core_ex/object/the_first_time.rb", "lib/test/unit/u_i/yaml/test_runner.rb", "test/check-core_ex.yml", "test/check-pkg-core_ex.yml", "test/resources", "test/sanity", "test/sanity-suite.yml", "test/test-unit-setup.rb", "test/unit-suite.yml", "test/resources/require", "test/resources/use-from-gems.rb", "test/resources/yaml_testrunner", "test/resources/require/test_require", "test/resources/require/test_require_rb.rb", "test/resources/require/test_require_so.so", "test/resources/yaml_testrunner/unit_test.rb", "test/sanity/multiple-requires.yml", "test/sanity/single-requires.yml", "AUTHORS", "NEWS", "Rakefile", "README", "SPEC.dyn.yml", "SPEC.gemspec", "SPEC.yml"]
|
11
|
+
s.files = ["lib/core_ex.rb", "lib/d_time.rb", "lib/dumpable_proc.rb", "lib/path_list.rb", "lib/temp_path.rb", "lib/version.rb", "lib/yaml_extension.rb", "lib/core_ex/embedded_tests.rb", "lib/core_ex/enumerable.rb", "lib/core_ex/exception.rb", "lib/core_ex/file_utils.rb", "lib/core_ex/pathname.rb", "lib/core_ex/proc.rb", "lib/core_ex/rakefile_base.rf", "lib/core_ex/require.rb", "lib/core_ex/string.rb", "lib/core_ex/time.rb", "lib/core_ex/try_dup.rb", "lib/core_ex/yaml.rb", "lib/core_ex/dependencies_ext/constant_load_path.rb", "lib/core_ex/module/attr_once.rb", "lib/core_ex/module/import.rb", "lib/core_ex/module/in_place.rb", "lib/core_ex/module/mix_in_with_args.rb", "lib/core_ex/object/instance_eval_with_args.rb", "lib/core_ex/object/singleton_class.rb", "lib/core_ex/object/the_first_time.rb", "lib/test/unit/u_i/yaml/test_runner.rb", "test/check-core_ex.yml", "test/check-pkg-core_ex.yml", "test/resources", "test/sanity", "test/sanity-suite.yml", "test/test-unit-setup.rb", "test/unit-suite.yml", "test/resources/require", "test/resources/use-from-gems.rb", "test/resources/yaml_testrunner", "test/resources/require/test_require", "test/resources/require/test_require_rb.rb", "test/resources/require/test_require_so.so", "test/resources/yaml_testrunner/unit_test.rb", "test/sanity/multiple-requires.yml", "test/sanity/single-requires.yml", "AUTHORS", "ChangeLog", "NEWS", "Rakefile", "README", "SPEC.dyn.yml", "SPEC.gemspec", "SPEC.yml"]
|
12
12
|
s.add_dependency(%q<activesupport>, ["~> 1.1.1"])
|
13
13
|
end
|
data/SPEC.yml
CHANGED
@@ -22,8 +22,7 @@ root_test_suite: test/check-pkg-core_ex.yml
|
|
22
22
|
rdoc_dir: doc/html
|
23
23
|
tags_url: svn://svn.feydakins.org/ruby_ex/tags
|
24
24
|
|
25
|
-
commit_command:
|
26
|
-
commit_dir: ..
|
25
|
+
commit_command: ci
|
27
26
|
|
28
27
|
rdoc_files: !filelist
|
29
28
|
- README
|
@@ -37,6 +36,8 @@ pkg_files: !filelist
|
|
37
36
|
- '[A-Z]*'
|
38
37
|
|
39
38
|
dependencies:
|
40
|
-
activesupport:
|
39
|
+
activesupport:
|
40
|
+
gem: ~> 1.1.1
|
41
|
+
tarball: 5161/activesupport-1.1.1.tgz
|
41
42
|
|
42
43
|
ttk_version: ~> 0.3.0
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
|
+
# License:: Gnu General Public License.
|
4
|
+
# Revision:: $Id: in_place.rb 381 2005-10-02 14:34:28Z ertai $
|
5
|
+
|
6
|
+
module CoreEx
|
7
|
+
|
8
|
+
module Module
|
9
|
+
|
10
|
+
module InPlace
|
11
|
+
|
12
|
+
def in_place ( *syms )
|
13
|
+
syms.each do |sym|
|
14
|
+
sym = sym.to_s.sub(/!*$/, '')
|
15
|
+
module_eval "
|
16
|
+
def #{sym} ( *a, &b )
|
17
|
+
dup.#{sym}!(*a, &b)
|
18
|
+
end
|
19
|
+
"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end # module InPlace
|
24
|
+
|
25
|
+
end # module Module
|
26
|
+
|
27
|
+
end # module CoreEx
|
28
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: singleton_class.rb
|
4
|
+
# Revision:: $Id: singleton_class.rb 382 2005-10-02 14:49:42Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module CoreEx
|
@@ -54,7 +54,8 @@ module CoreEx
|
|
54
54
|
end
|
55
55
|
assert_equal @string.singleton_class.object_id,
|
56
56
|
@string.singleton_class.object_id, 'not the same object id'
|
57
|
-
assert_equal ::String, @string.singleton_class.
|
57
|
+
assert_equal ::String, @string.singleton_class.ancestors.first,
|
58
|
+
'bad super class'
|
58
59
|
end
|
59
60
|
|
60
61
|
def test_define_and_undef_singleton_method
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: the_first_time.rb
|
4
|
+
# Revision:: $Id: the_first_time.rb 382 2005-10-02 14:49:42Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module CoreEx
|
@@ -19,7 +19,7 @@ module CoreEx
|
|
19
19
|
block[]
|
20
20
|
end
|
21
21
|
|
22
|
-
alias_method :
|
22
|
+
alias_method :just_once, :the_first_time
|
23
23
|
|
24
24
|
end # module TheFirstTime
|
25
25
|
|
@@ -29,4 +29,4 @@ end # module CoreEx
|
|
29
29
|
|
30
30
|
test_section __FILE__ do
|
31
31
|
|
32
|
-
end
|
32
|
+
end
|
data/lib/core_ex/pathname.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# License: Gnu General Public License.
|
4
4
|
|
5
5
|
# $LastChangedBy: ertai $
|
6
|
-
# $Id: pathname.rb
|
6
|
+
# $Id: pathname.rb 383 2005-10-02 16:48:09Z ertai $
|
7
7
|
|
8
8
|
|
9
9
|
|
@@ -291,7 +291,7 @@ test_section __FILE__ do
|
|
291
291
|
|
292
292
|
def test_yaml
|
293
293
|
str = 'foo/bar/baz.rb'
|
294
|
-
assert_yaml_load "
|
294
|
+
assert_yaml_load "!path #{str}", ::Pathname, str.to_path
|
295
295
|
assert_equal('baz.rb', @val.basename.to_s)
|
296
296
|
assert_equal(str, @val.to_s)
|
297
297
|
assert_yaml_dump str.to_path, @ref
|
data/lib/core_ex/proc.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: proc.rb
|
4
|
+
# Revision:: $Id: proc.rb 383 2005-10-02 16:48:09Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module CoreEx
|
@@ -65,7 +65,7 @@ module CoreEx
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def test_yaml
|
68
|
-
assert_yaml_load "
|
68
|
+
assert_yaml_load "!proc 3 + 7", Proc
|
69
69
|
assert_yaml_dump @val, @ref
|
70
70
|
assert_equal(10, @val[])
|
71
71
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: rakefile_base.rf
|
4
|
+
# Revision:: $Id: rakefile_base.rf 386 2005-10-03 00:02:16Z ertai $
|
5
5
|
|
6
6
|
require 'core_ex'
|
7
7
|
require 'ostruct'
|
@@ -80,16 +80,19 @@ task :default => [ :check ]
|
|
80
80
|
task :ruby_ex => [ :spec ] do
|
81
81
|
require_gem('ruby_ex', SPEC.ruby_ex_version || '~> 0.2.0')
|
82
82
|
require 'ruby_ex'
|
83
|
+
Commands.import!
|
84
|
+
$runner = Commands::Runners::System.new
|
85
|
+
$runner.raise_on_failures
|
86
|
+
$runner.make_verbose
|
83
87
|
end
|
84
88
|
|
85
89
|
|
86
|
-
# desc 'Setup the
|
87
|
-
task :
|
88
|
-
require_gem('
|
89
|
-
require '
|
90
|
-
|
91
|
-
|
92
|
-
cmd = TTK.bin[*a]
|
90
|
+
# desc 'Setup the uttk command'
|
91
|
+
task :uttk => [ :spec, :ruby_ex ] do
|
92
|
+
require_gem('uttk', SPEC.uttk_version || '~> 0.3.0')
|
93
|
+
require 'uttk'
|
94
|
+
def uttk ( *a, &b )
|
95
|
+
cmd = Uttk.bin[*a]
|
93
96
|
cmd.input = b[] if b
|
94
97
|
cmd.output = STDOUT
|
95
98
|
cmd.error = STDERR
|
@@ -100,8 +103,8 @@ end
|
|
100
103
|
|
101
104
|
|
102
105
|
desc 'Launch all test suites'
|
103
|
-
task :check => [ :
|
104
|
-
|
106
|
+
task :check => [ :uttk, :spec, :dyn_spec ] do
|
107
|
+
uttk '-l', 'check-log', '-S', 'url: file://<<pwd>>', '-C',
|
105
108
|
SPEC.root_test_suite
|
106
109
|
end
|
107
110
|
clean_task :check do
|
@@ -111,22 +114,20 @@ end
|
|
111
114
|
|
112
115
|
|
113
116
|
desc 'Check generated packages'
|
114
|
-
task :distcheck => [ :
|
117
|
+
task :distcheck => [ :uttk, :package ] do
|
115
118
|
urls = []
|
116
119
|
Pathname.glob('pkg/*') do |path|
|
117
120
|
next unless path.file?
|
118
121
|
urls << "file://#{path.expand_path}"
|
119
122
|
end
|
120
|
-
|
121
|
-
Check generated packages:
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
symbols : { url: <<url>> }
|
129
|
-
import : #{SPEC.root_test_suite}
|
123
|
+
uttk '-l', 'distcheck-log' do %Q[
|
124
|
+
Check generated packages: !S::Iterate
|
125
|
+
over: #{urls.inspect}
|
126
|
+
iter: url
|
127
|
+
test:
|
128
|
+
'Check the package: <<url>>': !S::Import
|
129
|
+
symbols: { url: <<url>> }
|
130
|
+
import : #{SPEC.root_test_suite}
|
130
131
|
]
|
131
132
|
end
|
132
133
|
end
|
@@ -256,7 +257,11 @@ file GEM_SPEC.to_s => [ :spec, :spec_pkg_files, :dyn_spec, :rdoc_spec ] do
|
|
256
257
|
|
257
258
|
if SPEC.dependencies
|
258
259
|
SPEC.dependencies.each do |name, version|
|
259
|
-
|
260
|
+
case version
|
261
|
+
when Array then version = version.first
|
262
|
+
when Hash then version = version['gem']
|
263
|
+
end
|
264
|
+
s.add_dependency(name, version)
|
260
265
|
end
|
261
266
|
end
|
262
267
|
|
@@ -351,7 +356,7 @@ end
|
|
351
356
|
# desc 'Common tasks for a release'
|
352
357
|
task :common_release =>
|
353
358
|
[
|
354
|
-
:
|
359
|
+
:uttk,
|
355
360
|
:vcs,
|
356
361
|
|
357
362
|
:release_confirm,
|
@@ -565,23 +570,41 @@ clean_task :publish_package do
|
|
565
570
|
end
|
566
571
|
|
567
572
|
|
568
|
-
|
569
573
|
task :vendor => [ :spec, :ruby_ex ] do
|
574
|
+
dev = $developpement_mode
|
575
|
+
$developpement_mode = false
|
570
576
|
unless VENDOR.directory?
|
571
|
-
say "Creating the vendor directory..."
|
577
|
+
say "Creating the #{(dev)? 'developpement ' : ''}vendor directory..."
|
572
578
|
VENDOR.mkpath
|
573
579
|
require 'uri_ex'
|
574
580
|
if SPEC.dependencies
|
575
581
|
SPEC.dependencies.each do |name, version|
|
576
|
-
|
577
|
-
|
582
|
+
url = nil
|
583
|
+
case version
|
584
|
+
when Array then url = version.last
|
585
|
+
when Hash
|
586
|
+
if dev and version['vcs']
|
587
|
+
url = version['vcs']
|
588
|
+
else
|
589
|
+
url = version['tarball']
|
590
|
+
end
|
591
|
+
else next
|
592
|
+
end
|
593
|
+
next if url.nil?
|
578
594
|
if url =~ /^\d+\/[^\/]+$/
|
579
595
|
url = "http://rubyforge.org/frs/download.php/#{url}"
|
580
596
|
end
|
581
597
|
url = URI.parse(url)
|
582
|
-
dest = VENDOR +
|
598
|
+
dest = VENDOR + name
|
583
599
|
STDERR.puts "#{url} => #{dest}"
|
584
|
-
FileType.guess(url.checkout
|
600
|
+
out = FileType.guess(url.checkout.first)
|
601
|
+
out = out.extract if out.extractable?
|
602
|
+
out.path.mv(dest)
|
603
|
+
if dev and version['vcs'] and (dest + 'SPEC.yml').exist?
|
604
|
+
cmd = $0.to_cmd['vendor_dev'] > [STDOUT, STDERR]
|
605
|
+
cmd.dir = dest
|
606
|
+
data = cmd.run($runner)
|
607
|
+
end
|
585
608
|
end
|
586
609
|
end
|
587
610
|
end
|
@@ -591,4 +614,17 @@ clean_task :vendor do
|
|
591
614
|
VENDOR.rm_rf
|
592
615
|
end
|
593
616
|
|
594
|
-
task :revendor => [:clobber_vendor, :vendor]
|
617
|
+
task :revendor => [:clobber_vendor, :vendor]
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
task :vendor_dev => [ :set_developpement_mode, :vendor ]
|
622
|
+
|
623
|
+
clean_task :vendor_dev => [:clobber_vendor]
|
624
|
+
|
625
|
+
task :revendor_dev => [:clobber_vendor_dev, :vendor_dev]
|
626
|
+
|
627
|
+
$developpement_mode ||= false
|
628
|
+
task :set_developpement_mode do
|
629
|
+
$developpement_mode = true
|
630
|
+
end
|
data/lib/core_ex/yaml.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: yaml.rb
|
4
|
+
# Revision:: $Id: yaml.rb 383 2005-10-02 16:48:09Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module CoreEx
|
@@ -62,29 +62,43 @@ class Array
|
|
62
62
|
|
63
63
|
alias_method :old_to_yaml, :to_yaml
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
YAML::
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
if HAVE_YAML_TAGURI
|
66
|
+
def to_yaml ( opts={} )
|
67
|
+
inline = nil
|
68
|
+
if not opts.is_a?(YAML::Syck::Emitter) and opts[:Inline] and not is_complex_yaml?
|
69
|
+
inline = :inline
|
70
|
+
end
|
71
|
+
YAML::quick_emit(object_id, opts) do |out|
|
72
|
+
out.seq( taguri, to_yaml_style || inline ) do |seq|
|
73
|
+
each { |x| seq.add x }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
else
|
78
|
+
def to_yaml ( opts={} )
|
79
|
+
em = (opts.is_a? YAML::Syck::Emitter)? opts : opts[:Emitter]
|
80
|
+
if (opts[:Inline] or (em and em.options[:Inline])) and not is_complex_yaml?
|
81
|
+
YAML::quick_emit(self.object_id, opts) do |out|
|
82
|
+
out << '['
|
83
|
+
first = true
|
84
|
+
each do |x|
|
85
|
+
if first
|
86
|
+
first = false
|
87
|
+
else
|
88
|
+
out << ', '
|
89
|
+
end
|
90
|
+
x.to_yaml(:Emitter => out)
|
76
91
|
end
|
77
|
-
|
92
|
+
out << ']'
|
78
93
|
end
|
79
|
-
|
94
|
+
else
|
95
|
+
old_to_yaml(opts)
|
80
96
|
end
|
81
|
-
else
|
82
|
-
old_to_yaml(opts)
|
83
97
|
end
|
84
98
|
end
|
85
99
|
|
86
100
|
|
87
|
-
undef_method :is_complex_yaml?
|
101
|
+
suppress(NoMethodError, NameError) { undef_method :is_complex_yaml? }
|
88
102
|
|
89
103
|
def is_complex_yaml?
|
90
104
|
any? { |x| x.is_complex_yaml? } or inspect.size > 80
|
@@ -98,31 +112,45 @@ class Hash
|
|
98
112
|
|
99
113
|
alias_method :old_to_yaml, :to_yaml
|
100
114
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
YAML::
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
115
|
+
if HAVE_YAML_TAGURI
|
116
|
+
def to_yaml ( opts={} )
|
117
|
+
inline = nil
|
118
|
+
if not opts.is_a?(YAML::Syck::Emitter) and opts[:Inline] and not is_complex_yaml?
|
119
|
+
inline = :inline
|
120
|
+
end
|
121
|
+
YAML::quick_emit(object_id, opts) do |out|
|
122
|
+
out.map(taguri, to_yaml_style || inline) do |map|
|
123
|
+
each { |k, v| map.add k, v }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else
|
128
|
+
def to_yaml ( opts={} )
|
129
|
+
em = (opts.is_a? YAML::Syck::Emitter)? opts : opts[:Emitter]
|
130
|
+
if (opts[:Inline] or (em and em.options[:Inline])) and not is_complex_yaml?
|
131
|
+
YAML::quick_emit(self.object_id, opts) do |out|
|
132
|
+
out << '{'
|
133
|
+
first = true
|
134
|
+
each do |k, v|
|
135
|
+
if first
|
136
|
+
first = false
|
137
|
+
else
|
138
|
+
out << ', '
|
139
|
+
end
|
140
|
+
k.to_yaml(:Emitter => out)
|
141
|
+
out << ': '
|
142
|
+
v.to_yaml(:Emitter => out)
|
112
143
|
end
|
113
|
-
|
114
|
-
out << ': '
|
115
|
-
v.to_yaml(:Emitter => out)
|
144
|
+
out << '}'
|
116
145
|
end
|
117
|
-
|
146
|
+
else
|
147
|
+
old_to_yaml(opts)
|
118
148
|
end
|
119
|
-
else
|
120
|
-
old_to_yaml(opts)
|
121
149
|
end
|
122
150
|
end
|
123
151
|
|
124
152
|
|
125
|
-
undef_method :is_complex_yaml?
|
153
|
+
suppress(NoMethodError, NameError) { undef_method :is_complex_yaml? }
|
126
154
|
|
127
155
|
def is_complex_yaml?
|
128
156
|
any? { |x| x.is_complex_yaml? } or inspect.size > 80
|
@@ -132,7 +160,7 @@ end # class Hash
|
|
132
160
|
|
133
161
|
|
134
162
|
|
135
|
-
YAML.add_builtin_type('
|
163
|
+
YAML.add_builtin_type('ruby') do |type, val|
|
136
164
|
eval val.to_s
|
137
165
|
end
|
138
166
|
|
@@ -146,14 +174,14 @@ test_section __FILE__ do
|
|
146
174
|
|
147
175
|
def test_regexp
|
148
176
|
@re = /a.*[bc]$/
|
149
|
-
assert_yaml_load '
|
177
|
+
assert_yaml_load '!re a.*[bc]$', Regexp, @re
|
150
178
|
assert_match(@val, 'afffc')
|
151
179
|
assert_no_match(@val, 'afffC')
|
152
180
|
assert_no_match(@val, 'fffb')
|
153
181
|
assert_no_match(@val, "af\nffb")
|
154
182
|
assert_yaml_dump @re, @ref
|
155
183
|
@re = /a.*[bc]$/mi
|
156
|
-
assert_yaml_load '
|
184
|
+
assert_yaml_load '!re ["a.*[bc]$", mi]', Regexp, @re
|
157
185
|
assert_match(@val, 'afffc')
|
158
186
|
assert_match(@val, 'afffC')
|
159
187
|
assert_no_match(@val, 'fffb')
|
@@ -161,55 +189,68 @@ test_section __FILE__ do
|
|
161
189
|
end
|
162
190
|
|
163
191
|
def test_range
|
164
|
-
assert_yaml_load "
|
192
|
+
assert_yaml_load "!range 0..10", Range, 0..10
|
165
193
|
assert_yaml_dump @val, @ref
|
166
|
-
assert_yaml_load "
|
194
|
+
assert_yaml_load "!range 0...10", Range, 0...10
|
167
195
|
assert_yaml_dump @val, @ref
|
168
196
|
end
|
169
197
|
|
170
198
|
def test_ruby
|
171
|
-
assert_yaml_load "
|
172
|
-
assert_yaml_load "
|
199
|
+
assert_yaml_load "!ruby 2 + 4", Integer, 6
|
200
|
+
assert_yaml_load "!ruby '[2, 4]'", Array, [2, 4]
|
201
|
+
end
|
202
|
+
|
203
|
+
class A < String
|
204
|
+
have YamlExtension, :core_ex_yaml_test_a
|
205
|
+
def is_complex_yaml?
|
206
|
+
true
|
207
|
+
end
|
208
|
+
def to_yaml_string
|
209
|
+
to_s
|
210
|
+
end
|
211
|
+
def self.yaml_load ( val )
|
212
|
+
A.new(val)
|
213
|
+
end
|
173
214
|
end
|
174
215
|
|
175
216
|
def test_array
|
176
217
|
opts = { :Inline => true }
|
177
|
-
assert_yaml_load '
|
218
|
+
assert_yaml_load '[2, "4"]', Array, [2, '4']
|
178
219
|
assert_yaml_dump @val, @ref, opts
|
179
|
-
assert_yaml_load '
|
180
|
-
assert_yaml_dump @val, "
|
181
|
-
assert_yaml_load "
|
182
|
-
assert_yaml_dump @val,
|
220
|
+
assert_yaml_load '[2, "4"]', Array, [2, '4']
|
221
|
+
assert_yaml_dump @val, "- 2\n- \"4\""
|
222
|
+
assert_yaml_load "[2, [!core_ex_yaml_test_a x]]", Array, [2, [A.new('x')]]
|
223
|
+
assert_yaml_dump @val, /- 2\n- (\n )?- !core_ex_yaml_test_a x/, opts
|
183
224
|
arr = (0 .. 25).to_a
|
184
225
|
str = arr.join(', ')
|
185
226
|
str2 = arr.join("\n- ")
|
186
|
-
assert_yaml_load "
|
187
|
-
assert_yaml_dump @val, "
|
188
|
-
assert_yaml_load '
|
227
|
+
assert_yaml_load "[#{str}]", Array, arr
|
228
|
+
assert_yaml_dump @val, "- #{str2}", opts
|
229
|
+
assert_yaml_load '[2, {a: 4}]', Array, [2, {'a' => 4}]
|
189
230
|
assert_yaml_dump @val, @ref, opts
|
190
231
|
end
|
191
232
|
|
192
233
|
def test_hash
|
193
234
|
opts = { :Inline => true }
|
194
|
-
assert_yaml_load '
|
235
|
+
assert_yaml_load '{a: "4"}', Hash, { 'a' => '4' }
|
195
236
|
assert_yaml_dump @val, @ref, opts
|
196
|
-
assert_yaml_load '
|
197
|
-
assert_yaml_dump @val, "
|
198
|
-
assert_yaml_load "
|
237
|
+
assert_yaml_load '{a: "4"}', Hash, { 'a' => '4' }
|
238
|
+
assert_yaml_dump @val, "a: \"4\""
|
239
|
+
assert_yaml_load "{a: [4]}", Hash, { 'a' => [4] }
|
199
240
|
assert_yaml_dump @val, @ref, opts
|
200
241
|
hash = Hash[*(0 .. 23).to_a]
|
201
242
|
arr = hash.map{|k,v| "#{k}: #{v}"}.sort
|
202
243
|
str = arr.join(', ')
|
203
244
|
str2 = arr.join('|')
|
204
|
-
assert_yaml_load "
|
205
|
-
assert_yaml_dump @val, /\A
|
245
|
+
assert_yaml_load "{#{str}}", Hash, hash
|
246
|
+
assert_yaml_dump @val, /\A(?:(?:#{str2})\n)*(?:#{str2})\Z/, opts
|
206
247
|
end
|
207
248
|
|
208
249
|
def test_no_inline
|
209
250
|
opts = { :Inline => false }
|
210
251
|
hash = Hash[*(0 .. 3).to_a]
|
211
252
|
tree = [hash.dup, hash.dup, hash.dup, hash.dup]
|
212
|
-
@no_inline =
|
253
|
+
@no_inline = /- (\n )?0: 1\n 2: 3\n- (\n )?0: 1\n 2: 3\n- (\n )?0: 1\n 2: 3\n- (\n )?0: 1\n 2: 3/
|
213
254
|
assert_yaml_dump tree, @no_inline, opts
|
214
255
|
assert_yaml_dump tree, @no_inline
|
215
256
|
end
|
data/lib/core_ex.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: core_ex.rb
|
4
|
+
# Revision:: $Id: core_ex.rb 386 2005-10-03 00:02:16Z ertai $
|
5
5
|
|
6
6
|
unless defined? CORE_EX_LOADED and CORE_EX_LOADED
|
7
7
|
CORE_EX_LOADED = true
|
8
|
+
require 'English'
|
8
9
|
$LOADED_FEATURES << 'core_ex.rb' unless $LOADED_FEATURES.include? 'core_ex.rb'
|
9
10
|
|
10
11
|
require 'pathname'
|
@@ -15,23 +16,23 @@ unless defined? CORE_EX_LOADED and CORE_EX_LOADED
|
|
15
16
|
core_ex_long = (CORE_EX_DIR + 'core_ex.rb').to_s
|
16
17
|
$LOADED_FEATURES << core_ex_long unless $LOADED_FEATURES.include? core_ex_long
|
17
18
|
|
18
|
-
CORE_EX_VENDORS
|
19
|
-
CORE_EX_VENDORS << CORE_EX_DIR.parent + 'vendor'
|
19
|
+
$CORE_EX_VENDORS ||= []
|
20
|
+
$CORE_EX_VENDORS << CORE_EX_DIR.parent + 'vendor'
|
20
21
|
|
21
22
|
def core_ex_debug ( &block )
|
22
23
|
# STDERR.puts block[].inspect
|
23
24
|
end
|
24
25
|
|
25
|
-
def core_ex_vendor_require ( dir_name,
|
26
|
-
if CORE_EX_VENDORS.any? { |dir| dir.exist? }
|
27
|
-
dir = Pathname.glob("{#{CORE_EX_VENDORS.join(',')}}/#{dir_name}#{
|
26
|
+
def core_ex_vendor_require ( dir_name, sub_dir='lib' )
|
27
|
+
if $CORE_EX_VENDORS.any? { |dir| dir.exist? }
|
28
|
+
dir = Pathname.glob("{#{$CORE_EX_VENDORS.join(',')}}/#{dir_name}/{#{sub_dir},}").first
|
28
29
|
if dir and dir.directory?
|
29
30
|
if defined? CoreEx::Pathname and Pathname.include? CoreEx::Pathname
|
30
31
|
dir.load_path!
|
31
32
|
else
|
32
33
|
$LOAD_PATH << dir.to_s
|
33
34
|
end
|
34
|
-
core_ex_debug { [:vendor, dir_name,
|
35
|
+
core_ex_debug { [:vendor, dir_name, sub_dir] }
|
35
36
|
else
|
36
37
|
raise LoadError, "no vendor dir #{dir}"
|
37
38
|
end
|
@@ -41,11 +42,12 @@ unless defined? CORE_EX_LOADED and CORE_EX_LOADED
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def core_ex_register_vendor ( dir )
|
44
|
-
CORE_EX_VENDORS << dir unless CORE_EX_VENDORS.include? dir
|
45
|
+
$CORE_EX_VENDORS << dir unless $CORE_EX_VENDORS.include? dir
|
45
46
|
end
|
46
47
|
|
47
48
|
begin
|
48
49
|
require 'rubygems'
|
50
|
+
raise LoadError, 'RubyGems not loaded' unless defined? RubyGems
|
49
51
|
def core_ex_gem_require ( gem_name, gem_version='> 0' )
|
50
52
|
require_gem gem_name, gem_version
|
51
53
|
core_ex_debug { [:require_gem, gem_name, gem_version] }
|
@@ -56,9 +58,9 @@ unless defined? CORE_EX_LOADED and CORE_EX_LOADED
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
59
|
-
def core_ex_require ( name, gem_name=name, dir_name=
|
61
|
+
def core_ex_require ( name, gem_name=name, dir_name=gem_name, gem_version='> 0', sub_dir='lib' )
|
60
62
|
begin
|
61
|
-
core_ex_vendor_require(dir_name,
|
63
|
+
core_ex_vendor_require(dir_name, sub_dir)
|
62
64
|
rescue LoadError => ex
|
63
65
|
begin
|
64
66
|
core_ex_gem_require(gem_name, gem_version)
|
@@ -70,7 +72,64 @@ unless defined? CORE_EX_LOADED and CORE_EX_LOADED
|
|
70
72
|
|
71
73
|
verbose = $VERBOSE
|
72
74
|
$VERBOSE = false
|
73
|
-
|
75
|
+
|
76
|
+
# <<< Dynamic fix: bug: Ruby 1.8.3 vs active_support 1.1.1
|
77
|
+
require 'logger'
|
78
|
+
class Logger
|
79
|
+
Format = 42 unless defined? Format
|
80
|
+
end
|
81
|
+
# >>>
|
82
|
+
|
83
|
+
core_ex_require 'active_support', 'activesupport', 'activesupport', '~> 1.1.1'
|
84
|
+
|
85
|
+
# <<< Dynamic patch: Yaml warnings in ruby 1.8.3
|
86
|
+
begin
|
87
|
+
silence_warnings { require 'yaml/tag' }
|
88
|
+
class Module
|
89
|
+
alias yaml_as_bugged yaml_as
|
90
|
+
def yaml_as( tag, sc = true )
|
91
|
+
class_eval <<-"end;", __FILE__, __LINE__
|
92
|
+
attr_writer :taguri
|
93
|
+
def taguri
|
94
|
+
if respond_to? :to_yaml_type
|
95
|
+
YAML::tagurize( to_yaml_type[1..-1] )
|
96
|
+
else
|
97
|
+
return @taguri if defined? @taguri
|
98
|
+
tag = #{ tag.dump }
|
99
|
+
if self.class.yaml_tag_subclasses? and self.class != YAML::tagged_classes[tag]
|
100
|
+
tag = "\#{ tag }:\#{ self.class.yaml_tag_class_name }"
|
101
|
+
end
|
102
|
+
tag
|
103
|
+
end
|
104
|
+
end
|
105
|
+
def self.yaml_tag_subclasses?; #{ sc ? 'true' : 'false' }; end
|
106
|
+
end;
|
107
|
+
YAML::tag_class tag, self
|
108
|
+
end
|
109
|
+
end
|
110
|
+
silence_warnings { require 'yaml' }
|
111
|
+
module YAML
|
112
|
+
module Syck
|
113
|
+
class Parser
|
114
|
+
alias initialize_bugged initialize
|
115
|
+
def initialize ( *a, &b )
|
116
|
+
@input = nil
|
117
|
+
initialize_bugged(*a, &b)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
class Object
|
123
|
+
def is_complex_yaml?
|
124
|
+
false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
HAVE_YAML_TAGURI = true
|
128
|
+
rescue LoadError => ex
|
129
|
+
HAVE_YAML_TAGURI = false
|
130
|
+
end
|
131
|
+
# >>>
|
132
|
+
|
74
133
|
|
75
134
|
# <<< little active_support patch
|
76
135
|
module Inflector
|
@@ -169,6 +228,7 @@ class Module
|
|
169
228
|
include CoreEx::Module::MixInWithArgs
|
170
229
|
include CoreEx::Module::AttrOnce
|
171
230
|
include CoreEx::Module::Import
|
231
|
+
include CoreEx::Module::InPlace
|
172
232
|
end # class Module
|
173
233
|
|
174
234
|
class Object
|
@@ -237,6 +297,9 @@ class Time
|
|
237
297
|
include CoreEx::Time
|
238
298
|
end # class Time
|
239
299
|
|
300
|
+
|
301
|
+
CoreEx.dir.load_path!
|
302
|
+
|
240
303
|
CoreEx::Yaml.import!
|
241
304
|
CoreEx::TryDup.import!
|
242
305
|
|
data/lib/dumpable_proc.rb
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: dumpable_proc.rb
|
4
|
+
# Revision:: $Id: dumpable_proc.rb 362 2005-09-24 17:12:57Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
class DumpableProc < Proc
|
8
8
|
|
9
9
|
def self.new ( str )
|
10
|
+
# FIXME imporve prevent from ruby injections
|
11
|
+
if str =~ /[{}]/
|
12
|
+
str = str.gsub(/[^{}]/, '')
|
13
|
+
while str.gsub!(/\{\}/, '')
|
14
|
+
end
|
15
|
+
unless str.empty?
|
16
|
+
raise ArgumentError, "Bad block: bad `{' `}' equilibration"
|
17
|
+
end
|
18
|
+
end
|
10
19
|
pr = super(&eval("proc { #{str} }"))
|
11
20
|
pr.instance_eval { @str = str.freeze }
|
12
21
|
pr
|
data/lib/yaml_extension.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: yaml_extension.rb
|
4
|
+
# Revision:: $Id: yaml_extension.rb 383 2005-10-02 16:48:09Z ertai $
|
5
5
|
|
6
6
|
require 'yaml'
|
7
7
|
|
@@ -11,7 +11,7 @@ module YamlExtension
|
|
11
11
|
theYamlType = aliases.shift
|
12
12
|
case theYamlType
|
13
13
|
when NilClass
|
14
|
-
theYamlType = self.name.
|
14
|
+
theYamlType = self.name.demodulize.underscore
|
15
15
|
when String
|
16
16
|
when Symbol
|
17
17
|
else
|
@@ -22,12 +22,19 @@ module YamlExtension
|
|
22
22
|
yamlTypes << theYamlType
|
23
23
|
yamlTypes.map! { |x| x.to_s.sub(/^!/, '') }
|
24
24
|
|
25
|
-
undef_method :to_yaml_type
|
26
25
|
old_to_yaml = :"#{theYamlType}_to_yaml"
|
27
26
|
alias_method old_to_yaml, :to_yaml
|
28
27
|
suppress(NoMethodError, NameError) { remove_method :to_yaml }
|
29
28
|
|
30
|
-
|
29
|
+
if HAVE_YAML_TAGURI
|
30
|
+
taguri_ = theYamlType.to_s
|
31
|
+
domain = 'yaml.org,2002' # FIXME 'feydakins.org,2005'
|
32
|
+
taguri_ = "tag:#{domain}:#{taguri_}" unless taguri_ =~ /^tag:/
|
33
|
+
define_method(:taguri) { taguri_ }
|
34
|
+
else
|
35
|
+
suppress(NoMethodError, NameError) { undef_method :to_yaml_type }
|
36
|
+
define_method(:to_yaml_type) { "!#{theYamlType}" }
|
37
|
+
end
|
31
38
|
|
32
39
|
theClass = self
|
33
40
|
yamlTypes.each do |yamlType|
|
@@ -37,13 +44,25 @@ module YamlExtension
|
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
if HAVE_YAML_TAGURI
|
48
|
+
def to_yaml ( opts={} )
|
49
|
+
if respond_to? :to_yaml_string
|
50
|
+
YAML::quick_emit(object_id, opts) do |out|
|
51
|
+
out.scalar(taguri, to_yaml_string, :plain)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
send(old_to_yaml, opts)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
else
|
58
|
+
def to_yaml ( opts={} )
|
59
|
+
if respond_to? :to_yaml_string
|
60
|
+
YAML::quick_emit(self.object_id, opts) do |out|
|
61
|
+
out << "#{to_yaml_type} #{to_yaml_string}"
|
62
|
+
end
|
63
|
+
else
|
64
|
+
send(old_to_yaml, opts)
|
44
65
|
end
|
45
|
-
else
|
46
|
-
send(old_to_yaml, opts)
|
47
66
|
end
|
48
67
|
end
|
49
68
|
|
@@ -56,7 +75,7 @@ module YamlExtension
|
|
56
75
|
attr_accessor :val, :str, :ref
|
57
76
|
|
58
77
|
def assert_yaml_load ( aString, aClass, anObject=nil )
|
59
|
-
assert_nothing_raised { @val = YAML::load(aString) }
|
78
|
+
assert_nothing_raised { @val = YAML::load("---\n" + aString) }
|
60
79
|
assert_kind_of(aClass, @val)
|
61
80
|
assert_equal(anObject, @val) unless anObject.nil?
|
62
81
|
@ref = aString
|
@@ -64,6 +83,8 @@ module YamlExtension
|
|
64
83
|
|
65
84
|
def assert_yaml_dump ( anObject, ref, options={} )
|
66
85
|
assert_nothing_raised { @str = anObject.to_yaml(options) }
|
86
|
+
@str.gsub!(/---\s*/, '')
|
87
|
+
@str.chomp!
|
67
88
|
if ref.is_a? Regexp
|
68
89
|
assert_match(ref, @str)
|
69
90
|
else
|
data/test/check-pkg-core_ex.yml
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
---
|
2
2
|
|
3
|
-
# Run this suite with -S 'url: scheme://the/url/to/the/
|
3
|
+
# Run this suite with -S 'url: scheme://the/url/to/the/core_ex/package'
|
4
4
|
CoreEx Package Test Suite: !S::Suite
|
5
5
|
contents:
|
6
6
|
|
7
7
|
- Checkout: !S::Checkout
|
8
8
|
url: <<url>>
|
9
9
|
fatal: true
|
10
|
+
weight: 0
|
10
11
|
|
11
12
|
- Check the package: !S::Import
|
12
13
|
import: <<checkout_dir>>/test/check-core_ex.yml
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.10
|
3
3
|
specification_version: 1
|
4
4
|
name: core_ex
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-
|
6
|
+
version: 0.4.0
|
7
|
+
date: 2005-10-03
|
8
8
|
summary: CoreEx is a proposal for a standard library extension.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -31,8 +31,6 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
31
31
|
version: 0.0.0
|
32
32
|
version:
|
33
33
|
platform: ruby
|
34
|
-
signing_key:
|
35
|
-
cert_chain:
|
36
34
|
authors:
|
37
35
|
- Nicolas Despr�s
|
38
36
|
- Nicolas Pouillard
|
@@ -59,6 +57,7 @@ files:
|
|
59
57
|
- lib/core_ex/dependencies_ext/constant_load_path.rb
|
60
58
|
- lib/core_ex/module/attr_once.rb
|
61
59
|
- lib/core_ex/module/import.rb
|
60
|
+
- lib/core_ex/module/in_place.rb
|
62
61
|
- lib/core_ex/module/mix_in_with_args.rb
|
63
62
|
- lib/core_ex/object/instance_eval_with_args.rb
|
64
63
|
- lib/core_ex/object/singleton_class.rb
|
@@ -81,6 +80,7 @@ files:
|
|
81
80
|
- test/sanity/multiple-requires.yml
|
82
81
|
- test/sanity/single-requires.yml
|
83
82
|
- AUTHORS
|
83
|
+
- ChangeLog
|
84
84
|
- NEWS
|
85
85
|
- Rakefile
|
86
86
|
- README
|