bootic_cli 0.6.5 → 0.6.6

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: 5b387d8fd3e457f8d96ee99d8ef47cc9202ab52f2a161815a79138e0047b4613
4
- data.tar.gz: e933918d22e7ce87854b905816cb1a20190f393f0c390209ba479e351599d8e9
3
+ metadata.gz: d331a2e0e56f33f937627282cfe29e9b5ac7cfce1389542ef451b1983188dbc9
4
+ data.tar.gz: e9e0c324da403e79c3ad97da0bdb0c00ad91de4b1cd82bc27683fe941ecf2e0c
5
5
  SHA512:
6
- metadata.gz: 5d87ca108ef8c9db618dd49e64731b7d910332b76900b7c3ca0db5fdc50a0781fb9078af96751dd3eedeba14ce680f96296e49554e2ce039f49989c70f88437e
7
- data.tar.gz: ec3e339333a702508a32bce522a66a4580915e4140ef05faf6e5c9b459439cf7f56f0d9f0f671eae2885f5f4ee2b7f317bcb65a8585ccb188a15a2ed8d208d56
6
+ metadata.gz: 00d76572ab531748bece289269e6e5dd1359ae1653fde14ab9596b603e4e68a7e18e4772a63781a4aab40a68399d3fb708eb5e2fce61773a5df18fa0b2e41c07
7
+ data.tar.gz: 6dbead30c1a94d944bb2768c829441b89ffddc215271322a5c88fefebb8ec07b7a39fa0dac60bf1726499cb2ba519b1e8c9c5603350c54c58c356a2c5bb7f080
@@ -31,19 +31,50 @@ module BooticCli
31
31
  end
32
32
  end
33
33
 
34
- desc 'dev', 'Create a development theme for your current shop'
34
+ desc 'dev', 'Create or delete a development theme for shop'
35
+ # option :shop, banner: '<shop_subdomain>', aliases: '-s', type: :string
36
+ option :delete, banner: '<true|false>', type: :boolean, desc: 'Deletes theme, if present'
35
37
  def dev
36
38
  within_theme do
37
- local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir)
38
- unless remote_theme.public?
39
- prompt.say "You already have a development theme set up!", :red
40
- abort
39
+ # shop = theme_selector.find_remote_shop(options['shop'])
40
+ local_theme = theme_selector.select_local_theme(current_dir)
41
+ shop = theme_selector.find_remote_shop(local_theme.subdomain)
42
+ remote_theme = theme_selector.select_remote_theme(shop)
43
+
44
+ if options['delete']
45
+ if remote_theme.public?
46
+ return prompt.say("No development theme found!", :red)
47
+ end
48
+
49
+ unless prompt.yes_or_no?("Are you ABSOLUTELY sure you want to delete your development theme?", false)
50
+ return prompt.say "No worries, mate."
51
+ end
52
+
53
+ if remote_theme.delete!
54
+ prompt.say "No problem! The development theme was removed."
55
+ else
56
+ prompt.say "Whoops! Couldn't delete theme dev theme."
57
+ end
58
+
59
+ else # create
60
+ unless remote_theme.public?
61
+ return prompt.say("You already have a development theme set up!", :red)
62
+ end
63
+
64
+ unless shop.themes.can?(:create_dev_theme)
65
+ return prompt.say('Dev theme not available!')
66
+ end
67
+
68
+ result = shop.themes.create_dev_theme
69
+ if result.has?(:errors)
70
+ prompt.say "Couldn't create dev theme: #{result.errors.map(&:field).join(', ')}"
71
+ else
72
+ prompt.say "Success! You're now working on a development copy of your theme."
73
+ prompt.say "Any changes you push or sync won't appear on your public website, but on the development version (in /preview/dev)."
74
+ prompt.say "Once you're ready to merge your changes back, run the `publish` command."
75
+ end
41
76
  end
42
77
 
43
- local_theme = theme_selector.create_dev_theme(current_dir)
44
- prompt.say "Success! You're now working on a development copy of your theme."
45
- prompt.say "Any changes you push or sync won't appear on your public website, but on the development version."
46
- prompt.say "Once you're ready to merge your changes back, run the `publish` command."
47
78
  end
48
79
  end
49
80
 
@@ -87,6 +87,14 @@ module BooticCli
87
87
  end
88
88
  end
89
89
 
90
+ def delete!
91
+ if theme.can?(:delete_theme)
92
+ res = theme.delete_theme
93
+ return !res.has?(:errors)
94
+ end
95
+ false
96
+ end
97
+
90
98
  def path
91
99
  theme.rels[:theme_preview].href
92
100
  end
@@ -49,14 +49,6 @@ module BooticCli
49
49
  theme
50
50
  end
51
51
 
52
- def create_dev_theme(dir)
53
- theme = select_local_theme(dir)
54
- shop = find_remote_shop(theme.subdomain)
55
- raise "No shop with subdomain #{subdomain}" unless shop
56
- raise 'Dev theme not available!' unless shop.themes.can?(:create_dev_theme)
57
- new_theme = APITheme.new(shop.themes.create_dev_theme)
58
- end
59
-
60
52
  def select_local_theme(dir, subdomain = nil)
61
53
  FSTheme.new(File.expand_path(dir), subdomain: subdomain)
62
54
  end
@@ -1,3 +1,3 @@
1
1
  module BooticCli
2
- VERSION = '0.6.5'
2
+ VERSION = '0.6.6'
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.6.5
4
+ version: 0.6.6
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: 2019-08-23 00:00:00.000000000 Z
12
+ date: 2019-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor