template-ruby 0.7.3 → 1.0.0
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 +11 -9
- data/VERSION +1 -1
- data/bin/template +57 -91
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db311323ca45e9d60dcaaed36860dd5279d1d058a0335d237360218bf2bbd11e
|
4
|
+
data.tar.gz: 79f2b4493839c39eb10796d440275aebf59ad96f78317e640019bf04ebfb200a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccdd1827656e53089211967d9db8cea06cab30b7606d4cbb50052353071af3bdfbd6e9a568a7b55d16160407f549cfad05fb219c3c5a6945e173b03eb38fe23d
|
7
|
+
data.tar.gz: 19982e2ebfb0d70d0125484bcc7f3532e35099dfaffee0a12c2a3d643ec58b9ab7e53a3fb848d6f7cca43150554339b99e0a0479ddeebe68ab411ea5ec5885ef
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
template-ruby (0.
|
4
|
+
template-ruby (1.0.0)
|
5
5
|
code-ruby
|
6
6
|
dorian-arguments
|
7
7
|
language-ruby
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (7.2.
|
13
|
+
activesupport (7.2.1)
|
14
14
|
base64
|
15
15
|
bigdecimal
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
@@ -24,10 +24,11 @@ GEM
|
|
24
24
|
ast (2.4.2)
|
25
25
|
base64 (0.2.0)
|
26
26
|
bigdecimal (3.1.8)
|
27
|
-
code-ruby (0.15.
|
27
|
+
code-ruby (0.15.16)
|
28
28
|
activesupport
|
29
29
|
bigdecimal
|
30
30
|
did-you-mean
|
31
|
+
dorian-arguments
|
31
32
|
json
|
32
33
|
language-ruby
|
33
34
|
zeitwerk
|
@@ -36,16 +37,17 @@ GEM
|
|
36
37
|
did-you-mean (0.1.1)
|
37
38
|
levenshtein (>= 0.2.0)
|
38
39
|
diff-lcs (1.5.1)
|
39
|
-
dorian-arguments (0.
|
40
|
+
dorian-arguments (0.4.1)
|
40
41
|
activesupport
|
41
42
|
bigdecimal
|
42
43
|
dorian-to_struct
|
43
|
-
dorian-to_struct (0.
|
44
|
+
dorian-to_struct (0.6.0)
|
44
45
|
drb (2.2.1)
|
45
46
|
i18n (1.14.5)
|
46
47
|
concurrent-ruby (~> 1.0)
|
47
48
|
json (2.7.2)
|
48
|
-
language-ruby (0.9.
|
49
|
+
language-ruby (0.9.3)
|
50
|
+
dorian-arguments
|
49
51
|
zeitwerk
|
50
52
|
language_server-protocol (3.17.0.3)
|
51
53
|
levenshtein (0.2.2)
|
@@ -59,7 +61,7 @@ GEM
|
|
59
61
|
rack (3.1.7)
|
60
62
|
rainbow (3.1.1)
|
61
63
|
regexp_parser (2.9.2)
|
62
|
-
rexml (3.3.
|
64
|
+
rexml (3.3.6)
|
63
65
|
strscan
|
64
66
|
rspec (3.13.0)
|
65
67
|
rspec-core (~> 3.13.0)
|
@@ -93,10 +95,10 @@ GEM
|
|
93
95
|
rubocop-performance (1.21.1)
|
94
96
|
rubocop (>= 1.48.1, < 2.0)
|
95
97
|
rubocop-ast (>= 1.31.1, < 2.0)
|
96
|
-
rubocop-rails (2.
|
98
|
+
rubocop-rails (2.26.0)
|
97
99
|
activesupport (>= 4.2.0)
|
98
100
|
rack (>= 1.1)
|
99
|
-
rubocop (>= 1.
|
101
|
+
rubocop (>= 1.52.0, < 2.0)
|
100
102
|
rubocop-ast (>= 1.31.1, < 2.0)
|
101
103
|
rubocop-rails-omakase (1.0.0)
|
102
104
|
rubocop
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/bin/template
CHANGED
@@ -1,105 +1,71 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "optparse"
|
5
4
|
require_relative "../lib/template-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
|
-
options[:input] = argv.join(" ") if options[:input].empty?
|
68
|
-
|
69
|
-
abort <<~HELP if options[:input].empty?
|
70
|
-
Usage: template INPUT
|
71
|
-
|
72
|
-
-v, --version Version of Template
|
73
|
-
-i, --input INPUT Input in the Template language (String or File)
|
74
|
-
-p, --parse Parser tree for input
|
75
|
-
-t, --timeout TIMEOUT Set timeout in seconds
|
76
|
-
--profile Profile Ruby code
|
77
|
-
--profiler TYPE Profiler output type (text (default) or html)
|
78
|
-
HELP
|
79
|
-
|
80
|
-
RubyProf.start if options[:profile]
|
81
|
-
|
82
|
-
if options[:parse]
|
83
|
-
pp Template::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 Template::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 Template::Parser.parse(input).to_raw
|
84
50
|
else
|
85
|
-
print
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
51
|
+
print(
|
52
|
+
Template.evaluate(
|
53
|
+
input,
|
54
|
+
output: $stdout,
|
55
|
+
error: $stderr,
|
56
|
+
timeout: parsed.options.timeout
|
57
|
+
)
|
58
|
+
)
|
91
59
|
end
|
92
60
|
|
93
|
-
if
|
61
|
+
if profile
|
94
62
|
result = RubyProf.stop
|
95
63
|
|
96
|
-
if options
|
97
|
-
printer = RubyProf::FlatPrinter.new(result)
|
98
|
-
printer.print($stdout)
|
99
|
-
elsif options[:profiler] == "html"
|
64
|
+
if parsed.options.profiler == "html"
|
100
65
|
printer = RubyProf::GraphHtmlPrinter.new(result)
|
101
66
|
printer.print($stdout)
|
102
67
|
else
|
103
|
-
|
68
|
+
printer = RubyProf::FlatPrinter.new(result)
|
69
|
+
printer.print($stdout)
|
104
70
|
end
|
105
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template-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: code-ruby
|