jcl 1.1.0 → 1.2.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/Cargo.toml +2 -2
- data/README.md +14 -14
- 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: 64de7b2189a97cbc85ac82e1265dcbb81bb8be4bcd74db6eb591a52771147318
|
|
4
|
+
data.tar.gz: 03f9ac824e11f96db61c1bd48b179c1ee1ddd80be5082a5cfd6bb461969a3f2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcc36613a8cca6f8fd5e5f8cc1c17963301753bba2ad45039db78ad4eaffd0a9991db0337fd4b2f8a71424c941766d02fdda680a2b7a9c2e2a7fdb9ac1b1fc1f
|
|
7
|
+
data.tar.gz: bc828a54bb3ad471854d28279a8bb9a075ea596a0b683b90e192971408dc2daaa846992c80786214b8d9e5168a57893aea6b77fba61c9591ce9b1cd7d97826db
|
data/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "jcl-ruby"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.2.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Hemmer IO <info@hemmer.io>"]
|
|
6
6
|
description = "Ruby bindings for JCL (Jack-of-All Configuration Language)"
|
|
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
|
|
|
12
12
|
name = "jcl"
|
|
13
13
|
|
|
14
14
|
[dependencies]
|
|
15
|
-
jcl = { path = "../..", version = "1.
|
|
15
|
+
jcl = { path = "../..", version = "1.2.0" }
|
|
16
16
|
magnus = "0.6"
|
|
17
17
|
serde_json = "1.0"
|
|
18
18
|
|
data/README.md
CHANGED
|
@@ -82,7 +82,7 @@ puts "Port: #{config['app']['port']}"
|
|
|
82
82
|
puts "Features: #{config['app']['features'].join(', ')}"
|
|
83
83
|
|
|
84
84
|
# Evaluate from file
|
|
85
|
-
file_config = JCL.eval_file('config.
|
|
85
|
+
file_config = JCL.eval_file('config.jcf')
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
### Formatting
|
|
@@ -183,7 +183,7 @@ require 'jcl'
|
|
|
183
183
|
|
|
184
184
|
module MyApp
|
|
185
185
|
class Application < Rails::Application
|
|
186
|
-
jcl_config = JCL.eval_file(Rails.root.join('config', 'app.
|
|
186
|
+
jcl_config = JCL.eval_file(Rails.root.join('config', 'app.jcf'))
|
|
187
187
|
|
|
188
188
|
config.app_name = jcl_config['app']['name']
|
|
189
189
|
config.api_endpoint = jcl_config['api']['endpoint']
|
|
@@ -199,7 +199,7 @@ end
|
|
|
199
199
|
require 'jcl'
|
|
200
200
|
|
|
201
201
|
# Load configuration from JCL
|
|
202
|
-
config = JCL.eval_file('/etc/app/config.
|
|
202
|
+
config = JCL.eval_file('/etc/app/config.jcf')
|
|
203
203
|
|
|
204
204
|
# Use configuration in Chef resources
|
|
205
205
|
template '/etc/nginx/nginx.conf' do
|
|
@@ -238,7 +238,7 @@ Then in your manifest:
|
|
|
238
238
|
|
|
239
239
|
```puppet
|
|
240
240
|
# manifests/config.pp
|
|
241
|
-
$config = jcl_eval('/etc/app/config.
|
|
241
|
+
$config = jcl_eval('/etc/app/config.jcf')
|
|
242
242
|
|
|
243
243
|
file { '/etc/app/settings.json':
|
|
244
244
|
ensure => file,
|
|
@@ -255,7 +255,7 @@ require 'jcl'
|
|
|
255
255
|
namespace :jcl do
|
|
256
256
|
desc 'Validate JCL configuration files'
|
|
257
257
|
task :validate do
|
|
258
|
-
Dir.glob('config/**/*.
|
|
258
|
+
Dir.glob('config/**/*.jcf').each do |file|
|
|
259
259
|
puts "Validating #{file}..."
|
|
260
260
|
|
|
261
261
|
begin
|
|
@@ -280,7 +280,7 @@ namespace :jcl do
|
|
|
280
280
|
|
|
281
281
|
desc 'Format JCL configuration files'
|
|
282
282
|
task :format do
|
|
283
|
-
Dir.glob('config/**/*.
|
|
283
|
+
Dir.glob('config/**/*.jcf').each do |file|
|
|
284
284
|
puts "Formatting #{file}..."
|
|
285
285
|
|
|
286
286
|
begin
|
|
@@ -303,7 +303,7 @@ require 'sinatra'
|
|
|
303
303
|
require 'jcl'
|
|
304
304
|
|
|
305
305
|
configure do
|
|
306
|
-
config = JCL.eval_file('config/app.
|
|
306
|
+
config = JCL.eval_file('config/app.jcf')
|
|
307
307
|
|
|
308
308
|
set :port, config['server']['port']
|
|
309
309
|
set :environment, config['environment']
|
|
@@ -312,7 +312,7 @@ end
|
|
|
312
312
|
|
|
313
313
|
get '/config' do
|
|
314
314
|
content_type :json
|
|
315
|
-
config = JCL.eval_file('config/app.
|
|
315
|
+
config = JCL.eval_file('config/app.jcf')
|
|
316
316
|
config.to_json
|
|
317
317
|
end
|
|
318
318
|
```
|
|
@@ -357,7 +357,7 @@ class ConfigLoader
|
|
|
357
357
|
end
|
|
358
358
|
|
|
359
359
|
# Usage
|
|
360
|
-
config = ConfigLoader.new('config/app.
|
|
360
|
+
config = ConfigLoader.new('config/app.jcf')
|
|
361
361
|
puts config.version
|
|
362
362
|
puts config.get('app.name')
|
|
363
363
|
```
|
|
@@ -370,7 +370,7 @@ require 'jcl'
|
|
|
370
370
|
|
|
371
371
|
RSpec.configure do |config|
|
|
372
372
|
config.before(:suite) do
|
|
373
|
-
test_config = JCL.eval_file('spec/fixtures/test_config.
|
|
373
|
+
test_config = JCL.eval_file('spec/fixtures/test_config.jcf')
|
|
374
374
|
ENV['TEST_CONFIG'] = test_config.to_json
|
|
375
375
|
end
|
|
376
376
|
end
|
|
@@ -414,7 +414,7 @@ All methods raise `RuntimeError` on errors. It's recommended to catch and handle
|
|
|
414
414
|
|
|
415
415
|
```ruby
|
|
416
416
|
begin
|
|
417
|
-
config = JCL.eval_file('config.
|
|
417
|
+
config = JCL.eval_file('config.jcf')
|
|
418
418
|
rescue RuntimeError => e
|
|
419
419
|
if e.message.include?('Parse error')
|
|
420
420
|
puts "Invalid JCL syntax: #{e.message}"
|
|
@@ -430,7 +430,7 @@ end
|
|
|
430
430
|
|
|
431
431
|
```ruby
|
|
432
432
|
# Inline rescue
|
|
433
|
-
config = JCL.eval_file('config.
|
|
433
|
+
config = JCL.eval_file('config.jcf') rescue {}
|
|
434
434
|
|
|
435
435
|
# Method with rescue
|
|
436
436
|
def load_config(path)
|
|
@@ -473,7 +473,7 @@ The JCL Ruby bindings are thread-safe. Multiple threads can safely call JCL meth
|
|
|
473
473
|
```ruby
|
|
474
474
|
threads = 10.times.map do |i|
|
|
475
475
|
Thread.new do
|
|
476
|
-
config = JCL.eval_file("config/env#{i}.
|
|
476
|
+
config = JCL.eval_file("config/env#{i}.jcf")
|
|
477
477
|
# Process config...
|
|
478
478
|
end
|
|
479
479
|
end
|
|
@@ -499,7 +499,7 @@ ruby test/jcl_test.rb
|
|
|
499
499
|
require 'benchmark'
|
|
500
500
|
require 'jcl'
|
|
501
501
|
|
|
502
|
-
jcl_code = File.read('large_config.
|
|
502
|
+
jcl_code = File.read('large_config.jcf')
|
|
503
503
|
|
|
504
504
|
Benchmark.bm do |x|
|
|
505
505
|
x.report('parse:') { 100.times { JCL.parse(jcl_code) } }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jcl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hemmer IO
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|