code-ruby 0.15.15 → 0.15.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -3
- 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: 441325308911e5cba82286bbc9a4be1d33c03b25210dbaeb818bf78c97ce12e4
|
|
4
|
+
data.tar.gz: 3b56769984fc4ffa5a1e9a036bfbac8393462dc1e22033804627764aa3b7aabf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8d1677af87363f60d2a2321af4539b8912f6c36f3185b7c8bc142ec2470853ea6f5884df3712903ae45cef4da168603620b7f1c9398b99fcd091c90d6a92a82
|
|
7
|
+
data.tar.gz: 1ab4328234974b7bd6501af777b5be1e6f76d8398927dd21fc6dfd18d210b19791462793973e7ec3b11dce4941733c9dc60fd0d353da2a59dbca17d5c8a40dac
|
data/Gemfile.lock
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
code-ruby (0.15.
|
|
4
|
+
code-ruby (0.15.16)
|
|
5
5
|
activesupport
|
|
6
6
|
bigdecimal
|
|
7
7
|
did-you-mean
|
|
8
|
+
dorian-arguments
|
|
8
9
|
json
|
|
9
10
|
language-ruby
|
|
10
11
|
zeitwerk
|
|
@@ -34,11 +35,16 @@ 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.3.0)
|
|
39
|
+
activesupport
|
|
40
|
+
bigdecimal
|
|
41
|
+
dorian-to_struct
|
|
42
|
+
dorian-to_struct (0.5.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.2)
|
|
42
48
|
zeitwerk
|
|
43
49
|
language_server-protocol (3.17.0.3)
|
|
44
50
|
levenshtein (0.2.2)
|
|
@@ -61,7 +67,7 @@ GEM
|
|
|
61
67
|
rspec-mocks (~> 3.13.0)
|
|
62
68
|
rspec-core (3.13.0)
|
|
63
69
|
rspec-support (~> 3.13.0)
|
|
64
|
-
rspec-expectations (3.13.
|
|
70
|
+
rspec-expectations (3.13.2)
|
|
65
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
66
72
|
rspec-support (~> 3.13.0)
|
|
67
73
|
rspec-mocks (3.13.1)
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.15.16
|
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
|
|
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.15.
|
|
4
|
+
version: 0.15.16
|
|
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-22 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
|