bunchcli 1.1.7 → 1.1.9.pre
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/.gitignore +1 -0
- data/bin/bunch +4 -0
- data/lib/bunch/bunchCLI.rb +15 -5
- data/lib/bunch/version.rb +1 -1
- metadata +5 -6
- data/Gemfile.lock +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a0125c6936b9621c4d8252a1df185e668c8dc85c8d6ed563fd203f7f018a475
|
4
|
+
data.tar.gz: ef01962a5939067128ffd5024055561b60ee8118e09216065e3642e0a9f33c6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 282e71d31323a1496eb98f6f06e360ca8a5564f004da13ceda9939ddf2cc5b5bc3bda694250e598f51d398796ff598461e0d9250600a1e931d332f924fa7d03a
|
7
|
+
data.tar.gz: a202098f10ef8da9c3017c5c7e61e342b59dfef5cd3cb8c6fb8725cb49923b42ff430fcc23ff4a405e57ac3cb308927d7191ac1c2c8075761629c8c6a9644a3a
|
data/.gitignore
CHANGED
data/bin/bunch
CHANGED
@@ -18,6 +18,10 @@ bunch = Bunch.new
|
|
18
18
|
optparse = OptionParser.new do |opts|
|
19
19
|
opts.banner = "CLI for Bunch.app v#{BunchCLI::VERSION}"
|
20
20
|
|
21
|
+
opts.on('-b', '--beta', 'Use Bunch Beta for commands') do |_opt|
|
22
|
+
bunch.target_app = 'Bunch Beta'
|
23
|
+
end
|
24
|
+
|
21
25
|
opts.on('-l', '--list', 'List available Bunches') do |_opt|
|
22
26
|
bunch.list_bunches
|
23
27
|
Process.exit 0
|
data/lib/bunch/bunchCLI.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
class Bunch
|
2
2
|
include Util
|
3
|
-
attr_writer :url_method, :fragment, :variables, :show_url
|
3
|
+
attr_writer :target_app, :url_method, :fragment, :variables, :show_url
|
4
4
|
|
5
5
|
def initialize
|
6
|
+
@target_app = nil
|
6
7
|
@bunch_dir = nil
|
7
8
|
@url_method = nil
|
8
9
|
@bunches = nil
|
@@ -25,11 +26,13 @@ class Bunch
|
|
25
26
|
@bunch_dir = nil
|
26
27
|
@url_method = nil
|
27
28
|
@bunches = nil
|
29
|
+
@target_app = nil
|
28
30
|
target = File.expand_path(CACHE_FILE)
|
29
31
|
settings = {
|
30
32
|
'bunchDir' => bunch_dir,
|
31
33
|
'method' => url_method,
|
32
34
|
'bunches' => bunches,
|
35
|
+
'target_app' => target_app,
|
33
36
|
'updated' => Time.now.strftime('%s').to_i
|
34
37
|
}
|
35
38
|
File.open(target,'w') do |f|
|
@@ -52,6 +55,7 @@ class Bunch
|
|
52
55
|
@bunch_dir = settings['bunchDir'] || bunch_dir
|
53
56
|
@url_method = settings['method'] || url_method
|
54
57
|
@bunches = settings['bunches'] || generate_bunch_list
|
58
|
+
@target_app = settings['target_app'] || target_app
|
55
59
|
end
|
56
60
|
|
57
61
|
def variable_query
|
@@ -69,10 +73,10 @@ class Bunch
|
|
69
73
|
# items.push({title: 0})
|
70
74
|
def generate_bunch_list
|
71
75
|
items = []
|
72
|
-
Dir.glob(File.join(bunch_dir, '
|
76
|
+
Dir.glob(File.join(bunch_dir, '**/*.bunch')).each do |f|
|
73
77
|
items.push(
|
74
78
|
path: f,
|
75
|
-
title:
|
79
|
+
title: f.sub(/^#{bunch_dir}\//,'').sub(/\.bunch$/,'')
|
76
80
|
)
|
77
81
|
end
|
78
82
|
items
|
@@ -80,13 +84,19 @@ class Bunch
|
|
80
84
|
|
81
85
|
def bunch_dir
|
82
86
|
@bunch_dir ||= begin
|
83
|
-
dir =
|
87
|
+
dir = `osascript -e 'tell app "#{@target_app}" to get preference "Folder"'`.strip
|
88
|
+
# dir = `/usr/bin/defaults read #{ENV['HOME']}/Library/Preferences/com.brettterpstra.Bunch.plist configDir`.strip
|
84
89
|
File.expand_path(dir)
|
85
90
|
end
|
86
91
|
end
|
87
92
|
|
93
|
+
def target_app
|
94
|
+
@target_app ||= "Bunch"
|
95
|
+
end
|
96
|
+
|
88
97
|
def url_method
|
89
|
-
@url_method ||=
|
98
|
+
@url_method ||= `osascript -e 'tell app "#{@target_app}" to get preference "Toggle"'`.strip == '1' ? 'toggle' : 'open'
|
99
|
+
# @url_method ||= `/usr/bin/defaults read #{ENV['HOME']}/Library/Preferences/com.brettterpstra.Bunch.plist toggleBunches`.strip == '1' ? 'toggle' : 'open'
|
90
100
|
end
|
91
101
|
|
92
102
|
def bunches
|
data/lib/bunch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunchcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -21,7 +21,6 @@ files:
|
|
21
21
|
- ".gitignore"
|
22
22
|
- CHANGELOG.md
|
23
23
|
- Gemfile
|
24
|
-
- Gemfile.lock
|
25
24
|
- LICENSE.txt
|
26
25
|
- README.md
|
27
26
|
- Rakefile
|
@@ -49,11 +48,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
48
|
version: 2.0.0
|
50
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
50
|
requirements:
|
52
|
-
- - "
|
51
|
+
- - ">"
|
53
52
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
53
|
+
version: 1.3.1
|
55
54
|
requirements: []
|
56
|
-
rubygems_version: 3.
|
55
|
+
rubygems_version: 3.2.3
|
57
56
|
signing_key:
|
58
57
|
specification_version: 4
|
59
58
|
summary: A CLI for use with Bunch.app (macOS)
|
data/Gemfile.lock
DELETED