chuck-norris 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/TODO +1 -0
  2. data/VERSION +1 -1
  3. data/chuck-norris.gemspec +5 -4
  4. data/lib/chuck-norris.rb +29 -8
  5. metadata +46 -47
data/TODO ADDED
@@ -0,0 +1 @@
1
+ method_missing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/chuck-norris.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{chuck-norris}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pavel Gorbokon (pahanix)"]
@@ -14,7 +14,8 @@ Gem::Specification.new do |s|
14
14
  s.email = %q{pahanix@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc",
18
+ "TODO"
18
19
  ]
19
20
  s.files = [
20
21
  ".document",
@@ -31,7 +32,7 @@ Gem::Specification.new do |s|
31
32
  s.homepage = %q{http://github.com/pahanix/chuck-norris}
32
33
  s.rdoc_options = ["--charset=UTF-8"]
33
34
  s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.7}
35
+ s.rubygems_version = %q{1.3.6}
35
36
  s.summary = %q{Chuck Norris}
36
37
  s.test_files = [
37
38
  "test/helper.rb",
@@ -42,7 +43,7 @@ Gem::Specification.new do |s|
42
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
44
  s.specification_version = 3
44
45
 
45
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
47
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
48
  else
48
49
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
data/lib/chuck-norris.rb CHANGED
@@ -23,17 +23,38 @@ class Object
23
23
  def say(text)
24
24
  `say #{text} &` if RUBY_PLATFORM =~ /darwin/
25
25
  end
26
+
27
+ def __mri_or_ree?
28
+ # 1.8.6 1.8.7/1.9.*, ree
29
+ !defined?(RUBY_DESCRIPTION) || RUBY_DESCRIPTION =~ /^ruby/
30
+ end
26
31
  end
27
32
 
28
33
  # LITTLE HACK to put Chuck Norris last respects at the end of application lifetime.
29
34
  # Kernel runs exit procs in reverse mode and at this point we can already have
30
35
  # other exit procs. For example from Shoulda or UnitTest (I'm not sure which exactly).
31
36
 
32
- # This hack works on MRI 1.8/1.9 and REE (actually it's a bug!)
33
- # and does not work on JRuby/Rubinius (well done!)
34
-
35
- # But anyway, we can postone creation of last respects on MRI 1.8/1.9 and REE.
36
-
37
- Kernel.at_exit {
38
- Kernel.at_exit { chuck_norris_pays_last_respects }
39
- }
37
+ if __mri_or_ree?
38
+ # This hack works on MRI 1.8/1.9 and REE (actually it's a bug!)
39
+ # and does not work on JRuby/Rubinius (well done!)
40
+ Kernel.at_exit {
41
+ Kernel.at_exit { chuck_norris_pays_last_respects }
42
+ }
43
+ elsif defined? Rubinius::AtExit
44
+ # Chuck Norris can hack even Rubinius
45
+ #
46
+ # Rubinius Kernel.at_exit implementation looks
47
+ #
48
+ # def at_exit(&block)
49
+ # Rubinius::AtExit.unshift(block)
50
+ # end
51
+ #
52
+ # We break incapsulation here and change internals of Rubunius
53
+ # We invert usual #at_exit and change Rubinius::AtExit directly
54
+ #
55
+ Rubinius::AtExit.push(lambda { chuck_norris_pays_last_respects })
56
+ elsif RUBY_PLATFORM =~ /java/
57
+ # and Java knocks under Chuck Norris
58
+ require 'java'
59
+ org.jruby.Ruby.getGlobalRuntime.pushExitBlock(lambda { chuck_norris_pays_last_respects })
60
+ end
metadata CHANGED
@@ -3,13 +3,13 @@ name: chuck-norris
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 0
7
- - 1
8
- - 0
9
- version: 0.1.0
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
- - Pavel Gorbokon (pahanix)
12
+ - Pavel Gorbokon (pahanix)
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
@@ -17,19 +17,18 @@ cert_chain: []
17
17
  date: 2010-09-25 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: thoughtbot-shoulda
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
31
- type: :development
32
- version_requirements: *id001
20
+ - !ruby/object:Gem::Dependency
21
+ name: thoughtbot-shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
33
32
  description: When Chuck Norris throws exceptions, it's across the room
34
33
  email: pahanix@gmail.com
35
34
  executables: []
@@ -37,51 +36,51 @@ executables: []
37
36
  extensions: []
38
37
 
39
38
  extra_rdoc_files:
40
- - LICENSE
41
- - README.rdoc
39
+ - LICENSE
40
+ - README.rdoc
41
+ - TODO
42
42
  files:
43
- - .document
44
- - .gitignore
45
- - LICENSE
46
- - README.rdoc
47
- - Rakefile
48
- - VERSION
49
- - chuck-norris.gemspec
50
- - lib/chuck-norris.rb
51
- - test/helper.rb
52
- - test/test_chuck-norris.rb
43
+ - .document
44
+ - .gitignore
45
+ - LICENSE
46
+ - README.rdoc
47
+ - Rakefile
48
+ - VERSION
49
+ - chuck-norris.gemspec
50
+ - lib/chuck-norris.rb
51
+ - test/helper.rb
52
+ - test/test_chuck-norris.rb
53
+ - TODO
53
54
  has_rdoc: true
54
55
  homepage: http://github.com/pahanix/chuck-norris
55
56
  licenses: []
56
57
 
57
58
  post_install_message:
58
59
  rdoc_options:
59
- - --charset=UTF-8
60
+ - --charset=UTF-8
60
61
  require_paths:
61
- - lib
62
+ - lib
62
63
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
64
  requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
- none: false
72
71
  requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- segments:
76
- - 0
77
- version: "0"
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
78
77
  requirements: []
79
78
 
80
79
  rubyforge_project:
81
- rubygems_version: 1.3.7
80
+ rubygems_version: 1.3.6
82
81
  signing_key:
83
82
  specification_version: 3
84
83
  summary: Chuck Norris
85
84
  test_files:
86
- - test/helper.rb
87
- - test/test_chuck-norris.rb
85
+ - test/helper.rb
86
+ - test/test_chuck-norris.rb