gem-loaded 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,58 @@
1
+ # Gem Loaded #
2
+
3
+ http://rubygems.org/gems/gem-loaded
4
+
5
+ # Description #
6
+
7
+ Reports whether a given gem is loaded.
8
+
9
+ # Summary #
10
+
11
+ Provides Gem.loaded?.
12
+
13
+ Created primarily in order to determine development vs. production load paths (require vs. require_relative).
14
+
15
+ # Install #
16
+
17
+ * sudo gem install gem-loaded
18
+
19
+ # Usage #
20
+
21
+ ```ruby
22
+ require 'gem-loaded'
23
+
24
+ Gem.loaded?( 'some-gem' ) # => false
25
+ require 'some-gem'
26
+ Gem.loaded?( 'some-gem' ) # => true
27
+
28
+ if Gem.loaded?( 'some-gem' )
29
+ require 'some-other-gem'
30
+ else
31
+ require_relative '../../../relative/path/to/other/gem.rb'
32
+ end
33
+ ```
34
+
35
+ # License #
36
+
37
+ (The MIT License)
38
+
39
+ Copyright (c) 2011 Asher
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining
42
+ a copy of this software and associated documentation files (the
43
+ 'Software'), to deal in the Software without restriction, including
44
+ without limitation the rights to use, copy, modify, merge, publish,
45
+ distribute, sublicense, and/or sell copies of the Software, and to
46
+ permit persons to whom the Software is furnished to do so, subject to
47
+ the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be
50
+ included in all copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
53
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
54
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
55
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
56
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
57
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
58
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ == Cascading Configuration
2
+
3
+ http://rubygems.org/gems/cascading-configuration
4
+
5
+ == Description
6
+
7
+ Adds methods for cascading configurations.
8
+
9
+ == Summary
10
+
11
+ Cascading configuration methods for single settings, arrays, hashes.
12
+
13
+ == Install
14
+
15
+ * sudo gem install cascading-configuration
16
+
17
+ == Usage
18
+
19
+ require 'gem-loaded'
20
+
21
+ Gem.loaded?( 'some-gem' ) # => false
22
+ require 'some-gem'
23
+ Gem.loaded?( 'some-gem' ) # => true
24
+
25
+ if Gem.loaded?( 'some-gem' )
26
+ require 'some-other-gem'
27
+ else
28
+ require_relative '../../../relative/path/to/other/gem.rb'
29
+ end
30
+
31
+ == License
32
+
33
+ (The MIT License)
34
+
35
+ Copyright (c) 2011 Asher
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining
38
+ a copy of this software and associated documentation files (the
39
+ 'Software'), to deal in the Software without restriction, including
40
+ without limitation the rights to use, copy, modify, merge, publish,
41
+ distribute, sublicense, and/or sell copies of the Software, and to
42
+ permit persons to whom the Software is furnished to do so, subject to
43
+ the following conditions:
44
+
45
+ The above copyright notice and this permission notice shall be
46
+ included in all copies or substantial portions of the Software.
47
+
48
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
49
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
50
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
51
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
52
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
53
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
54
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+
2
+ require_relative 'gem-loaded/Gem.rb'
@@ -0,0 +1,12 @@
1
+
2
+ module Gem
3
+
4
+ ##################
5
+ # self.loaded? #
6
+ ##################
7
+
8
+ def self.loaded?( gem_name )
9
+ return @loaded_specs.has_key?( gem_name )
10
+ end
11
+
12
+ end
@@ -0,0 +1,19 @@
1
+
2
+ require_relative '../lib/gem-loaded.rb'
3
+
4
+ describe Gem do
5
+
6
+ #############
7
+ # loaded? #
8
+ #############
9
+
10
+ it 'can report whether a gem is loaded via rubygems' do
11
+ Gem.loaded?( 'non-existant-gem' ).should == false
12
+ Gem.loaded?( 'module-cluster' ).should == false
13
+ # I have module cluster - you probably won't.
14
+ # There aren't built-in gems, so difficult to say what the best way is to test on systems other than mine.
15
+ require 'module-cluster'
16
+ Gem.loaded?( 'module-cluster' ).should == true
17
+ end
18
+
19
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-loaded
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.0
6
+ platform: ruby
7
+ authors:
8
+ - Asher
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-08-09 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: module-cluster
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :development
25
+ version_requirements: *id001
26
+ description: Provides Gem.loaded?.
27
+ email: asher@ridiculouspower.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/gem-loaded/Gem.rb
36
+ - lib/gem-loaded.rb
37
+ - spec/Gem_spec.rb
38
+ - README.md
39
+ - README.rdoc
40
+ homepage: http://rubygems.org/gems/gem-loaded
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project: gem-loaded
63
+ rubygems_version: 1.8.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Reports whether a given gem is loaded.
67
+ test_files: []
68
+