gem-patching 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ require 'rubygems/patching'
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+
3
+ module Gem
4
+ def self.patching(name, *requirements, &block)
5
+ target = Gem::Dependency.new(name, *requirements)
6
+ loaded_gem = Gem.loaded_specs[name]
7
+ if loaded_gem && target.requirement.satisfied_by?(loaded_gem.version)
8
+ yield if block_given?
9
+ else
10
+ msg = ["Attempt to apply patch targeting version '#{requirements.join(', ')}' of '#{name}'"]
11
+ msg << (loaded_gem ? "but active version is '#{loaded_gem.version}'" : "but '#{name}' is not active")
12
+ raise msg.join(', ')
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-patching
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Ingo Weiss
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-09 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: gem-patching provides a mechanism for marking code blocks as a patch targeting specific versions of a gem and be notified when that gem is updated, so that developers can assess whether the patch continues to be necessary
23
+ email: ingo@ingoweiss.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/gem-patching.rb
32
+ - lib/rubygems/patching.rb
33
+ has_rdoc: true
34
+ homepage: http://github.com/ingoweiss/gem-patching
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Better management of patches targeting specific versions of a specific gems
67
+ test_files: []
68
+