rubulex 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +47 -39
- data/lib/rubulex.rb +1 -1
- data/lib/rubulex/app.rb +7 -5
- data/lib/rubulex/regexp_parser.rb +19 -22
- data/lib/rubulex/version.rb +1 -1
- data/rubulex.gemspec +5 -5
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5d87030013ee86ead4b36a52443b5784d500406e752e7f1f78822b5671ce246d
|
4
|
+
data.tar.gz: 908d6b8907d7b313a1d702e05d29d910c46e63c5ab5f6e519567dcd61eb7d6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0ba67b14cabb9bd9ea6c05e6281b68dbc834f1468f611179ad121550a3559110938ea770fc0c3df40c299d5e8b404ffbf61aaf86cc00d2d3959f3515d1f17d9
|
7
|
+
data.tar.gz: 152f7bb9c4a2beeaf2f6e89d6c0af7cccc82cf30636056e6517e7864b53485d7fb6ab2987cc41741f2a965ff70cabf0d7e042c450225a2a5be90ebfde15a9e7e
|
data/Gemfile.lock
CHANGED
@@ -1,58 +1,66 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubulex (0.
|
5
|
-
|
6
|
-
sinatra (~>
|
7
|
-
sinatra-contrib (~>
|
8
|
-
slim (~>
|
4
|
+
rubulex (0.7.0)
|
5
|
+
sassc (~> 2.0)
|
6
|
+
sinatra (~> 2.0)
|
7
|
+
sinatra-contrib (~> 2.0)
|
8
|
+
slim (~> 4.0)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://www.rubygems.org/
|
12
12
|
specs:
|
13
|
-
backports (3.
|
14
|
-
diff-lcs (1.
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
backports (3.12.0)
|
14
|
+
diff-lcs (1.3)
|
15
|
+
ffi (1.10.0)
|
16
|
+
ffi (1.10.0-java)
|
17
|
+
multi_json (1.13.1)
|
18
|
+
mustermann (1.0.3)
|
19
|
+
rack (2.0.6)
|
20
|
+
rack-protection (2.0.5)
|
18
21
|
rack
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
rspec-
|
23
|
-
rspec-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
rspec-expectations (3.3.1)
|
22
|
+
rake (12.3.2)
|
23
|
+
rspec (3.8.0)
|
24
|
+
rspec-core (~> 3.8.0)
|
25
|
+
rspec-expectations (~> 3.8.0)
|
26
|
+
rspec-mocks (~> 3.8.0)
|
27
|
+
rspec-core (3.8.0)
|
28
|
+
rspec-support (~> 3.8.0)
|
29
|
+
rspec-expectations (3.8.2)
|
28
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-mocks (3.
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-mocks (3.8.0)
|
31
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-support (3.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-support (3.8.0)
|
36
|
+
sassc (2.0.1)
|
37
|
+
ffi (~> 1.9)
|
38
|
+
rake
|
39
|
+
sinatra (2.0.5)
|
40
|
+
mustermann (~> 1.0)
|
41
|
+
rack (~> 2.0)
|
42
|
+
rack-protection (= 2.0.5)
|
43
|
+
tilt (~> 2.0)
|
44
|
+
sinatra-contrib (2.0.5)
|
45
|
+
backports (>= 2.8.2)
|
41
46
|
multi_json
|
42
|
-
|
43
|
-
rack-
|
44
|
-
sinatra (
|
47
|
+
mustermann (~> 1.0)
|
48
|
+
rack-protection (= 2.0.5)
|
49
|
+
sinatra (= 2.0.5)
|
45
50
|
tilt (>= 1.3, < 3)
|
46
|
-
slim (
|
47
|
-
temple (
|
48
|
-
tilt (>=
|
49
|
-
temple (0.
|
50
|
-
tilt (2.0.
|
51
|
+
slim (4.0.1)
|
52
|
+
temple (>= 0.7.6, < 0.9)
|
53
|
+
tilt (>= 2.0.6, < 2.1)
|
54
|
+
temple (0.8.1)
|
55
|
+
tilt (2.0.9)
|
51
56
|
|
52
57
|
PLATFORMS
|
53
58
|
java
|
54
59
|
ruby
|
55
60
|
|
56
61
|
DEPENDENCIES
|
57
|
-
rspec (~> 3.
|
62
|
+
rspec (~> 3.8.0)
|
58
63
|
rubulex!
|
64
|
+
|
65
|
+
BUNDLED WITH
|
66
|
+
1.16.2
|
data/lib/rubulex.rb
CHANGED
data/lib/rubulex/app.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
module Rubulex
|
2
2
|
class App < Sinatra::Base
|
3
|
+
RUBULEX_DATA_PATH = Pathname.new(Gem.loaded_specs["rubulex"].full_gem_path) / "data" / "rubulex"
|
4
|
+
|
3
5
|
helpers Sinatra::JSON
|
4
6
|
set :json_encoder, :to_json
|
5
7
|
set :static, true
|
6
|
-
set :public_folder,
|
7
|
-
set :views,
|
8
|
+
set :public_folder, RUBULEX_DATA_PATH / "public"
|
9
|
+
set :views, RUBULEX_DATA_PATH / "views"
|
8
10
|
set :slim, { format: :html5 }
|
9
11
|
|
10
12
|
get '/' do
|
11
13
|
slim :index
|
12
|
-
end
|
14
|
+
end
|
13
15
|
|
14
16
|
get '/stylesheets/:name.css' do
|
15
17
|
content_type 'text/css', charset: 'utf-8'
|
@@ -21,8 +23,8 @@ module Rubulex
|
|
21
23
|
content_type 'text/html', charset: 'utf-8'
|
22
24
|
|
23
25
|
parser = Rubulex::RegexpParser.new(
|
24
|
-
params[:regex].to_s,
|
25
|
-
params[:options].to_s,
|
26
|
+
params[:regex].to_s,
|
27
|
+
params[:options].to_s,
|
26
28
|
params[:test_data].to_s
|
27
29
|
)
|
28
30
|
|
@@ -13,7 +13,7 @@ module Rubulex
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def data=(data)
|
16
|
-
@data = data[0..4095] || ""
|
16
|
+
@data = data[0..4095] || ""
|
17
17
|
end
|
18
18
|
|
19
19
|
def regex=(regex)
|
@@ -25,12 +25,12 @@ module Rubulex
|
|
25
25
|
def options=(options)
|
26
26
|
options = options.match(/(?<options>(?<option>[imxo]){,4})/)[:options].split(//)
|
27
27
|
|
28
|
-
options_lookup_table = Hash.new(0)
|
28
|
+
options_lookup_table = Hash.new(0)
|
29
29
|
options_lookup_table["i"] = Regexp::IGNORECASE
|
30
30
|
options_lookup_table["m"] = Regexp::MULTILINE
|
31
31
|
options_lookup_table["x"] = Regexp::EXTENDED
|
32
32
|
|
33
|
-
@options = options.inject(0) do |result, option|
|
33
|
+
@options = options.inject(0) do |result, option|
|
34
34
|
result | options_lookup_table[option]
|
35
35
|
end
|
36
36
|
end
|
@@ -47,7 +47,7 @@ module Rubulex
|
|
47
47
|
(@colors ||= [:red, :green, :darkorange, :blue].cycle).next
|
48
48
|
end
|
49
49
|
data.gsub!(@regex) do |match|
|
50
|
-
"<span class='#{colors.call}'>#{match}</span>"
|
50
|
+
"<span class='#{h(colors.call)}'>#{h(match)}</span>"
|
51
51
|
end
|
52
52
|
|
53
53
|
data.gsub(/\n/,"<br />")
|
@@ -56,28 +56,20 @@ module Rubulex
|
|
56
56
|
def render_match_groups(data)
|
57
57
|
match_groups = []
|
58
58
|
|
59
|
-
data.
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
sub_match_set
|
64
|
-
|
65
|
-
match_group_count.times do |index|
|
66
|
-
key = sub_match.names[index] || index + 1
|
67
|
-
match_text = sub_match[key]
|
68
|
-
|
69
|
-
sub_match_set << Struct::MatchRelation.new(key, match_text)
|
70
|
-
end
|
71
|
-
|
72
|
-
match_groups << sub_match_set
|
59
|
+
matches = data.to_enum(:scan, @regex).map { Regexp.last_match }
|
60
|
+
matches.each do |match_data|
|
61
|
+
sub_match_set = []
|
62
|
+
match_data.captures.each_with_index do |match_text, i|
|
63
|
+
sub_match_set << Struct::MatchRelation.new(i+1, match_text)
|
73
64
|
end
|
65
|
+
match_groups << sub_match_set
|
74
66
|
end
|
75
67
|
|
76
|
-
match_groups.map.with_index { |sub_set, index|
|
77
|
-
group = "<dl><dt>Match #{index + 1}</dt>"
|
68
|
+
match_groups.map.with_index { |sub_set, index|
|
69
|
+
group = "<dl><dt>Match #{h(index + 1)}</dt>"
|
78
70
|
group << sub_set.map { |match|
|
79
|
-
"<dd>#{match.name}: #{match.text}</dd>"
|
80
|
-
}.join
|
71
|
+
"<dd>#{h(match.name)}: #{h(match.text)}</dd>"
|
72
|
+
}.join
|
81
73
|
group << "</dl>"
|
82
74
|
}.join("<br />")
|
83
75
|
end
|
@@ -88,6 +80,11 @@ module Rubulex
|
|
88
80
|
match_groups: @match_groups
|
89
81
|
}
|
90
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def h(text)
|
86
|
+
Rack::Utils.escape_html(text)
|
87
|
+
end
|
91
88
|
end
|
92
89
|
|
93
90
|
end
|
data/lib/rubulex/version.rb
CHANGED
data/rubulex.gemspec
CHANGED
@@ -13,12 +13,12 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/ofeldt/rubulex"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.add_runtime_dependency "sinatra",
|
17
|
-
spec.add_runtime_dependency "sinatra-contrib", "~>
|
18
|
-
spec.add_runtime_dependency "slim",
|
19
|
-
spec.add_runtime_dependency "
|
16
|
+
spec.add_runtime_dependency "sinatra", "~> 2.0"
|
17
|
+
spec.add_runtime_dependency "sinatra-contrib", "~> 2.0"
|
18
|
+
spec.add_runtime_dependency "slim", "~> 4.0"
|
19
|
+
spec.add_runtime_dependency "sassc", "~> 2.0"
|
20
20
|
|
21
|
-
spec.add_development_dependency "rspec", "~> 3.
|
21
|
+
spec.add_development_dependency "rspec", "~> 3.8.0"
|
22
22
|
|
23
23
|
spec.files = `git ls-files`.split($/)
|
24
24
|
spec.bindir = "exe"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubulex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Feldt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sinatra-contrib
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: slim
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '4.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '4.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: sassc
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '2.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 3.
|
75
|
+
version: 3.8.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 3.
|
82
|
+
version: 3.8.0
|
83
83
|
description: A simple self-hosted Rubular Clone
|
84
84
|
email:
|
85
85
|
- oliver.feldt@googlemail.com
|
@@ -124,9 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.7.6
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Rubulex is a simple web application for developing/testing Regular Expression
|
131
131
|
test_files: []
|
132
|
-
has_rdoc:
|