dorian 2.5.0 → 2.5.2

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: 71b8b344806e358d754e6e68eb0333bdb33e5099eab13e3b0df41ccc13bd3c5f
4
- data.tar.gz: c26ab096a11c5c9c8da1845e3e83fe41adb3836397e6581669c550d3d8837b3f
3
+ metadata.gz: 1dcd07e19e424772b965202cc544ba7d4bf8c0670c792c79b5678b50f546a5a7
4
+ data.tar.gz: b2f8d9bde82e265fee6aa29dfce68535322b32ffdda2388d86ee9163a544902c
5
5
  SHA512:
6
- metadata.gz: 9eda2aa612da2a4d35854f9ada61d35e7917c19c56bc9335d25045a748965b65990230f7a5300f4aeb1b320b2aabe5c608a00031719137549eda6c0e88384a30
7
- data.tar.gz: 52af3c55d0a75ba0aead5ffe111edf5ef448b5fb6a3791ee485a20eea3191a3198c8f4e071b551210a4bb99a62a80b2ce7c33e504cbc8e30ccd765a689d396a8
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dorian (2.5.0)
4
+ dorian (2.5.2)
5
5
  csv
6
6
  dorian-arguments
7
7
  dorian-eval
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.0
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
- require_relative "../lib/dorian/bin"
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
- Dorian::Bin.run
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
- (headers_of(content) ? headers_of(content).to_csv : "") +
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 = before.lines.map { |line| JSON.parse(line).to_json }.join("\n")
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
- before
1600
- .lines
1601
- .map do |line|
1602
- sort(YAML.safe_load(JSON.parse(line))).to_yaml.to_json
1603
- end
1604
- .join("\n") + "\n"
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.each_key { |key| doc.trailer.info.delete(key) }
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, :directory, :symlink, :env, :enc, :txt, :pro, :binary, :slim,
1665
- :fish, :bat, :xcconfig, :pbxproj, :jpeg, :png, :webp, :heic, :ico
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
@@ -4,3 +4,4 @@ Bob,25,Los Angeles,Designer
4
4
  Charlie,35,Chicago,Teacher
5
5
  Diana,28,Miami,Developer
6
6
  Edward,40,San Francisco,Manager
7
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié