bootic_cli 0.9.2 → 0.9.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a296e4252d391af00cccfff4af93d652c2daa29e4b8d65cd42202331bfc1b70d
|
4
|
+
data.tar.gz: 2f485bdd0c668f84738a21d7872404180ebaf04f594d37b1e000bc5df1966f52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d44a11d8d69d2bd619cd69b8f9e8cfcaf42eea3674f6281cc14c9d70f74c1660da618f4b07983a034ac2d23534e380d83f485946705c641032af12feaa4c835
|
7
|
+
data.tar.gz: 6ad0e38e1b4274e68cc52c9d987f0b126af1d786707d2962d82b719bbc158ad4bb8bfba7efe3b1e63bf59ae05cd27e35753ccadea3c09deceeeceb0e735bb546
|
@@ -139,7 +139,7 @@ module BooticCli
|
|
139
139
|
if options['force'].nil? && has_lockfile?
|
140
140
|
prompt.say("Looks like there's another process already watching this dir.")
|
141
141
|
prompt.say("If this is not the case, please run this command with --force (or -f)")
|
142
|
-
|
142
|
+
exit
|
143
143
|
end
|
144
144
|
|
145
145
|
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
@@ -220,7 +220,7 @@ module BooticCli
|
|
220
220
|
within_theme do
|
221
221
|
unless File.directory?(dir) and contains_theme?(dir)
|
222
222
|
prompt.say("Path doesn't exist or doesn't contain theme: #{dir}")
|
223
|
-
|
223
|
+
exit
|
224
224
|
end
|
225
225
|
|
226
226
|
dirname = File.dirname(dir)
|
@@ -254,14 +254,14 @@ module BooticCli
|
|
254
254
|
def warn_about_public
|
255
255
|
unless prompt.yes_or_no?("You're pushing changes directly to your public theme. Are you sure?", true)
|
256
256
|
prompt.say("Ok, sure. You can skip the above warning prompt by passing a `--public` flag.")
|
257
|
-
|
257
|
+
exit
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
261
261
|
def within_theme(&block)
|
262
262
|
unless is_within_theme?
|
263
263
|
prompt.say "This directory doesn't look like a Bootic theme! (#{current_expanded_dir})", :magenta
|
264
|
-
|
264
|
+
exit
|
265
265
|
end
|
266
266
|
|
267
267
|
logged_in_action do
|
@@ -313,7 +313,7 @@ module BooticCli
|
|
313
313
|
input = shell.ask("#{question} [#{default_char}]").strip
|
314
314
|
rescue Interrupt
|
315
315
|
say "\nCtrl-C received. Bailing out!", :magenta
|
316
|
-
|
316
|
+
exit
|
317
317
|
end
|
318
318
|
|
319
319
|
return default_answer if input == '' || input.downcase == default_char
|
@@ -19,12 +19,12 @@ module BooticCli
|
|
19
19
|
|
20
20
|
def ==(other)
|
21
21
|
if other.digest.to_s == '' # api theme asset without a digest set
|
22
|
-
# puts "Other has no digest, so comparing dates: #{self.updated_on} vs #{other.updated_on}"
|
22
|
+
# puts "Other has no digest, so comparing dates: #{self.updated_on.to_i} vs #{other.updated_on.to_i}"
|
23
23
|
return self.updated_on.to_i == other.updated_on.to_i
|
24
24
|
end
|
25
25
|
|
26
26
|
# file sizes may differ as they are served by CDN (that shrinks them)
|
27
|
-
# puts "Comparing
|
27
|
+
# puts "Comparing FSTheme vs other digest:\n#{digest}\n#{other.digest}"
|
28
28
|
self.digest == other.digest # self.file_size == other.file_size
|
29
29
|
end
|
30
30
|
end
|
@@ -33,22 +33,34 @@ module BooticCli
|
|
33
33
|
TEMPLATE_PATTERNS = ['sections/*.html', '*.html', '*.css', '*.js', '*.json', 'theme.yml'].freeze
|
34
34
|
ASSET_PATTERNS = [File.join(ASSETS_DIR, '*')].freeze
|
35
35
|
|
36
|
+
ASSET_PATH_REGEX = /^assets\/[^\/]+$/.freeze
|
37
|
+
TEMPLATE_PATH_REGEX = /^[^\/]+\.(html|css|scss|js|json|yml)$/.freeze
|
38
|
+
SECTION_PATH_REGEX = /^sections\/[^\/]+.html$/.freeze
|
39
|
+
|
36
40
|
def self.resolve_path(path, dir)
|
37
41
|
File.expand_path(path).sub(File.expand_path(dir) + '/', '')
|
38
42
|
end
|
39
43
|
|
40
|
-
#
|
44
|
+
# helper to resolve the right type (Template or Asset) from a local path
|
41
45
|
# this is not part of the generic Theme interface
|
42
|
-
def self.resolve_type(path)
|
43
|
-
|
46
|
+
def self.resolve_type(path, dir)
|
47
|
+
relative_path = resolve_path(path, dir)
|
48
|
+
|
49
|
+
if relative_path[ASSET_PATH_REGEX]
|
50
|
+
:asset
|
51
|
+
elsif relative_path[TEMPLATE_PATH_REGEX] || relative_path[SECTION_PATH_REGEX]
|
52
|
+
:template
|
53
|
+
end
|
44
54
|
end
|
45
55
|
|
46
56
|
def self.resolve_file(path, workdir)
|
47
|
-
|
48
|
-
|
57
|
+
unless type = resolve_type(path, workdir)
|
58
|
+
return # neither an asset or template
|
59
|
+
end
|
49
60
|
|
50
61
|
# initialize a new asset or template as it might be a new file
|
51
|
-
|
62
|
+
file = File.new(path)
|
63
|
+
item = if type == :asset
|
52
64
|
file_name = File.basename(path)
|
53
65
|
ThemeAsset.new(file_name, file, file.mtime.utc)
|
54
66
|
else
|
@@ -326,6 +326,11 @@ module BooticCli
|
|
326
326
|
return if File.basename(path)[0] == '.' # filter out .lock and .state
|
327
327
|
|
328
328
|
item, type = FSTheme.resolve_file(path, dir)
|
329
|
+
unless item
|
330
|
+
# puts "Not a template or asset: #{path}"
|
331
|
+
return
|
332
|
+
end
|
333
|
+
|
329
334
|
success = handle_file_errors(type, item) do
|
330
335
|
case type
|
331
336
|
when :template
|
@@ -338,7 +343,11 @@ module BooticCli
|
|
338
343
|
end
|
339
344
|
|
340
345
|
def delete_file(theme, path, dir)
|
341
|
-
type = FSTheme.resolve_type(path)
|
346
|
+
unless type = FSTheme.resolve_type(path, dir)
|
347
|
+
# puts "Not a template or asset: #{path}"
|
348
|
+
return
|
349
|
+
end
|
350
|
+
|
342
351
|
success = case type
|
343
352
|
when :template
|
344
353
|
file_name = FSTheme.resolve_path(path, dir)
|
@@ -346,8 +355,6 @@ module BooticCli
|
|
346
355
|
when :asset
|
347
356
|
file_name = File.basename(path)
|
348
357
|
theme.remove_asset(file_name)
|
349
|
-
else
|
350
|
-
raise "Invalid type: #{type}"
|
351
358
|
end
|
352
359
|
puts "Deleted remote #{type}: #{highlight(file_name)}" if success
|
353
360
|
end
|
@@ -361,7 +368,7 @@ module BooticCli
|
|
361
368
|
|
362
369
|
if fields.include?('$.updated_on') || fields.include?('updated_on')
|
363
370
|
prompt.say("#{file.file_name} timestamp #{e.errors.first.messages.first}", :red)
|
364
|
-
|
371
|
+
exit
|
365
372
|
end
|
366
373
|
|
367
374
|
error_msg = if fields.include?('file_content_type') or fields.include?('content_type')
|
@@ -389,15 +396,15 @@ module BooticCli
|
|
389
396
|
|
390
397
|
rescue APITheme::UnknownResponse => e # 502s, 503s, etc
|
391
398
|
prompt.say("Got an unknown response from server: #{e.message}. Please try again in a minute.", :red)
|
392
|
-
|
399
|
+
exit
|
393
400
|
|
394
|
-
rescue Net::OpenTimeout, Net::ReadTimeout => e
|
401
|
+
rescue SocketError, Net::OpenTimeout, Net::ReadTimeout => e
|
395
402
|
prompt.say("I'm having trouble connecting to the server. Please try again in a minute.", :red)
|
396
|
-
|
403
|
+
exit
|
397
404
|
|
398
405
|
rescue BooticClient::ServerError => e
|
399
406
|
prompt.say("Couldn't save #{file.file_name}. Please try again in a few minutes.", :red)
|
400
|
-
|
407
|
+
exit
|
401
408
|
end
|
402
409
|
end
|
403
410
|
end
|
data/lib/bootic_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootic_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|