monkey-lib 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -59,7 +59,7 @@ end
59
59
 
60
60
  task :environment do
61
61
  $LOAD_PATH.unshift "lib"
62
- require "monkey"
62
+ require "monkey-lib"
63
63
  end
64
64
 
65
65
  desc "run all specs"
@@ -1,2 +1,15 @@
1
1
  require "monkey"
2
- MonkeyLib = Monkey
2
+
3
+ unless defined? Monkey
4
+ warn "installing both the monkey and the monkey-lib gem results in conflicts, add a Gemfile, use gemsets or remove monkey gem"
5
+ $LOADED_FEATURES.delete_if { |l| l =~ /monkey\.rb$/ }
6
+ if defined? require_relative
7
+ require_relative "monkey"
8
+ else
9
+ $LOAD_PATH.unshift File.expand_path('..', __FILE__)
10
+ require 'monkey'
11
+ end
12
+ fail "Please remove monkey gem (not monkey-lib gem) from your $LOAD_PATH" unless defined? Monkey
13
+ end
14
+
15
+ MonkeyLib = Monkey
@@ -1,4 +1,4 @@
1
- require "monkey"
1
+ require "monkey-lib"
2
2
 
3
3
  Module.class_eval do
4
4
  alias const_missing_without_detection const_missing
@@ -96,10 +96,10 @@ module Monkey
96
96
  end
97
97
 
98
98
  def self.setup!(backend)
99
- @setup = true
100
99
  if backend
101
100
  @backend = detect_backend(backend)
102
101
  @backend.setup
102
+ @setup = true
103
103
  @backend
104
104
  else
105
105
  available_backends.each do |backend|
@@ -2,7 +2,7 @@ Monkey::Backend.new :ActiveSupport, :active_support do
2
2
  def setup
3
3
  load_lib :version
4
4
  expects_module "::ActiveSupport::CoreExtensions::String::Inflections" if version < "3"
5
- load_libs "core_ext/object" => [:metaclass, :misc], :core_ext => %w[array/extract_options string/inflections module/introspection]
5
+ load_libs "core_ext/object" => [:singleton_class, :misc], :core_ext => %w[array/extract_options string/inflections module/introspection]
6
6
  if version < "3"
7
7
  ::Array.send :include, ::ActiveSupport::CoreExtensions::Array::ExtractOptions
8
8
  ::Module.send :include, ::ActiveSupport::CoreExtensions::Module
@@ -11,9 +11,6 @@ Monkey::Backend.new :ActiveSupport, :active_support do
11
11
  alias to_const_string camelcase
12
12
  alias to_const_path underscore
13
13
  end
14
- ::Object.class_eval do
15
- alias singleton_class metaclass unless respond_to? :singleton_class
16
- end
17
14
  end
18
15
 
19
16
  def version(default = "0")
@@ -17,7 +17,7 @@ module Monkey
17
17
  @core_class = klass
18
18
  klass.send :include, self
19
19
  self::ClassMethods.extend ClassDsl
20
- self::ClassMethods.core_class core_class
20
+ self::ClassMethods.core_class @core_class
21
21
  @core_class.class_eval <<-EOS
22
22
  def method_missing(meth, *args, &blk)
23
23
  return super if Monkey::Backend.setup?
@@ -26,10 +26,13 @@ module Monkey
26
26
  end
27
27
  EOS
28
28
  unless klass.is_a? Class
29
+ # HACK: Don't modify modules while looping through object space.
30
+ # JRuby does not like that.
31
+ list = []
29
32
  ObjectSpace.each_object(Module) do |mod|
30
- next unless mod.ancestors.include? klass and not mod.ancestors.include? self
31
- mod.send :include, klass
33
+ list << mod if mod.ancestors.include? klass and not mod.ancestors.include? self
32
34
  end
35
+ list.each { |e| e.send :include, klass }
33
36
  end
34
37
  end
35
38
  return @core_class
@@ -1,5 +1,5 @@
1
1
  $LOAD_PATH.unshift File.expand_path(__FILE__.sub("spec/spec_helper.rb", "lib"))
2
- require "monkey"
2
+ require "monkey-lib"
3
3
 
4
4
  # I hate that code, but rbx for some reason ignores RUBYOPT.
5
5
  begin
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 2
10
- version: 0.4.2
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konstantin Haase
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-31 00:00:00 +02:00
18
+ date: 2010-07-09 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency