gemcd 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ gemcd-*.gem
data/lib/gemcd.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'gemcd/version'
2
+ require 'rubygems/command_manager'
3
+ require 'rubygems/commands/cd'
2
4
 
3
- class GemCd
4
- end
5
+ Gem::CommandManager.instance.register_command :open
data/lib/gemcd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class GemCd
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,16 @@
1
+ class Gem::Commands::OpenCommand < Gem::Command
2
+ def initialize
3
+ super 'cd', "Navigates to the gem's source directory."
4
+ end
5
+
6
+ def arguments
7
+ "GEM gem name"
8
+ end
9
+
10
+ def execute
11
+ gem = options[:args].first
12
+ raise Gem::CommandLineError, 'Usage: gem cd GEM' unless gem
13
+ Dir.chdir("#{Gem::Specification.find_by_name(gem).full_gem_path}")
14
+ exec '$0'
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemcd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,10 +19,12 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - .gitignore
22
23
  - Gemfile
23
24
  - gemcd.gemspec
24
25
  - lib/gemcd.rb
25
26
  - lib/gemcd/version.rb
27
+ - lib/rubygems/commands/cd.rb
26
28
  - readme.md
27
29
  homepage: https://github.com/nickbarth/GemCd
28
30
  licenses: []