bootic_cli 0.4.3 → 0.4.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/commands/themes.rb +18 -3
- data/lib/bootic_cli/themes/missing_items_theme.rb +4 -0
- data/lib/bootic_cli/themes/theme_diff.rb +4 -0
- data/lib/bootic_cli/themes/theme_selector.rb +1 -1
- data/lib/bootic_cli/themes/updated_theme.rb +4 -0
- data/lib/bootic_cli/themes/workflows.rb +22 -13
- data/lib/bootic_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e481971c908c55b0696187dacbcd90f2c0a98d0e
|
4
|
+
data.tar.gz: c815d530ed012021ba9c2eda228fcb96cd5d8b73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e8f04432406d094ecec4eb6457a53f576c9ed20736e929e3779c99711000b19ec623665fb3c64cab4b2fcdc5e53d98cdcef59605bc5cb24edf0028911b780f9
|
7
|
+
data.tar.gz: 3395443655a57ec2de06b2383c38b5057a334fb607ef7e59853bb1a90b1570ecfb71ae83c4a1ce35debae1c0368cf20299154ade38fff908279a58b0797922f1
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require 'launchy'
|
2
3
|
require 'bootic_cli/themes/workflows'
|
3
4
|
require 'bootic_cli/themes/theme_selector'
|
@@ -79,11 +80,25 @@ module BooticCli
|
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
82
|
-
desc 'publish', '
|
83
|
+
desc 'publish', 'Moves your development theme into your public website'
|
83
84
|
def publish
|
84
85
|
within_theme do
|
85
|
-
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir
|
86
|
-
|
86
|
+
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir)
|
87
|
+
if remote_theme.public?
|
88
|
+
say "You don't seem to have a development theme set up, so there's nothing to publish!", :red
|
89
|
+
else
|
90
|
+
say("Publishing means all your public theme's templates and assets will be lost.")
|
91
|
+
if prompt.yes_or_no?("Would you like to make a local copy of your current public theme before publishing?", false)
|
92
|
+
|
93
|
+
backup_path = File.join(local_theme.path, "public-theme-backup-#{Time.now.to_i}")
|
94
|
+
backup_theme, public_theme = theme_selector.select_theme_pair(default_subdomain, backup_path, true)
|
95
|
+
|
96
|
+
say("Gotcha. Backing up your public theme into #{backup_theme.path}")
|
97
|
+
workflows.pull(backup_theme, public_theme)
|
98
|
+
end
|
99
|
+
|
100
|
+
workflows.publish(local_theme, remote_theme)
|
101
|
+
end
|
87
102
|
end
|
88
103
|
end
|
89
104
|
|
@@ -9,6 +9,10 @@ module BooticCli
|
|
9
9
|
@force_update = force_update
|
10
10
|
end
|
11
11
|
|
12
|
+
def any?
|
13
|
+
updated_in_source.any? || updated_in_target.any? || missing_in_target.any? || missing_in_source.any?
|
14
|
+
end
|
15
|
+
|
12
16
|
def updated_in_source
|
13
17
|
@updated_in_source ||= UpdatedTheme.new(source: source, target: target, force_update: force_update)
|
14
18
|
end
|
@@ -26,7 +26,7 @@ module BooticCli
|
|
26
26
|
|
27
27
|
if wants_dev or prompt.yes_or_no?("Would you like to create (and work on) a development version of your theme? (recommended)", true)
|
28
28
|
prompt.say "Good thinking. Creating a development theme out of your current public one...", :green
|
29
|
-
remote_theme = shop.themes.create_dev_theme
|
29
|
+
remote_theme = APITheme.new(shop.themes.create_dev_theme)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -15,6 +15,10 @@ module BooticCli
|
|
15
15
|
@force_update = force_update
|
16
16
|
end
|
17
17
|
|
18
|
+
def any?
|
19
|
+
templates.any? || assets.any?
|
20
|
+
end
|
21
|
+
|
18
22
|
def templates
|
19
23
|
@templates ||= map_pair(source.templates, target.templates) do |a, b|
|
20
24
|
diff = Diffy::Diff.new(normalize_endings(b.body), normalize_endings(a.body), context: 1)
|
@@ -127,7 +127,8 @@ module BooticCli
|
|
127
127
|
notice "Local <--- Remote"
|
128
128
|
|
129
129
|
diff.updated_in_target.templates.each do |t|
|
130
|
-
puts "Updated in remote: #{t.file_name}"
|
130
|
+
puts "Updated in remote: #{t.file_name} (updated at #{t.updated_on})"
|
131
|
+
puts t.diff.to_s(:color)
|
131
132
|
end
|
132
133
|
|
133
134
|
diff.missing_in_source.templates.each do |t|
|
@@ -141,7 +142,8 @@ module BooticCli
|
|
141
142
|
notice "Local ---> Remote"
|
142
143
|
|
143
144
|
diff.updated_in_source.templates.each do |t|
|
144
|
-
puts "Updated locally: #{t.file_name}"
|
145
|
+
puts "Updated locally: #{t.file_name} (updated at #{t.updated_on})"
|
146
|
+
puts t.diff.to_s(:color)
|
145
147
|
end
|
146
148
|
|
147
149
|
diff.missing_in_target.templates.each do |f|
|
@@ -183,24 +185,31 @@ module BooticCli
|
|
183
185
|
# ctrl-c
|
184
186
|
Signal.trap('INT') {
|
185
187
|
listener.stop
|
186
|
-
puts 'See you in another lifetime,
|
188
|
+
puts 'See you in another lifetime, brother.'
|
187
189
|
exit
|
188
190
|
}
|
189
191
|
|
190
|
-
prompt.say "Preview changes at #{remote_theme.path}", :cyan
|
192
|
+
prompt.say "Preview changes at #{remote_theme.path}. Hit Ctrl-C to stop watching for changes.", :cyan
|
191
193
|
Kernel.sleep
|
192
194
|
end
|
193
195
|
|
194
196
|
def publish(local_theme, remote_theme)
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
197
|
+
raise "This command is meant for dev themes only" unless remote_theme.dev?
|
198
|
+
|
199
|
+
changes = ThemeDiff.new(source: local_theme, target: remote_theme)
|
200
|
+
if changes.any?
|
201
|
+
prompt.say "There are some differences between your local and the remote version of your development theme."
|
202
|
+
if prompt.yes_or_no? "Do you want to push your local changes now?", false
|
203
|
+
push(local_theme, remote_theme, delete: true)
|
204
|
+
else
|
205
|
+
prompt.say "Oh well. Please make sure both versions are synced before publishing.", :magenta
|
206
|
+
exit(1)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
prompt.notice "Alrighty! Publishing your development theme..."
|
211
|
+
remote_theme.publish(true) # syncs dev to public, without flipping them
|
212
|
+
prompt.notice "Yay! Your development theme has been made public. Take a look at #{remote_theme.path}", :cyan
|
204
213
|
end
|
205
214
|
|
206
215
|
private
|
data/lib/bootic_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootic_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|