cinnabar 0.0.5 → 0.0.7

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: d83910154ce0808abd650b6516e0a18187de481de2021a38011673a4756de8bd
4
- data.tar.gz: 5d91b4825c634344ce80327208b6e33875189c33ffc4aca7bb614645f7be21d7
3
+ metadata.gz: e6421e09dfa0c80203e6f23bcc2fab637dc1e8b1e8673d0f584a9bbcd323e3f4
4
+ data.tar.gz: 4828cb0de49dc9039b61ad2367913db43957a8debac9a5dad2224ed49a818872
5
5
  SHA512:
6
- metadata.gz: 2b9016a81fe9afcdbb293748fd4b3054df0ba92e858c81a9a57f6bff082bc9a44cf78f63d8c076d592dfc66de3084241c55731ab76a40037711aea4dfa645bb9
7
- data.tar.gz: 504b1cd43bfef722f3d3699d2695d23ad3da0134e1e3b99188359b2d7b5b83f0a32b1ea624ae129a0727775f4016a930ece24d98a746b8eecea813ea8ba68f36
6
+ metadata.gz: 6f29c1326ae25a3658027ae98dc160af3c31204e6f4d720e10094c10286591f34586fd07e231bc9604cdbeba40ddb93c8a9c35cd803e8821271f66d77a98a439
7
+ data.tar.gz: dfe9e80083ed0da1b47c0cde810f4dde2a0a33111d6e06a55bc59740c44cdc4fd5f4e208a6b7e647e28372b1a4015b665a2ba5e59a0cea4e3462f6b0b6a39981
data/.rubocop.yml CHANGED
@@ -26,8 +26,6 @@ Style/Documentation:
26
26
  Enabled: false
27
27
  Style/ClassAndModuleChildren:
28
28
  EnforcedStyle: compact
29
- Style/RescueModifier:
30
- Enabled: false
31
29
 
32
30
  # https://docs.rubocop.org/rubocop/cops_metrics.html
33
31
  Metrics/MethodLength:
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.3
60
+ ref: v0.0.7
61
61
 
62
62
  - name: (example) run cargo command
63
63
  run: |
@@ -307,7 +307,11 @@ class Cinnabar::GemPath
307
307
  File.write(tmp, content)
308
308
  File.rename(tmp, path)
309
309
  ensure
310
- File.unlink(tmp) rescue nil
310
+ begin
311
+ File.unlink(tmp)
312
+ rescue StandardError
313
+ nil
314
+ end
311
315
  end
312
316
  end
313
317
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cinnabar
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.7'
5
5
  end
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 = -> {
@@ -39,10 +62,15 @@ $ruby_cache_dir = -> {
39
62
  }.call
40
63
 
41
64
  -> {
42
- dir = $ruby_cache_dir.join('lib/cinnabar')
65
+ libs = %w[gem_path utils]
66
+ lib_dir = File.expand_path('../../../lib/cinnabar', __dir__).then { Pathname _1 }
67
+ if lib_dir.exist?
68
+ libs.each { require lib_dir.join(_1) }
69
+ return
70
+ end
43
71
 
44
- %w[gem_path utils]
45
- .each { require dir.join(_1) }
72
+ dir = $ruby_cache_dir.join('lib/cinnabar')
73
+ libs.each { require dir.join(_1) }
46
74
  }.call
47
75
 
48
76
  def new_cinnabar_gem_path_class(gems)
@@ -107,20 +135,9 @@ include Sinlog::Mixin
107
135
  include Argvise::HashMixin
108
136
 
109
137
  # load `which` & `sh-utils`
110
- -> {
111
- gem = 'cinnabar'
112
-
113
- new_cinnabar_gem_path_class([gem])
114
- .cache_hash[gem]
115
- .last
116
- .then { File.expand_path('../misc/firb/lib', _1).to_path }
117
- .tap do |dir|
118
- %w[which sh_utils]
119
- .each { require dir.join(_1) }
120
- end
121
- }.call
122
- # require_relative '../lib/which'
123
- # require_relative '../lib/sh_utils'
138
+ require_relative '../lib/which'
139
+ require_relative '../lib/version'
140
+ require_relative '../lib/sh_utils'
124
141
 
125
142
  # ====================
126
143
  run_ruby_cli unless ARGV.empty?
data/misc/firb/bin/firb0 CHANGED
@@ -33,10 +33,15 @@ $ruby_cache_dir = -> {
33
33
  }.call
34
34
 
35
35
  -> {
36
- dir = $ruby_cache_dir.join('lib/cinnabar')
36
+ libs = %w[gem_path utils]
37
+ lib_dir = File.expand_path('../../../lib/cinnabar', __dir__).then { Pathname _1 }
38
+ if lib_dir.exist?
39
+ libs.each { require lib_dir.join(_1) }
40
+ return
41
+ end
37
42
 
38
- %w[gem_path utils]
39
- .each { require dir.join(_1) }
43
+ dir = $ruby_cache_dir.join('lib/cinnabar')
44
+ libs.each { require dir.join(_1) }
40
45
  }.call
41
46
 
42
47
  def new_cinnabar_gem_path_class(gems)
@@ -71,6 +76,12 @@ def start_irb
71
76
  IRB.start
72
77
  end
73
78
 
79
+ begin
80
+ require_relative '../lib/version'
81
+ rescue StandardError
82
+ nil
83
+ end
84
+
74
85
  unless ARGV.empty?
75
86
  require 'rbconfig'
76
87
  ENV['RUBYOPT'] = '--disable=gems'
@@ -4,17 +4,9 @@
4
4
 
5
5
  require_relative 'which'
6
6
 
7
- BAT_CAT_CMD = -> {
8
- %w[bat batcat]
9
- .each { return [_1, '-Pp'] if which(_1) }
10
- ['cat']
11
- }.call
12
-
13
- EXA_LS_CMD = -> {
14
- %w[eza exa]
15
- .each { return [_1, '--icons=auto'] if which(_1) }
16
- ['ls', '--color=auto']
17
- }.call
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)
@@ -31,10 +23,10 @@ def path_sym_to_str(path)
31
23
  end
32
24
 
33
25
  def run_eza_ls(path = '.', *rest)
34
- cmd = EXA_LS_CMD
26
+ cmd = EXA_LS_CMD.dup
35
27
  cmd.concat(rest) unless rest.empty?
36
28
  path = path_sym_to_str(path)
37
- cmd << File.expand_path(path)
29
+ cmd.push(File.expand_path(path))
38
30
  puts "\e[9m #{cmd} \e[0m"
39
31
  system(*cmd)
40
32
  end
@@ -53,7 +45,7 @@ def la(path = '.', *rest)
53
45
  end
54
46
 
55
47
  def cat(path, *rest)
56
- cmd = BAT_CAT_CMD
48
+ cmd = BAT_CAT_CMD.dup
57
49
  path = path_sym_to_str(path)
58
50
  cmd << File.expand_path(path)
59
51
  cmd.concat(rest) unless rest.empty?
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firb
4
+ VERSION = '0.0.2'
5
+ end
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.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - 2moe
@@ -49,6 +49,7 @@ files:
49
49
  - misc/firb/bin/firb0.bat
50
50
  - misc/firb/install-cinnabar.ps1
51
51
  - misc/firb/lib/sh_utils.rb
52
+ - misc/firb/lib/version.rb
52
53
  - misc/firb/lib/which.rb
53
54
  homepage: https://github.com/2moe/cinnabar
54
55
  licenses: