template-ruby 0.7.3 → 1.1.0

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
  SHA256:
3
- metadata.gz: a9d26d2cbb19512e90afc42ae4e3a7fb0f31f47f0246d098722fb168973eaef4
4
- data.tar.gz: 9f2d55a307fb6dee1a5e08fb450a4491254da0696dd263fdcb7fe77415e92b48
3
+ metadata.gz: 2f150542cc0de3c2bc1d201355a605c95edd9b3c4c715951e81e77b11218c1d9
4
+ data.tar.gz: 41334f085dde737ed4e4cd827dc60e6ad0f6823c51f2a5243f77696b406b98dc
5
5
  SHA512:
6
- metadata.gz: 61fa49d7ba5cb60e7e1831246d2988a8db41c24d82e41df33f9c6ee738bab6c31c9e0463b5619c2e6d3e29c7a9ac6151ca01031d3afb166ed4b74559a14d6ba2
7
- data.tar.gz: 42175618e7b57dd97cd7bf2e183f28b057f73aa6db323b24a9f65bffc508a01db0273a795b6327085137fc835108f8fa642f0cadb4e72569ee6c91cd4668e86c
6
+ metadata.gz: a847d9866df2dd5aa9be44fef4bfc244d1828678f76264f6e4b48fb32753705970e279d8967106f7635419aa59d7580be42dee210f88ed3936ea9ed9e6e3af1c
7
+ data.tar.gz: 77a69956a521966f0ac4130f7a32eef88e0b6da989982d9f1a683b066d7233f0d1ec92e991c6fe510c02cfb5d7198a0cd2c4eecb694f4174e255ee7ff68c8f2a
@@ -28,10 +28,10 @@ jobs:
28
28
  with:
29
29
  bundler-cache: true
30
30
  - run: bin/rubocop
31
- yarn-audit:
32
- name: Yarn Audit
31
+ npm-audit:
32
+ name: npm Audit
33
33
  runs-on: ubuntu-latest
34
34
  steps:
35
35
  - uses: actions/checkout@v4
36
36
  - uses: actions/setup-node@v4
37
- - run: yarn audit
37
+ - run: npm audit
data/.prettierignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ vendor
data/.rubocop.yml CHANGED
@@ -1,8 +1,124 @@
1
- inherit_gem:
2
- rubocop-rails-omakase: rubocop.yml
3
-
4
- Layout/SpaceInsideArrayLiteralBrackets:
1
+ ---
2
+ AllCops:
3
+ Exclude:
4
+ - "*/node_modules/**/*"
5
+ - "*/vendor/**/*"
6
+ - node_modules/**/*
7
+ - vendor/**/*
8
+ NewCops: enable
9
+ Layout/ClosingHeredocIndentation:
10
+ Enabled: false
11
+ Layout/FirstArgumentIndentation:
12
+ Enabled: false
13
+ Layout/HashAlignment:
14
+ Enabled: false
15
+ Layout/HeredocIndentation:
16
+ Enabled: false
17
+ Layout/LineEndStringConcatenationIndentation:
18
+ Enabled: false
19
+ Layout/LineLength:
20
+ Enabled: false
21
+ Layout/MultilineMethodCallIndentation:
22
+ Enabled: false
23
+ Layout/MultilineOperationIndentation:
24
+ Enabled: false
25
+ Lint/EmptyClass:
26
+ Enabled: false
27
+ Lint/MissingSuper:
28
+ Enabled: false
29
+ Lint/PercentStringArray:
30
+ Enabled: false
31
+ Lint/ShadowingOuterLocalVariable:
32
+ Enabled: false
33
+ Lint/SuppressedException:
34
+ Enabled: false
35
+ Lint/UnusedBlockArgument:
36
+ Enabled: false
37
+ Lint/UselessAssignment:
38
+ Enabled: false
39
+ Metrics/AbcSize:
40
+ Enabled: false
41
+ Metrics/BlockLength:
42
+ Enabled: false
43
+ Metrics/ClassLength:
44
+ Enabled: false
45
+ Metrics/CyclomaticComplexity:
46
+ Enabled: false
47
+ Metrics/MethodLength:
48
+ Enabled: false
49
+ Metrics/ModuleLength:
50
+ Enabled: false
51
+ Metrics/ParameterLists:
52
+ Enabled: false
53
+ Metrics/PerceivedComplexity:
54
+ Enabled: false
55
+ Naming/FileName:
56
+ Enabled: false
57
+ Naming/MethodParameterName:
58
+ Enabled: false
59
+ Naming/VariableNumber:
5
60
  Enabled: false
6
-
7
61
  Performance/UnfreezeString:
8
62
  Enabled: false
63
+ RSpec/AnyInstance:
64
+ Enabled: false
65
+ RSpec/ContextWording:
66
+ Enabled: false
67
+ RSpec/DescribeClass:
68
+ Enabled: false
69
+ RSpec/ExampleLength:
70
+ Enabled: false
71
+ RSpec/ExampleWording:
72
+ Enabled: false
73
+ RSpec/MultipleExpectations:
74
+ Enabled: false
75
+ RSpec/NoExpectationExample:
76
+ Enabled: false
77
+ RSpec/PendingWithoutReason:
78
+ Enabled: false
79
+ Rails/Delegate:
80
+ Enabled: false
81
+ Rails/DynamicFindBy:
82
+ Enabled: false
83
+ Rails/HelperInstanceVariable:
84
+ Enabled: false
85
+ Rails/NegateInclude:
86
+ Enabled: false
87
+ Rails/Output:
88
+ Enabled: false
89
+ Rails/Presence:
90
+ Enabled: false
91
+ Rails/Present:
92
+ Enabled: false
93
+ Rails/ThreeStateBooleanColumn:
94
+ Enabled: false
95
+ Rails/TimeZone:
96
+ Enabled: false
97
+ Security/Eval:
98
+ Enabled: false
99
+ Style/CaseEquality:
100
+ Enabled: false
101
+ Style/Documentation:
102
+ Enabled: false
103
+ Style/DoubleNegation:
104
+ Enabled: false
105
+ Style/EmptyMethod:
106
+ Enabled: false
107
+ Style/IfUnlessModifier:
108
+ Enabled: false
109
+ Style/MultilineBlockChain:
110
+ Enabled: false
111
+ Style/QuotedSymbols:
112
+ Enabled: false
113
+ Style/StringLiterals:
114
+ Enabled: false
115
+ Style/StringLiteralsInInterpolation:
116
+ Enabled: false
117
+ require:
118
+ - rubocop-factory_bot
119
+ - rubocop-performance
120
+ - rubocop-rails
121
+ - rubocop-rake
122
+ - rubocop-rspec
123
+ - rubocop-rspec_rails
124
+ - rubocop-capybara
data/Gemfile CHANGED
@@ -8,4 +8,14 @@ ruby "3.3.4"
8
8
 
9
9
  gem "rspec"
10
10
  gem "ruby-prof"
11
- gem "rubocop-rails-omakase"
11
+
12
+ gem "bundler-audit"
13
+
14
+ gem "rubocop-factory_bot"
15
+ gem "rubocop-performance"
16
+ gem "rubocop-rails"
17
+ gem "rubocop-rake"
18
+ gem "rubocop-rspec"
19
+ gem "rubocop-rspec_rails"
20
+
21
+ gem "rubocop-capybara"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- template-ruby (0.7.3)
4
+ template-ruby (1.1.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.0)
13
+ activesupport (7.2.1)
14
14
  base64
15
15
  bigdecimal
16
16
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -24,10 +24,14 @@ GEM
24
24
  ast (2.4.2)
25
25
  base64 (0.2.0)
26
26
  bigdecimal (3.1.8)
27
- code-ruby (0.15.15)
27
+ bundler-audit (0.9.2)
28
+ bundler (>= 1.2.0, < 3)
29
+ thor (~> 1.0)
30
+ code-ruby (1.0.0)
28
31
  activesupport
29
32
  bigdecimal
30
33
  did-you-mean
34
+ dorian-arguments
31
35
  json
32
36
  language-ruby
33
37
  zeitwerk
@@ -36,16 +40,14 @@ GEM
36
40
  did-you-mean (0.1.1)
37
41
  levenshtein (>= 0.2.0)
38
42
  diff-lcs (1.5.1)
39
- dorian-arguments (0.3.0)
40
- activesupport
43
+ dorian-arguments (1.1.1)
41
44
  bigdecimal
42
- dorian-to_struct
43
- dorian-to_struct (0.5.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.2)
49
+ language-ruby (1.0.1)
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.5)
64
+ rexml (3.3.6)
63
65
  strscan
64
66
  rspec (3.13.0)
65
67
  rspec-core (~> 3.13.0)
@@ -87,26 +89,30 @@ GEM
87
89
  unicode-display_width (>= 2.4.0, < 3.0)
88
90
  rubocop-ast (1.32.1)
89
91
  parser (>= 3.3.1.0)
90
- rubocop-minitest (0.35.1)
91
- rubocop (>= 1.61, < 2.0)
92
- rubocop-ast (>= 1.31.1, < 2.0)
92
+ rubocop-capybara (2.21.0)
93
+ rubocop (~> 1.41)
94
+ rubocop-factory_bot (2.26.1)
95
+ rubocop (~> 1.61)
93
96
  rubocop-performance (1.21.1)
94
97
  rubocop (>= 1.48.1, < 2.0)
95
98
  rubocop-ast (>= 1.31.1, < 2.0)
96
- rubocop-rails (2.25.1)
99
+ rubocop-rails (2.26.0)
97
100
  activesupport (>= 4.2.0)
98
101
  rack (>= 1.1)
99
- rubocop (>= 1.33.0, < 2.0)
102
+ rubocop (>= 1.52.0, < 2.0)
100
103
  rubocop-ast (>= 1.31.1, < 2.0)
101
- rubocop-rails-omakase (1.0.0)
102
- rubocop
103
- rubocop-minitest
104
- rubocop-performance
105
- rubocop-rails
104
+ rubocop-rake (0.6.0)
105
+ rubocop (~> 1.0)
106
+ rubocop-rspec (3.0.4)
107
+ rubocop (~> 1.61)
108
+ rubocop-rspec_rails (2.30.0)
109
+ rubocop (~> 1.61)
110
+ rubocop-rspec (~> 3, >= 3.0.1)
106
111
  ruby-prof (1.7.0)
107
112
  ruby-progressbar (1.13.0)
108
113
  securerandom (0.3.1)
109
114
  strscan (3.1.0)
115
+ thor (1.3.2)
110
116
  tzinfo (2.0.6)
111
117
  concurrent-ruby (~> 1.0)
112
118
  unicode-display_width (2.5.0)
@@ -115,10 +121,18 @@ GEM
115
121
  PLATFORMS
116
122
  arm64-darwin-22
117
123
  arm64-darwin-23
124
+ x86_64-linux
118
125
 
119
126
  DEPENDENCIES
127
+ bundler-audit
120
128
  rspec
121
- rubocop-rails-omakase
129
+ rubocop-capybara
130
+ rubocop-factory_bot
131
+ rubocop-performance
132
+ rubocop-rails
133
+ rubocop-rake
134
+ rubocop-rspec
135
+ rubocop-rspec_rails
122
136
  ruby-prof
123
137
  template-ruby!
124
138
 
@@ -126,4 +140,4 @@ RUBY VERSION
126
140
  ruby 3.3.4p94
127
141
 
128
142
  BUNDLED WITH
129
- 2.5.17
143
+ 2.5.18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 1.1.0
data/bin/bundle ADDED
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m =
14
+ Module.new do
15
+ module_function
16
+
17
+ def invoked_as_script?
18
+ File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
19
+ end
20
+
21
+ def env_var_version
22
+ ENV.fetch("BUNDLER_VERSION", nil)
23
+ end
24
+
25
+ def cli_arg_version
26
+ return unless invoked_as_script? # don't want to hijack other binstubs
27
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
28
+
29
+ bundler_version = nil
30
+ update_index = nil
31
+ ARGV.each_with_index do |a, i|
32
+ if update_index && update_index.succ == i &&
33
+ a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
34
+ bundler_version = a
35
+ end
36
+ unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
37
+ next
38
+ end
39
+
40
+ bundler_version = Regexp.last_match(1)
41
+ update_index = i
42
+ end
43
+ bundler_version
44
+ end
45
+
46
+ def gemfile
47
+ gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
48
+ return gemfile if gemfile && !gemfile.empty?
49
+
50
+ File.expand_path("../Gemfile", __dir__)
51
+ end
52
+
53
+ def lockfile
54
+ lockfile =
55
+ case File.basename(gemfile)
56
+ when "gems.rb"
57
+ gemfile.sub(/\.rb$/, ".locked")
58
+ else
59
+ "#{gemfile}.lock"
60
+ end
61
+ File.expand_path(lockfile)
62
+ end
63
+
64
+ def lockfile_version
65
+ return unless File.file?(lockfile)
66
+
67
+ lockfile_contents = File.read(lockfile)
68
+ unless lockfile_contents =~
69
+ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
70
+ return
71
+ end
72
+
73
+ Regexp.last_match(1)
74
+ end
75
+
76
+ def bundler_requirement
77
+ @bundler_requirement ||=
78
+ env_var_version || cli_arg_version ||
79
+ bundler_requirement_for(lockfile_version)
80
+ end
81
+
82
+ def bundler_requirement_for(version)
83
+ return "#{Gem::Requirement.default}.a" unless version
84
+
85
+ bundler_gem_version = Gem::Version.new(version)
86
+
87
+ bundler_gem_version.approximate_recommendation
88
+ end
89
+
90
+ def load_bundler!
91
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
92
+
93
+ activate_bundler
94
+ end
95
+
96
+ def activate_bundler
97
+ gem_error =
98
+ activation_error_handling { gem "bundler", bundler_requirement }
99
+ return if gem_error.nil?
100
+
101
+ require_error = activation_error_handling { require "bundler/version" }
102
+ if require_error.nil? &&
103
+ Gem::Requirement.new(bundler_requirement).satisfied_by?(
104
+ Gem::Version.new(Bundler::VERSION)
105
+ )
106
+ return
107
+ end
108
+
109
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
110
+ exit 42
111
+ end
112
+
113
+ def activation_error_handling
114
+ yield
115
+ nil
116
+ rescue StandardError, LoadError => e
117
+ e
118
+ end
119
+ end
120
+
121
+ m.load_bundler!
122
+
123
+ load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
data/bin/bundle-audit ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle-audit' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?(
17
+ "This file was generated by Bundler"
18
+ )
19
+ load(bundle_binstub)
20
+ else
21
+ abort(
22
+ "Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
23
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again."
24
+ )
25
+ end
26
+ end
27
+
28
+ require "rubygems"
29
+ require "bundler/setup"
30
+
31
+ load Gem.bin_path("bundler-audit", "bundle-audit")
data/bin/bundler-audit ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundler-audit' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?(
17
+ "This file was generated by Bundler"
18
+ )
19
+ load(bundle_binstub)
20
+ else
21
+ abort(
22
+ "Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
23
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again."
24
+ )
25
+ end
26
+ end
27
+
28
+ require "rubygems"
29
+ require "bundler/setup"
30
+
31
+ load Gem.bin_path("bundler-audit", "bundler-audit")
data/bin/rubocop ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?(
17
+ "This file was generated by Bundler"
18
+ )
19
+ load(bundle_binstub)
20
+ else
21
+ abort(
22
+ "Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
23
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again."
24
+ )
25
+ end
26
+ end
27
+
28
+ require "rubygems"
29
+ require "bundler/setup"
30
+
31
+ load Gem.bin_path("rubocop", "rubocop")
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
- options = {
8
- timeout: 0,
9
- profile: false,
10
- profiler: "text",
11
- input: "",
12
- parse: false
13
- }
14
-
15
- argv =
16
- OptionParser
17
- .new do |opts|
18
- opts.banner = "Usage: template INPUT\n\n"
19
-
20
- opts.on("-v", "--version", "Version of Template") do |_input|
21
- puts Code::Version
22
- exit
23
- end
24
-
25
- opts.on(
26
- "-i INPUT",
27
- "--input INPUT",
28
- "Input in the Template language (String or File)"
29
- ) do |input|
30
- input = File.read(input) if File.exist?(input)
31
-
32
- options[:input] = input
33
- end
34
-
35
- opts.on("-p", "--parse", "Parser tree for input") do |parse|
36
- options[:parse] = parse
37
- end
38
-
39
- opts.on(
40
- "-t TIMEOUT",
41
- "--timeout TIMEOUT",
42
- "Set timeout in seconds"
43
- ) { |timeout| options[:timeout] = timeout.to_f }
44
-
45
- opts.on(
46
- "-z TIME_ZONE",
47
- "--time-zone TIME_ZONE",
48
- "Set time zone"
49
- ) { |time_zone| Time.zone = time_zone }
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 Template.evaluate(
86
- options[:input],
87
- output: $stdout,
88
- error: $stderr,
89
- timeout: options[:timeout]
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 options[:profile]
61
+ if profile
94
62
  result = RubyProf.stop
95
63
 
96
- if options[:profiler] == "text"
97
- printer = RubyProf::FlatPrinter.new(result)
98
- printer.print($stdout)
99
- elsif options[:profiler] == "html"
100
- printer = RubyProf::GraphHtmlPrinter.new(result)
101
- printer.print($stdout)
102
- else
103
- abort "#{options[:profiler]} not recognized"
104
- end
64
+ printer =
65
+ if parsed.options.profiler == "html"
66
+ RubyProf::GraphHtmlPrinter.new(result)
67
+ else
68
+ RubyProf::FlatPrinter.new(result)
69
+ end
70
+ printer.print($stdout)
105
71
  end
@@ -16,7 +16,7 @@ class Template
16
16
  end
17
17
 
18
18
  def backslash
19
- str("\\")
19
+ str('\\')
20
20
  end
21
21
 
22
22
  def code_part
@@ -3,4 +3,4 @@
3
3
  require_relative "../template"
4
4
 
5
5
  Template::Version =
6
- Gem::Version.new(File.read(File.expand_path("../../../VERSION", __FILE__)))
6
+ Gem::Version.new(File.read(File.expand_path("../../VERSION", __dir__)))
data/package-lock.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "template-ruby",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "license": "MIT",
8
+ "engines": {
9
+ "node": "22.5.1",
10
+ "npm": "10.8.2"
11
+ }
12
+ }
13
+ }
14
+ }
data/package.json CHANGED
@@ -2,7 +2,6 @@
2
2
  "license": "MIT",
3
3
  "engines": {
4
4
  "node": "22.5.1",
5
- "yarn": "1.22.22",
6
5
  "npm": "10.8.2"
7
6
  }
8
7
  }
@@ -2,12 +2,12 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- RSpec.describe Code do
5
+ RSpec.describe Template do
6
6
  [
7
7
  ["{name = :Dorian nothing}Hello {name}", "Hello Dorian"]
8
8
  ].each do |input, expected|
9
9
  it "#{input} == #{expected}" do
10
- expect(Template.evaluate(input)).to eq(expected)
10
+ expect(described_class.evaluate(input)).to eq(expected)
11
11
  end
12
12
  end
13
13
  end
@@ -13,7 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.license = "MIT"
14
14
  s.executables = "template"
15
15
  s.add_dependency "code-ruby"
16
+ s.add_dependency "dorian-arguments"
16
17
  s.add_dependency "language-ruby"
17
18
  s.add_dependency "zeitwerk"
18
- s.add_dependency "dorian-arguments"
19
+ s.metadata["rubygems_mfa_required"] = "true"
20
+ s.required_ruby_version = "3.3.4"
19
21
  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.7.3
4
+ version: 1.1.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-22 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code-ruby
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: language-ruby
28
+ name: dorian-arguments
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: zeitwerk
42
+ name: language-ruby
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: dorian-arguments
56
+ name: zeitwerk
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -77,6 +77,7 @@ files:
77
77
  - ".github/workflows/ci.yml"
78
78
  - ".gitignore"
79
79
  - ".node-version"
80
+ - ".prettierignore"
80
81
  - ".rspec"
81
82
  - ".rubocop.yml"
82
83
  - ".ruby-version"
@@ -86,7 +87,11 @@ files:
86
87
  - LICENSE
87
88
  - README.md
88
89
  - VERSION
90
+ - bin/bundle
91
+ - bin/bundle-audit
92
+ - bin/bundler-audit
89
93
  - bin/rspec
94
+ - bin/rubocop
90
95
  - bin/template
91
96
  - bin/test
92
97
  - lib/template-ruby.rb
@@ -99,24 +104,25 @@ files:
99
104
  - lib/template/parser.rb
100
105
  - lib/template/parser/template.rb
101
106
  - lib/template/version.rb
107
+ - package-lock.json
102
108
  - package.json
103
109
  - spec/spec_helper.rb
104
110
  - spec/template_spec.rb
105
111
  - template-ruby.gemspec
106
- - yarn.lock
107
112
  homepage: https://github.com/dorianmariecom/template-ruby
108
113
  licenses:
109
114
  - MIT
110
- metadata: {}
115
+ metadata:
116
+ rubygems_mfa_required: 'true'
111
117
  post_install_message:
112
118
  rdoc_options: []
113
119
  require_paths:
114
120
  - lib
115
121
  required_ruby_version: !ruby/object:Gem::Requirement
116
122
  requirements:
117
- - - ">="
123
+ - - '='
118
124
  - !ruby/object:Gem::Version
119
- version: '0'
125
+ version: 3.3.4
120
126
  required_rubygems_version: !ruby/object:Gem::Requirement
121
127
  requirements:
122
128
  - - ">="
data/yarn.lock DELETED
@@ -1,4 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-