mynyml-override 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/Manifest +9 -0
- data/README +10 -4
- data/Rakefile +48 -42
- data/override.gemspec +16 -0
- data/specs.watchr +35 -0
- data/test/test_helper.rb +0 -6
- data/test/test_override.rb +2 -4
- metadata +34 -11
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright © 2009 Martin Aumont (mynyml)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/Manifest
ADDED
data/README
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
-
|
1
|
+
=== Summary
|
2
2
|
|
3
|
-
Allows using the 'super' keyword
|
4
|
-
Simple and elegant alternative to alias_method_chain for redifining methods while keeping access to the previous definition.
|
3
|
+
Allows using the 'super' keyword with methods previously defined in reopened classes.
|
4
|
+
Simple and elegant alternative to Rails' #alias_method_chain for redifining methods while keeping access to the previous definition.
|
5
5
|
|
6
|
-
|
6
|
+
=== Install
|
7
|
+
|
8
|
+
gem install mynyml-override --source http://gemcutter.org
|
9
|
+
|
10
|
+
=== Examples
|
11
|
+
|
12
|
+
require 'override'
|
7
13
|
|
8
14
|
class Post
|
9
15
|
def text
|
data/Rakefile
CHANGED
@@ -1,48 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
p.gem_spec = spec
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
desc "Remove package products"
|
32
|
-
task :clean => :clobber_package
|
33
|
-
|
34
|
-
desc "Update the gemspec for GitHub's gem server"
|
35
|
-
task :gemspec do
|
36
|
-
Pathname("#{spec.name}.gemspec").open('w') {|f| f << YAML.dump(spec) }
|
1
|
+
task(:default => 'test:all')
|
2
|
+
|
3
|
+
# --------------------------------------------------
|
4
|
+
# Tests
|
5
|
+
# --------------------------------------------------
|
6
|
+
namespace(:test) do
|
7
|
+
|
8
|
+
desc "Run tests"
|
9
|
+
task(:all) do
|
10
|
+
cmd = "ruby -rubygems -I.:lib test/test_override.rb"
|
11
|
+
puts(cmd) if ENV['VERBOSE']
|
12
|
+
system(cmd)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Run all tests on multiple ruby versions (requires rvm)"
|
16
|
+
task(:portability) do
|
17
|
+
versions = %w( 1.8.6 1.8.7 1.9 1.9.2 jruby )
|
18
|
+
versions.each do |version|
|
19
|
+
system <<-BASH
|
20
|
+
bash -c 'source ~/.rvm/scripts/rvm;
|
21
|
+
rvm use #{version};
|
22
|
+
echo "--------- #{version} ----------";
|
23
|
+
rake -s test:all'
|
24
|
+
BASH
|
25
|
+
end
|
26
|
+
end
|
37
27
|
end
|
38
28
|
|
39
|
-
|
40
|
-
|
41
|
-
|
29
|
+
# --------------------------------------------------
|
30
|
+
# Docs
|
31
|
+
# --------------------------------------------------
|
32
|
+
desc "Generate YARD Documentation"
|
33
|
+
task :yardoc do
|
34
|
+
require 'yard'
|
35
|
+
files = %w( lib/**/*.rb )
|
36
|
+
options = %w( -o doc/yard --readme README.rdoc --files LICENSE )
|
37
|
+
YARD::CLI::Yardoc.run *(options + files)
|
42
38
|
end
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
# --------------------------------------------------
|
41
|
+
# Stats
|
42
|
+
# --------------------------------------------------
|
43
|
+
desc "LOC count"
|
44
|
+
task(:loc) do
|
45
|
+
loc = 0
|
46
|
+
Dir['lib/**/*'].each do |file|
|
47
|
+
next if File.directory?(file)
|
48
|
+
File.read(file).each_line do |line|
|
49
|
+
loc += 1 unless line.strip.empty? || line.strip =~ /^#/
|
50
|
+
end
|
51
|
+
end
|
52
|
+
puts "lib files contain #{loc} SLOCs"
|
47
53
|
end
|
48
54
|
|
data/override.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'mynyml-override'
|
3
|
+
s.version = '0.5.2'
|
4
|
+
s.summary = "Ruby lib that allows using 'super' in methods of reopened classes."
|
5
|
+
s.description = "Provides a simple and elegant alternative to alias_method_chain for redifining methods, while keeping access to the previous defenition."
|
6
|
+
s.author = "Martin Aumont"
|
7
|
+
s.email = 'mynyml@gmail.com'
|
8
|
+
s.homepage = 'http://github.com/mynyml/override'
|
9
|
+
s.rubyforge_project = "mynyml-override"
|
10
|
+
s.has_rdoc = true
|
11
|
+
s.require_path = "lib"
|
12
|
+
s.files = File.read("Manifest").strip.split("\n")
|
13
|
+
|
14
|
+
s.add_development_dependency 'context'
|
15
|
+
s.add_development_dependency 'matchy'
|
16
|
+
end
|
data/specs.watchr
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Run me with:
|
2
|
+
#
|
3
|
+
# $ watchr specs.watchr
|
4
|
+
|
5
|
+
# --------------------------------------------------
|
6
|
+
# Helpers
|
7
|
+
# --------------------------------------------------
|
8
|
+
def run(cmd)
|
9
|
+
puts(cmd)
|
10
|
+
system(cmd)
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_all_tests
|
14
|
+
# see Rakefile for the definition of the test:all task
|
15
|
+
system( "rake -s test:all VERBOSE=true" )
|
16
|
+
end
|
17
|
+
|
18
|
+
# --------------------------------------------------
|
19
|
+
# Watchr Rules
|
20
|
+
# --------------------------------------------------
|
21
|
+
watch( '^test/test_override\.rb' ) { run( "ruby -rubygems -I.:lib test/test_override.rb" ) }
|
22
|
+
watch( '^lib/override\.rb' ) { run( "ruby -rubygems -I.:lib test/test_override.rb" ) }
|
23
|
+
|
24
|
+
# --------------------------------------------------
|
25
|
+
# Signal Handling
|
26
|
+
# --------------------------------------------------
|
27
|
+
# Ctrl-\
|
28
|
+
Signal.trap('QUIT') do
|
29
|
+
puts " --- Running all tests ---\n\n"
|
30
|
+
run_all_tests
|
31
|
+
end
|
32
|
+
|
33
|
+
# Ctrl-C
|
34
|
+
Signal.trap('INT') { abort("\n") }
|
35
|
+
|
data/test/test_helper.rb
CHANGED
data/test/test_override.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mynyml-override
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Aumont
|
@@ -9,10 +9,29 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03
|
12
|
+
date: 2009-11-03 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: context
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: matchy
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
16
35
|
description: Provides a simple and elegant alternative to alias_method_chain for redifining methods, while keeping access to the previous defenition.
|
17
36
|
email: mynyml@gmail.com
|
18
37
|
executables: []
|
@@ -22,15 +41,19 @@ extensions: []
|
|
22
41
|
extra_rdoc_files: []
|
23
42
|
|
24
43
|
files:
|
25
|
-
-
|
26
|
-
-
|
44
|
+
- LICENSE
|
45
|
+
- Manifest
|
27
46
|
- README
|
28
47
|
- Rakefile
|
29
|
-
-
|
48
|
+
- lib/override.rb
|
49
|
+
- override.gemspec
|
50
|
+
- specs.watchr
|
30
51
|
- test/test_helper.rb
|
31
52
|
- test/test_override.rb
|
32
53
|
has_rdoc: true
|
33
|
-
homepage:
|
54
|
+
homepage: http://github.com/mynyml/override
|
55
|
+
licenses: []
|
56
|
+
|
34
57
|
post_install_message:
|
35
58
|
rdoc_options: []
|
36
59
|
|
@@ -50,10 +73,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
73
|
version:
|
51
74
|
requirements: []
|
52
75
|
|
53
|
-
rubyforge_project:
|
54
|
-
rubygems_version: 1.
|
76
|
+
rubyforge_project: mynyml-override
|
77
|
+
rubygems_version: 1.3.5
|
55
78
|
signing_key:
|
56
|
-
specification_version:
|
79
|
+
specification_version: 3
|
57
80
|
summary: Ruby lib that allows using 'super' in methods of reopened classes.
|
58
81
|
test_files: []
|
59
82
|
|