cinnabar 0.0.6 → 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 +4 -4
- data/docs/Readme.md +37 -5
- data/lib/cinnabar/path.rb +12 -0
- data/lib/cinnabar/version.rb +1 -1
- data/misc/firb/bin/firb +24 -1
- data/misc/firb/{install-cinnabar.ps1 → install.ps1} +7 -3
- data/misc/firb/lib/sh_utils.rb +3 -11
- data/misc/firb/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c9380fe3043491a6713a462cf2dbf775dbfac84ba64a4bf07795935784bd970
|
|
4
|
+
data.tar.gz: 349073ec15c90a198c964a1da6e73e1babe212385a2d173d44d67427181338e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
-
|
|
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:
|
data/lib/cinnabar/version.rb
CHANGED
data/misc/firb/bin/firb
CHANGED
|
@@ -22,8 +22,31 @@
|
|
|
22
22
|
# which :ruby #=> `which ruby`
|
|
23
23
|
# cdir '~/.cache' #=> `cd ~/.cache; pwd; ls`
|
|
24
24
|
# pwd #=> Dir.pwd
|
|
25
|
+
#
|
|
26
|
+
# Install Dependencies:
|
|
27
|
+
#
|
|
28
|
+
# - Windows:
|
|
29
|
+
# winget install Microsoft.VCRedist.2015+.x64
|
|
30
|
+
# # OR: winget install Microsoft.VCRedist.2015+.arm64
|
|
31
|
+
#
|
|
32
|
+
# scoop install bat eza
|
|
33
|
+
#
|
|
34
|
+
# - macOS:
|
|
35
|
+
# brew install bat eza
|
|
36
|
+
#
|
|
37
|
+
# - Debian:
|
|
38
|
+
#
|
|
39
|
+
# apt update
|
|
40
|
+
# apt install -y bat eza
|
|
41
|
+
# ln -svf /usr/bin/batcat /usr/local/bin/bat
|
|
42
|
+
#
|
|
43
|
+
# - Arch:
|
|
44
|
+
# pacman -Sy bat eza
|
|
45
|
+
#
|
|
46
|
+
# - Alpine:
|
|
47
|
+
# apk add bat eza
|
|
48
|
+
#
|
|
25
49
|
# ====================
|
|
26
|
-
|
|
27
50
|
Kernel.warn " ruby:\t#{RUBY_VERSION}" if ARGV.empty?
|
|
28
51
|
|
|
29
52
|
$ruby_cache_dir = -> {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env pwsh
|
|
2
2
|
# Usage:
|
|
3
|
-
# UNIX:
|
|
4
|
-
# sh install
|
|
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
|
-
#
|
|
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(©_to_cache_dir)
|
|
35
|
+
|
|
36
|
+
puts '========='
|
|
37
|
+
print 'Path: '
|
|
38
|
+
puts File.expand_path('firb/bin', cache_dir)
|
|
35
39
|
"
|
data/misc/firb/lib/sh_utils.rb
CHANGED
|
@@ -4,17 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
require_relative 'which'
|
|
6
6
|
|
|
7
|
-
BAT_CAT_CMD =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
['cat']
|
|
11
|
-
}.call.freeze
|
|
12
|
-
|
|
13
|
-
EXA_LS_CMD = -> {
|
|
14
|
-
%w[eza exa]
|
|
15
|
-
.each { return [_1, '--icons=auto'] if which(_1) }
|
|
16
|
-
['ls', '--color=auto']
|
|
17
|
-
}.call.freeze
|
|
7
|
+
BAT_CAT_CMD = ['bat', '-Pp'].freeze
|
|
8
|
+
EXA_LS_CMD = ['eza', '--icons=auto'].freeze
|
|
9
|
+
# EXA_LS_CMD = ['ls', '--color=auto'].freeze
|
|
18
10
|
|
|
19
11
|
# Similar to `cd "/path/to/dir"; pwd; ls`
|
|
20
12
|
def cdir(path = Dir.home)
|
data/misc/firb/lib/version.rb
CHANGED
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.
|
|
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
|
|
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
|