zucker 4 → 5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +15 -1
- data/Rakefile +44 -0
- data/lib/zucker.rb +71 -10
- data/lib/zucker/1/D.rb +2 -0
- data/lib/zucker/1/aliases.rb +2 -0
- data/lib/zucker/1/all.rb +2 -0
- data/lib/zucker/1/array.rb +2 -0
- data/lib/zucker/1/array2proc.rb +2 -0
- data/lib/zucker/1/binding.rb +2 -0
- data/lib/zucker/1/blank.rb +2 -0
- data/lib/zucker/1/class2proc.rb +2 -0
- data/lib/zucker/1/debug.rb +2 -0
- data/lib/zucker/1/default.rb +2 -0
- data/lib/zucker/1/egonil.rb +2 -0
- data/lib/zucker/1/enumerable.rb +2 -0
- data/lib/zucker/1/hash.rb +2 -0
- data/lib/zucker/1/hash2proc.rb +2 -0
- data/lib/zucker/1/iterate.rb +2 -0
- data/lib/zucker/1/ivars.rb +2 -0
- data/lib/zucker/1/kernel.rb +2 -0
- data/lib/zucker/1/mcopy.rb +2 -0
- data/lib/zucker/1/mm.rb +2 -0
- data/lib/zucker/1/regexp2proc.rb +2 -0
- data/lib/zucker/1/sandbox.rb +2 -0
- data/lib/zucker/1/square_brackets_for.rb +2 -0
- data/lib/zucker/1/string.rb +2 -0
- data/lib/zucker/1/unary.rb +2 -0
- data/lib/zucker/1/union.rb +2 -0
- data/lib/zucker/2/D.rb +2 -0
- data/lib/zucker/2/aliases.rb +2 -0
- data/lib/zucker/2/all.rb +2 -0
- data/lib/zucker/2/array.rb +2 -0
- data/lib/zucker/2/array2proc.rb +2 -0
- data/lib/zucker/2/binding.rb +2 -0
- data/lib/zucker/2/blank.rb +2 -0
- data/lib/zucker/2/class2proc.rb +2 -0
- data/lib/zucker/2/debug.rb +2 -0
- data/lib/zucker/2/default.rb +2 -0
- data/lib/zucker/2/egonil.rb +2 -0
- data/lib/zucker/2/enumerable.rb +2 -0
- data/lib/zucker/2/hash.rb +2 -0
- data/lib/zucker/2/hash2proc.rb +2 -0
- data/lib/zucker/2/info.rb +2 -0
- data/lib/zucker/2/iterate.rb +2 -0
- data/lib/zucker/2/ivars.rb +2 -0
- data/lib/zucker/2/kernel.rb +2 -0
- data/lib/zucker/2/mcopy.rb +2 -0
- data/lib/zucker/2/mm.rb +2 -0
- data/lib/zucker/2/regexp2proc.rb +2 -0
- data/lib/zucker/2/sandbox.rb +2 -0
- data/lib/zucker/2/square_brackets_for.rb +2 -0
- data/lib/zucker/2/string.rb +2 -0
- data/lib/zucker/2/unary.rb +2 -0
- data/lib/zucker/2/union.rb +2 -0
- data/lib/zucker/3/D.rb +2 -0
- data/lib/zucker/3/alias_for.rb +2 -0
- data/lib/zucker/3/aliases.rb +2 -0
- data/lib/zucker/3/all.rb +2 -0
- data/lib/zucker/3/array.rb +2 -0
- data/lib/zucker/3/array2proc.rb +2 -0
- data/lib/zucker/3/binding.rb +2 -0
- data/lib/zucker/3/blank.rb +2 -0
- data/lib/zucker/3/class2proc.rb +2 -0
- data/lib/zucker/3/debug.rb +2 -0
- data/lib/zucker/3/default.rb +2 -0
- data/lib/zucker/3/egonil.rb +2 -0
- data/lib/zucker/3/enumerable.rb +2 -0
- data/lib/zucker/3/hash.rb +2 -0
- data/lib/zucker/3/hash2proc.rb +2 -0
- data/lib/zucker/3/info.rb +2 -0
- data/lib/zucker/3/iterate.rb +2 -0
- data/lib/zucker/3/ivars.rb +2 -0
- data/lib/zucker/3/kernel.rb +2 -0
- data/lib/zucker/3/mcopy.rb +2 -0
- data/lib/zucker/3/mm.rb +2 -0
- data/lib/zucker/3/not.rb +2 -0
- data/lib/zucker/3/regexp2proc.rb +2 -0
- data/lib/zucker/3/sandbox.rb +2 -0
- data/lib/zucker/3/square_brackets_for.rb +2 -0
- data/lib/zucker/3/string.rb +2 -0
- data/lib/zucker/3/tap.rb +2 -0
- data/lib/zucker/3/unary.rb +2 -0
- data/lib/zucker/3/union.rb +2 -0
- data/lib/zucker/{D.rb → 4/D.rb} +2 -0
- data/lib/zucker/4/alias_for.rb +21 -0
- data/lib/zucker/4/aliases.rb +35 -0
- data/lib/zucker/4/all.rb +8 -0
- data/lib/zucker/4/array.rb +25 -0
- data/lib/zucker/4/array2proc.rb +18 -0
- data/lib/zucker/4/binding.rb +27 -0
- data/lib/zucker/4/blank.rb +28 -0
- data/lib/zucker/4/class2proc.rb +12 -0
- data/lib/zucker/4/debug.rb +8 -0
- data/lib/zucker/4/default.rb +40 -0
- data/lib/zucker/4/egonil.rb +16 -0
- data/lib/zucker/4/engine.rb +69 -0
- data/lib/zucker/4/enumerable.rb +14 -0
- data/lib/zucker/4/hash.rb +21 -0
- data/lib/zucker/4/hash2proc.rb +16 -0
- data/lib/zucker/4/info.rb +173 -0
- data/lib/zucker/4/iterate.rb +25 -0
- data/lib/zucker/4/ivars.rb +28 -0
- data/lib/zucker/4/kernel.rb +27 -0
- data/lib/zucker/4/mcopy.rb +10 -0
- data/lib/zucker/4/mm.rb +33 -0
- data/lib/zucker/4/not.rb +19 -0
- data/lib/zucker/4/os.rb +50 -0
- data/lib/zucker/{q.rb → 4/q.rb} +2 -0
- data/lib/zucker/4/regexp2proc.rb +12 -0
- data/lib/zucker/4/sandbox.rb +23 -0
- data/lib/zucker/4/square_brackets_for.rb +22 -0
- data/lib/zucker/4/string.rb +54 -0
- data/lib/zucker/4/tap.rb +11 -0
- data/lib/zucker/4/unary.rb +24 -0
- data/lib/zucker/4/union.rb +16 -0
- data/lib/zucker/4/version.rb +115 -0
- data/lib/zucker/5/alias_for.rb +21 -0
- data/lib/zucker/5/aliases.rb +51 -0
- data/lib/zucker/5/all.rb +4 -0
- data/lib/zucker/5/array.rb +25 -0
- data/lib/zucker/5/array2proc.rb +18 -0
- data/lib/zucker/5/binding.rb +34 -0
- data/lib/zucker/5/blank.rb +28 -0
- data/lib/zucker/5/cc.rb +25 -0
- data/lib/zucker/5/class2proc.rb +12 -0
- data/lib/zucker/5/control.rb +4 -0
- data/lib/zucker/5/dd.rb +24 -0
- data/lib/zucker/5/debug.rb +4 -0
- data/lib/zucker/5/default.rb +4 -0
- data/lib/zucker/5/egonil.rb +16 -0
- data/lib/zucker/5/engine.rb +69 -0
- data/lib/zucker/5/enumerable.rb +14 -0
- data/lib/zucker/5/env.rb +4 -0
- data/lib/zucker/5/extensions.rb +4 -0
- data/lib/zucker/5/hash.rb +27 -0
- data/lib/zucker/5/hash2proc.rb +16 -0
- data/lib/zucker/5/info.rb +177 -0
- data/lib/zucker/5/iterate.rb +26 -0
- data/lib/zucker/5/ivars.rb +28 -0
- data/lib/zucker/5/kernel.rb +34 -0
- data/lib/zucker/5/mcopy.rb +10 -0
- data/lib/zucker/5/mm.rb +34 -0
- data/lib/zucker/5/not.rb +19 -0
- data/lib/zucker/5/object.rb +4 -0
- data/lib/zucker/5/oo.rb +17 -0
- data/lib/zucker/5/os.rb +49 -0
- data/lib/zucker/5/qq.rb +12 -0
- data/lib/zucker/5/regexp2proc.rb +12 -0
- data/lib/zucker/5/sandbox.rb +25 -0
- data/lib/zucker/5/shortcuts.rb +4 -0
- data/lib/zucker/5/square_brackets_for.rb +21 -0
- data/lib/zucker/5/string.rb +54 -0
- data/lib/zucker/5/tap.rb +11 -0
- data/lib/zucker/5/to_proc.rb +4 -0
- data/lib/zucker/5/unary.rb +24 -0
- data/lib/zucker/5/union.rb +16 -0
- data/lib/zucker/5/version.rb +118 -0
- data/lib/zucker/alias_for.rb +2 -0
- data/lib/zucker/aliases.rb +19 -1
- data/lib/zucker/all.rb +3 -5
- data/lib/zucker/array.rb +2 -0
- data/lib/zucker/array2proc.rb +2 -0
- data/lib/zucker/binding.rb +5 -0
- data/lib/zucker/blank.rb +2 -0
- data/lib/zucker/cc.rb +25 -0
- data/lib/zucker/class2proc.rb +2 -0
- data/lib/zucker/control.rb +4 -0
- data/lib/zucker/dd.rb +23 -0
- data/lib/zucker/debug.rb +2 -4
- data/lib/zucker/default.rb +2 -36
- data/lib/zucker/egonil.rb +2 -0
- data/lib/zucker/engine.rb +3 -1
- data/lib/zucker/enumerable.rb +2 -0
- data/lib/zucker/env.rb +4 -0
- data/lib/zucker/extensions.rb +4 -0
- data/lib/zucker/hash.rb +8 -0
- data/lib/zucker/hash2proc.rb +2 -0
- data/lib/zucker/info.rb +23 -17
- data/lib/zucker/iterate.rb +3 -0
- data/lib/zucker/ivars.rb +2 -0
- data/lib/zucker/kernel.rb +12 -3
- data/lib/zucker/mcopy.rb +2 -0
- data/lib/zucker/mm.rb +5 -2
- data/lib/zucker/not.rb +2 -0
- data/lib/zucker/object.rb +4 -0
- data/lib/zucker/oo.rb +17 -0
- data/lib/zucker/os.rb +5 -2
- data/lib/zucker/qq.rb +12 -0
- data/lib/zucker/regexp2proc.rb +2 -0
- data/lib/zucker/sandbox.rb +4 -0
- data/lib/zucker/shortcuts.rb +4 -0
- data/lib/zucker/square_brackets_for.rb +13 -12
- data/lib/zucker/string.rb +2 -0
- data/lib/zucker/tap.rb +2 -0
- data/lib/zucker/to_proc.rb +4 -0
- data/lib/zucker/unary.rb +2 -0
- data/lib/zucker/union.rb +2 -0
- data/lib/zucker/version.rb +72 -67
- metadata +87 -5
data/CHANGELOG
CHANGED
@@ -1,11 +1,25 @@
|
|
1
|
-
2010-09-
|
1
|
+
2010-09-04 | Zucker 5
|
2
|
+
* debug edition - added two debug helpers: oo (output line, method, file) and cc (output method callstack)
|
3
|
+
* renamed cube D to dd add added more debug aliases (for mm and binding)
|
4
|
+
* fixed __SPECIAL_VARS__ in info and kernel cube and some minor bugfixes
|
5
|
+
* Zucker.activate_more_aliases! option
|
6
|
+
* added Hash#&
|
7
|
+
* added aliases: File.filename (for basename), Dir.join and Dir.split (for File.join, split)
|
8
|
+
* added a flexible requiring mechansim in zucker.rb (no api changes)
|
9
|
+
* restructered packages
|
10
|
+
* added rake tasks for releasing
|
11
|
+
* improved RubyVersion constant (cleaner and more flexible)
|
12
|
+
|
2
13
|
|
14
|
+
2010-09-01 | Zucker 4
|
15
|
+
* fixed Binding#inspect
|
3
16
|
* added RubyEngine constant
|
4
17
|
* added RubyVersion constant
|
5
18
|
* added OS constant
|
6
19
|
* added q debug method (like p but on one line)
|
7
20
|
* added String#-
|
8
21
|
|
22
|
+
|
9
23
|
2010-08-14 | Zucker 3
|
10
24
|
* added tap cube
|
11
25
|
* added Object#not
|
data/Rakefile
CHANGED
@@ -18,6 +18,9 @@ end
|
|
18
18
|
task 'default' => 'spec'
|
19
19
|
Spec::Rake::SpecTask.new('spec') do |t|
|
20
20
|
t.spec_files = FileList['spec/*.rb']
|
21
|
+
if RUBY_VERSION < '1.9'
|
22
|
+
t.spec_files -= Zucker::NON_1_8_CUBES.map{|e| "spec/#{e}_spec.rb"}
|
23
|
+
end
|
21
24
|
end
|
22
25
|
|
23
26
|
# gem
|
@@ -41,3 +44,44 @@ Rake::GemPackageTask.new(spec) do |pkg|
|
|
41
44
|
pkg.gem_spec = spec
|
42
45
|
end
|
43
46
|
|
47
|
+
# release
|
48
|
+
desc 'run specs, build doc, bump version, set date, copy version directories and add these changes to git'
|
49
|
+
task 'prepare_release' => %w[spec doc] do # run specs and doc
|
50
|
+
# really want to release?
|
51
|
+
print 'Do you really want to release? ...then enter release: '
|
52
|
+
exit if $stdin.gets.chomp != 'release'
|
53
|
+
|
54
|
+
# bump version and date
|
55
|
+
require 'date'
|
56
|
+
zucker_rb = File.read('lib/zucker.rb')
|
57
|
+
zucker_rb.sub! /VERSION\s*=.*(\d+).*$/ do "VERSION = '#{ @v = $1.to_i + 1 }'" end
|
58
|
+
zucker_rb.sub! /DATE\s*=.*$/, "DATE = '#{Date.today}'"
|
59
|
+
File.open 'lib/zucker.rb','w' do |f| f.write zucker_rb end
|
60
|
+
|
61
|
+
# copy version directories
|
62
|
+
`mkdir lib/zucker/#@v`
|
63
|
+
`cp lib/zucker/*.* lib/zucker/#@v/`
|
64
|
+
`mkdir desc/#@v`
|
65
|
+
`cp desc/*.* desc/#@v/`
|
66
|
+
`mkdir doc/#@v`
|
67
|
+
`cp doc/*.* doc/#@v/`
|
68
|
+
`mkdir spec/#@v`
|
69
|
+
`cp spec/*.* spec/#@v/`
|
70
|
+
|
71
|
+
# add changes to git and tag
|
72
|
+
`git add .`
|
73
|
+
`git commit -m 'Ruby Zucker #@v :)'`
|
74
|
+
`git tag -a v#@v -m 'Ruby Zucker #@v :)'`
|
75
|
+
|
76
|
+
# done
|
77
|
+
puts "prepared Zucker #@v gem release"
|
78
|
+
end
|
79
|
+
|
80
|
+
desc 'prepare_release, build gem, and push it to git and rubygems'
|
81
|
+
task 'release' => %w[gem] do
|
82
|
+
`git push origin master --tags`
|
83
|
+
last_gem = Dir['pkg/zucker-*.gem'].sort[-1] # TODO better sorting or date for zucker-10
|
84
|
+
exit if last_gem =~ /next/ # some error happened, do not pollute rubygems.org
|
85
|
+
puts last_gem
|
86
|
+
#`gem push pkg/#{last_gem}`
|
87
|
+
end
|
data/lib/zucker.rb
CHANGED
@@ -1,19 +1,80 @@
|
|
1
1
|
# documentation at http://rubyzucker.info or doc/zucker_doc.html
|
2
2
|
|
3
3
|
module Zucker
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
# version and date get modified by the :prepare_release rake task
|
5
|
+
VERSION = '5'
|
6
|
+
DATE = '2010-09-04'
|
7
|
+
|
8
|
+
# cube list
|
9
|
+
PACKAGES = {
|
10
|
+
:control => %w|egonil iterate tap sandbox kernel|,
|
11
|
+
:env => %w|engine info os version|,
|
12
|
+
:extensions => %w|array enumerable hash string unary union|,
|
13
|
+
:object => %w|blank mcopy not|,
|
14
|
+
:to_proc => %w|array2proc class2proc hash2proc regexp2proc|,
|
15
|
+
:shortcuts => %w|aliases alias_for square_brackets_for ivars|,
|
16
|
+
:debug => %w|binding cc dd mm oo qq|,
|
17
|
+
}
|
18
|
+
|
19
|
+
NON_1_8_CUBES = %w|not tap union|
|
20
|
+
|
21
|
+
class << self
|
22
|
+
# Zucker require helpers
|
23
|
+
def require_cube(cube, version = '')
|
24
|
+
unless RUBY_VERSION < '1.9' && Zucker::NON_1_8_CUBES.include?(cube)
|
25
|
+
require File.expand_path( File.join('..', 'zucker', version, cube), __FILE__)
|
26
|
+
end
|
27
|
+
end
|
7
28
|
|
8
|
-
|
9
|
-
|
29
|
+
def require_package(package, version = '')
|
30
|
+
PACKAGES[package.to_sym].each{ |cube|
|
31
|
+
require_cube cube, version
|
32
|
+
}
|
33
|
+
end
|
10
34
|
|
11
|
-
|
35
|
+
def require_this(filename)
|
36
|
+
version= File.split( File.expand_path( filename) )[-2]
|
37
|
+
version = '' if version !~ /^\d+$/
|
38
|
+
package = File.basename( filename ).chomp( File.extname( filename ))
|
39
|
+
Zucker.require_package(package, version)
|
40
|
+
end
|
12
41
|
|
13
|
-
|
42
|
+
def require_all(version = '')
|
43
|
+
require_default( version ) +
|
44
|
+
[require_package( :debug, version )]
|
45
|
+
end
|
14
46
|
|
15
|
-
|
47
|
+
def require_default(version = '')
|
48
|
+
PACKAGES.map{ |package, _|
|
49
|
+
require_package package if package != :debug
|
50
|
+
}.compact
|
51
|
+
end
|
52
|
+
|
53
|
+
# these aliases 'pollute' the global namespace or may conflict with other codee
|
54
|
+
def activate_more_aliases!
|
55
|
+
aliases = {
|
56
|
+
:mcopy => :copy,
|
57
|
+
:egonil => :n,
|
58
|
+
:make_new => :init,
|
59
|
+
:tap_on => :returning,
|
60
|
+
:library? => :lib?,
|
61
|
+
:square_brackets_for => :brackets,
|
62
|
+
}
|
63
|
+
|
64
|
+
loaded_aliases = []
|
65
|
+
aliases.each{ |old, new|
|
66
|
+
Object.class_eval "alias #{new} #{old}; loaded_aliases << :#{new}" rescue nil
|
67
|
+
}
|
68
|
+
eval "::RV = RubyVersion; loaded_aliases << :RV" rescue nil
|
69
|
+
eval "::RE = RubyEngine; loaded_aliases << :RE" rescue nil
|
70
|
+
|
71
|
+
loaded_aliases
|
72
|
+
end
|
73
|
+
alias more_aliases! activate_more_aliases!
|
74
|
+
end
|
75
|
+
end
|
16
76
|
|
17
|
-
#
|
77
|
+
# You can use Zucker with
|
78
|
+
# require 'zucker/all'
|
18
79
|
|
19
|
-
#
|
80
|
+
# J-_-L
|
data/lib/zucker/1/D.rb
CHANGED
data/lib/zucker/1/aliases.rb
CHANGED
data/lib/zucker/1/all.rb
CHANGED
data/lib/zucker/1/array.rb
CHANGED
data/lib/zucker/1/array2proc.rb
CHANGED
data/lib/zucker/1/binding.rb
CHANGED
data/lib/zucker/1/blank.rb
CHANGED
data/lib/zucker/1/class2proc.rb
CHANGED
data/lib/zucker/1/debug.rb
CHANGED
data/lib/zucker/1/default.rb
CHANGED
data/lib/zucker/1/egonil.rb
CHANGED
data/lib/zucker/1/enumerable.rb
CHANGED
data/lib/zucker/1/hash.rb
CHANGED
data/lib/zucker/1/hash2proc.rb
CHANGED
data/lib/zucker/1/iterate.rb
CHANGED
data/lib/zucker/1/ivars.rb
CHANGED
data/lib/zucker/1/kernel.rb
CHANGED
data/lib/zucker/1/mcopy.rb
CHANGED
data/lib/zucker/1/mm.rb
CHANGED
data/lib/zucker/1/regexp2proc.rb
CHANGED
data/lib/zucker/1/sandbox.rb
CHANGED
data/lib/zucker/1/string.rb
CHANGED
data/lib/zucker/1/unary.rb
CHANGED
data/lib/zucker/1/union.rb
CHANGED
data/lib/zucker/2/D.rb
CHANGED
data/lib/zucker/2/aliases.rb
CHANGED
data/lib/zucker/2/all.rb
CHANGED
data/lib/zucker/2/array.rb
CHANGED
data/lib/zucker/2/array2proc.rb
CHANGED
data/lib/zucker/2/binding.rb
CHANGED
data/lib/zucker/2/blank.rb
CHANGED
data/lib/zucker/2/class2proc.rb
CHANGED
data/lib/zucker/2/debug.rb
CHANGED
data/lib/zucker/2/default.rb
CHANGED
data/lib/zucker/2/egonil.rb
CHANGED
data/lib/zucker/2/enumerable.rb
CHANGED
data/lib/zucker/2/hash.rb
CHANGED
data/lib/zucker/2/hash2proc.rb
CHANGED