bunchcli 1.1.7 → 1.1.9.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55bb9ba0a6f1c9e3b4ede2e6c204b1e9803d080a5ebde6753cabad044303a474
4
- data.tar.gz: c11edb485d0285f6badc37d11a06414a04856dfa76d01b8509a2ec189f7d696d
3
+ metadata.gz: 0a0125c6936b9621c4d8252a1df185e668c8dc85c8d6ed563fd203f7f018a475
4
+ data.tar.gz: ef01962a5939067128ffd5024055561b60ee8118e09216065e3642e0a9f33c6c
5
5
  SHA512:
6
- metadata.gz: 2ef4e5aac1183b3eaac52647d34775f105ea2da48ddd5ea45ebeb223912f00ee1212215a9cff7caaf9cbd06e78b43cfeb1a0fe7e5b223f4f0109e1b8f3aeb520
7
- data.tar.gz: f13720b801abfe22f0d5585eeb9b9cc08dab31befa38bbaa73a6e96d0ef13d68254a7f7a0ce32d819c741a1c281380e4f0e924b3197906636a583d0b5309be4b
6
+ metadata.gz: 282e71d31323a1496eb98f6f06e360ca8a5564f004da13ceda9939ddf2cc5b5bc3bda694250e598f51d398796ff598461e0d9250600a1e931d332f924fa7d03a
7
+ data.tar.gz: a202098f10ef8da9c3017c5c7e61e342b59dfef5cd3cb8c6fb8725cb49923b42ff430fcc23ff4a405e57ac3cb308927d7191ac1c2c8075761629c8c6a9644a3a
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /vendor/
10
+ Gemfile.lock
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
@@ -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, '*.bunch')).each do |f|
76
+ Dir.glob(File.join(bunch_dir, '**/*.bunch')).each do |f|
73
77
  items.push(
74
78
  path: f,
75
- title: File.basename(f, '.bunch')
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 = `/usr/bin/defaults read #{ENV['HOME']}/Library/Preferences/com.brettterpstra.Bunch.plist configDir`.strip
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 ||= `/usr/bin/defaults read #{ENV['HOME']}/Library/Preferences/com.brettterpstra.Bunch.plist toggleBunches`.strip == '1' ? 'toggle' : 'open'
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
@@ -1,3 +1,3 @@
1
1
  module BunchCLI
2
- VERSION = "1.1.7"
2
+ VERSION = "1.1.9.pre"
3
3
  end
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.7
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-02-03 00:00:00.000000000 Z
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: '0'
53
+ version: 1.3.1
55
54
  requirements: []
56
- rubygems_version: 3.1.4
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
@@ -1,19 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bunchcli (1.1.7)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- rake (12.3.3)
10
-
11
- PLATFORMS
12
- x86_64-darwin-19
13
-
14
- DEPENDENCIES
15
- bunchcli!
16
- rake (~> 12.0)
17
-
18
- BUNDLED WITH
19
- 2.2.4