bootic_cli 0.9.3 → 0.9.5
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/commands/themes.rb +2 -0
- data/lib/bootic_cli/themes/fs_theme.rb +19 -7
- data/lib/bootic_cli/themes/missing_items_theme.rb +4 -0
- data/lib/bootic_cli/themes/theme_diff.rb +10 -0
- data/lib/bootic_cli/themes/updated_theme.rb +4 -0
- data/lib/bootic_cli/themes/workflows.rb +12 -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: 4e9689455a4845de27825aa295f27f84c1e45035bbb350413f85f171a26e4bd0
|
4
|
+
data.tar.gz: ce296652260b9f18af912d636272b6df039be1207584c2b6d619ecfd3cfb1331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3b44f183224b102820bc1f8a4f200d43d277fb385e973d5a792144cda1cc16ea852209c084d364436226dd72a7b377f444e4c9e6aecf70dcf9abe8618367756
|
7
|
+
data.tar.gz: 855814910c7e021eee1386a2fc1fea56384fd8dad25eead5d4438be5824ff0a9afaecd51c8d3c7ae439d049e17c43eabfd1fc3a49ca5a6527f11d1ce40dcd760
|
@@ -147,6 +147,8 @@ module BooticCli
|
|
147
147
|
|
148
148
|
diff = BooticCli::Themes::ThemeDiff.new(source: local_theme, target: remote_theme)
|
149
149
|
if diff.any?
|
150
|
+
# puts diff.summary
|
151
|
+
|
150
152
|
if prompt.yes_or_no?("There are differences between the remote theme and your local copy. Sync now?", true)
|
151
153
|
workflows.sync(local_theme, remote_theme)
|
152
154
|
prompt.say "Synced!", :cyan
|
@@ -30,25 +30,37 @@ module BooticCli
|
|
30
30
|
end
|
31
31
|
|
32
32
|
ASSETS_DIR = 'assets'.freeze
|
33
|
-
TEMPLATE_PATTERNS = ['sections/*.html', '*.html', '*.css', '*.js', '*.json', '
|
33
|
+
TEMPLATE_PATTERNS = ['sections/*.html', '*.html', '*.css', '*.js', '*.json', '*.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
|
@@ -9,6 +9,16 @@ module BooticCli
|
|
9
9
|
@force_update = force_update
|
10
10
|
end
|
11
11
|
|
12
|
+
def summary
|
13
|
+
msg = []
|
14
|
+
msg.push(" - Updated in source: #{updated_in_source.count}") if updated_in_source.any?
|
15
|
+
msg.push(" - Updated in target: #{updated_in_target.count}") if updated_in_target.any?
|
16
|
+
msg.push(" - Missing in target: #{missing_in_target.count}") if missing_in_target.any?
|
17
|
+
msg.push(" - Missing in source: #{missing_in_source.count}") if missing_in_source.any?
|
18
|
+
msg.unshift("Summary:") if msg.any?
|
19
|
+
msg.join("\n")
|
20
|
+
end
|
21
|
+
|
12
22
|
def any?
|
13
23
|
updated_in_source.any? || updated_in_target.any? || missing_in_target.any? || missing_in_source.any?
|
14
24
|
end
|
@@ -28,6 +28,10 @@ module BooticCli
|
|
28
28
|
templates.any? # || assets.any?
|
29
29
|
end
|
30
30
|
|
31
|
+
def count
|
32
|
+
templates.count
|
33
|
+
end
|
34
|
+
|
31
35
|
def templates
|
32
36
|
@templates ||= map_pair(source.templates, target.templates) do |a, b|
|
33
37
|
diff = Diffy::Diff.new(normalize_endings(b.body), normalize_endings(a.body), context: 1)
|
@@ -168,6 +168,8 @@ module BooticCli
|
|
168
168
|
changes = ThemeDiff.new(source: local_theme, target: remote_theme)
|
169
169
|
if changes.any?
|
170
170
|
prompt.say "There are differences between your local and the remote version of your shop's development theme."
|
171
|
+
puts changes.summary
|
172
|
+
|
171
173
|
if prompt.yes_or_no? "Push your local changes now?", true
|
172
174
|
push(local_theme, remote_theme, delete: true)
|
173
175
|
else
|
@@ -326,6 +328,11 @@ module BooticCli
|
|
326
328
|
return if File.basename(path)[0] == '.' # filter out .lock and .state
|
327
329
|
|
328
330
|
item, type = FSTheme.resolve_file(path, dir)
|
331
|
+
unless item
|
332
|
+
puts "Not a template or asset: #{path}"
|
333
|
+
return
|
334
|
+
end
|
335
|
+
|
329
336
|
success = handle_file_errors(type, item) do
|
330
337
|
case type
|
331
338
|
when :template
|
@@ -338,7 +345,11 @@ module BooticCli
|
|
338
345
|
end
|
339
346
|
|
340
347
|
def delete_file(theme, path, dir)
|
341
|
-
type = FSTheme.resolve_type(path)
|
348
|
+
unless type = FSTheme.resolve_type(path, dir)
|
349
|
+
# puts "Not a template or asset: #{path}"
|
350
|
+
return
|
351
|
+
end
|
352
|
+
|
342
353
|
success = case type
|
343
354
|
when :template
|
344
355
|
file_name = FSTheme.resolve_path(path, dir)
|
@@ -346,8 +357,6 @@ module BooticCli
|
|
346
357
|
when :asset
|
347
358
|
file_name = File.basename(path)
|
348
359
|
theme.remove_asset(file_name)
|
349
|
-
else
|
350
|
-
raise "Invalid type: #{type}"
|
351
360
|
end
|
352
361
|
puts "Deleted remote #{type}: #{highlight(file_name)}" if success
|
353
362
|
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.5
|
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-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|