opener-tokenizer 1.0.8 → 1.0.9

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: 13496247ba47f692c80f12993485a57bd0e0a72b
4
- data.tar.gz: fcaa9ee31dad9c1f060c82acad59f9742575e3d7
3
+ metadata.gz: 275fb27a8f2ed178e9b28406471d29a086f6b9f4
4
+ data.tar.gz: 2f7c7531e54f72406263b9bf0d25ff82c0a46007
5
5
  SHA512:
6
- metadata.gz: 2512639dd4ff6a4c9bfc8d266428d92f466d49032132fbfaa24f2f8770ac0141225d065af02f4d518c167354356bd4617c11eb9bcd3b61b5e913e92a28ce599f
7
- data.tar.gz: deb1510b4f54a4f5a411eaca399db5bc553b25870f433dedefa6e8d1eb064c74a0bde95314dd48305215cac43d9b197b83c16b240a67559959c9d9afe002a9ae
6
+ metadata.gz: 6b5ee46d17b89684504a92dcc19b31c7d327088dabee5a4b751351dce1f287ee0191ec1051cc519c1d306c271fdd9f06f5d688e210fdc6d1fec16eef3450f33a
7
+ data.tar.gz: d3302b2bb53eecc52022a58027f315db0c9894fb208cb64c01489249916f3d2468d5cde7b9d2f67352b99d5dc827ab4c7894b52b683be5d7950486e09889652e
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class Tokenizer
3
- VERSION = "1.0.8"
3
+ VERSION = "1.0.9"
4
4
  end
5
5
  end
@@ -61,7 +61,7 @@
61
61
  <p>* required</p>
62
62
  <p>** When entering a value no response will be displayed in the browser.</p>
63
63
 
64
- <form action="<%=url("/")%>" method="POST">
64
+ <form action="" method="POST">
65
65
  <div>
66
66
  <label for="input"/>Type your text here*</label>
67
67
  <br/>
@@ -5,7 +5,6 @@ require 'optparse'
5
5
 
6
6
  require_relative 'tokenizer/version'
7
7
  require_relative 'tokenizer/cli'
8
- require_relative 'tokenizer/error_layer'
9
8
 
10
9
  module Opener
11
10
  ##
@@ -76,7 +75,7 @@ module Opener
76
75
  return stdout
77
76
 
78
77
  rescue Exception => error
79
- return ErrorLayer.new(input, error.message, self.class).add
78
+ return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
80
79
  end
81
80
  end
82
81
 
@@ -28,6 +28,7 @@ Gem::Specification.new do |gem|
28
28
  gem.add_dependency 'sinatra', '~>1.4.2'
29
29
  gem.add_dependency 'httpclient'
30
30
  gem.add_dependency 'opener-daemons'
31
+ gem.add_dependency 'opener-core', '~>1.0.2'
31
32
  gem.add_dependency 'puma'
32
33
 
33
34
  gem.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-tokenizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
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: opener-tokenizer-base
@@ -94,6 +94,20 @@ dependencies:
94
94
  version: '0'
95
95
  prerelease: false
96
96
  type: :runtime
97
+ - !ruby/object:Gem::Dependency
98
+ name: opener-core
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.2
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ~>
107
+ - !ruby/object:Gem::Version
108
+ version: 1.0.2
109
+ prerelease: false
110
+ type: :runtime
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: puma
99
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -181,7 +195,6 @@ files:
181
195
  - exec/tokenizer.rb
182
196
  - lib/opener/tokenizer.rb
183
197
  - lib/opener/tokenizer/cli.rb
184
- - lib/opener/tokenizer/error_layer.rb
185
198
  - lib/opener/tokenizer/public/markdown.css
186
199
  - lib/opener/tokenizer/server.rb
187
200
  - lib/opener/tokenizer/version.rb
@@ -1,89 +0,0 @@
1
- module Opener
2
- class Tokenizer
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 # Tokenizer
89
- end # Opener