gem_dep_example 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ext/mkrf_conf.rb +29 -0
  2. data/lib/gem_dep_example.rb +11 -0
  3. metadata +49 -0
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,29 @@
1
+ #This file needs to be named mkrf_conf.rb
2
+ #so that rubygems will recognize it as a ruby extension
3
+ #file and not think it is a C extension file
4
+
5
+ require 'rubygems/dependency_installer.rb'
6
+
7
+ #Load up the rubygem's dependency installer to
8
+ #installer the gems we want based on the version
9
+ #of Ruby the user has installed
10
+ installer = Gem::DependencyInstaller.new
11
+ begin
12
+ if RUBY_VERSION < "1.9"
13
+ installer.install "gem_dep_polish", ">=0"
14
+ else
15
+ installer.install "gem_dep_shine", ">=0"
16
+ end
17
+
18
+ rescue
19
+ #Exit with a non-zero value to let rubygems something went wrong
20
+ exit(1)
21
+ end
22
+
23
+ #If this was C, rubygems would attempt to run make
24
+ #Since this is Ruby, rubygems will attempt to run rake
25
+ #If it doesn't find and successfully run a rakefile, it errors out
26
+ f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
27
+ f.write("task :default\n")
28
+ f.close
29
+
@@ -0,0 +1,11 @@
1
+ class GemDepExample
2
+
3
+ def self.polish
4
+ puts "The Gem is Radiant"
5
+ end
6
+
7
+ def self.shine
8
+ puts "The Gem is Brilliant"
9
+ end
10
+
11
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_dep_example
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mark Mzyk
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-25 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Showing how to hack rubygems to install gem dependencies based on the
15
+ user's installed ruby version
16
+ email:
17
+ - mmzyk@programmersparadox.com
18
+ executables: []
19
+ extensions:
20
+ - ext/mkrf_conf.rb
21
+ extra_rdoc_files: []
22
+ files:
23
+ - lib/gem_dep_example.rb
24
+ - ext/mkrf_conf.rb
25
+ homepage: http://www.programmersparadox.com
26
+ licenses: []
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 1.8.17
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: Example of how to manage gem dependencies based on the user's ruby version
49
+ test_files: []