cinnabar 0.0.7 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6421e09dfa0c80203e6f23bcc2fab637dc1e8b1e8673d0f584a9bbcd323e3f4
4
- data.tar.gz: 4828cb0de49dc9039b61ad2367913db43957a8debac9a5dad2224ed49a818872
3
+ metadata.gz: 8c9380fe3043491a6713a462cf2dbf775dbfac84ba64a4bf07795935784bd970
4
+ data.tar.gz: 349073ec15c90a198c964a1da6e73e1babe212385a2d173d44d67427181338e2
5
5
  SHA512:
6
- metadata.gz: 6f29c1326ae25a3658027ae98dc160af3c31204e6f4d720e10094c10286591f34586fd07e231bc9604cdbeba40ddb93c8a9c35cd803e8821271f66d77a98a439
7
- data.tar.gz: dfe9e80083ed0da1b47c0cde810f4dde2a0a33111d6e06a55bc59740c44cdc4fd5f4e208a6b7e647e28372b1a4015b665a2ba5e59a0cea4e3462f6b0b6a39981
6
+ metadata.gz: cf824e87ce90c648a774f77539aff478653eaaeadc44b943f8699cc7c67d55078a641d1f7223ebf44e5f68944cd35c3038d253a99073bcf9cfe49907fa42b952
7
+ data.tar.gz: f6bea3d650ad6a835ab7f5436d9cf112649938656c008aa1fd4a273ebadb2ddd1038dea1e01f8d0d7e1e6e9f93b74638ceeda7ab2e65f1d4d134073ee32c0d4e
data/docs/Readme.md CHANGED
@@ -57,7 +57,7 @@ jobs:
57
57
  with:
58
58
  repository: 2moe/cinnabar
59
59
  path: cinnabar
60
- ref: v0.0.7
60
+ ref: v0.0.8
61
61
 
62
62
  - name: (example) run cargo command
63
63
  run: |
@@ -168,14 +168,46 @@ jobs:
168
168
 
169
169
  ### GemPath
170
170
 
171
+ `GemPath` is used mainly with Ruby started via the `--disable=gems` flag; the code below is equivalent to `%w[ irb rdoc reline ].each { require it }`.
172
+
173
+ ```ruby
174
+ def require_gems = ->(gems) {
175
+ {
176
+ # cache_dir: File.expand_path('~/.cache/ruby'),
177
+ gems:,
178
+ }
179
+ .then(&Cinnabar.new_gem_path_proc)
180
+ .append_load_path!
181
+
182
+ gems.each { require _1 }
183
+ }
184
+
185
+ %w[
186
+ irb rdoc reline
187
+ ].then(&require_gems)
188
+ ```
189
+
171
190
  #### Faster IRB
172
191
 
173
- > **NON CI Environment**
192
+ Because `GemPath` automatically caches gem `require_paths`, combining it with `ruby --disable=gems` can significantly reduce IRB startup time.
193
+
194
+ 1. Run: [misc/firb/install.ps1](../misc/firb/install.ps1)
195
+
196
+ OR:
197
+
198
+ ```pwsh
199
+ gem install cinnabar
200
+ ```
201
+
202
+ 2.
203
+ - Enter the directory:
204
+ - `ruby -r cinnabar -e "p Cinnabar.firb_path"`
205
+ - OR: `${XDG_CACHE_HOME:-~/.cache}/ruby/firb/bin/` (POSIX sh)
206
+ - OR: `~/.cache/ruby/firb/bin/`
207
+ - OR: `%UserProfile%\.cache\ruby\firb\bin` (Windows CMD)
174
208
 
175
- 1. run: [misc/firb/install-cinnabar.ps1](../misc/firb/install-cinnabar.ps1)
176
- 2. Enter `${XDG_CACHE_HOME:-~/.cache}/ruby/firb/bin/`
177
209
  3. run
178
210
  - [`./firb0`](../misc/firb/bin/firb0)
179
- - OR `.\firb0.bat` (Windows)
211
+ - OR [`.\firb0.bat`](../misc/firb/bin/firb0.bat) (Windows)
180
212
  - OR [`./firb`](../misc/firb/bin/firb)
181
213
  - OR `.\firb.bat` (Windows)
data/lib/cinnabar/path.rb CHANGED
@@ -19,6 +19,18 @@ module Cinnabar
19
19
  def self.to_path_proc = ->(s) { Pathname(s) }
20
20
  end
21
21
 
22
+ module Cinnabar
23
+ module_function
24
+
25
+ def firb_path
26
+ File.expand_path('../../misc/firb/bin/', Kernel.__dir__)
27
+ end
28
+
29
+ def firb_installation_script_path
30
+ File.expand_path('../../misc/firb/install.ps1', Kernel.__dir__)
31
+ end
32
+ end
33
+
22
34
  # Adds `String#to_path` as a convenience helper to convert strings into {Kernel.Pathname}.
23
35
  #
24
36
  # This module supports two integration styles:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cinnabar
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  end
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env pwsh
2
2
  # Usage:
3
- # UNIX:
4
- # sh install-cinnabar.ps1
3
+ # UNIX-like:
4
+ # sh install.ps1
5
5
  # Windows: Copy everything in this file and paste it into PowerShell to run.
6
6
  #
7
7
  # Description: install cinnabar and copy to cache dir
8
8
  # Note: Although the shebang is `pwsh`, you can run it with POSIX sh.
9
- # Depens: ruby (>= 3.1)
9
+ # Depends: ruby (>= 3.1)
10
10
 
11
11
  gem install cinnabar
12
12
 
@@ -32,4 +32,8 @@ ruby -r pathname -r cinnabar -r fileutils -e "
32
32
 
33
33
  [lib_dir, firb]
34
34
  .each(&copy_to_cache_dir)
35
+
36
+ puts '========='
37
+ print 'Path: '
38
+ puts File.expand_path('firb/bin', cache_dir)
35
39
  "
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinnabar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2moe
@@ -47,7 +47,7 @@ files:
47
47
  - misc/firb/bin/firb.bat
48
48
  - misc/firb/bin/firb0
49
49
  - misc/firb/bin/firb0.bat
50
- - misc/firb/install-cinnabar.ps1
50
+ - misc/firb/install.ps1
51
51
  - misc/firb/lib/sh_utils.rb
52
52
  - misc/firb/lib/version.rb
53
53
  - misc/firb/lib/which.rb