ralias 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/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Ralias
2
2
 
3
- This library is extended so that it can be used to rich your shell more :)
4
-
5
3
  ## Build Status
6
4
 
7
5
  <img src="https://secure.travis-ci.org/daic-h/ralias.png"/>
@@ -41,32 +41,28 @@ module Ralias
41
41
  end
42
42
 
43
43
  def run(_cmd, args)
44
- cmd = commands[_cmd]
44
+ cmd = commands[_cmd] || (raise CommandNotFound)
45
45
  required_args = cmd.parameters
46
46
 
47
- begin
48
- if required_args.size == args.size
49
- if built_in_commands.include?(_cmd)
50
- cmd.call(*args)
51
- else
52
- system cmd.call(*args)
53
- end
47
+ if required_args.size == args.size
48
+ if built_in_commands.include?(_cmd)
49
+ cmd.call(*args)
54
50
  else
55
- with_color(:red) do
56
- "wrong number of arguments (#{args.size} for #{required_args.size}) (ArgumentError)"
57
- end
58
-
59
- required_args.each do |arg|
60
- with_color { "argumets: " + arg[1].to_s }
61
- end
62
- raise CommandNotFound
51
+ (system cmd.call(*args))
52
+ end
53
+ else
54
+ with_color(:red) do
55
+ "wrong number of arguments (#{args.size} for #{required_args.size}) (ArgumentError)"
63
56
  end
64
57
 
65
- rescue CommandNotFound
66
- with_color(:red) { "command not found." }
67
- rescue
68
- with_color(:red) { "error in the definition file." }
58
+ required_args.each do |arg|
59
+ with_color { "argumets: " + arg[1].to_s }
60
+ end
69
61
  end
62
+ rescue CommandNotFound
63
+ with_color(:red) { "command not found." }
64
+ rescue
65
+ with_color(:red) { "error in the definition file." }
70
66
  end
71
67
  end
72
68
  end
@@ -21,13 +21,13 @@ HELP
21
21
  #
22
22
  # normal alias definition
23
23
  #
24
- # define("lsA") { "ls -al" }
24
+ # define("lsA") { "ls -al" }
25
25
  #
26
26
  # if you want to use the arguments to the alias
27
27
  #
28
- # define("github") do |user_name, repository|
29
- # "git clone https://github.com/#{user_name}/#{repository}.git"
30
- # end
28
+ # define("github") do |user_name, repository|
29
+ # "git clone https://github.com/#{user_name}/#{repository}.git"
30
+ # end
31
31
  #
32
32
  EXAMPLE
33
33
  end
@@ -55,4 +55,17 @@ HELP
55
55
  end
56
56
  end
57
57
  built_in_commands << "list"
58
+
59
+ #
60
+ # Use in the command function here
61
+ #
62
+ class << self
63
+ def b_cd(command = "")
64
+ %Q(cd #{command.to_s} && exec /bin/bash)
65
+ end
66
+
67
+ def z_cd(command = "")
68
+ %Q(cd #{command.to_s} && exec /bin/zsh)
69
+ end
70
+ end
58
71
  end
@@ -1,3 +1,3 @@
1
1
  module Ralias
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,4 +1,4 @@
1
- # -*- encoding: utf-8 -*-
1
+ # -*- coding: utf-8; mode: ruby; -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  require "ralias/version"
4
4
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Daic_h"]
9
9
  s.email = ["bunny.hop.md@gmail.com"]
10
10
  s.homepage = ""
11
- s.summary = 'to extend the alias of shell in ruby'
11
+ s.summary = 'can be defined like the alias of shell'
12
12
  s.description = s.summary
13
13
 
14
14
  s.rubyforge_project = "ralias"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ralias
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:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-09 00:00:00.000000000Z
12
+ date: 2012-02-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70329175865900 !ruby/object:Gem::Requirement
16
+ requirement: &70275622745280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.2.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70329175865900
24
+ version_requirements: *70275622745280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70329175851220 !ruby/object:Gem::Requirement
27
+ requirement: &70275622742760 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,8 +32,8 @@ dependencies:
32
32
  version: 2.7.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70329175851220
36
- description: to extend the alias of shell in ruby
35
+ version_requirements: *70275622742760
36
+ description: can be defined like the alias of shell
37
37
  email:
38
38
  - bunny.hop.md@gmail.com
39
39
  executables:
@@ -80,7 +80,7 @@ rubyforge_project: ralias
80
80
  rubygems_version: 1.8.10
81
81
  signing_key:
82
82
  specification_version: 3
83
- summary: to extend the alias of shell in ruby
83
+ summary: can be defined like the alias of shell
84
84
  test_files:
85
85
  - spec/command_spec.rb
86
86
  - spec/spec_helper.rb