opener-ner 2.0.4 → 2.0.5

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: 7a4a8aef36d827b9811f412d1d95274baa7231a2
4
- data.tar.gz: 3db1738f90157c90d2e1ef450bdd3128bf580b11
3
+ metadata.gz: f917036a207b771bcfb9cd7fbc3c919ca1af27e7
4
+ data.tar.gz: ad4f73cf0beac4996101555cddc6621e8de3722a
5
5
  SHA512:
6
- metadata.gz: feecd33fcb6a097507051fdcce95e14be12f1f622de7573831fa21dd3906f44663285d01f1fe17072f180900a3fd9e7373eb9515110c2792af63014f547e3fb1
7
- data.tar.gz: 000d6253fe93afc61e1360fadbc25484877705a41bd7e43b4c54355a92bf56e51d7cb4ad6cabec969ec5000ca4e0d5100d19b29cc87dc15601d7b9270cd62611
6
+ metadata.gz: 1fea3cc0f29490165b5d0b55f5ff91ed8c0a69536df30c3fa4adc3c54530e96b13be8ed5a6f22360eb1e5f3cd653a05ba9e1eeb81e58d13c8674d18b1f5e63a8
7
+ data.tar.gz: 261f724b82aa36317b9564b31399bb13f0b881b0e19224308b60de38ff5dc3e7b3f52570c7620a8c1325c60dc367963b19eb0f73e79bc10db377fd1f24db861a
@@ -4,7 +4,6 @@ require 'nokogiri'
4
4
 
5
5
  require_relative 'ner/version'
6
6
  require_relative 'ner/cli'
7
- require_relative 'ner/error_layer'
8
7
 
9
8
  module Opener
10
9
  ##
@@ -65,7 +64,7 @@ module Opener
65
64
 
66
65
  return kernel.run(input)
67
66
  rescue Exception => error
68
- return ErrorLayer.new(input, error.message, self.class).add
67
+ return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
69
68
  end
70
69
  end
71
70
 
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class Ner
3
- VERSION = '2.0.4'
3
+ VERSION = '2.0.5'
4
4
  end # NER
5
5
  end # Opener
@@ -16,7 +16,7 @@
16
16
  ** When entering a value no response will be displayed in the browser.
17
17
  </p>
18
18
 
19
- <form action="<%=url("/")%>" method="POST">
19
+ <form action="" method="POST">
20
20
  <div>
21
21
  <label for="input">KAF input *</label>
22
22
  <br />
@@ -25,9 +25,9 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency 'nokogiri'
26
26
  gem.add_dependency 'puma'
27
27
  gem.add_dependency 'opener-daemons'
28
- gem.add_dependency 'opener-core', ['>= 0.1.2']
29
28
  gem.add_dependency 'opener-ner-base'
30
29
  gem.add_dependency 'opener-webservice'
30
+ gem.add_dependency 'opener-core', '~> 1.0'
31
31
 
32
32
  gem.add_development_dependency 'rake'
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-ner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
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-06-12 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -81,21 +81,21 @@ dependencies:
81
81
  prerelease: false
82
82
  type: :runtime
83
83
  - !ruby/object:Gem::Dependency
84
- name: opener-core
84
+ name: opener-ner-base
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '>='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.1.2
89
+ version: '0'
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - '>='
93
93
  - !ruby/object:Gem::Version
94
- version: 0.1.2
94
+ version: '0'
95
95
  prerelease: false
96
96
  type: :runtime
97
97
  - !ruby/object:Gem::Dependency
98
- name: opener-ner-base
98
+ name: opener-webservice
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '>='
@@ -109,17 +109,17 @@ dependencies:
109
109
  prerelease: false
110
110
  type: :runtime
111
111
  - !ruby/object:Gem::Dependency
112
- name: opener-webservice
112
+ name: opener-core
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '1.0'
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - '>='
120
+ - - ~>
121
121
  - !ruby/object:Gem::Version
122
- version: '0'
122
+ version: '1.0'
123
123
  prerelease: false
124
124
  type: :runtime
125
125
  - !ruby/object:Gem::Dependency
@@ -153,7 +153,6 @@ files:
153
153
  - exec/ner.rb
154
154
  - lib/opener/ner.rb
155
155
  - lib/opener/ner/cli.rb
156
- - lib/opener/ner/error_layer.rb
157
156
  - lib/opener/ner/public/markdown.css
158
157
  - lib/opener/ner/server.rb
159
158
  - lib/opener/ner/version.rb
@@ -1,89 +0,0 @@
1
- module Opener
2
- class Ner
3
- ##
4
- # Add Error Layer to KAF file instead of throwing an error.
5
- #
6
- class ErrorLayer
7
- attr_accessor :input, :document, :error, :klass
8
-
9
- def initialize(input, error, klass)
10
- @input = input.to_s
11
- # Make sure there is always a document, even if it is empty.
12
- @document = Nokogiri::XML(input) rescue Nokogiri::XML(nil)
13
- @error = error
14
- @klass = klass
15
- end
16
-
17
- def add
18
- if is_xml?
19
- unless has_errors_layer?
20
- add_errors_layer
21
- end
22
- else
23
- add_root
24
- add_text
25
- add_errors_layer
26
- end
27
- add_error
28
-
29
- xml = !!document.encoding ? document.to_xml : document.to_xml(:encoding => "UTF-8")
30
-
31
- return xml
32
- end
33
-
34
- ##
35
- # Check if the document is a valid XML file.
36
- #
37
- def is_xml?
38
- !!document.root
39
- end
40
-
41
- ##
42
- # Add root element to the XML file.
43
- #
44
- def add_root
45
- root = Nokogiri::XML::Node.new "KAF", document
46
- document.add_child(root)
47
- end
48
-
49
- ##
50
- # Check if the document already has an errors layer.
51
- #
52
- def has_errors_layer?
53
- !!document.at('errors')
54
- end
55
-
56
- ##
57
- # Add errors element to the XML file.
58
- #
59
- def add_errors_layer
60
- node = Nokogiri::XML::Node.new "errors", document
61
- document.root.add_child(node)
62
- end
63
-
64
- ##
65
- # Add the text file incase it is not a valid XML document. More
66
- # info for debugging.
67
- #
68
- def add_text
69
- node = Nokogiri::XML::Node.new "raw", document
70
- node.inner_html = input
71
- document.root.add_child(node)
72
-
73
- end
74
-
75
- ##
76
- # Add the actual error to the errors layer.
77
- #
78
- def add_error
79
- node = document.at('errors')
80
- error_node = Nokogiri::XML::Node.new "error", node
81
- error_node['class'] = klass.to_s
82
- error_node['version'] = klass::VERSION
83
- error_node.inner_html = error
84
- node.add_child(error_node)
85
- end
86
-
87
- end # ErrorLayer
88
- end # Ner
89
- end # Opener