cinnabar 0.0.4 → 0.0.6

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: b8b6184f3c8af69dfce30f53af0f8fcad8b34a380dae6bc3e21c32f3bde4753b
4
- data.tar.gz: aa0f40c2a071eb846d01db60bdf60a9b738d8a3f0fe76e70bf57d48fa670376b
3
+ metadata.gz: d1b9aa28bb5ec0a8ab6c27fad3c32118087ddb9bf6caef21a4b511f0c2c0c4c8
4
+ data.tar.gz: 952f7f0c1d2b915f3fde32ead4cc36c4c96c482e616325a7df596ed8f1187fb4
5
5
  SHA512:
6
- metadata.gz: 866a074b21a09531dd22c8f237f25ea9b86f96c2a431d99b010d7b375def9f58947f244ee67d4177c442c82bc16b7b4c578ad75ad5768ac90baae009663d714a
7
- data.tar.gz: 5f65f8f023ba4281cc6afb755f8ab3f5f73faa627096a81cb2c78734ef14b36f686ee87ddd91912b07c2d8630a79730c2c7a3918be5723a7aa9ed2b87b388d8f
6
+ metadata.gz: 3b20bb4b422443e83afd40753ef2862ec59f8533b2b1e0fee3c33e755e42d1fc26b158b297f73c7ae402a09709be49e82b6f77053b3c761fea31da929d8244e4
7
+ data.tar.gz: c814343302e8e2f94e3ae04b9558b8306e0512b541e136391ce67863b40edc0468da990a9b69e58440a669424acca1bd352cdebb150dabd4d10dbf93a249da41
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.5
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
 
@@ -394,6 +398,7 @@ class Cinnabar::GemPath
394
398
  # @return [Array<String>]
395
399
  def broken_gems
396
400
  @cache_hash
401
+ .filter { |k, _| @gems.include? k }
397
402
  .reject { |_, v| all_paths_exist?(v) }
398
403
  .keys
399
404
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cinnabar
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.6'
5
5
  end
data/misc/firb/bin/firb CHANGED
@@ -39,10 +39,15 @@ $ruby_cache_dir = -> {
39
39
  }.call
40
40
 
41
41
  -> {
42
- dir = $ruby_cache_dir.join('lib/cinnabar')
42
+ libs = %w[gem_path utils]
43
+ lib_dir = File.expand_path('../../../lib/cinnabar', __dir__).then { Pathname _1 }
44
+ if lib_dir.exist?
45
+ libs.each { require lib_dir.join(_1) }
46
+ return
47
+ end
43
48
 
44
- %w[gem_path utils]
45
- .each { require dir.join(_1) }
49
+ dir = $ruby_cache_dir.join('lib/cinnabar')
50
+ libs.each { require dir.join(_1) }
46
51
  }.call
47
52
 
48
53
  def new_cinnabar_gem_path_class(gems)
@@ -107,20 +112,9 @@ include Sinlog::Mixin
107
112
  include Argvise::HashMixin
108
113
 
109
114
  # 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'
115
+ require_relative '../lib/which'
116
+ require_relative '../lib/version'
117
+ require_relative '../lib/sh_utils'
124
118
 
125
119
  # ====================
126
120
  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'
@@ -8,13 +8,13 @@ BAT_CAT_CMD = -> {
8
8
  %w[bat batcat]
9
9
  .each { return [_1, '-Pp'] if which(_1) }
10
10
  ['cat']
11
- }.call
11
+ }.call.freeze
12
12
 
13
13
  EXA_LS_CMD = -> {
14
14
  %w[eza exa]
15
15
  .each { return [_1, '--icons=auto'] if which(_1) }
16
16
  ['ls', '--color=auto']
17
- }.call
17
+ }.call.freeze
18
18
 
19
19
  # Similar to `cd "/path/to/dir"; pwd; ls`
20
20
  def cdir(path = Dir.home)
@@ -31,10 +31,10 @@ def path_sym_to_str(path)
31
31
  end
32
32
 
33
33
  def run_eza_ls(path = '.', *rest)
34
- cmd = EXA_LS_CMD
34
+ cmd = EXA_LS_CMD.dup
35
35
  cmd.concat(rest) unless rest.empty?
36
36
  path = path_sym_to_str(path)
37
- cmd << File.expand_path(path)
37
+ cmd.push(File.expand_path(path))
38
38
  puts "\e[9m #{cmd} \e[0m"
39
39
  system(*cmd)
40
40
  end
@@ -53,7 +53,7 @@ def la(path = '.', *rest)
53
53
  end
54
54
 
55
55
  def cat(path, *rest)
56
- cmd = BAT_CAT_CMD
56
+ cmd = BAT_CAT_CMD.dup
57
57
  path = path_sym_to_str(path)
58
58
  cmd << File.expand_path(path)
59
59
  cmd.concat(rest) unless rest.empty?
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Firb
4
+ VERSION = '0.0.1'
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.4
4
+ version: 0.0.6
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: