bootic_cli 0.9.3 → 0.9.4
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/lib/bootic_cli/themes/fs_theme.rb +18 -6
- data/lib/bootic_cli/themes/workflows.rb +10 -3
- data/lib/bootic_cli/version.rb +1 -1
- metadata +2 -2
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
|
@@ -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
|
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
|