pcb-init 0.1.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +67 -0
  3. data/bin/pcb-init +5 -0
  4. data/lib/pcb_init.rb +162 -0
  5. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 87b0d377a4260f18b23001b19e2e9b4ed27f2abebdeba3ca71ac5a521e0b3830
4
+ data.tar.gz: ed072439bae0bebc68e61d835640e3d1bdf04c931f6222777b03a0b7b3b1b984
5
+ SHA512:
6
+ metadata.gz: b59a1209267600c90ae363eb36306c149a2ec75d8227c955cf68a7721239c6cf2cf664c281f6e9a4730044a8acd0e7bb22b17d748b01262ce06b44065421e167
7
+ data.tar.gz: 034504d8b77f5bbd0d6508713ec545ebd9564f21595613a7bd97fc23f3746c673e916f4f1419124e0be833bba20d6124ee13e67df38cc8bc53c3ae7f88907653
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # pcb-init
2
+
3
+ A Ruby CLI tool that scaffolds a **best-practice KiCad PCB project structure**.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ gem build pcb-init.gemspec
9
+ gem install ./pcb-init-0.1.0.gem
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```bash
15
+ pcb-init PROJECT_NAME
16
+ ```
17
+
18
+ ## Example
19
+
20
+ ```bash
21
+ pcb-init my-awesome-board
22
+ ```
23
+
24
+ This will create a well-organized folder structure:
25
+
26
+ ```
27
+ my-awesome-board/
28
+ ├── README.md
29
+ ├── docs/
30
+ │ └── changelog.md
31
+ ├── schematic/
32
+ ├── pcb/
33
+ │ └── design_rules.md
34
+ ├── libraries/
35
+ │ ├── symbols/
36
+ │ ├── footprints/
37
+ │ └── 3d_models/
38
+ ├── bom/
39
+ ├── manufacturing/
40
+ │ ├── gerbers/
41
+ │ ├── drill/
42
+ │ ├── pick_and_place/
43
+ │ └── panel/
44
+ ├── assembly/
45
+ ├── images/
46
+ ├── revisions/
47
+ │ └── rev_A/
48
+ ├── firmware/
49
+ │ ├── source/
50
+ │ └── binaries/
51
+ └── .gitignore
52
+ ```
53
+
54
+ ## Features
55
+
56
+ - Clean, organized folder structure following PCB project best practices
57
+ - Pre-configured `.gitignore` for KiCad and manufacturing files
58
+ - Ready-to-use templates for documentation
59
+ - No external dependencies (pure Ruby)
60
+
61
+ ## Requirements
62
+
63
+ - Ruby ≥ 3.0
64
+
65
+ ## License
66
+
67
+ MIT
data/bin/pcb-init ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/pcb_init'
4
+
5
+ PcbInit.run(ARGV)
data/lib/pcb_init.rb ADDED
@@ -0,0 +1,162 @@
1
+ require 'fileutils'
2
+
3
+ class PcbInit
4
+ def self.run(argv)
5
+ new.run(argv)
6
+ end
7
+
8
+ def run(argv)
9
+ if argv.empty? || argv.include?('--help') || argv.include?('-h')
10
+ show_help
11
+ return
12
+ end
13
+
14
+ project_name = argv[0]
15
+
16
+ if Dir.exist?(project_name)
17
+ puts "Error: Directory '#{project_name}' already exists."
18
+ exit 1
19
+ end
20
+
21
+ create_project_structure(project_name)
22
+ create_files(project_name)
23
+
24
+ puts "✓ Successfully created PCB project: #{project_name}/"
25
+ end
26
+
27
+ private
28
+
29
+ def show_help
30
+ puts <<~HELP
31
+ pcb-init - Scaffold a best-practice KiCad PCB project structure
32
+
33
+ Usage:
34
+ pcb-init PROJECT_NAME
35
+
36
+ Options:
37
+ -h, --help Show this help message
38
+
39
+ Example:
40
+ pcb-init my-awesome-board
41
+ HELP
42
+ end
43
+
44
+ def create_project_structure(project_name)
45
+ directories = [
46
+ "#{project_name}/docs",
47
+ "#{project_name}/schematic",
48
+ "#{project_name}/pcb",
49
+ "#{project_name}/libraries/symbols",
50
+ "#{project_name}/libraries/footprints",
51
+ "#{project_name}/libraries/3d_models",
52
+ "#{project_name}/bom",
53
+ "#{project_name}/manufacturing/gerbers",
54
+ "#{project_name}/manufacturing/drill",
55
+ "#{project_name}/manufacturing/pick_and_place",
56
+ "#{project_name}/manufacturing/panel",
57
+ "#{project_name}/assembly",
58
+ "#{project_name}/images",
59
+ "#{project_name}/revisions/rev_A",
60
+ "#{project_name}/firmware/source",
61
+ "#{project_name}/firmware/binaries"
62
+ ]
63
+
64
+ directories.each do |dir|
65
+ FileUtils.mkdir_p(dir)
66
+ end
67
+ end
68
+
69
+ def create_files(project_name)
70
+ create_readme(project_name)
71
+ create_changelog(project_name)
72
+ create_design_rules(project_name)
73
+ create_gitignore(project_name)
74
+ end
75
+
76
+ def create_readme(project_name)
77
+ content = <<~README
78
+ # #{project_name}
79
+
80
+ PCB project description goes here.
81
+ README
82
+
83
+ File.write("#{project_name}/README.md", content)
84
+ end
85
+
86
+ def create_changelog(project_name)
87
+ content = <<~CHANGELOG
88
+ # Changelog
89
+
90
+ ## Rev A
91
+
92
+ - Initial project setup
93
+ CHANGELOG
94
+
95
+ File.write("#{project_name}/docs/changelog.md", content)
96
+ end
97
+
98
+ def create_design_rules(project_name)
99
+ content = <<~DESIGN_RULES
100
+ # Design Rules
101
+
102
+ ## PCB Specifications
103
+
104
+ - Minimum trace width: TBD
105
+ - Minimum via size: TBD
106
+ - Board thickness: TBD
107
+ - Layer count: TBD
108
+
109
+ ## Manufacturing Notes
110
+
111
+ Add your design rules and constraints here.
112
+ DESIGN_RULES
113
+
114
+ File.write("#{project_name}/pcb/design_rules.md", content)
115
+ end
116
+
117
+ def create_gitignore(project_name)
118
+ content = <<~GITIGNORE
119
+ # KiCad project files
120
+ *.kicad_pcb-bak
121
+ *.kicad_sch-bak
122
+ *.kicad_prl
123
+ *.kicad_pro
124
+ *.kicad_dru
125
+ *.kicad_wks
126
+ *.kicad_pcb
127
+ *.kicad_sch
128
+ *.net
129
+ *.dsn
130
+ *.ses
131
+ *.xml
132
+ *.lst
133
+ *.rpt
134
+ *.erc
135
+ *.drc
136
+ *.kicad_mod
137
+ *.kicad_sym
138
+ cache.lib
139
+ fp-lib-table
140
+ sym-lib-table
141
+
142
+ # Manufacturing outputs
143
+ *.gbr
144
+ *.drl
145
+ *.gbrjob
146
+ *.zip
147
+ *.tar.gz
148
+
149
+ # Assembly files
150
+ *.pos
151
+ *.csv
152
+ *.bom
153
+
154
+ # Temporary files
155
+ *~
156
+ .DS_Store
157
+ Thumbs.db
158
+ GITIGNORE
159
+
160
+ File.write("#{project_name}/.gitignore", content)
161
+ end
162
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pcb-init
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Colthedeveloper
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: A Ruby CLI tool that generates a well-organized folder structure for
13
+ KiCad PCB projects
14
+ email:
15
+ - colakunleumaru@gmail.com
16
+ executables:
17
+ - pcb-init
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - README.md
22
+ - bin/pcb-init
23
+ - lib/pcb_init.rb
24
+ homepage: https://github.com/colthedeveloper/pcb-init
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '3.0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 4.0.3
43
+ specification_version: 4
44
+ summary: Scaffold a best-practice KiCad PCB project structure
45
+ test_files: []