hiiro 0.1.32 → 0.1.33.pre.2
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/g-pr +1 -2
- data/bin/h-branch +1 -2
- data/bin/h-buffer +1 -1
- data/bin/h-link +1 -1
- data/bin/h-osubtask +1 -2
- data/bin/h-otask +1 -1
- data/bin/h-pane +1 -1
- data/bin/h-plugin +1 -1
- data/bin/h-pr +1 -2
- data/bin/h-session +1 -1
- data/bin/h-sha +1 -1
- data/bin/h-vim +1 -1
- data/bin/h-window +1 -1
- data/exe/h +1 -1
- data/lib/hiiro/plugins.rb +64 -0
- data/lib/hiiro/version.rb +1 -1
- data/lib/hiiro.rb +33 -18
- data/plugins/notify.rb +1 -1
- data/plugins/old_task.rb +1 -1
- data/plugins/project.rb +1 -1
- data/plugins/tasks.rb +7 -2
- data/script/publish +18 -3
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcfae77d18ac4bf22f781a841bd6410867a8f2d6b3326845a6a4fcab79229175
|
|
4
|
+
data.tar.gz: e6677f372a9442aa0cccbb888f7ee9da8a8568543bad42e7485b674ed30d2af4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b87d2d1eeec269aae9371f93b8ba28c68a2eba03817d6b667289c5178d799b5c86ce0802f0d8dec3f02ecb7d5687745e6b132b354bf32c5ce8ed0656b5ecc29
|
|
7
|
+
data.tar.gz: c0789c1f694680700927d7301a587775e655a3ebe0d07137bcb812314614edb2da07b4f1148a3ec2db178e1f64ae2e03ebda565bbd0bada47c4f439f634ad27b
|
data/bin/g-pr
CHANGED
data/bin/h-branch
CHANGED
data/bin/h-buffer
CHANGED
data/bin/h-link
CHANGED
|
@@ -193,7 +193,7 @@ class LinkManager
|
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
lm = LinkManager.new
|
|
196
|
-
o = Hiiro.init(*ARGV, plugins: [Tmux, Pins], links_file: lm.links_file)
|
|
196
|
+
o = Hiiro.init(*ARGV, plugins: [:Tmux, :Pins], links_file: lm.links_file)
|
|
197
197
|
|
|
198
198
|
o.add_subcmd(:add) do |*args|
|
|
199
199
|
links = lm.load_links
|
data/bin/h-osubtask
CHANGED
data/bin/h-otask
CHANGED
data/bin/h-pane
CHANGED
data/bin/h-plugin
CHANGED
|
@@ -5,7 +5,7 @@ require 'json'
|
|
|
5
5
|
require 'hiiro'
|
|
6
6
|
|
|
7
7
|
BASE_DIR = File.join(Dir.home, '.config/hiiro/plugins')
|
|
8
|
-
o = Hiiro.init(*ARGV, plugins: [Tmux, Pins], dir: BASE_DIR)
|
|
8
|
+
o = Hiiro.init(*ARGV, plugins: [:Tmux, :Pins], dir: BASE_DIR)
|
|
9
9
|
|
|
10
10
|
def plugin_files
|
|
11
11
|
Dir.glob(File.join(BASE_DIR, '**/*'))
|
data/bin/h-pr
CHANGED
data/bin/h-session
CHANGED
|
@@ -22,7 +22,7 @@ require 'rspec'
|
|
|
22
22
|
# has (subcommand) /Users/unixsuperhero/bin/h-session:139
|
|
23
23
|
# info (subcommand) /Users/unixsuperhero/bin/h-session:143
|
|
24
24
|
|
|
25
|
-
o = Hiiro.init(*ARGV, plugins: [Pins])
|
|
25
|
+
o = Hiiro.init(*ARGV, plugins: [:Pins])
|
|
26
26
|
|
|
27
27
|
o.add_subcmd(:ls) { |*args|
|
|
28
28
|
system('tmux', 'list-sessions', *args)
|
data/bin/h-sha
CHANGED
data/bin/h-vim
CHANGED
|
@@ -5,7 +5,7 @@ require 'hiiro'
|
|
|
5
5
|
BASE_DIR = CONFIG_DIR = File.join(Dir.home, '.config/nvim')
|
|
6
6
|
TMUX_SESSION_NAME = 'vim'
|
|
7
7
|
|
|
8
|
-
o = Hiiro.init(*ARGV, plugins: [Tmux, Pins, Project])
|
|
8
|
+
o = Hiiro.init(*ARGV, plugins: [:Tmux, :Pins, :Project])
|
|
9
9
|
|
|
10
10
|
o.add_subcmd(:edit) { |*args|
|
|
11
11
|
nvim = ENV['EDITOR']
|
data/bin/h-window
CHANGED
data/exe/h
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
class Hiiro
|
|
2
|
+
class Plugins
|
|
3
|
+
class << self
|
|
4
|
+
def load_plugin(name)
|
|
5
|
+
name_str = name.to_s
|
|
6
|
+
return const_get(name_str) if plugin_loaded?(name_str)
|
|
7
|
+
|
|
8
|
+
path = plugin_path(name_str)
|
|
9
|
+
unless path
|
|
10
|
+
warn "[hiiro] plugin not found: #{name_str}"
|
|
11
|
+
return nil
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
module_eval(File.read(path), path, 1)
|
|
15
|
+
|
|
16
|
+
unless const_defined?(name_str, false)
|
|
17
|
+
warn "[hiiro] plugin #{name_str} did not define expected constant"
|
|
18
|
+
return nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
@loaded_plugins ||= []
|
|
22
|
+
@loaded_plugins << name_str
|
|
23
|
+
const_get(name_str)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def plugin_loaded?(name_str)
|
|
27
|
+
(@loaded_plugins || []).include?(name_str.to_s)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def plugin_path(name_str)
|
|
31
|
+
plugin_filename = name_str.underscore + '.rb'
|
|
32
|
+
|
|
33
|
+
paths_to_check = [
|
|
34
|
+
File.join(Dir.home, '.config/hiiro/plugins'),
|
|
35
|
+
File.join(File.expand_path('../..', __FILE__), 'plugins'),
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
paths_to_check.each do |dir|
|
|
39
|
+
full_path = File.join(dir, plugin_filename)
|
|
40
|
+
return full_path if File.exist?(full_path)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
nil
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def load_all
|
|
47
|
+
user_dir = File.join(Dir.home, '.config/hiiro/plugins')
|
|
48
|
+
gem_dir = File.join(File.expand_path('../..', __FILE__), 'plugins')
|
|
49
|
+
|
|
50
|
+
FileUtils.mkdir_p(user_dir) unless Dir.exist?(user_dir)
|
|
51
|
+
|
|
52
|
+
user_files = Dir.glob(File.join(user_dir, '*.rb'))
|
|
53
|
+
user_basenames = user_files.map { |f| File.basename(f) }
|
|
54
|
+
|
|
55
|
+
gem_files = Dir.exist?(gem_dir) ? Dir.glob(File.join(gem_dir, '*.rb')) : []
|
|
56
|
+
fallback_files = gem_files.reject { |f| user_basenames.include?(File.basename(f)) }
|
|
57
|
+
|
|
58
|
+
(user_files + fallback_files).each do |path|
|
|
59
|
+
module_eval(File.read(path), path, 1)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
data/lib/hiiro/version.rb
CHANGED
data/lib/hiiro.rb
CHANGED
|
@@ -4,15 +4,29 @@ require "shellwords"
|
|
|
4
4
|
|
|
5
5
|
require_relative "hiiro/version"
|
|
6
6
|
require_relative "hiiro/history"
|
|
7
|
+
require_relative "hiiro/plugins"
|
|
8
|
+
|
|
9
|
+
class String
|
|
10
|
+
def underscore(camel_cased_word=self)
|
|
11
|
+
regex = /(?:(?<=([A-Za-z\d]))|\b)((?-mix:(?=a)b))(?=\b|[^a-z])/
|
|
12
|
+
return camel_cased_word.to_s.dup unless /[A-Z-]|::/.match?(camel_cased_word)
|
|
13
|
+
word = camel_cased_word.to_s.gsub("::", "/")
|
|
14
|
+
word.gsub!(regex) { "#{$1 && '_' }#{$2.downcase}" }
|
|
15
|
+
word.gsub!(/(?<=[A-Z])(?=[A-Z][a-z])|(?<=[a-z\d])(?=[A-Z])/, "_")
|
|
16
|
+
word.tr!("-", "_")
|
|
17
|
+
word.downcase!
|
|
18
|
+
word
|
|
19
|
+
end
|
|
20
|
+
end
|
|
7
21
|
|
|
8
22
|
class Hiiro
|
|
9
23
|
def self.init(*args, plugins: [], logging: false, **values, &block)
|
|
10
|
-
|
|
24
|
+
load_plugins(plugins)
|
|
11
25
|
args = ARGV if args.empty?
|
|
12
26
|
|
|
13
27
|
new($0, *args, logging: logging, **values).tap do |hiiro|
|
|
14
28
|
History.load(hiiro)
|
|
15
|
-
hiiro.
|
|
29
|
+
hiiro.init_plugins(*plugins)
|
|
16
30
|
|
|
17
31
|
hiiro.add_subcmd(:edit, **values) { |*args|
|
|
18
32
|
system(ENV['EDITOR'] || 'nvim', hiiro.bin)
|
|
@@ -28,12 +42,10 @@ class Hiiro
|
|
|
28
42
|
hiiro.run
|
|
29
43
|
end
|
|
30
44
|
|
|
31
|
-
def self.
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
def self.load_plugins(plugin_list)
|
|
46
|
+
plugin_list.each do |name|
|
|
47
|
+
Plugins.load_plugin(name.to_s)
|
|
34
48
|
end
|
|
35
|
-
|
|
36
|
-
self
|
|
37
49
|
end
|
|
38
50
|
|
|
39
51
|
attr_reader :bin, :bin_name, :all_args, :full_command
|
|
@@ -119,11 +131,24 @@ class Hiiro
|
|
|
119
131
|
|
|
120
132
|
def pins = @pins ||= Pin.new(self)
|
|
121
133
|
|
|
134
|
+
def init_plugins(*names)
|
|
135
|
+
names.flatten.each do |name|
|
|
136
|
+
plugin_const = Hiiro::Plugins.const_get(name.to_s) rescue nil
|
|
137
|
+
next unless plugin_const
|
|
138
|
+
load_plugin(plugin_const)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
122
142
|
def load_plugins(*plugins)
|
|
123
143
|
plugins.flatten.each { |plugin| load_plugin(plugin) }
|
|
124
144
|
end
|
|
125
145
|
|
|
126
|
-
def load_plugin(
|
|
146
|
+
def load_plugin(plugin)
|
|
147
|
+
plugin_const = case plugin
|
|
148
|
+
when Module then plugin
|
|
149
|
+
when String, Symbol then Hiiro::Plugins.load_plugin(plugin.to_s)
|
|
150
|
+
end
|
|
151
|
+
return unless plugin_const
|
|
127
152
|
return if @loaded_plugins.include?(plugin_const)
|
|
128
153
|
|
|
129
154
|
plugin_const.load(self)
|
|
@@ -180,14 +205,6 @@ class Hiiro
|
|
|
180
205
|
|
|
181
206
|
class Config
|
|
182
207
|
class << self
|
|
183
|
-
def plugin_files
|
|
184
|
-
Dir.glob(File.join(plugin_dir, '*'))
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
def plugin_dir
|
|
188
|
-
config_dir('plugins')
|
|
189
|
-
end
|
|
190
|
-
|
|
191
208
|
def config_dir(subdir=nil)
|
|
192
209
|
File.join(Dir.home, '.config/hiiro', *[subdir].compact).tap do |config_path|
|
|
193
210
|
FileUtils.mkdir_p(config_path) unless Dir.exist?(config_path)
|
|
@@ -437,6 +454,4 @@ class Hiiro
|
|
|
437
454
|
end
|
|
438
455
|
end
|
|
439
456
|
end
|
|
440
|
-
|
|
441
|
-
load_env
|
|
442
457
|
end
|
data/plugins/notify.rb
CHANGED
data/plugins/old_task.rb
CHANGED
data/plugins/project.rb
CHANGED
data/plugins/tasks.rb
CHANGED
|
@@ -289,7 +289,12 @@ class TaskManager
|
|
|
289
289
|
assignments_file = File.join(File.dirname(tasks_file), 'assignments.yml')
|
|
290
290
|
if File.exist?(assignments_file)
|
|
291
291
|
raw = YAML.safe_load_file(assignments_file) || {}
|
|
292
|
-
|
|
292
|
+
tasks = raw.map do |tree_path, task_name|
|
|
293
|
+
h = { 'name' => task_name, 'tree' => tree_path }
|
|
294
|
+
h['session'] = task_name if task_name.include?('/')
|
|
295
|
+
h
|
|
296
|
+
end
|
|
297
|
+
data = { 'tasks' => tasks }
|
|
293
298
|
save_tasks(data)
|
|
294
299
|
return data
|
|
295
300
|
end
|
|
@@ -736,7 +741,7 @@ end
|
|
|
736
741
|
|
|
737
742
|
module Tasks
|
|
738
743
|
def self.load(hiiro)
|
|
739
|
-
hiiro.load_plugin(Tmux)
|
|
744
|
+
hiiro.load_plugin('Tmux')
|
|
740
745
|
add_subcommands(hiiro)
|
|
741
746
|
end
|
|
742
747
|
|
data/script/publish
CHANGED
|
@@ -2,9 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
require "hiiro"
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
pre_release = ARGV.include?("-t")
|
|
6
|
+
parts = Hiiro::VERSION.split(?.)
|
|
7
|
+
|
|
8
|
+
if parts.length == 5 && parts[3] == "pre"
|
|
9
|
+
major, minor, patch, _, pre_num = parts
|
|
10
|
+
if pre_release
|
|
11
|
+
new_version = [major, minor, patch, "pre", pre_num.to_i + 1].join(?.)
|
|
12
|
+
else
|
|
13
|
+
new_version = [major, minor, patch].join(?.)
|
|
14
|
+
end
|
|
15
|
+
else
|
|
16
|
+
major, minor, patch = parts
|
|
17
|
+
if pre_release
|
|
18
|
+
new_version = [major, minor, patch.to_i + 1, "pre", 1].join(?.)
|
|
19
|
+
else
|
|
20
|
+
new_version = [major, minor, patch.to_i + 1].join(?.)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
8
23
|
|
|
9
24
|
File.open('lib/hiiro/version.rb', 'w+') do |f|
|
|
10
25
|
f.puts 'class Hiiro'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hiiro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.33.pre.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joshua Toyota
|
|
@@ -77,6 +77,7 @@ files:
|
|
|
77
77
|
- hiiro.gemspec
|
|
78
78
|
- lib/hiiro.rb
|
|
79
79
|
- lib/hiiro/history.rb
|
|
80
|
+
- lib/hiiro/plugins.rb
|
|
80
81
|
- lib/hiiro/version.rb
|
|
81
82
|
- links.backup.yml
|
|
82
83
|
- notes
|
|
@@ -108,9 +109,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
108
109
|
version: 2.7.0
|
|
109
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
111
|
requirements:
|
|
111
|
-
- - "
|
|
112
|
+
- - ">"
|
|
112
113
|
- !ruby/object:Gem::Version
|
|
113
|
-
version:
|
|
114
|
+
version: 1.3.1
|
|
114
115
|
requirements: []
|
|
115
116
|
rubygems_version: 3.3.7
|
|
116
117
|
signing_key:
|