booker 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/booker.rb +24 -11
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66eee15b03131060b83845037e2d8379db8fec53
|
4
|
+
data.tar.gz: ee81fcf16d0a652e6bd8283b0ae73f4a12924fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e17594d0e0f5e70c1825a299f82ca2410014f35098095461bbd2550aa30c8828f7db401c6d84abc0df4771215c5e72733cc6a5c5ae1d1aeb2a5df4c9977f4320
|
7
|
+
data.tar.gz: c207c0b6389922960bbf3df2974980ecdb20f281697ee7c7a24afa5779f3bceed127ae36de4afee429ecdc48c1065d20bfd79934e26c96ad75e1cfae99b13129
|
data/lib/booker.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# parse web's command line args
|
2
2
|
|
3
3
|
|
4
|
-
VERSION = "0.2.
|
4
|
+
VERSION = "0.2.2"
|
5
5
|
|
6
6
|
|
7
7
|
require 'yaml'
|
8
|
+
require 'find'
|
8
9
|
require 'json'
|
9
10
|
require_relative 'bookmarks'
|
10
11
|
require_relative 'config'
|
@@ -131,23 +132,35 @@ class Booker
|
|
131
132
|
exit 0 if target.nil?
|
132
133
|
|
133
134
|
if /comp/i.match(target) # completion installation
|
135
|
+
# check if zsh is even installed for this user
|
134
136
|
begin
|
135
|
-
|
136
|
-
fpath = `zsh -c 'echo $fpath'`.split(' ')[0]
|
137
|
-
File.open(fpath + "/_web", 'w') {|f| f.write(COMPLETION) }
|
138
|
-
loaded = `zsh -c 'autoload -U _web'`
|
139
|
-
puts "Success: ".grn +
|
140
|
-
"installed zsh autocompletion in #{fpath}"
|
137
|
+
fpath = `zsh -c 'echo $fpath'`.split(' ')
|
141
138
|
rescue
|
142
139
|
pexit "Failure: ".red +
|
143
|
-
"
|
140
|
+
"zsh is probably not installed, could not find $fpath", 1
|
141
|
+
end
|
142
|
+
# determine where to install completion function
|
143
|
+
fpath.each do |fp|
|
144
|
+
begin
|
145
|
+
File.open(fp + "/_web", 'w') {|f| f.write(COMPLETION) }
|
146
|
+
break # if this works, don't try anymore
|
147
|
+
rescue
|
148
|
+
puts "Failure: ".red +
|
149
|
+
"could not write ZSH completion _web script to $fpath"
|
150
|
+
end
|
144
151
|
end
|
152
|
+
exec "zsh -c 'autoload -U _web'"
|
153
|
+
puts "Success: ".grn +
|
154
|
+
"installed zsh autocompletion in #{fpath}"
|
145
155
|
|
146
|
-
elsif /
|
156
|
+
elsif /book/i.match(target) # bookmarks installation
|
147
157
|
# locate bookmarks file, show user, write to config?
|
148
|
-
puts 'searching for chrome bookmarks...(takes time)'
|
158
|
+
puts 'searching for chrome bookmarks... (takes some time)'
|
149
159
|
begin
|
150
|
-
bms =
|
160
|
+
bms = []
|
161
|
+
Find.find(ENV["HOME"]) do |path|
|
162
|
+
bms << path if /chrom.*bookmarks/i.match path
|
163
|
+
end
|
151
164
|
puts 'select your bookmarks file: '
|
152
165
|
bms.each_with_index{|bm, i| puts i.to_s.grn + " - " + bm }
|
153
166
|
selected = bms[gets.chomp.to_i]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Warner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -73,8 +73,9 @@ licenses:
|
|
73
73
|
metadata: {}
|
74
74
|
post_install_message: |2
|
75
75
|
Thank you for installing booker!
|
76
|
-
To set bookmarks location, run `web
|
77
|
-
To add zsh completion,
|
76
|
+
To set bookmarks location, run `web -i bookmarks`
|
77
|
+
To add zsh completion, run `web -i completion`
|
78
|
+
To see more help, run `web --help`
|
78
79
|
rdoc_options: []
|
79
80
|
require_paths:
|
80
81
|
- lib
|