bootic_cli 0.4.8 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd67c5e244fa152afde49d0ded817c9733d6ce640aee72c14854f635566e0a43
4
- data.tar.gz: 51b29bf4e75a6f597887198fbdfa66df41301370f2a3169de0f4bcba363b755b
3
+ metadata.gz: 55a78add4d79c5db970e4ad5df3b038fd6db6702c674cb60092c9d9f93bcf533
4
+ data.tar.gz: 120a782606574c1dd7d94b25112e033cb348fd6fb2889201bbfe1bf28cf55fde
5
5
  SHA512:
6
- metadata.gz: 4e6094bca75a4a68b4a94a80180e543fdae6286612a8697fb66662821e896b3b4008ed2abb0a62c4ea89c64f0346b3efe8a57ac583467151d359531b708ffff5
7
- data.tar.gz: 1e32cc79ee74403371a7b5daeecc6355a32db967559701f7d262b5509baea3d74c4a5a0224c1dec395063a00e97850aeebbf85023d9266e4ceaa0aae47144988
6
+ metadata.gz: 2a5a02b98f284912ce408de4cdcd141907e56f5b3e0b1741fbd60a42f3e32a0118e7635a82e9de57955f92ef1880ca7149d31c2c8d9b8b95c7f921382cedf5c1
7
+ data.tar.gz: 94ff56bc77d419c27886aef885ebcbaa93eed49d63b7eca8aa8a325c834ac6c3f05c99ab9811c481ed2e5b55e06dfea3c6072d76436027d3cce4745a8e9c6c5f
@@ -1,5 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  require 'launchy'
3
+ require 'bootic_cli/themes/theme_diff'
3
4
  require 'bootic_cli/themes/workflows'
4
5
  require 'bootic_cli/themes/theme_selector'
5
6
 
@@ -37,6 +38,7 @@ module BooticCli
37
38
  within_theme do
38
39
  local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
39
40
  workflows.pull(local_theme, remote_theme, delete: options['delete'] || true)
41
+ prompt.say "Done! Preview this theme at #{remote_theme.path}", :cyan
40
42
  end
41
43
  end
42
44
 
@@ -48,6 +50,7 @@ module BooticCli
48
50
  local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
49
51
  warn_user if remote_theme.public? and options['public'].nil?
50
52
  workflows.push(local_theme, remote_theme, delete: options['delete'] || true)
53
+ prompt.say "Done! View updated version at #{remote_theme.path}", :cyan
51
54
  end
52
55
  end
53
56
 
@@ -58,6 +61,7 @@ module BooticCli
58
61
  local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
59
62
  warn_user if remote_theme.public? and options['public'].nil?
60
63
  workflows.sync(local_theme, remote_theme)
64
+ prompt.say "Synced! Preview this theme at #{remote_theme.path}", :cyan
61
65
  end
62
66
  end
63
67
 
@@ -84,17 +88,31 @@ module BooticCli
84
88
  def publish
85
89
  within_theme do
86
90
  local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir)
91
+
87
92
  if remote_theme.public?
88
93
  say "You don't seem to have a development theme set up, so there's nothing to publish!", :red
89
94
  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)
95
+
96
+ # check if there are any differences between the dev and public themes
97
+ local_theme, public_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, true)
98
+ diff = BooticCli::Themes::ThemeDiff.new(source: remote_theme, target: public_theme)
99
+
100
+ unless diff.any?
101
+ unless prompt.yes_or_no?("Your public and development themes seem to be in sync (no differences). Publish anyway?", false)
102
+ prompt.say "Okeysay. Bye."
103
+ exit 1
104
+ end
105
+ end
106
+
107
+ # say("Publishing means all your public theme's templates and assets will be replaced and lost.")
108
+ if prompt.yes_or_no?("Would you like to make a local copy of your current public theme before publishing?", diff.any?) # default to true if changes exist
92
109
 
93
110
  backup_path = File.join(local_theme.path, "public-theme-backup-#{Time.now.to_i}")
94
- backup_theme, public_theme = theme_selector.select_theme_pair(local_theme.subdomain, backup_path, true)
111
+ backup_theme = theme_selector.select_local_theme(backup_path, local_theme.subdomain)
95
112
 
96
- say("Gotcha. Backing up your public theme into #{backup_theme.path}")
113
+ say("Gotcha. Backing up your public theme into #{prompt.highlight(backup_theme.path)}")
97
114
  workflows.pull(backup_theme, public_theme)
115
+ prompt.say "Done! Existing public theme was saved to #{prompt.highlight(File.basename(backup_theme.path))}", :cyan
98
116
  end
99
117
 
100
118
  workflows.publish(local_theme, remote_theme)
@@ -34,7 +34,7 @@ module BooticCli
34
34
  end
35
35
 
36
36
  def select_theme_pair(subdomain, dir, production = false)
37
- local_theme = select_local_theme(dir)
37
+ local_theme = select_local_theme(dir, subdomain)
38
38
  shop = find_remote_shop(local_theme.subdomain)
39
39
  raise "No shop with subdomain #{local_theme.subdomain}" unless shop
40
40
  remote_theme = select_remote_theme(shop, production)
@@ -56,8 +56,6 @@ module BooticCli
56
56
  copy_templates(diff.missing_in_source, local_theme, download_opts)
57
57
  # lets copy all of them and let user decide to overwrite existing
58
58
  copy_assets(remote_theme, local_theme, download_opts)
59
-
60
- prompt.say "Done! Preview this theme at #{remote_theme.path}", :cyan
61
59
  end
62
60
 
63
61
  def push(local_theme, remote_theme, delete: true)
@@ -82,8 +80,6 @@ module BooticCli
82
80
  else
83
81
  notice 'Not removing remote files that were removed locally.'
84
82
  end
85
-
86
- prompt.say "Done! View updated version at #{remote_theme.path}", :cyan
87
83
  end
88
84
 
89
85
  def sync(local_theme, remote_theme)
@@ -116,8 +112,6 @@ module BooticCli
116
112
  notice 'Uploading missing remote templates & assets...'
117
113
  copy_templates(diff.missing_in_target, remote_theme, download_opts)
118
114
  copy_assets(diff.missing_in_target, remote_theme, download_opts)
119
-
120
- prompt.say "Synced! Preview this theme at #{remote_theme.path}", :cyan
121
115
  end
122
116
 
123
117
  def compare(local_theme, remote_theme)
@@ -221,8 +215,8 @@ module BooticCli
221
215
  end
222
216
 
223
217
  prompt.notice "Alrighty! Publishing your development theme..."
224
- remote_theme.publish # syncs dev to public, without flipping them
225
- prompt.notice "Yay! Your development theme has been made public. Take a look at #{remote_theme.path}"
218
+ updated_theme = remote_theme.publish # syncs dev to public, without flipping them
219
+ prompt.notice "Yay! Your development theme has been made public. Take a look at #{remote_theme.path.sub('/preview/dev', '')}"
226
220
  end
227
221
 
228
222
  private
@@ -1,3 +1,3 @@
1
1
  module BooticCli
2
- VERSION = "0.4.8"
2
+ VERSION = "0.5.0"
3
3
  end
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.4.8
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis