rbenv-rehash 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ require 'rubygems' unless Object.const_defined?(:Gem)
2
+ require File.dirname(__FILE__) + "/lib/rbenv-rehash"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "rbenv-rehash"
6
+ s.version = RbenvRehash::VERSION
7
+ s.authors = ["Ryan Souza"]
8
+ s.email = "ryan@ryansouza.net"
9
+ s.summary = "Rubygems plugin to automatically rehash rbenv"
10
+ s.description = "Rubygems plugin to automatically run 'rbenv rehash' after (un)installing gems with executables"
11
+ s.homepage = "http://github.com/scoz/rbenv-rehash"
12
+ s.files = Dir.glob(%w[ {lib,test}/**/*.rb ]) + %w{Rakefile .gemspec}
13
+ end
@@ -0,0 +1,32 @@
1
+ # Borrowed from http://github.com/cldwalker/gem_grep
2
+
3
+ require 'rake'
4
+ require 'fileutils'
5
+
6
+ def gemspec
7
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
8
+ end
9
+
10
+ desc "Build the gem"
11
+ task :gem=>:gemspec do
12
+ sh "gem build .gemspec"
13
+ FileUtils.mkdir_p 'pkg'
14
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
15
+ end
16
+
17
+ desc "Install the gem locally"
18
+ task :install => :gem do
19
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
20
+ end
21
+
22
+ desc "Generate the gemspec"
23
+ task :generate do
24
+ puts gemspec.to_ruby
25
+ end
26
+
27
+ desc "Validate the gemspec"
28
+ task :gemspec do
29
+ gemspec.validate
30
+ end
31
+
32
+ task :default => :gemspec
@@ -0,0 +1,11 @@
1
+
2
+ module RbenvRehash
3
+ VERSION = '0.1'
4
+
5
+ def self.rehash_at_exit
6
+ unless @rbenv_rehashed
7
+ system("rbenv rehash")
8
+ @rbenv_rehashed = true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'rubygems/installer'
3
+ require 'rubygems/specification'
4
+ require 'rbenv-rehash'
5
+
6
+ Gem.post_install { |inst|
7
+ at_exit { RbenvRehash.rehash_at_exit } unless inst.spec.executables.empty?
8
+ }
9
+
10
+ Gem.post_uninstall { |uninst|
11
+ at_exit { RbenvRehash.rehash_at_exit } unless uninst.spec.executables.empty?
12
+ }
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rbenv-rehash
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ryan Souza
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-21 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: Rubygems plugin to automatically run 'rbenv rehash' after (un)installing
15
+ gems with executables
16
+ email: ryan@ryansouza.net
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/rbenv-rehash.rb
22
+ - lib/rubygems_plugin.rb
23
+ - Rakefile
24
+ - .gemspec
25
+ homepage: http://github.com/scoz/rbenv-rehash
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.10
46
+ signing_key:
47
+ specification_version: 3
48
+ summary: Rubygems plugin to automatically rehash rbenv
49
+ test_files: []