gem-alias 0.0.1
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 +1 -0
- data/LICENSE +22 -0
- data/README.md +50 -0
- data/Rakefile +4 -0
- data/gem-alias.gemspec +22 -0
- data/lib/gem-alias/extension.rb +37 -0
- data/lib/gem-alias/version.rb +7 -0
- data/lib/rubygems/commands/aliases_command.rb +23 -0
- data/lib/rubygems_plugin.rb +4 -0
- metadata +60 -0
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pkg
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2012 OZAWA Sakuro
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Gem::Alias
|
|
2
|
+
|
|
3
|
+
This gem adds alias expansion feature to the `gem` command.
|
|
4
|
+
|
|
5
|
+
You can define subcommand aliases via ~/.gemrc and list them by `aliases` subcommand.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
$ gem install gem-alias
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Add `:aliases` key to your ~/.gemrc and put definitions as a hash.
|
|
14
|
+
|
|
15
|
+
Example:
|
|
16
|
+
|
|
17
|
+
:aliases:
|
|
18
|
+
upgrade = update
|
|
19
|
+
ls = list
|
|
20
|
+
rsearch = search --remote
|
|
21
|
+
|
|
22
|
+
Now you can use them!
|
|
23
|
+
|
|
24
|
+
$ gem rsearch rake
|
|
25
|
+
*** expanding rsearch rake to search --remote rake
|
|
26
|
+
|
|
27
|
+
*** REMOTE GEMS ***
|
|
28
|
+
<snip>
|
|
29
|
+
|
|
30
|
+
Verbose expansion message above can be suppressed with the `:verbose` configuration.
|
|
31
|
+
|
|
32
|
+
You can list the definitions by `gem aliases`:
|
|
33
|
+
|
|
34
|
+
ls = list
|
|
35
|
+
rsearch = search --remote
|
|
36
|
+
upgrade = update
|
|
37
|
+
|
|
38
|
+
Note that this list is sorted.
|
|
39
|
+
|
|
40
|
+
## Contributing
|
|
41
|
+
|
|
42
|
+
1. Fork it
|
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
44
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
46
|
+
5. Create new Pull Request
|
|
47
|
+
|
|
48
|
+
## ToDo
|
|
49
|
+
|
|
50
|
+
* Like normal commands, aliases should also be looked up with shorter, but unambiguous names.
|
data/Rakefile
ADDED
data/gem-alias.gemspec
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# -*- encoding: US-ASCII -*-
|
|
2
|
+
|
|
3
|
+
require File.expand_path('../lib/gem-alias/version', __FILE__)
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |gem|
|
|
6
|
+
gem.authors = ['OZAWA Sakuro']
|
|
7
|
+
gem.email = ['sakuro@2238club.org']
|
|
8
|
+
gem.description = <<-EOF.gsub(/^ /, '')
|
|
9
|
+
This gem adds alias expansion feature to the 'gem' command.
|
|
10
|
+
You can define subcommand aliases via .gemrc and list them
|
|
11
|
+
by 'aliases' subcommand.
|
|
12
|
+
EOF
|
|
13
|
+
gem.summary = %q{A RubyGems extension to add subcommand aliasing.}
|
|
14
|
+
gem.homepage = 'http://github.com/sakuro/gem-alias'
|
|
15
|
+
|
|
16
|
+
gem.files = `git ls-files`.split($\)
|
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
gem.name = 'gem-alias'
|
|
20
|
+
gem.require_paths = ['lib']
|
|
21
|
+
gem.version = Gem::Alias::VERSION
|
|
22
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- encoding: US-ASCII -*-
|
|
2
|
+
|
|
3
|
+
require 'rubygems/config_file'
|
|
4
|
+
require 'rubygems/command_manager'
|
|
5
|
+
require 'shellwords'
|
|
6
|
+
|
|
7
|
+
module Gem
|
|
8
|
+
class ConfigFile
|
|
9
|
+
def aliases
|
|
10
|
+
hash[:aliases] ||= []
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class CommandManager
|
|
15
|
+
|
|
16
|
+
alias process_args_rubygems process_args
|
|
17
|
+
|
|
18
|
+
def process_args(args)
|
|
19
|
+
process_args_rubygems(expand_alias(args))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def expand_alias(args)
|
|
25
|
+
definition = Gem.configuration.aliases[args.first]
|
|
26
|
+
if definition
|
|
27
|
+
(definition.shellsplit + args[1..-1]).tap do |expanded_args|
|
|
28
|
+
if Gem.configuration.verbose
|
|
29
|
+
say "*** expanding #{args.shelljoin} to #{expanded_args.shelljoin}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
args
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -*- encoding: US-ASCII -*-
|
|
2
|
+
|
|
3
|
+
require 'rubygems/command'
|
|
4
|
+
|
|
5
|
+
module Gem
|
|
6
|
+
module Commands
|
|
7
|
+
class AliasesCommand < Command
|
|
8
|
+
def initialize
|
|
9
|
+
super 'aliases', 'List alias definitions'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def usage # :nodoc:
|
|
13
|
+
"#{program_name}"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def execute
|
|
17
|
+
Gem.configuration.aliases.sort.each do |alias_name, definition|
|
|
18
|
+
say "\t#{alias_name} = #{definition}"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gem-alias
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- OZAWA Sakuro
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-06-01 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: ! 'This gem adds alias expansion feature to the ''gem'' command.
|
|
15
|
+
|
|
16
|
+
You can define subcommand aliases via .gemrc and list them
|
|
17
|
+
|
|
18
|
+
by ''aliases'' subcommand.
|
|
19
|
+
|
|
20
|
+
'
|
|
21
|
+
email:
|
|
22
|
+
- sakuro@2238club.org
|
|
23
|
+
executables: []
|
|
24
|
+
extensions: []
|
|
25
|
+
extra_rdoc_files: []
|
|
26
|
+
files:
|
|
27
|
+
- .gitignore
|
|
28
|
+
- LICENSE
|
|
29
|
+
- README.md
|
|
30
|
+
- Rakefile
|
|
31
|
+
- gem-alias.gemspec
|
|
32
|
+
- lib/gem-alias/extension.rb
|
|
33
|
+
- lib/gem-alias/version.rb
|
|
34
|
+
- lib/rubygems/commands/aliases_command.rb
|
|
35
|
+
- lib/rubygems_plugin.rb
|
|
36
|
+
homepage: http://github.com/sakuro/gem-alias
|
|
37
|
+
licenses: []
|
|
38
|
+
post_install_message:
|
|
39
|
+
rdoc_options: []
|
|
40
|
+
require_paths:
|
|
41
|
+
- lib
|
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
|
+
none: false
|
|
44
|
+
requirements:
|
|
45
|
+
- - ! '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
requirements: []
|
|
55
|
+
rubyforge_project:
|
|
56
|
+
rubygems_version: 1.8.23
|
|
57
|
+
signing_key:
|
|
58
|
+
specification_version: 3
|
|
59
|
+
summary: A RubyGems extension to add subcommand aliasing.
|
|
60
|
+
test_files: []
|