hiiro 0.1.128 → 0.1.130

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: '09f207c7d55133e07dfa8330daa84a8d6e028c4059010a0d47f5120f0475a8f1'
4
- data.tar.gz: d6816dafa1cb23faac95810d74448200111c939be005ad167bd16ac366c79a8a
3
+ metadata.gz: 9ee15221ef5fd0d6dd334387e083049fc53cec41df755c270451f1329e63804a
4
+ data.tar.gz: 89df78fc18b86391dced6ec9e7f1dbb597f6f6549a3c627cc5b2898c2dd23b94
5
5
  SHA512:
6
- metadata.gz: ccf22b0a069402d2ee055cdb5878dd5cdb8710c95acc558de3a02c549843cfef27ce07e39e87adb9614dc34c50001188298acd6e7ad1b51b431bb41a5ae80b8a
7
- data.tar.gz: 48466a4ea4b2ac68441e9bab672ac8a88883d9a9437899a0600ff020353ef30f44d4a1a5116092f26e0f69843cd8816e6b2bc630b13eeabdd6acca6655a9462a
6
+ metadata.gz: 6e043a980f853c53b429500047fc872092e21488a45ad9bfd1cdf64b4fab56d1513423cfe7af061988c468cb10272935cca9ceadad059d972c03c1ba51c152d0
7
+ data.tar.gz: 3abc9a1acfd9ff38060b6d8c01accae3efa5cea58113b8f0b1378b1270054b0e95543797400b9c89a5ed941c40679ab51299b447e86ccdf676189f561fb8dae6
data/bin/h-misc ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hiiro'
4
+
5
+ Hiiro.run {
6
+ add_subcmd(:symlinks) do |*args|
7
+ opts = Hiiro::Options.parse(args) do
8
+ option(:root, short: :r, desc: 'root path')
9
+ end
10
+
11
+ pwd = Hiiro::Paths.new(Dir.pwd)
12
+ outside_basedir = opts.args.inject({}) do |h,basedir|
13
+ symlinks = pwd.symlinks_in(basedir)
14
+
15
+ outside_dir = symlinks
16
+ .reject{|l| l.dest_in_dir?(basedir) }
17
+ .tap do |outside|
18
+ outside.each do |link,dest|
19
+ puts
20
+ puts "LINK: #{link}"
21
+ puts "DEST: #{dest}"
22
+ puts "is outside => #{real_base}"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ }
28
+
data/bin/testlink ADDED
@@ -0,0 +1 @@
1
+ ../exe/h
data/lib/hiiro/glob.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Hiiro
2
+ class Glob
3
+ def self.brace(*list)
4
+ "{#{list.flatten.compact.join(?,)}}"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "hiiro"
4
+ require "delegate"
5
+
6
+ class Hiiro
7
+ class Paths
8
+ attr_reader :base
9
+
10
+ def initialize(base=Dir.pwd)
11
+ @base = Pathname.new base
12
+ end
13
+
14
+ def from_base(file)
15
+ path = Pathname.new(file)
16
+ path.relative_path_from(base)
17
+ end
18
+
19
+ def symlinks_in(path)
20
+ subdir = Pathname.new(path)
21
+
22
+ subdir.find
23
+ .select(&:symlink?)
24
+ .map { |link| Symlink.new(link) }
25
+ end
26
+
27
+ class Symlink < SimpleDelegator
28
+ def path
29
+ @path ||= Pathname.new(__getobj__)
30
+ end
31
+
32
+ def dest
33
+ path.readlink
34
+ end
35
+
36
+ def dest_in_dir?(dir)
37
+ dir = Pathname.new(dir)
38
+
39
+ relpath = dest.relative_path_from(dir)
40
+ relpath.descend.first.to_s != '..'
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.128"
2
+ VERSION = "0.1.130"
3
3
  end
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.128
4
+ version: 0.1.130
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -91,6 +91,7 @@ files:
91
91
  - bin/h-commit
92
92
  - bin/h-config
93
93
  - bin/h-link
94
+ - bin/h-misc
94
95
  - bin/h-pane
95
96
  - bin/h-plugin
96
97
  - bin/h-pr
@@ -100,6 +101,7 @@ files:
100
101
  - bin/h-todo
101
102
  - bin/h-window
102
103
  - bin/h-wtree
104
+ - bin/testlink
103
105
  - docs/README.md
104
106
  - docs/docker-testing-guide.md
105
107
  - docs/h-buffer.md
@@ -121,9 +123,11 @@ files:
121
123
  - lib/hiiro/git/remote.rb
122
124
  - lib/hiiro/git/worktree.rb
123
125
  - lib/hiiro/git/worktrees.rb
126
+ - lib/hiiro/glob.rb
124
127
  - lib/hiiro/matcher.rb
125
128
  - lib/hiiro/notification.rb
126
129
  - lib/hiiro/options.rb
130
+ - lib/hiiro/paths.rb
127
131
  - lib/hiiro/queue.rb
128
132
  - lib/hiiro/shell.rb
129
133
  - lib/hiiro/tasks.rb