opener-core 2.2.0 → 2.3.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: 03369a2b54b181f10f44cbeb3aaf03f4e77bce5c
4
- data.tar.gz: 7c55dddf8683e0face672005890d1e7875f1b3d2
3
+ metadata.gz: ae866565827f5fcdd91168b27ffce5f1e0ea3121
4
+ data.tar.gz: 0e6537c4e0c0ab0510c7487aec66c5c8c5c48de3
5
5
  SHA512:
6
- metadata.gz: 179d9be2fae2aec9260a42bee0e6b36ebc04ddde43c2859abf2ac4a77f8683c239afd5363d4b281192a1a5fe07c6b7ba5320c3f20518b2b0536da9074b70580a
7
- data.tar.gz: 07f0fd8aa620e8ad02f8de03293ac20d7b68a344afec4f57c43cdf9986995b549d3a53de2425a890c38843aa37230dd8f2d6ecb3570a5a7ddce4807d0c6668e5
6
+ metadata.gz: c6ec81346c1409a8ac31a02598eebdada6eec3b1a3a76e6d46ad434b05cb23c6d3db26ed94de43f01eab537b5daf634defbb9d250ad09ecebcc59fb98bfb5724
7
+ data.tar.gz: 63dfe4fed71d80a52b6c941c6cf58a5148ab6554ccc004356efc2e3b4b9edc03bcb1f8e8facebc22cd063f95f4b6a39edc7dfb4bde5b90267d518c8a659bf3a3
@@ -8,6 +8,6 @@ require 'httpclient'
8
8
  require 'archive'
9
9
 
10
10
  require_relative 'core/version'
11
- require_relative 'core/opt_parser'
12
11
  require_relative 'core/resource_switcher'
13
12
  require_relative 'core/syslog'
13
+ require_relative 'core/language_error'
@@ -0,0 +1,23 @@
1
+ module Opener
2
+ module Core
3
+ ##
4
+ # Error class that can be used by components whenever they encounter an
5
+ # unsupported language.
6
+ #
7
+ # @!attribute [r] language
8
+ # @return [String]
9
+ #
10
+ class UnsupportedLanguageError < StandardError
11
+ attr_reader :language
12
+
13
+ ##
14
+ # @param [String] language
15
+ #
16
+ def initialize(language)
17
+ @language = language
18
+
19
+ super("The language #{language.inspect} is not supported")
20
+ end
21
+ end # UnsupportedLanguageError
22
+ end # Core
23
+ end # Opener
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  module Core
3
- VERSION = '2.2.0'
3
+ VERSION = '2.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
@@ -103,7 +103,7 @@ files:
103
103
  - LICENSE.txt
104
104
  - README.md
105
105
  - lib/opener/core.rb
106
- - lib/opener/core/opt_parser.rb
106
+ - lib/opener/core/language_error.rb
107
107
  - lib/opener/core/resource_switcher.rb
108
108
  - lib/opener/core/syslog.rb
109
109
  - lib/opener/core/version.rb
@@ -1,60 +0,0 @@
1
- module Opener
2
- module Core
3
- class OptParser
4
- attr_accessor :option_parser, :options
5
-
6
- def initialize(&block)
7
- @options = {}
8
- @option_parser = construct_option_parser(options, &block)
9
- end
10
-
11
- def parse(args)
12
- process(:parse, args)
13
- end
14
-
15
- def parse!(args)
16
- process(:parse!, args)
17
- end
18
-
19
- def pre_parse!(args)
20
- delete_double_dash = false
21
- process(:parse!, args, delete_double_dash)
22
- end
23
-
24
- def pre_parse(args)
25
- delete_double_dash = false
26
- process(:parse, args, delete_double_dash)
27
- end
28
-
29
- def self.parse(args)
30
- new.parse(args)
31
- end
32
-
33
- def self.parse!(args)
34
- new.parse!(args)
35
- end
36
-
37
- def self.pre_parse!(args)
38
- new.pre_parse!(args)
39
- end
40
-
41
- def self.pre_parse(args)
42
- new.pre_parse(args)
43
- end
44
-
45
- private
46
-
47
- def process(call, args, delete_double_dash=true)
48
- args.delete("--") if delete_double_dash
49
- option_parser.send(call, args)
50
- return options
51
- end
52
-
53
- def construct_option_parser(options, &block)
54
- raise NotImplementedError
55
- end
56
- end
57
-
58
- end
59
- end
60
-