1
1
# ` template-ruby-gem `
2
2
3
3
Built upon [ ` ParadoxV5/mygem ` ] ( https://github.com/ParadoxV5/mygem ) ,
4
- this is a moderate yet thorough template for a Ruby Gem project.
5
- Note: just ` gem ` . The ` rake ` is for invoking minitest (See [ §Rakefile] ( #Rakefile ) .
4
+ this is a moderate yet thorough template for a Ruby C extension project.
5
+ Note: just ` gem ` . The ` rake ` is for test-building and invoking minitest (See [ §Rakefile] ( #Rakefile ) .
6
6
7
7
8
8
## How to Setup
9
9
10
10
* Rename all occurrences of ` mygem ` , lower- or title-case, with the name of your epic Gem.
11
+ * [ ` ext/mygem/ ` ] ( ext/mygem/ )
12
+ * [ ` ext/mygem/mygem.c ` and Line 3] ( ext/mygem/mygem.c#L3 )
13
+ * [ ` ext/mygem/extconf.rb ` Line 6] ( ext/mygem/extconf.rb#L6 )
11
14
* [ ` lib/mygem/ ` ] ( lib/mygem/ )
12
15
* [ ` lib/mygem.rb ` and Line 1 & 2] ( lib/mygem.rb#L1-2 )
13
16
* [ ` lib/mygem/version.rb Line 3 ` ] ( lib/mygem/version.rb#L3 )
14
17
* [ ` sig/mygem.rbs ` and Line 1] ( sig/mygem.rbs#L1 )
15
18
* [ ` test/mygem_test.rb ` and Lines 3 & 4] ( test/mygem_test.rb#L3-4 )
16
19
* [ ` mygem.gemspec ` and Lines 2, 5 & 7] ( mygem.gemspec#L2-L7 )
20
+ * [ ` Rakefile ` Lines 12 & 15] ( Rakefile#L12-L15 )
17
21
* Update the [ ` gemspec ` ] ( mygem.gemspec ) with your Gem’s information. (See [ §` *.gemspec ` ] ( #gemspec ) )
18
22
* Overwrite this ` README ` with an introduction to your epic project.
19
23
* Replace * this template’s* [ ` LICENSE.txt ` ] ( LICENSE.txt ) with
@@ -28,9 +32,15 @@ Note: just `gem`. The `rake` is for invoking minitest (See [§Rakefile](#Rakefil
28
32
Follow [ the convention] ( https://guides.rubygems.org/patterns/#file-names ) regarding the file structure:
29
33
30
34
35
+ ### [ ` ext/** ` ] ( ext/ )
36
+
37
+ This is the folder where people put their C sources under a sub-folder,
38
+ including the [ init. function] ( ext/mygem/mygem.c ) and the [ config script] ( ext/mygem/extconf.rb ) .
39
+ Third-party headers can be in ` ext/include ` for organization.
40
+
31
41
### [ ` lib/** ` ] ( lib/ )
32
42
33
- This is the folder where people put their Gem sources, starting with their
43
+ This is the folder where people put their Ruby sources, starting with their
34
44
[ entry script] ( lib/mygem.rb ) right under ` lib ` and the rest in a sub-folder.
35
45
36
46
@@ -72,6 +82,8 @@ See [§License](#License)
72
82
73
83
The cool li’l testing toolkit minitest does not come with an executable,
74
84
but rather a Ruby API that generates a handful of [ Rake] ( https://github.com/ruby/rake ) tasks.
85
+ While we are at it, we might as well include [ ` rake-compiler ` ] ( https://github.com/rake-compiler/rake-compiler/actions )
86
+ to automate compiling C during development.
75
87
76
88
77
89
### [ ` README.md ` ] ( README.md )
@@ -87,17 +99,17 @@ Inside this folder are small but thoroughly configured ([minimal modification](#
87
99
#### [ ` documentation.yml ` ] ( .github/workflows/documentation.yml )
88
100
Generate [ YARD docs] ( https://yardoc.org ) and
89
101
[ publish to GitHub Pages] ( https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta )
90
- after the ` main ` branch receives an update in the Ruby sources ([ ` lib/ ` ] ( lib/ ) ) folder .
102
+ after the ` main ` branch receives an update in the sources ([ ` ext/ ` ] ( ext/ ) & [ ` lib/ ` ] ( lib/ ) ) folders .
91
103
92
104
#### [ ` test.yml ` ] ( .github/workflows/test.yml )
93
105
Run tests independently (` rake test:isolated ` ) after any branch receives an update
94
106
on the [ ` .gemspec ` ] ( mygem.gemspec ) (in the event of library version changes) or
95
- in the sources ([ ` lib ` ] ( lib/ ) ) or test ([ ` test ` ] ( test/ ) ) folders.
107
+ in the sources ([ ` ext ` ] ( ext/ ) & [ ` lib/ ` ] ( lib/ ) ) or test ([ ` test ` ] ( test/ ) ) folders.
96
108
97
109
#### [ ` type_check.yml ` ] ( .github/workflows/type_check.yml )
98
110
Check your RBS appendices (see [ §sig/** ] ( #sig ) ) after any branch receives an update
99
111
on the [ ` .gemspec ` ] ( mygem.gemspec ) (in the event of library version changes) or
100
- in the sources ([ ` lib ` ] ( lib/ ) ) or signature ([ ` sig ` ] ( sig/ ) ) folders.
112
+ in the Ruby ([ ` lib ` ] ( lib/ ) ) or signature ([ ` sig ` ] ( sig/ ) ) folders.
101
113
102
114
#### [ ` package.yml ` ] ( .github/workflows/package.yml )
103
115
Publish to RubyGems after the GitHub repo publishes a Release. This workflow requires a “Push rubygem”
0 commit comments