matthewtodd-rubygems_commands 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +31 -0
- data/Rakefile +19 -0
- data/lib/rubygems/commands/doc_command.rb +22 -0
- data/lib/rubygems/commands/export_command.rb +24 -0
- data/lib/rubygems/commands/mate_command.rb +17 -0
- data/lib/rubygems_commands.rb +5 -0
- data/lib/rubygems_plugin.rb +5 -0
- data/lib/tabtab_definitions/gem.rb +11 -0
- metadata +87 -0
data/README.rdoc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= Rubygems Commands
|
2
|
+
|
3
|
+
Since version 1.3.2, rubygems has allowed 3rd-party libraries to provide additional sub-commands for `gem`.
|
4
|
+
|
5
|
+
This gem provides for `gem mate`, `gem doc`, and `gem export`.
|
6
|
+
|
7
|
+
== Behold
|
8
|
+
|
9
|
+
gem mate activerecord
|
10
|
+
# => mate /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2
|
11
|
+
|
12
|
+
gem doc activerecord
|
13
|
+
# => open /opt/local/lib/ruby/gems/1.8/doc/activerecord-2.3.2/rdoc/index.html
|
14
|
+
|
15
|
+
gem export activerecord
|
16
|
+
# => Creates these files in the current directory:
|
17
|
+
# activerecord-2.3.2.gem
|
18
|
+
# activesupport-2.3.2.gem
|
19
|
+
|
20
|
+
== Install
|
21
|
+
|
22
|
+
gem sources --add http://gems.github.com
|
23
|
+
gem install matthewtodd-rubygems_commands
|
24
|
+
|
25
|
+
== Tab Completion
|
26
|
+
|
27
|
+
Provided by Dr. Nic's tabtab[http://tabtab.rubyforge.org] gem.
|
28
|
+
|
29
|
+
After installing, you'll want to update your tabtab completions with
|
30
|
+
|
31
|
+
install_tabtab
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
this_rakefile_uses_shoe = <<END
|
2
|
+
----------------------------------------
|
3
|
+
Please install Shoe:
|
4
|
+
gem sources --add http://gems.github.com
|
5
|
+
gem install matthewtodd-shoe
|
6
|
+
----------------------------------------
|
7
|
+
END
|
8
|
+
|
9
|
+
begin
|
10
|
+
gem 'matthewtodd-shoe'
|
11
|
+
rescue Gem::LoadError
|
12
|
+
abort this_rakefile_uses_shoe
|
13
|
+
else
|
14
|
+
require 'shoe'
|
15
|
+
end
|
16
|
+
|
17
|
+
Shoe.tie('rubygems_commands', '0.1.0', 'Random useful rubygems plugins, with tab completion.') do |spec|
|
18
|
+
spec.add_dependency 'tabtab'
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
|
3
|
+
class Gem::Commands::DocCommand < Gem::Command
|
4
|
+
def initialize
|
5
|
+
super 'doc', 'Open gem rdoc'
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute
|
9
|
+
index = Gem::SourceIndex.from_installed_gems
|
10
|
+
spec = index.find_name(get_one_gem_name, Gem::Requirement.default).last
|
11
|
+
|
12
|
+
if spec.has_rdoc?
|
13
|
+
exec 'open', File.join(spec.installation_path, 'doc', spec.full_name, 'rdoc', 'index.html')
|
14
|
+
else
|
15
|
+
$stderr.puts "#{spec.full_name} does not have rdoc."
|
16
|
+
end
|
17
|
+
|
18
|
+
def usage
|
19
|
+
"#{program_name} GEMNAME"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
|
3
|
+
class Gem::Commands::ExportCommand < Gem::Command
|
4
|
+
def initialize
|
5
|
+
super 'export', 'Copy a gem and its dependencies into the current directory'
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute
|
9
|
+
export(get_one_gem_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def usage
|
13
|
+
"#{program_name} GEMNAME"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def export(name)
|
19
|
+
index = Gem::SourceIndex.from_installed_gems
|
20
|
+
spec = index.find_name(name, Gem::Requirement.default).last
|
21
|
+
FileUtils.copy(File.join(spec.installation_path, 'cache', spec.file_name), '.')
|
22
|
+
spec.runtime_dependencies.each { |d| export(d.name) }
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems/command'
|
2
|
+
|
3
|
+
class Gem::Commands::MateCommand < Gem::Command
|
4
|
+
def initialize
|
5
|
+
super 'mate', 'Open gem source in TextMate'
|
6
|
+
end
|
7
|
+
|
8
|
+
def execute
|
9
|
+
index = Gem::SourceIndex.from_installed_gems
|
10
|
+
spec = index.find_name(get_one_gem_name, Gem::Requirement.default).last
|
11
|
+
exec 'mate', spec.full_gem_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def usage
|
15
|
+
"#{program_name} GEMNAME"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
def locally_installed_gems
|
4
|
+
Gem::SourceIndex.from_installed_gems.latest_specs.map { |spec| spec.name }
|
5
|
+
end
|
6
|
+
|
7
|
+
TabTab::Definition.register('gem') do |c|
|
8
|
+
c.command(:doc) { locally_installed_gems }
|
9
|
+
c.command(:export) { locally_installed_gems }
|
10
|
+
c.command(:mate) { locally_installed_gems }
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: matthewtodd-rubygems_commands
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthew Todd
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-29 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: matthewtodd-shoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: tabtab
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description:
|
36
|
+
email: matthew.todd@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- Rakefile
|
45
|
+
- README.rdoc
|
46
|
+
- lib/rubygems
|
47
|
+
- lib/rubygems/commands
|
48
|
+
- lib/rubygems/commands/doc_command.rb
|
49
|
+
- lib/rubygems/commands/export_command.rb
|
50
|
+
- lib/rubygems/commands/mate_command.rb
|
51
|
+
- lib/rubygems_commands.rb
|
52
|
+
- lib/rubygems_plugin.rb
|
53
|
+
- lib/tabtab_definitions
|
54
|
+
- lib/tabtab_definitions/gem.rb
|
55
|
+
has_rdoc: false
|
56
|
+
homepage:
|
57
|
+
licenses:
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options:
|
60
|
+
- --main
|
61
|
+
- README.rdoc
|
62
|
+
- --title
|
63
|
+
- rubygems_commands-0.1.0
|
64
|
+
- --inline-source
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.3.5
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: Random useful rubygems plugins, with tab completion.
|
86
|
+
test_files: []
|
87
|
+
|