command-dispatcher 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48eb180aa79ec26ef8eb8937131540b493a8f6f8
4
- data.tar.gz: 7bfcc03f628d9c2c493fcceabcd9693c54338fbd
3
+ metadata.gz: e3e2be358d935705ef34c6f082a8ce927b990fce
4
+ data.tar.gz: 7983a9233080ae2266f929ee62eec449c6fa723b
5
5
  SHA512:
6
- metadata.gz: 54f01845f7ce03b86a8884a38bc63b7191eb74492757359735677510168be7b9e0140b47d5a46b41699a3c5e22229d0f42d066deb4ad66e8df93322e4d873485
7
- data.tar.gz: 32aaaf1670d087858ce56ef674a8af7ff76d2388f4f1e31dda46406ad3d2b8f579124778b5acfa478bd416ad8ba1956b1bbf6d067bd56576399e8f17c65add4e
6
+ metadata.gz: f6a86ce5aff8a61fc455330aba13cf816af5e5b71854990e341faf8095bfed845f3be32d9579831af9c5bb14c986e1b1634813531093e8774987b81847492a57
7
+ data.tar.gz: a1903327a7debe69c3e531236104d214a698daddf1f59af2076c3a4bd437e0ce9abea7598ac704a5127bbacc9d4138f7c5f703ba6c55779bcd0d7feaf49fa675
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Command::Dispatcher
2
2
 
3
- TODO: Write a gem description
3
+ [![Code Climate](https://codeclimate.com/github/patbonecrusher/command-dispatcher.png)](https://codeclimate.com/github/patbonecrusher/command-dispatcher)
4
4
 
5
5
  ## Installation
6
6
 
@@ -24,19 +24,20 @@ With CommandDispatcher you would create a first cli script and add the
24
24
  following code to it:
25
25
 
26
26
  `mygemscript`
27
- `$scriptPath = File.expand_path(File.dirname(__FILE__))
28
- $scriptName = File.basename(__FILE__)
29
- $command = ARGV.shift
30
- dispatcher = CommandDispatcher::Dispatcher.new( $scriptPath, $scriptName )
31
-
32
- begin
33
- dispatcher.dispatchCommand($command, *ARGV)
34
- rescue ArgumentError => ex
35
- $stderr.puts "Error: " + ex.to_s + ". Please specify a valid command."
36
- dispatcher.usage
37
- exit -1
38
- ensure
39
- end`
27
+
28
+ $scriptPath = File.expand_path(File.dirname(__FILE__))
29
+ $scriptName = File.basename(__FILE__)
30
+ $command = ARGV.shift
31
+ dispatcher = CommandDispatcher::Dispatcher.new( $scriptPath, $scriptName )
32
+
33
+ begin
34
+ dispatcher.dispatchCommand($command, *ARGV)
35
+ rescue ArgumentError => ex
36
+ $stderr.puts "Error: " + ex.to_s + ". Please specify a valid command."
37
+ dispatcher.usage
38
+ exit -1
39
+ ensure
40
+ end
40
41
 
41
42
  Then for each command, you would create a specific ruby script file name like:
42
43
  `mygemscript-commanda`
@@ -45,7 +46,6 @@ Then for each command, you would create a specific ruby script file name like:
45
46
 
46
47
  Such that when invoking `mygemscript commanda` would resolve in calling `mygemscript-commanda`
47
48
 
48
- TODO: Write usage instructions here
49
49
 
50
50
  ## Contributing
51
51
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -18,8 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
- spec.add_development_dependency "rake"
22
- spec.add_development_dependency 'version'
23
- spec.add_development_dependency 'rspec'
24
-
21
+ spec.add_development_dependency "rake", '~> 0'
22
+ spec.add_development_dependency 'version', '~> 0'
23
+ spec.add_development_dependency 'rspec', '~> 0'
24
+
25
+ spec.add_dependency 'win32-file', '~> 0'
26
+ spec.add_dependency 'win32-security', '~> 0'
27
+
25
28
  end
@@ -11,7 +11,7 @@ module CommandDispatcher
11
11
  def initialize(rootScriptAbsLocation, rootScriptName)
12
12
  @rootScriptAbsLocation = rootScriptAbsLocation
13
13
  @rootScriptName = rootScriptName
14
- @commandPrefix = rootScriptAbsLocation + '/' + rootScriptName + '-';
14
+ @commandPrefix = rootScriptAbsLocation + '/' + rootScriptName + '-'
15
15
  end
16
16
 
17
17
  # -------------------------------------------------------------------------
@@ -21,9 +21,9 @@ module CommandDispatcher
21
21
  tmp=f.slice(@commandPrefix.size, f.size)
22
22
  invalid=tmp.include? "-"
23
23
  if !invalid
24
- help = `#{f} --usage`
25
- command = File.basename(f).gsub!( "-", " " )
26
- $stdout.puts command.ljust(25) + " : " + help
24
+ command = File.basename(f)
25
+ help = `#{command} --usage`
26
+ $stdout.puts command.gsub!( "-", " " ).ljust(25) + " : " + help
27
27
  end
28
28
  end
29
29
  end
@@ -35,7 +35,7 @@ module CommandDispatcher
35
35
  raise ArgumentError.new(EX_NOCMD) if cmd == nil
36
36
  raise ArgumentError.new("#{cmd} " + EX_INVALCMD) unless isValid?(cmd)
37
37
 
38
- exec(@commandPrefix + cmd, *arguments)
38
+ exec(@rootScriptName + '-' + cmd, *arguments)
39
39
  end
40
40
 
41
41
  # -------------------------------------------------------------------------
metadata CHANGED
@@ -1,69 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command-dispatcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Laplante
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-05 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: version
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: win32-file
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: win32-security
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
96
  version: '0'
69
97
  description: Help with dispatching specific functionality to other ruby scripts. mybinscript
@@ -74,8 +102,8 @@ executables: []
74
102
  extensions: []
75
103
  extra_rdoc_files: []
76
104
  files:
77
- - .document
78
- - .gitignore
105
+ - ".document"
106
+ - ".gitignore"
79
107
  - Gemfile
80
108
  - LICENSE
81
109
  - README.md
@@ -95,20 +123,21 @@ require_paths:
95
123
  - lib
96
124
  required_ruby_version: !ruby/object:Gem::Requirement
97
125
  requirements:
98
- - - '>='
126
+ - - ">="
99
127
  - !ruby/object:Gem::Version
100
128
  version: '0'
101
129
  required_rubygems_version: !ruby/object:Gem::Requirement
102
130
  requirements:
103
- - - '>='
131
+ - - ">="
104
132
  - !ruby/object:Gem::Version
105
133
  version: '0'
106
134
  requirements: []
107
135
  rubyforge_project:
108
- rubygems_version: 2.1.11
136
+ rubygems_version: 2.3.0
109
137
  signing_key:
110
138
  specification_version: 4
111
139
  summary: ''
112
140
  test_files:
113
141
  - test/helper.rb
114
142
  - test/test_command-dispatcher.rb
143
+ has_rdoc: