configurations 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7415bb2455bde354b3e2db792f4ff3b0d39ed012
4
- data.tar.gz: fc663b3bb7de0224af0e6112008e5752760c930e
3
+ metadata.gz: 0e15768b4735b836614316e5add917727b13f06a
4
+ data.tar.gz: e211a39356c76a333f2b855bc831341de38c876b
5
5
  SHA512:
6
- metadata.gz: 75dd7197ee0fead9848bd6896550d950487c8f8853e3c9177c7ccaae63821db9827a770ea023ffa1fc18e8b7b44852fc7efd48ed5432896b6ce131e9ab01233b
7
- data.tar.gz: 0579d9eaf837f25f766f2dfc9e392d51d940604e490870d180147b380e0f37c8067f14f86e15588c72f85c080faeec5f9d67c764abb641381e854aae47aadb47
6
+ metadata.gz: 5d0140d31188351ae3af656201eedebe5c1f68e4f98f4ad44c27557c366f761cf9a84079199ea1cc800dddaf753a09ce02645e75c9497a295bb0af17f44ac929
7
+ data.tar.gz: 6cb2bb2c5e950d40e49bcd1342017eb7723916799883770d7f98d9fb2d2a1a6873c69a8b59a3ac404c372999266a07df98e639c261c7ad1a22715e83d17d90ad
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  doc
5
+ coverage
data/.travis.yml CHANGED
@@ -3,11 +3,11 @@ branches:
3
3
  only:
4
4
  - master
5
5
  rvm:
6
+ - 1.9.2
6
7
  - 1.9.3
7
8
  - 2.0.0
8
9
  - 2.1.0
9
10
  - rbx
10
11
  - jruby-19mode
11
- - jruby-20mode
12
-
13
- script: rake
12
+
13
+ script: CODECLIMATE_REPO_TOKEN=36cf84c73264d3c361003f66903eec8aa5fb2b3494496f3a9676630518ecc9f9 rake
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'codeclimate-test-reporter', group: :test, require: nil
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Configurations
2
+ [![Build Status](https://travis-ci.org/beatrichartz/configurations.svg?branch=master)](https://travis-ci.org/beatrichartz/configurations) [![Test Coverage](https://codeclimate.com/github/beatrichartz/configurations/badges/coverage.svg)](https://codeclimate.com/github/beatrichartz/configurations) [![Code Climate](https://codeclimate.com/github/beatrichartz/configurations/badges/gpa.svg)](https://codeclimate.com/github/beatrichartz/configurations) [![Inline docs](http://inch-ci.org/github/beatrichartz/configurations.png?branch=master)](http://inch-ci.org/github/beatrichartz/configurations) [![Dependency Status](https://gemnasium.com/beatrichartz/configurations.svg)](https://gemnasium.com/beatrichartz/configurations)
3
+
2
4
 
3
5
  Configurations provides a unified approach to do configurations using the `MyGem.configure do ... end` idiom with the flexibility to do everything from arbitrary configurations to type asserted configurations for your gem or any other ruby code.
4
6
 
@@ -12,6 +14,10 @@ or with Bundler
12
14
 
13
15
  Configurations uses [Semver 2.0](http://semver.org/)
14
16
 
17
+ ## Compatibility
18
+
19
+ Compatible with MRI 1.9.2 - 2.1, Rubinius, jRuby
20
+
15
21
  ## Why?
16
22
 
17
23
  There are various ways to do configurations, yet there seems to be a broad consensus on the `MyGem.configure do ... end` idiom.
@@ -133,7 +139,7 @@ MyGem.configuration.to_h #=> a Hash
133
139
 
134
140
  ### Some caveats
135
141
 
136
- The `to_h` from above is along with `method_missing` and `initialize` the only purposely defined method which you can not overwrite with a configuration value.
142
+ The `to_h` from above is along with `method_missing`, `object_id` and `initialize` the only purposely defined method which you can not overwrite with a configuration value.
137
143
  Apart from these methods, you should be able to set pretty much any property name you like. `Configuration` inherits from `BasicObject`, so even standard Ruby method names are available.
138
144
 
139
145
  ## Contributing
@@ -12,5 +12,5 @@ module Configurations
12
12
 
13
13
  # Version number of Configurations
14
14
  #
15
- VERSION = '1.0.0'
15
+ VERSION = '1.0.1'
16
16
  end
@@ -3,23 +3,36 @@ module Configurations
3
3
  #
4
4
  class Configuration < BasicObject
5
5
 
6
- # @!macro [attach] install_kernel_method
7
- # @method $1
8
- #
9
- def self.install_kernel_method(method)
10
- kernel_method = ::Kernel.instance_method(method)
11
- define_method method do |*args, &block|
12
- kernel_method.bind(self).call(*args, &block)
6
+ # 1.9 does not allow for method rebinding in another scope
7
+ #
8
+ if ::RUBY_VERSION < '2.0.0'
9
+ include ::Kernel
10
+ undef :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup,
11
+ :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?,
12
+ :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods,
13
+ :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?,
14
+ :instance_of?, :kind_of?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend,
15
+ :display, :method, :public_method, :define_singleton_method, :to_enum, :enum_for
16
+ else
17
+ # @!macro [attach] install_kernel_method
18
+ # @method $1
19
+ #
20
+ def self.install_kernel_method(method)
21
+ kernel_method = ::Kernel.instance_method(method)
22
+
23
+ define_method method do |*args, &block|
24
+ kernel_method.bind(self).call(*args, &block)
25
+ end
13
26
  end
14
- end
15
27
 
16
- # Installs the type asserting is_a? method from Kernel
17
- #
18
- install_kernel_method(:is_a?)
28
+ # Installs the type asserting is_a? method from Kernel
29
+ #
30
+ install_kernel_method(:is_a?)
19
31
 
20
- # Installs the inspect method from Kernel
21
- #
22
- install_kernel_method(:inspect)
32
+ # Installs the inspect method from Kernel
33
+ #
34
+ install_kernel_method(:inspect)
35
+ end
23
36
 
24
37
  # Initialize a new configuration
25
38
  # @param [Proc] configuration_defaults A proc yielding to a default configuration
data/test/test_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  require 'pathname'
2
5
  require 'minitest'
3
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configurations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beat Richartz