cetus 0.3.2 → 0.3.4
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/bin/cetus +62 -11
- data/cetus.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 995a3f03065183fd8722ba976f9b2eb12ed5a69043c798fed0d5a2fab419b0ae
|
4
|
+
data.tar.gz: 8b94f488bee274950016b2614c455e721f75e5af101b427a31d331484167a21e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a329ef150d0743ca07438b15acb5381bf5912310eaf508fb27bc6d7bf9dc9b7ff5bfbee9447e10fc8c2108a0605637329ece522635a6389d3f9a71a8e6715aa8
|
7
|
+
data.tar.gz: 370be4f893da82674db064dbe89efc33c1959b08659aecc002a33e72c4a6cac562520a6e13b91679e671a7e1b430f37a91368ebf1e25f9ee61934c61c644667b
|
data/bin/cetus
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# Author: rkumar http://github.com/rkumar/cetus/
|
9
9
|
# Date: 2013-02-17 - 17:48
|
10
10
|
# License: GPL
|
11
|
-
# Last update: 2019-06-
|
11
|
+
# Last update: 2019-06-20 09:24
|
12
12
|
# --------------------------------------------------------------------------- #
|
13
13
|
# cetus.rb Copyright (C) 2012-2019 rahul kumar
|
14
14
|
# == CHANGELOG
|
@@ -41,7 +41,7 @@ now = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
|
41
41
|
# alias c=~/bin/cetus.rb
|
42
42
|
# c
|
43
43
|
|
44
|
-
VERSION = '0.3.
|
44
|
+
VERSION = '0.3.3.0'
|
45
45
|
CONFIG_PATH = ENV['XDG_CONFIG_HOME'] || File.join(ENV['HOME'], '.config')
|
46
46
|
CONFIG_FILE = "#{CONFIG_PATH}/cetus/conf.yml"
|
47
47
|
|
@@ -458,10 +458,13 @@ CURSOR_COLOR = REVERSE
|
|
458
458
|
@status_color = 4 # status line, can be 2 3 4 5 6
|
459
459
|
@status_color_right = 8 # status line right part
|
460
460
|
|
461
|
+
@now = Time.now
|
462
|
+
|
461
463
|
# Menubar on top of screen
|
462
464
|
@help = "#{BOLD}?#{BOLD_OFF} Help #{BOLD}`#{BOLD_OFF} Menu #{BOLD}!#{BOLD_OFF} Execute #{BOLD}=#{BOLD_OFF} Toggle #{BOLD}C-x#{BOLD_OFF} File Actions #{BOLD}q#{BOLD_OFF} Quit "
|
463
465
|
|
464
466
|
def read_directory
|
467
|
+
@now = Time.now
|
465
468
|
rescan_required false
|
466
469
|
|
467
470
|
@filterstr ||= 'M' # XXX can we remove from here
|
@@ -969,9 +972,10 @@ def truncate_formatted_filename f, unformatted_len, wid
|
|
969
972
|
# NOTE: we cannot remove the hint
|
970
973
|
# for single hints we need to add extra space
|
971
974
|
# there could be escape codes of varying length
|
972
|
-
sindex = f.index ' '
|
975
|
+
sindex = f.index(' ') || f.index('+')
|
973
976
|
# 4 = 2 for literals, 2 to get ahead of sindex+1
|
974
|
-
|
977
|
+
# FIXME crashing here, maybe there was a plus sign in place of space
|
978
|
+
f[0..sindex + 0] + '<' + f[sindex + 3 + excess..-1] + ' '
|
975
979
|
end
|
976
980
|
return f
|
977
981
|
end
|
@@ -2830,7 +2834,10 @@ def file_actions action=nil
|
|
2830
2834
|
end
|
2831
2835
|
|
2832
2836
|
end
|
2833
|
-
|
2837
|
+
# 2019-06-20 - FIXME next line crashes current_file is nil
|
2838
|
+
if current_file
|
2839
|
+
h[:M] = :set_move_target if File.directory?(current_file)
|
2840
|
+
end
|
2834
2841
|
h[:z] = :zip unless filetype(first) == :zip
|
2835
2842
|
h['/'] = :ffind
|
2836
2843
|
h[:l] = :locate
|
@@ -2900,7 +2907,7 @@ def file_actions action=nil
|
|
2900
2907
|
1
|
2901
2908
|
# already been executed by menu
|
2902
2909
|
# We could have just put 'stat' in the menu but that doesn't look so nice
|
2903
|
-
when :locate
|
2910
|
+
when :locate, :ffind
|
2904
2911
|
1
|
2905
2912
|
else
|
2906
2913
|
return unless menu_text
|
@@ -3092,7 +3099,8 @@ def move_to position
|
|
3092
3099
|
if current_file == SEPARATOR
|
3093
3100
|
@cursor += 1 if @cursor_movement == :down
|
3094
3101
|
@cursor -= 1 if @cursor_movement == :up
|
3095
|
-
return
|
3102
|
+
# 2019-06-01 - remove return in case scrolling happens here
|
3103
|
+
# return
|
3096
3104
|
end
|
3097
3105
|
|
3098
3106
|
# 2019-03-18 - adding sta
|
@@ -3559,10 +3567,16 @@ def enhance_file_list
|
|
3559
3567
|
# if so , expand lib and maybe bin, put a couple recent files
|
3560
3568
|
# FIXME: gemspec file will be same as current folder
|
3561
3569
|
if @files.index('Gemfile') || !@files.grep(/\.gemspec/).empty?
|
3570
|
+
|
3571
|
+
if @files.index('app/')
|
3572
|
+
insert_into_list('config/', "config/routes.rb")
|
3573
|
+
end
|
3574
|
+
|
3562
3575
|
# usually the lib dir has only one file and one dir
|
3576
|
+
# NOTE: avoid lib if rails project
|
3563
3577
|
flg = false
|
3564
3578
|
@files.concat get_important_files(@current_dir)
|
3565
|
-
if @files.index('lib/')
|
3579
|
+
if @files.index('lib/') && !@files.index('app/')
|
3566
3580
|
# get first five entries by modification time
|
3567
3581
|
# f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split("\n")
|
3568
3582
|
f = get_files_by_mtime('lib')&.first(5)
|
@@ -3573,6 +3587,7 @@ def enhance_file_list
|
|
3573
3587
|
end
|
3574
3588
|
|
3575
3589
|
# look into lib file for that project
|
3590
|
+
# lib has a dir in it with the gem name
|
3576
3591
|
dd = File.basename(@current_dir)
|
3577
3592
|
if f.index("lib/#{dd}/")
|
3578
3593
|
# f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split("\n")
|
@@ -3586,18 +3601,43 @@ def enhance_file_list
|
|
3586
3601
|
end
|
3587
3602
|
|
3588
3603
|
# look into bin directory and get first five modified files
|
3589
|
-
|
3604
|
+
# FIXME: not in the case of rails, only for commandline programs
|
3605
|
+
if @files.index('bin/') && !@files.index('app/')
|
3590
3606
|
# f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split("\n")
|
3591
3607
|
f = get_files_by_mtime('bin')&.first(5)
|
3592
3608
|
# @log.warn "2768 f1 #{f1} != #{f} in bin/" if f1 != f
|
3593
3609
|
insert_into_list('bin/', f) if f && !f.empty?
|
3594
3610
|
flg = true
|
3595
3611
|
end
|
3612
|
+
|
3613
|
+
# oft used rails files
|
3614
|
+
# TODO remove concerns dir
|
3615
|
+
# FIXME too many files added, try adding recent only
|
3616
|
+
if @files.index('app/')
|
3617
|
+
[ "app/controllers", "app/models", "app/views" ].each do |dir|
|
3618
|
+
f = get_files_by_mtime(dir)&.first(5)
|
3619
|
+
if f && !f.empty?
|
3620
|
+
@log.debug "f has #{f.count} files before"
|
3621
|
+
@log.debug "f has #{f} files before"
|
3622
|
+
f = get_recent(f)
|
3623
|
+
@log.debug "f has #{f.count} files after"
|
3624
|
+
@log.debug "f has #{f} files after"
|
3625
|
+
insert_into_list("#{dir}/", f) unless f.empty?
|
3626
|
+
end
|
3627
|
+
end
|
3628
|
+
|
3629
|
+
insert_into_list('config/', "config/routes.rb")
|
3630
|
+
|
3631
|
+
# top 3 dirs in app dir
|
3632
|
+
f = get_files_by_mtime('app/')&.first(3)
|
3633
|
+
insert_into_list('app/', f) if f && !f.empty?
|
3634
|
+
flg = true
|
3635
|
+
end
|
3596
3636
|
return if flg
|
3597
3637
|
|
3598
|
-
# lib has a dir in it with the gem name
|
3599
3638
|
|
3600
|
-
end
|
3639
|
+
end # Gemfile
|
3640
|
+
|
3601
3641
|
# 2019-06-01 - added for crystal and other languages
|
3602
3642
|
if @files.index('src/')
|
3603
3643
|
f = get_files_by_mtime('src')&.first(5)
|
@@ -3675,6 +3715,16 @@ def insert_into_list _dir, file
|
|
3675
3715
|
@files.push(*file)
|
3676
3716
|
end
|
3677
3717
|
|
3718
|
+
def get_recent(array)
|
3719
|
+
array = array.select do |f|
|
3720
|
+
stat = File.stat(f)
|
3721
|
+
span = @now - stat.mtime
|
3722
|
+
spandays = span / 86400
|
3723
|
+
spandays < 3
|
3724
|
+
end
|
3725
|
+
array
|
3726
|
+
end
|
3727
|
+
|
3678
3728
|
# Get visited files and bookmarks that are inside this directory
|
3679
3729
|
# at a lower level.
|
3680
3730
|
# 2019-03-23 - not exactly clear what is happening XXX
|
@@ -3691,6 +3741,7 @@ def get_important_files dir
|
|
3691
3741
|
@visited_files.each do |e|
|
3692
3742
|
list << e[l..-1] if e.index(dir) == 0
|
3693
3743
|
end
|
3744
|
+
list = get_recent(list)
|
3694
3745
|
|
3695
3746
|
# bookmarks if it starts with this directory then add it
|
3696
3747
|
# FIXME it puts same directory cetus into the list with full path
|
data/cetus.gemspec
CHANGED
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'cetus'
|
9
|
-
spec.version = '0.3.
|
9
|
+
spec.version = '0.3.4'
|
10
10
|
spec.authors = ['Rahul Kumar']
|
11
11
|
spec.email = ['oneness.univ@gmail.com']
|
12
12
|
spec.description = %q{lightning fast file navigator}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cetus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rahul Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.0.
|
82
|
+
rubygems_version: 3.0.6
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: lightning fast file navigator - ruby 1.9.3 .. ruby 2.6
|