Skip to content

Commit

Permalink
Add KiCad configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Nov 21, 2024
1 parent 2b66f10 commit f7c5759
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/tasks/kicad.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

task :kicad => [:'brew:casks_and_formulae'] do
puts ANSI.blue { 'Configuring KiCad …' }

kicad_version = JSON.parse(capture('brew', 'info', '--json=v2', '--cask', 'kicad')).fetch('casks')[0].fetch('installed')

Check failure on line 6 in lib/tasks/kicad.rake

View workflow job for this annotation

GitHub Actions / rubocop

[Layout/LineLength] Layout/LineLength: Line is too long. [122/120]
kicad_major_minor_version = kicad_version[/(\d+\.\d+)/, 1]

raise unless kicad_major_minor_version

kicad_common = Pathname("~/Library/Preferences/kicad/#{kicad_major_minor_version}/kicad_common.json").expand_path

json = kicad_common.exist? ? JSON.parse(kicad_common.read) : {}

json['input'] ||= {}
json['input']['auto_pan'] = true
json['input']['center_on_zoom'] = false

json['environment'] ||= {}
json['environment']['vars'] ||= {}
json['environment']['vars']['EASYEDA2KICAD'] = File.expand_path('~/Documents/KiCad/easyeda2kicad')

kicad_common.write JSON.pretty_generate(json)
end

0 comments on commit f7c5759

Please sign in to comment.