Skip to content

Commit

Permalink
remove syntax_tree-json dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianmariecom committed Sep 15, 2024
1 parent f0c0582 commit ad21674
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ PATH
syntax_tree
syntax_tree-css
syntax_tree-haml
syntax_tree-json
syntax_tree-xml
terminal-table
w_syntax_tree-erb
Expand Down Expand Up @@ -153,9 +152,6 @@ GEM
haml (>= 5.2)
prettier_print (>= 1.2.1)
syntax_tree (>= 6.0.0)
syntax_tree-json (0.3.0)
prettier_print
syntax_tree (>= 2.0.1)
syntax_tree-xml (0.1.0)
prettier_print
syntax_tree (>= 2.0.1)
Expand Down
1 change: 0 additions & 1 deletion dorian.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Gem::Specification.new do |s|
s.add_dependency "syntax_tree"
s.add_dependency "syntax_tree-haml"
s.add_dependency "syntax_tree-xml"
s.add_dependency "syntax_tree-json"
s.add_dependency "syntax_tree-css"
s.add_dependency "terminal-table"
s.add_dependency "w_syntax_tree-erb"
Expand Down
5 changes: 3 additions & 2 deletions lib/dorian/bin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,7 @@ def filetype(path)
return :xml if ext == ".plist"
return :xml if ext == ".storyboard"
return :groovy if ext == ".gradle"
return :groovy if ext == ".properties"
return unless File.exist?(path)
first_line = File.open(path, &:gets).to_s
first_line = first_line.encode("UTF-8", invalid: :replace).strip
Expand All @@ -1567,12 +1568,12 @@ def format(path, context:)
after = SyntaxTree::Haml.format(before)
when :erb
after = SyntaxTree::ERB.format(before)
when :json
after = SyntaxTree::JSON.format(before)
when :xml
after = SyntaxTree::XML.format(before)
when :css
after = SyntaxTree::CSS.format(before)
when :json
after = JSON.pretty_generate(JSON.parse(before))
when :jsonl
after = before.lines.map { |line| JSON.parse(line).to_json }.join("\n")
when :csv
Expand Down

0 comments on commit ad21674

Please sign in to comment.