maven-helper-script 0.1.2 → 0.1.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require_relative 'invalid_command_exception'
2
3
 
3
4
  module MavenHelperScript
4
5
 
@@ -25,7 +26,7 @@ module MavenHelperScript
25
26
  mapping.each_char do |character|
26
27
  command = findCommandFor(character)
27
28
  if !command || command.empty?
28
- raise "Unable to locate command for: " << character
29
+ raise MavenHelperScript::InvalidCommandException.new(@commands, mapping)
29
30
  end
30
31
  result << command << " "
31
32
  end
@@ -0,0 +1,19 @@
1
+ module MavenHelperScript
2
+
3
+ class InvalidCommandException < Exception
4
+ def initialize(commands, failedCommand)
5
+ @commands = commands
6
+ @failedCommand = failedCommand
7
+ end
8
+
9
+ def commands
10
+ return @commands
11
+ end
12
+
13
+ def failedCommand
14
+ return @failedCommand
15
+ end
16
+
17
+ end
18
+
19
+ end
data/lib/script_runner.rb CHANGED
@@ -40,7 +40,13 @@ module MavenHelperScript
40
40
  puts "Failed executing command: " << command
41
41
  puts LINE
42
42
  end
43
-
43
+ rescue MavenHelperScript::InvalidCommandException => e
44
+ puts "Unable to process command: " << e.failedCommand
45
+ puts "\nFound Commands: "
46
+ e.commands.each do |key, value|
47
+ puts "\t" << key << " : " << value
48
+ end
49
+ puts "\nUse valid combinations of the commands above."
44
50
  end
45
51
 
46
52
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "maven-helper-script"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kingOburgers"]
12
- s.date = "2012-09-19"
12
+ s.date = "2012-09-22"
13
13
  s.description = "Execute your complex maven commands faster with the shortened helper syntax. See the rdoc for more details and examples."
14
14
  s.email = "kieferfam@msn.com"
15
15
  s.executables = ["m"]
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "bin/m",
29
29
  "lib/argument_parser.rb",
30
30
  "lib/configuration_checker.rb",
31
+ "lib/invalid_command_exception.rb",
31
32
  "lib/project_home_finder.rb",
32
33
  "lib/script_runner.rb",
33
34
  "maven-helper-script.gemspec",
@@ -38,6 +39,7 @@ Gem::Specification.new do |s|
38
39
  "test/argument_parser_spec.rb",
39
40
  "test/configuration_checker_map_spec.rb",
40
41
  "test/configuration_checker_spec.rb",
42
+ "test/invalid_command_exception_spec.rb",
41
43
  "test/m.yml",
42
44
  "test/map.yml",
43
45
  "test/project_home_finder_spec.rb",
@@ -1,5 +1,6 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
2
  require "configuration_checker"
3
+ require "invalid_command_exception"
3
4
 
4
5
  describe MavenHelperScript::ConfigurationChecker do
5
6
  before(:each) do
@@ -19,7 +20,7 @@ describe MavenHelperScript::ConfigurationChecker do
19
20
  end
20
21
 
21
22
  it "should blow up if you can't find the other part of a command" do
22
- expect {@checker.checkForCommand("cj") }.to raise_error(RuntimeError, "Unable to locate command for: j")
23
+ expect {@checker.checkForCommand("cj") }.to raise_error(MavenHelperScript::InvalidCommandException)
23
24
  end
24
25
 
25
26
  it "should find plugin execution" do
@@ -27,7 +28,7 @@ describe MavenHelperScript::ConfigurationChecker do
27
28
  end
28
29
 
29
30
  it "should blow up when can't find command" do
30
- expect {@checker.checkForCommand("j") }.to raise_error(RuntimeError, "Unable to locate command for: j")
31
+ expect {@checker.checkForCommand("j") }.to raise_error(MavenHelperScript::InvalidCommandException)
31
32
  end
32
33
 
33
34
  it "should return all command arguments" do
@@ -1,5 +1,6 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
2
  require "configuration_checker"
3
+ require "invalid_command_exception"
3
4
 
4
5
  describe MavenHelperScript::ConfigurationChecker do
5
6
  before(:each) do
@@ -23,7 +24,7 @@ describe MavenHelperScript::ConfigurationChecker do
23
24
  end
24
25
 
25
26
  it "should blow up when can't find command" do
26
- expect {@checker.checkForCommand("j") }.to raise_error(RuntimeError, "Unable to locate command for: j")
27
+ expect {@checker.checkForCommand("j") }.to raise_error(MavenHelperScript::InvalidCommandException)
27
28
  end
28
29
 
29
30
  it "should return all command arguments" do
@@ -0,0 +1,16 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require "invalid_command_exception"
3
+
4
+ describe MavenHelperScript::InvalidCommandException do
5
+ before (:each) do
6
+ @commands = Hash.new()
7
+ @commands["m"] = "make"
8
+ @error = MavenHelperScript::InvalidCommandException.new(@commands, "boom")
9
+ end
10
+
11
+ it "should print command mapping" do
12
+ @error.commands.should == @commands
13
+ @error.failedCommand.should == "boom"
14
+ end
15
+
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maven-helper-script
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-19 00:00:00.000000000 Z
12
+ date: 2012-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -79,6 +79,7 @@ files:
79
79
  - bin/m
80
80
  - lib/argument_parser.rb
81
81
  - lib/configuration_checker.rb
82
+ - lib/invalid_command_exception.rb
82
83
  - lib/project_home_finder.rb
83
84
  - lib/script_runner.rb
84
85
  - maven-helper-script.gemspec
@@ -89,6 +90,7 @@ files:
89
90
  - test/argument_parser_spec.rb
90
91
  - test/configuration_checker_map_spec.rb
91
92
  - test/configuration_checker_spec.rb
93
+ - test/invalid_command_exception_spec.rb
92
94
  - test/m.yml
93
95
  - test/map.yml
94
96
  - test/project_home_finder_spec.rb
@@ -107,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
109
  version: '0'
108
110
  segments:
109
111
  - 0
110
- hash: -317974925
112
+ hash: 352759457
111
113
  required_rubygems_version: !ruby/object:Gem::Requirement
112
114
  none: false
113
115
  requirements: