dorian 2.5.0 → 2.5.2
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/.rubocop.yml +4 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/bin/dorian +27 -2
- data/lib/dorian/bin.rb +16 -15
- data/samples/books.jsonl +1 -1
- data/samples/people.csv +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dcd07e19e424772b965202cc544ba7d4bf8c0670c792c79b5678b50f546a5a7
|
4
|
+
data.tar.gz: b2f8d9bde82e265fee6aa29dfce68535322b32ffdda2388d86ee9163a544902c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db846256d0dc2b5d4c7e44b560b1f4b0977cb7aa31b5fc965e10b61ac99f4ed4bd62f36bd9deb9c7b1f63c303119c730286be6c7009c95c3e28c048599a022cc
|
7
|
+
data.tar.gz: 353d55f6a0221ddd6c75485a452a26f1ffb64bcc7077aa6947d911e90c9847037531f156a99c3b54fa797cb0677ded9b8d57050bbebf0834025c9c13359d3a7c
|
data/.rubocop.yml
CHANGED
@@ -101,12 +101,16 @@ Security/Eval:
|
|
101
101
|
Enabled: false
|
102
102
|
Style/CaseEquality:
|
103
103
|
Enabled: false
|
104
|
+
Style/DocumentDynamicEvalDefinition:
|
105
|
+
Enabled: false
|
104
106
|
Style/Documentation:
|
105
107
|
Enabled: false
|
106
108
|
Style/DoubleNegation:
|
107
109
|
Enabled: false
|
108
110
|
Style/EmptyMethod:
|
109
111
|
Enabled: false
|
112
|
+
Style/HashEachMethods:
|
113
|
+
Enabled: false
|
110
114
|
Style/IfUnlessModifier:
|
111
115
|
Enabled: false
|
112
116
|
Style/MultilineBlockChain:
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.2
|
data/bin/dorian
CHANGED
@@ -1,6 +1,31 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'dorian' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
5
10
|
|
6
|
-
|
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("dorian", "dorian")
|
data/lib/dorian/bin.rb
CHANGED
@@ -16,7 +16,6 @@ require "syntax_tree"
|
|
16
16
|
require "syntax_tree/erb"
|
17
17
|
require "syntax_tree/haml"
|
18
18
|
require "syntax_tree/xml"
|
19
|
-
require "syntax_tree/json"
|
20
19
|
require "tempfile"
|
21
20
|
require "terminal-table"
|
22
21
|
require "uri"
|
@@ -932,12 +931,13 @@ class Dorian
|
|
932
931
|
|
933
932
|
case output
|
934
933
|
when :csv
|
935
|
-
|
934
|
+
"#{headers_of(content)&.to_csv}#{
|
936
935
|
map(content) do |element|
|
937
936
|
CSV.generate(headers: headers_of(content)) do |csv|
|
938
937
|
csv << wrap(element)
|
939
938
|
end
|
940
939
|
end.join
|
940
|
+
}"
|
941
941
|
when :json
|
942
942
|
pretty? ? JSON.pretty_generate(content) : content.to_json
|
943
943
|
when :jsonl
|
@@ -1576,7 +1576,6 @@ class Dorian
|
|
1576
1576
|
before = File.read(path)
|
1577
1577
|
|
1578
1578
|
case filetype(path)
|
1579
|
-
when :directory
|
1580
1579
|
when :ruby
|
1581
1580
|
after = SyntaxTree.format(before)
|
1582
1581
|
when :haml
|
@@ -1588,20 +1587,23 @@ class Dorian
|
|
1588
1587
|
when :json
|
1589
1588
|
after = JSON.pretty_generate(JSON.parse(before))
|
1590
1589
|
when :jsonl
|
1591
|
-
after =
|
1590
|
+
after =
|
1591
|
+
"#{before.lines.map { |line| JSON.parse(line).to_json }.join("\n")}\n"
|
1592
1592
|
when :csv
|
1593
1593
|
after =
|
1594
|
-
CSV.generate { |csv| CSV.parse(before).each { |row| csv << row } }
|
1594
|
+
"#{CSV.generate { |csv| CSV.parse(before).each { |row| csv << row } }}\n"
|
1595
1595
|
when :yaml
|
1596
1596
|
after = sort(YAML.safe_load(before)).to_yaml
|
1597
1597
|
when :yamll
|
1598
1598
|
after =
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1599
|
+
"#{
|
1600
|
+
before
|
1601
|
+
.lines
|
1602
|
+
.map do |line|
|
1603
|
+
sort(YAML.safe_load(JSON.parse(line))).to_yaml.to_json
|
1604
|
+
end
|
1605
|
+
.join("\n")
|
1606
|
+
}\n"
|
1605
1607
|
when :js
|
1606
1608
|
context.eval("format(#{path.to_json}, 'babel')")
|
1607
1609
|
when :ts
|
@@ -1628,7 +1630,7 @@ class Dorian
|
|
1628
1630
|
end
|
1629
1631
|
when :pdf
|
1630
1632
|
doc = HexaPDF::Document.open(path)
|
1631
|
-
doc.trailer.info.
|
1633
|
+
doc.trailer.info.each { |key, _| doc.trailer.info.delete(key) }
|
1632
1634
|
doc.write(path, update_fields: false)
|
1633
1635
|
after = File.read(path)
|
1634
1636
|
when :tex
|
@@ -1661,8 +1663,8 @@ class Dorian
|
|
1661
1663
|
else
|
1662
1664
|
warn "run: `brew install ktlint` for #{path}"
|
1663
1665
|
end
|
1664
|
-
when :raw, :
|
1665
|
-
:
|
1666
|
+
when :raw, :env, :enc, :txt, :pro, :binary, :slim, :fish, :bat, :xcconfig,
|
1667
|
+
:pbxproj, :jpeg, :png, :webp, :heic, :ico
|
1666
1668
|
# nothing to do
|
1667
1669
|
else
|
1668
1670
|
case File.basename(path)
|
@@ -1686,7 +1688,6 @@ class Dorian
|
|
1686
1688
|
end
|
1687
1689
|
rescue StandardError => e
|
1688
1690
|
warn "failed to parse #{path}: #{e.message}"
|
1689
|
-
binding.irb
|
1690
1691
|
end
|
1691
1692
|
end
|
1692
1693
|
end
|
data/samples/books.jsonl
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
{"title":"The Great Gatsby","author":"F. Scott Fitzgerald","published_year":1925,"genres":["Novel","Historical"],"available":true}
|
2
2
|
{"title":"To Kill a Mockingbird","author":"Harper Lee","published_year":1960,"genres":["Novel","Southern Gothic","Bildungsroman"],"available":false}
|
3
|
-
{"title":"1984","author":"George Orwell","published_year":1949,"genres":["Dystopian","Political Fiction"],"available":true}
|
3
|
+
{"title":"1984","author":"George Orwell","published_year":1949,"genres":["Dystopian","Political Fiction"],"available":true}
|
data/samples/people.csv
CHANGED