extlib 0.9.13 → 0.9.14
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of extlib might be problematic. Click here for more details.
- data/.autotest +21 -0
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +1 -1
- data/README.rdoc +17 -0
- data/Rakefile +18 -170
- data/VERSION +1 -0
- data/extlib.gemspec +146 -0
- data/lib/extlib/class.rb +8 -8
- data/lib/extlib/hash.rb +7 -7
- data/lib/extlib/inflection.rb +11 -5
- data/lib/extlib/lazy_array.rb +26 -32
- data/lib/extlib/mash.rb +11 -11
- data/lib/extlib/object.rb +9 -9
- data/lib/extlib/object_space.rb +1 -1
- data/lib/extlib/rubygems.rb +1 -1
- data/lib/extlib/string.rb +4 -3
- data/spec/inflection_extras_spec.rb +18 -1
- data/spec/lazy_array_spec.rb +25 -0
- data/spec/rcov.opts +6 -0
- data/spec/spec.opts +1 -0
- data/spec/string_spec.rb +1 -0
- data/tasks/ci.rake +1 -0
- data/tasks/metrics.rake +36 -0
- data/tasks/spec.rake +25 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +81 -20
- data/History.txt +0 -77
- data/README +0 -0
- data/lib/extlib/tasks/release.rb +0 -15
- data/lib/extlib/version.rb +0 -3
data/.autotest
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Autotest.add_hook :initialize do |at|
|
2
|
+
ignore = %w[ .git log plugins script tasks bin CHANGELOG FAQ MIT-LICENSE QUICKLINKS README ]
|
3
|
+
|
4
|
+
ignore.each do |exception|
|
5
|
+
at.add_exception(exception)
|
6
|
+
end
|
7
|
+
|
8
|
+
at.clear_mappings
|
9
|
+
|
10
|
+
at.add_mapping(%r{^spec/.+_spec\.rb$}) do |filename,_|
|
11
|
+
filename
|
12
|
+
end
|
13
|
+
|
14
|
+
at.add_mapping(%r{^lib/extlib/(.+)\.rb$}) do |_,match|
|
15
|
+
[ "spec/#{match[1]}_spec.rb" ]
|
16
|
+
end
|
17
|
+
|
18
|
+
at.add_mapping(%r{^spec/spec_helper\.rb$}) do
|
19
|
+
at.files_matching(%r{^spec/.+_spec\.rb$})
|
20
|
+
end
|
21
|
+
end
|
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
CHANGED
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= extlib
|
2
|
+
|
3
|
+
Support library for DataMapper and Merb.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2009 Dan Kubb. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,180 +1,28 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
1
|
require 'rubygems'
|
4
|
-
require 'rubygems/installer'
|
5
2
|
require 'rake'
|
6
|
-
require "rake/clean"
|
7
|
-
require "rake/gempackagetask"
|
8
|
-
require "fileutils"
|
9
|
-
require Pathname('spec/rake/spectask')
|
10
|
-
require Pathname('lib/extlib/version')
|
11
3
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS'])
|
4
|
+
begin
|
5
|
+
gem 'jeweler', '~> 1.4'
|
6
|
+
require 'jeweler'
|
16
7
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
8
|
+
Jeweler::Tasks.new do |gem|
|
9
|
+
gem.name = 'extlib'
|
10
|
+
gem.summary = 'Support library for DataMapper and Merb'
|
11
|
+
gem.description = gem.summary
|
12
|
+
gem.email = 'dan.kubb@gmail.com'
|
13
|
+
gem.homepage = 'http://github.com/datamapper/extlib'
|
14
|
+
gem.authors = [ 'Dan Kubb' ]
|
24
15
|
|
25
|
-
|
26
|
-
EMAIL = "dan.kubb@gmail.com"
|
16
|
+
gem.rubyforge_project = 'extlib'
|
27
17
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
RELEASE_NAME = "REL #{GEM_VERSION}"
|
33
|
-
|
34
|
-
require "lib/extlib/tasks/release"
|
35
|
-
|
36
|
-
spec = Gem::Specification.new do |s|
|
37
|
-
s.name = GEM_NAME
|
38
|
-
s.version = GEM_VERSION
|
39
|
-
s.platform = Gem::Platform::RUBY
|
40
|
-
s.author = AUTHOR
|
41
|
-
s.email = EMAIL
|
42
|
-
s.homepage = PROJECT_URL
|
43
|
-
s.summary = PROJECT_SUMMARY
|
44
|
-
s.description = PROJECT_DESCRIPTION
|
45
|
-
s.require_path = 'lib'
|
46
|
-
s.files = %w[ LICENSE README Rakefile History.txt ] + Dir['lib/**/*'] + Dir['spec/**/*']
|
47
|
-
|
48
|
-
# rdoc
|
49
|
-
s.has_rdoc = false
|
50
|
-
s.extra_rdoc_files = %w[ LICENSE README History.txt ]
|
51
|
-
|
52
|
-
# Dependencies
|
53
|
-
# s.add_dependency "english", ">=0.2.0"
|
54
|
-
end
|
55
|
-
|
56
|
-
Rake::GemPackageTask.new(spec) do |package|
|
57
|
-
package.gem_spec = spec
|
58
|
-
end
|
59
|
-
|
60
|
-
desc 'Remove all package, docs and spec products'
|
61
|
-
task :clobber_all => %w[ clobber_package clobber_doc extlib:clobber_spec ]
|
62
|
-
|
63
|
-
##############################################################################
|
64
|
-
# Specs and continous integration
|
65
|
-
##############################################################################
|
66
|
-
task :default => 'extlib:spec'
|
67
|
-
task :spec => 'extlib:spec'
|
68
|
-
|
69
|
-
namespace :extlib do
|
70
|
-
Spec::Rake::SpecTask.new(:spec) do |t|
|
71
|
-
t.spec_opts << '--options' << ROOT + 'spec/spec.opts'
|
72
|
-
t.spec_files = Pathname.glob(ENV['FILES'] || 'spec/**/*_spec.rb').map { |f| f.to_s }
|
73
|
-
t.libs << 'lib'
|
74
|
-
begin
|
75
|
-
gem 'rcov'
|
76
|
-
t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
|
77
|
-
t.rcov_opts << '--exclude' << 'spec'
|
78
|
-
t.rcov_opts << '--text-summary'
|
79
|
-
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
80
|
-
rescue LoadError
|
81
|
-
# rcov not installed
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
|
-
##############################################################################
|
88
|
-
# Documentation
|
89
|
-
##############################################################################
|
90
|
-
desc "Generate documentation"
|
91
|
-
task :doc do
|
92
|
-
begin
|
93
|
-
require 'yard'
|
94
|
-
exec 'yardoc'
|
95
|
-
rescue LoadError
|
96
|
-
puts 'You will need to install the latest version of Yard to generate the
|
97
|
-
documentation for extlib.'
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def sudo_gem(cmd)
|
102
|
-
sh "#{SUDO} #{RUBY} -S gem #{cmd}", :verbose => false
|
103
|
-
end
|
104
|
-
|
105
|
-
desc "Install #{GEM_NAME}"
|
106
|
-
task :install => :package do
|
107
|
-
sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION}"
|
108
|
-
end
|
109
|
-
|
110
|
-
if WINDOWS
|
111
|
-
namespace :dev do
|
112
|
-
desc 'Install for development (for Windows)'
|
113
|
-
task :winstall => :gem do
|
114
|
-
system %{gem install --no-rdoc --no-ri -l pkg/#{GEM_NAME}-#{GEM_VERSION}.gem}
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
namespace :ci do
|
120
|
-
|
121
|
-
task :prepare do
|
122
|
-
rm_rf ROOT + "ci"
|
123
|
-
mkdir_p ROOT + "ci"
|
124
|
-
mkdir_p ROOT + "ci/doc"
|
125
|
-
mkdir_p ROOT + "ci/cyclomatic"
|
126
|
-
mkdir_p ROOT + "ci/token"
|
18
|
+
gem.add_development_dependency 'json_pure', '~> 1.2.0'
|
19
|
+
gem.add_development_dependency 'rspec', '~> 1.2.9'
|
20
|
+
gem.add_development_dependency 'yard', '~> 0.4.0'
|
127
21
|
end
|
128
22
|
|
129
|
-
|
130
|
-
out = ENV['CC_BUILD_ARTIFACTS'] || "out"
|
131
|
-
mkdir_p out unless File.directory? out
|
132
|
-
|
133
|
-
mv "ci/rspec_report.html", "#{out}/rspec_report.html"
|
134
|
-
mv "ci/coverage", "#{out}/coverage"
|
135
|
-
mv "ci/doc", "#{out}/doc"
|
136
|
-
mv "ci/cyclomatic", "#{out}/cyclomatic_complexity"
|
137
|
-
mv "ci/token", "#{out}/token_complexity"
|
138
|
-
end
|
139
|
-
|
140
|
-
task :spec => :prepare do
|
141
|
-
Rake::Task[:spec].invoke
|
142
|
-
mv ROOT + "coverage", ROOT + "ci/coverage"
|
143
|
-
Rake::Task[:gem]
|
144
|
-
Gem::Installer.new("pkg/#{GEM_NAME}-#{GEM_VERSION}.gem").install
|
145
|
-
end
|
146
|
-
|
147
|
-
task :doc do
|
148
|
-
require 'yard'
|
149
|
-
sh 'yardoc'
|
150
|
-
end
|
23
|
+
Jeweler::GemcutterTasks.new
|
151
24
|
|
152
|
-
task
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
system "saikuro -t -i lib -y 0 -w 20 -e 30 -o ci/token"
|
157
|
-
mv 'ci/token/index_token.html', 'ci/token/index.html'
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
task :ci => ["ci:spec"]
|
163
|
-
|
164
|
-
desc 'Default: run spec examples'
|
165
|
-
task :default => 'spec'
|
166
|
-
|
167
|
-
##############################################################################
|
168
|
-
# Benchmarks
|
169
|
-
##############################################################################
|
170
|
-
|
171
|
-
namespace :benchmark do
|
172
|
-
desc "Runs benchmarks"
|
173
|
-
task :run do
|
174
|
-
files = Dir["benchmarks/**/*.rb"]
|
175
|
-
|
176
|
-
files.each do |f|
|
177
|
-
system "ruby #{f}"
|
178
|
-
end
|
179
|
-
end
|
25
|
+
FileList['tasks/**/*.rake'].each { |task| load task }
|
26
|
+
rescue LoadError
|
27
|
+
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
|
180
28
|
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.14
|
data/extlib.gemspec
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{extlib}
|
8
|
+
s.version = "0.9.14"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Dan Kubb"]
|
12
|
+
s.date = %q{2009-12-11}
|
13
|
+
s.description = %q{Support library for DataMapper and Merb}
|
14
|
+
s.email = %q{dan.kubb@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".autotest",
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"extlib.gemspec",
|
28
|
+
"lib/extlib.rb",
|
29
|
+
"lib/extlib/array.rb",
|
30
|
+
"lib/extlib/assertions.rb",
|
31
|
+
"lib/extlib/blank.rb",
|
32
|
+
"lib/extlib/boolean.rb",
|
33
|
+
"lib/extlib/byte_array.rb",
|
34
|
+
"lib/extlib/class.rb",
|
35
|
+
"lib/extlib/datetime.rb",
|
36
|
+
"lib/extlib/dictionary.rb",
|
37
|
+
"lib/extlib/hash.rb",
|
38
|
+
"lib/extlib/hook.rb",
|
39
|
+
"lib/extlib/inflection.rb",
|
40
|
+
"lib/extlib/lazy_array.rb",
|
41
|
+
"lib/extlib/lazy_module.rb",
|
42
|
+
"lib/extlib/logger.rb",
|
43
|
+
"lib/extlib/mash.rb",
|
44
|
+
"lib/extlib/module.rb",
|
45
|
+
"lib/extlib/nil.rb",
|
46
|
+
"lib/extlib/numeric.rb",
|
47
|
+
"lib/extlib/object.rb",
|
48
|
+
"lib/extlib/object_space.rb",
|
49
|
+
"lib/extlib/pathname.rb",
|
50
|
+
"lib/extlib/pooling.rb",
|
51
|
+
"lib/extlib/rubygems.rb",
|
52
|
+
"lib/extlib/simple_set.rb",
|
53
|
+
"lib/extlib/string.rb",
|
54
|
+
"lib/extlib/struct.rb",
|
55
|
+
"lib/extlib/symbol.rb",
|
56
|
+
"lib/extlib/time.rb",
|
57
|
+
"lib/extlib/virtual_file.rb",
|
58
|
+
"spec/array_spec.rb",
|
59
|
+
"spec/blank_spec.rb",
|
60
|
+
"spec/byte_array_spec.rb",
|
61
|
+
"spec/class_spec.rb",
|
62
|
+
"spec/datetime_spec.rb",
|
63
|
+
"spec/hash_spec.rb",
|
64
|
+
"spec/hook_spec.rb",
|
65
|
+
"spec/inflection/plural_spec.rb",
|
66
|
+
"spec/inflection/singular_spec.rb",
|
67
|
+
"spec/inflection_extras_spec.rb",
|
68
|
+
"spec/lazy_array_spec.rb",
|
69
|
+
"spec/lazy_module_spec.rb",
|
70
|
+
"spec/mash_spec.rb",
|
71
|
+
"spec/module_spec.rb",
|
72
|
+
"spec/object_space_spec.rb",
|
73
|
+
"spec/object_spec.rb",
|
74
|
+
"spec/pooling_spec.rb",
|
75
|
+
"spec/rcov.opts",
|
76
|
+
"spec/simple_set_spec.rb",
|
77
|
+
"spec/spec.opts",
|
78
|
+
"spec/spec_helper.rb",
|
79
|
+
"spec/string_spec.rb",
|
80
|
+
"spec/struct_spec.rb",
|
81
|
+
"spec/symbol_spec.rb",
|
82
|
+
"spec/time_spec.rb",
|
83
|
+
"spec/try_call_spec.rb",
|
84
|
+
"spec/try_dup_spec.rb",
|
85
|
+
"spec/virtual_file_spec.rb",
|
86
|
+
"tasks/ci.rake",
|
87
|
+
"tasks/metrics.rake",
|
88
|
+
"tasks/spec.rake",
|
89
|
+
"tasks/yard.rake",
|
90
|
+
"tasks/yardstick.rake"
|
91
|
+
]
|
92
|
+
s.homepage = %q{http://github.com/datamapper/extlib}
|
93
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
94
|
+
s.require_paths = ["lib"]
|
95
|
+
s.rubyforge_project = %q{extlib}
|
96
|
+
s.rubygems_version = %q{1.3.5}
|
97
|
+
s.summary = %q{Support library for DataMapper and Merb}
|
98
|
+
s.test_files = [
|
99
|
+
"spec/array_spec.rb",
|
100
|
+
"spec/blank_spec.rb",
|
101
|
+
"spec/byte_array_spec.rb",
|
102
|
+
"spec/class_spec.rb",
|
103
|
+
"spec/datetime_spec.rb",
|
104
|
+
"spec/hash_spec.rb",
|
105
|
+
"spec/hook_spec.rb",
|
106
|
+
"spec/inflection/plural_spec.rb",
|
107
|
+
"spec/inflection/singular_spec.rb",
|
108
|
+
"spec/inflection_extras_spec.rb",
|
109
|
+
"spec/lazy_array_spec.rb",
|
110
|
+
"spec/lazy_module_spec.rb",
|
111
|
+
"spec/mash_spec.rb",
|
112
|
+
"spec/module_spec.rb",
|
113
|
+
"spec/object_space_spec.rb",
|
114
|
+
"spec/object_spec.rb",
|
115
|
+
"spec/pooling_spec.rb",
|
116
|
+
"spec/simple_set_spec.rb",
|
117
|
+
"spec/spec_helper.rb",
|
118
|
+
"spec/string_spec.rb",
|
119
|
+
"spec/struct_spec.rb",
|
120
|
+
"spec/symbol_spec.rb",
|
121
|
+
"spec/time_spec.rb",
|
122
|
+
"spec/try_call_spec.rb",
|
123
|
+
"spec/try_dup_spec.rb",
|
124
|
+
"spec/virtual_file_spec.rb"
|
125
|
+
]
|
126
|
+
|
127
|
+
if s.respond_to? :specification_version then
|
128
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
129
|
+
s.specification_version = 3
|
130
|
+
|
131
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
132
|
+
s.add_development_dependency(%q<json_pure>, ["~> 1.2.0"])
|
133
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
|
134
|
+
s.add_development_dependency(%q<yard>, ["~> 0.4.0"])
|
135
|
+
else
|
136
|
+
s.add_dependency(%q<json_pure>, ["~> 1.2.0"])
|
137
|
+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
|
138
|
+
s.add_dependency(%q<yard>, ["~> 0.4.0"])
|
139
|
+
end
|
140
|
+
else
|
141
|
+
s.add_dependency(%q<json_pure>, ["~> 1.2.0"])
|
142
|
+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
|
143
|
+
s.add_dependency(%q<yard>, ["~> 0.4.0"])
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
data/lib/extlib/class.rb
CHANGED
@@ -28,8 +28,8 @@
|
|
28
28
|
class Class
|
29
29
|
# Defines class-level and instance-level attribute reader.
|
30
30
|
#
|
31
|
-
# @param *syms<Array
|
32
|
-
# @return
|
31
|
+
# @param [*syms<Array] Array of attributes to define reader for.
|
32
|
+
# @return [Array<#to_s>] List of attributes that were made into cattr_readers
|
33
33
|
#
|
34
34
|
# @api public
|
35
35
|
#
|
@@ -56,9 +56,9 @@ class Class
|
|
56
56
|
|
57
57
|
# Defines class-level (and optionally instance-level) attribute writer.
|
58
58
|
#
|
59
|
-
# @param
|
59
|
+
# @param [Array<*#to_s, Hash{:instance_writer => Boolean}>] Array of attributes to define writer for.
|
60
60
|
# @option syms :instance_writer<Boolean> if true, instance-level attribute writer is defined.
|
61
|
-
# @return
|
61
|
+
# @return [Array<#to_s>] List of attributes that were made into cattr_writers
|
62
62
|
#
|
63
63
|
# @api public
|
64
64
|
def cattr_writer(*syms)
|
@@ -88,7 +88,7 @@ class Class
|
|
88
88
|
#
|
89
89
|
# @param *syms<Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to define accessor for.
|
90
90
|
# @option syms :instance_writer<Boolean> if true, instance-level attribute writer is defined.
|
91
|
-
# @return
|
91
|
+
# @return [Array<#to_s>] List of attributes that were made into accessors
|
92
92
|
#
|
93
93
|
# @api public
|
94
94
|
def cattr_accessor(*syms)
|
@@ -100,7 +100,7 @@ class Class
|
|
100
100
|
# each subclass has a copy of parent's attribute.
|
101
101
|
#
|
102
102
|
# @param *syms<Array[#to_s]> Array of attributes to define inheritable reader for.
|
103
|
-
# @return
|
103
|
+
# @return [Array<#to_s>] Array of attributes converted into inheritable_readers.
|
104
104
|
#
|
105
105
|
# @api public
|
106
106
|
#
|
@@ -139,7 +139,7 @@ class Class
|
|
139
139
|
# @param *syms<Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to
|
140
140
|
# define inheritable writer for.
|
141
141
|
# @option syms :instance_writer<Boolean> if true, instance-level inheritable attribute writer is defined.
|
142
|
-
# @return
|
142
|
+
# @return [Array<#to_s>] An Array of the attributes that were made into inheritable writers.
|
143
143
|
#
|
144
144
|
# @api public
|
145
145
|
#
|
@@ -167,7 +167,7 @@ class Class
|
|
167
167
|
# @param *syms<Array[*#to_s, Hash{:instance_writer => Boolean}]> Array of attributes to
|
168
168
|
# define inheritable accessor for.
|
169
169
|
# @option syms :instance_writer<Boolean> if true, instance-level inheritable attribute writer is defined.
|
170
|
-
# @return
|
170
|
+
# @return [Array<#to_s>] An Array of attributes turned into inheritable accessors.
|
171
171
|
#
|
172
172
|
# @api public
|
173
173
|
def class_inheritable_accessor(*syms)
|