code-ruby 0.15.15 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -8
- data/VERSION +1 -0
- data/bin/code +57 -94
- data/code-ruby.gemspec +2 -4
- data/lib/code/version.rb +2 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8fd1137d78771da7054494333cedcdf9ebb4d45402112d2694d227e4d44739b
|
4
|
+
data.tar.gz: f494bfe408b64cd08e39f300b499d1634c8ec59534519306658d44ef908c2f72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 641adcd7f50838888057e7f2c84464d89641a5648136a00f18955ae2128d35b59ac7d2a780544c0a3cf2f917110e7417cbe9dfc4d1f9c494eac80cf313abe2b4
|
7
|
+
data.tar.gz: d42e4ab20e52db2ab7cbde25b12c43810ef8441076954cbe3fbf7fba6abb1ae861af48ea0b85b85d037e26c77aeb96cc4c6b26a96f42e651ea3e33ee4845ca89
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
code-ruby (0.
|
4
|
+
code-ruby (1.0.0)
|
5
5
|
activesupport
|
6
6
|
bigdecimal
|
7
7
|
did-you-mean
|
8
|
+
dorian-arguments
|
8
9
|
json
|
9
10
|
language-ruby
|
10
11
|
zeitwerk
|
@@ -12,7 +13,7 @@ PATH
|
|
12
13
|
GEM
|
13
14
|
remote: https://rubygems.org/
|
14
15
|
specs:
|
15
|
-
activesupport (7.2.
|
16
|
+
activesupport (7.2.1)
|
16
17
|
base64
|
17
18
|
bigdecimal
|
18
19
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
@@ -26,7 +27,7 @@ GEM
|
|
26
27
|
ast (2.4.2)
|
27
28
|
base64 (0.2.0)
|
28
29
|
bigdecimal (3.1.8)
|
29
|
-
bundler-audit (0.9.
|
30
|
+
bundler-audit (0.9.2)
|
30
31
|
bundler (>= 1.2.0, < 3)
|
31
32
|
thor (~> 1.0)
|
32
33
|
concurrent-ruby (1.3.4)
|
@@ -34,11 +35,17 @@ GEM
|
|
34
35
|
did-you-mean (0.1.1)
|
35
36
|
levenshtein (>= 0.2.0)
|
36
37
|
diff-lcs (1.5.1)
|
38
|
+
dorian-arguments (0.4.1)
|
39
|
+
activesupport
|
40
|
+
bigdecimal
|
41
|
+
dorian-to_struct
|
42
|
+
dorian-to_struct (0.6.0)
|
37
43
|
drb (2.2.1)
|
38
44
|
i18n (1.14.5)
|
39
45
|
concurrent-ruby (~> 1.0)
|
40
46
|
json (2.7.2)
|
41
|
-
language-ruby (0.9.
|
47
|
+
language-ruby (0.9.3)
|
48
|
+
dorian-arguments
|
42
49
|
zeitwerk
|
43
50
|
language_server-protocol (3.17.0.3)
|
44
51
|
levenshtein (0.2.2)
|
@@ -53,7 +60,7 @@ GEM
|
|
53
60
|
rainbow (3.1.1)
|
54
61
|
rake (13.2.1)
|
55
62
|
regexp_parser (2.9.2)
|
56
|
-
rexml (3.3.
|
63
|
+
rexml (3.3.6)
|
57
64
|
strscan
|
58
65
|
rspec (3.13.0)
|
59
66
|
rspec-core (~> 3.13.0)
|
@@ -61,7 +68,7 @@ GEM
|
|
61
68
|
rspec-mocks (~> 3.13.0)
|
62
69
|
rspec-core (3.13.0)
|
63
70
|
rspec-support (~> 3.13.0)
|
64
|
-
rspec-expectations (3.13.
|
71
|
+
rspec-expectations (3.13.2)
|
65
72
|
diff-lcs (>= 1.2.0, < 2.0)
|
66
73
|
rspec-support (~> 3.13.0)
|
67
74
|
rspec-mocks (3.13.1)
|
@@ -87,10 +94,10 @@ GEM
|
|
87
94
|
rubocop-performance (1.21.1)
|
88
95
|
rubocop (>= 1.48.1, < 2.0)
|
89
96
|
rubocop-ast (>= 1.31.1, < 2.0)
|
90
|
-
rubocop-rails (2.
|
97
|
+
rubocop-rails (2.26.0)
|
91
98
|
activesupport (>= 4.2.0)
|
92
99
|
rack (>= 1.1)
|
93
|
-
rubocop (>= 1.
|
100
|
+
rubocop (>= 1.52.0, < 2.0)
|
94
101
|
rubocop-ast (>= 1.31.1, < 2.0)
|
95
102
|
rubocop-rails-omakase (1.0.0)
|
96
103
|
rubocop
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/bin/code
CHANGED
@@ -1,108 +1,71 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "optparse"
|
5
4
|
require_relative "../lib/code-ruby"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
opts.on("--profile", "Profile Ruby code") do |_timeout|
|
52
|
-
require "ruby-prof"
|
53
|
-
options[:profile] = true
|
54
|
-
end
|
55
|
-
|
56
|
-
opts.on(
|
57
|
-
"--profiler TYPE",
|
58
|
-
"Profiler output type (text (default) or html)"
|
59
|
-
) do |profiler|
|
60
|
-
require "ruby-prof"
|
61
|
-
options[:profile] = true
|
62
|
-
options[:profiler] = profiler
|
63
|
-
end
|
64
|
-
end
|
65
|
-
.parse!
|
66
|
-
|
67
|
-
if options[:input].empty?
|
68
|
-
options[:input] = argv.join(" ")
|
69
|
-
options[:input] = File.read(options[:input]) if File.exist?(options[:input])
|
70
|
-
end
|
71
|
-
|
72
|
-
abort <<~HELP if options[:input].empty?
|
73
|
-
Usage: code INPUT
|
74
|
-
|
75
|
-
-v, --version Version of Code
|
76
|
-
-i, --input INPUT Input in the Code language (String or File)
|
77
|
-
-p, --parse Parser tree for input
|
78
|
-
-t, --timeout TIMEOUT Set timeout in seconds
|
79
|
-
--profile Profile Ruby code
|
80
|
-
--profiler TYPE Profiler output type (text (default) or html)
|
81
|
-
HELP
|
82
|
-
|
83
|
-
RubyProf.start if options[:profile]
|
84
|
-
|
85
|
-
if options[:parse]
|
86
|
-
pp Code::Parser.parse(options[:input]).to_raw
|
5
|
+
require "dorian/arguments"
|
6
|
+
|
7
|
+
parsed =
|
8
|
+
Dorian::Arguments.parse(
|
9
|
+
input: {
|
10
|
+
type: :string,
|
11
|
+
alias: :i
|
12
|
+
},
|
13
|
+
parse: {
|
14
|
+
type: :boolean,
|
15
|
+
alias: :p
|
16
|
+
},
|
17
|
+
profile: :boolean,
|
18
|
+
profiler: :string,
|
19
|
+
timeout: {
|
20
|
+
type: :integer,
|
21
|
+
alias: :t
|
22
|
+
},
|
23
|
+
version: {
|
24
|
+
type: :boolean,
|
25
|
+
alias: :v
|
26
|
+
},
|
27
|
+
help: {
|
28
|
+
type: :boolean,
|
29
|
+
alias: :h
|
30
|
+
}
|
31
|
+
)
|
32
|
+
|
33
|
+
abort Code::Version.to_s if parsed.options.version
|
34
|
+
abort parsed.help if parsed.options.help
|
35
|
+
|
36
|
+
input = parsed.options.input.to_s
|
37
|
+
input = File.read(input) if File.exist?(input)
|
38
|
+
input += parsed.arguments.join(" ")
|
39
|
+
input += parsed.files.map { |file| File.read(file) }.join
|
40
|
+
|
41
|
+
abort parsed.help if input.empty?
|
42
|
+
|
43
|
+
profile = parsed.options.profile || !parsed.options.profiler.empty?
|
44
|
+
require "ruby-prof" if profile
|
45
|
+
|
46
|
+
RubyProf.start if profile
|
47
|
+
|
48
|
+
if parsed.options.parse
|
49
|
+
pp Code::Parser.parse(input).to_raw
|
87
50
|
else
|
88
|
-
print
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
51
|
+
print(
|
52
|
+
Code.evaluate(
|
53
|
+
input,
|
54
|
+
output: $stdout,
|
55
|
+
error: $stderr,
|
56
|
+
timeout: parsed.options.timeout
|
57
|
+
)
|
58
|
+
)
|
94
59
|
end
|
95
60
|
|
96
|
-
if
|
61
|
+
if profile
|
97
62
|
result = RubyProf.stop
|
98
63
|
|
99
|
-
if options
|
100
|
-
printer = RubyProf::FlatPrinter.new(result)
|
101
|
-
printer.print($stdout)
|
102
|
-
elsif options[:profiler] == "html"
|
64
|
+
if parsed.options.profiler == "html"
|
103
65
|
printer = RubyProf::GraphHtmlPrinter.new(result)
|
104
66
|
printer.print($stdout)
|
105
67
|
else
|
106
|
-
|
68
|
+
printer = RubyProf::FlatPrinter.new(result)
|
69
|
+
printer.print($stdout)
|
107
70
|
end
|
108
71
|
end
|
data/code-ruby.gemspec
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "English"
|
4
|
-
require_relative "lib/code/version"
|
5
|
-
|
6
3
|
Gem::Specification.new do |s|
|
7
4
|
s.name = "code-ruby"
|
8
|
-
s.version =
|
5
|
+
s.version = File.read("VERSION").strip
|
9
6
|
s.summary = "a programming language for the internet"
|
10
7
|
s.description = s.summary
|
11
8
|
s.authors = ["Dorian Marié"]
|
@@ -22,4 +19,5 @@ Gem::Specification.new do |s|
|
|
22
19
|
s.add_dependency "json"
|
23
20
|
s.add_dependency "language-ruby"
|
24
21
|
s.add_dependency "zeitwerk"
|
22
|
+
s.add_dependency "dorian-arguments"
|
25
23
|
end
|
data/lib/code/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: dorian-arguments
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: a programming language for the internet
|
98
112
|
email: dorian@dorianmarie.fr
|
99
113
|
executables:
|
@@ -114,6 +128,7 @@ files:
|
|
114
128
|
- LICENSE
|
115
129
|
- README.md
|
116
130
|
- Rakefile
|
131
|
+
- VERSION
|
117
132
|
- bin/bundle-audit
|
118
133
|
- bin/bundler-audit
|
119
134
|
- bin/code
|