bootic_cli 0.5.2 → 0.5.3

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
  SHA1:
3
- metadata.gz: a5127d49dc387636714e2b3a9cbc724d3c240fc8
4
- data.tar.gz: 7bd10ce8519aa573ecd6aa0af7dffc900e3b7970
3
+ metadata.gz: 124176a77bce62cae1afe8e3c7804df89e862462
4
+ data.tar.gz: 82ab73189ede38c158b8359bd31e54d410837ea3
5
5
  SHA512:
6
- metadata.gz: 3faff67e89ed9592bf5b7255addbe884154cb21eb4cd9856ef461cd9c9b966b5bc9b5ab15635006f3a0346ab04041aef008d514996452e0f9c42178012840c7a
7
- data.tar.gz: 1b205ad3dd475ff19d16e1d65b36b89d86bdc5493ede8efc5e9a56abca64fb9416750e6de9cd89e797659ecaf6d3fab4d0e80b8a8fa2d9bd50b73ecd569f622d
6
+ metadata.gz: 07cbc4c6fb1d172f4b716be085e5074cca7a1f92da1d7fb0cd1d9292af5e554feba61bad3199508f4ab53f127abdec97f2e6ed34b5f57596614c26dcec4857a4
7
+ data.tar.gz: 73c3a3dd9c2e07170feb84b10bd25bb1a62d52e08d9bbd18b2c20c60a5bee6eef0e0405fc0728da08432c8ed2e6ed2226d1253d10258298a816fa1627875c0e1
data/README.md CHANGED
@@ -98,12 +98,6 @@ bootic help list_products
98
98
  bootic list_products list -s hidden
99
99
  ```
100
100
 
101
- ## Development
102
-
103
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec bootic` to use the code located in this directory, ignoring other installed copies of this gem.
104
-
105
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
106
-
107
101
  ## Contributing
108
102
 
109
103
  1. Fork it ( https://github.com/bootic/bootic_cli/fork )
data/bootic_cli.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'bootic_cli/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "bootic_cli"
8
8
  spec.version = BooticCli::VERSION
9
- spec.authors = ["Ismael Celis"]
10
- spec.email = ["ismael@bootic.io"]
9
+ spec.authors = ["Ismael Celis", "Tomás Pollak"]
10
+ spec.email = ["ismael@bootic.io", "tomas@bootic.io"]
11
11
 
12
12
  spec.summary = %q{Bootic command-line client.}
13
13
  spec.description = %q{Bootic command-line client.}
@@ -31,6 +31,22 @@ module BooticCli
31
31
  end
32
32
  end
33
33
 
34
+ desc 'dev', 'Create a development theme for your current shop'
35
+ def dev
36
+ 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
41
+ end
42
+
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
+ end
48
+ end
49
+
34
50
  desc 'pull', 'Pull remote changes into current theme directory'
35
51
  option :public, banner: '<true|false>', type: :boolean, aliases: '-p', desc: 'Pull from public theme, even if dev theme exists'
36
52
  option :delete, banner: '<true|false>', type: :boolean, desc: 'Remove local files that were removed in remote theme (default: true)'
@@ -54,7 +70,7 @@ module BooticCli
54
70
  end
55
71
  end
56
72
 
57
- desc 'sync', 'Sync changes from local theme copy with remote'
73
+ desc 'sync', 'Sync changes between local and remote themes'
58
74
  option :public, banner: '<true|false>', type: :boolean, aliases: '-p', desc: 'Sync to public theme, even if dev theme exists'
59
75
  def sync
60
76
  within_theme do
@@ -65,12 +81,17 @@ module BooticCli
65
81
  end
66
82
  end
67
83
 
68
- desc 'compare', 'Show differences between local and remote copies'
69
- option :public, banner: '<true|false>', type: :boolean, aliases: '-p', desc: 'Compare against public theme, even if dev theme exists'
84
+ desc 'compare', 'Show differences between local and remote copies (both public and dev, if present)'
70
85
  def compare
71
86
  within_theme do
72
- local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
87
+ local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir)
73
88
  workflows.compare(local_theme, remote_theme)
89
+
90
+ # if we just compared against the dev theme, redo the mumbo-jumbo but with the public one
91
+ unless remote_theme.public?
92
+ local_theme, public_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, true)
93
+ workflows.compare(local_theme, public_theme)
94
+ end
74
95
  end
75
96
  end
76
97
 
@@ -99,7 +120,8 @@ module BooticCli
99
120
  local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir)
100
121
 
101
122
  if remote_theme.public?
102
- prompt.say "You don't seem to have a development theme set up, so there's nothing to publish!", :red
123
+ prompt.say "You don't seem to have a development theme set up, so there's nothing to publish. :)", :red
124
+ prompt.say "To push your local changes directly to your public theme, either run the `push` or `sync` commands.", :red
103
125
  else
104
126
 
105
127
  # check if there are any differences between the dev and public themes
@@ -70,9 +70,9 @@ module BooticCli
70
70
  theme.can?(:publish_theme)
71
71
  end
72
72
 
73
- def publish
73
+ def publish(opts = {})
74
74
  if theme.can?(:publish_theme)
75
- @theme = theme.publish_theme
75
+ @theme = theme.publish_theme(opts)
76
76
  reload!(false)
77
77
  end
78
78
  end
@@ -49,6 +49,14 @@ 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
+
52
60
  def select_local_theme(dir, subdomain = nil)
53
61
  FSTheme.new(File.expand_path(dir), subdomain: subdomain)
54
62
  end
@@ -162,6 +162,27 @@ module BooticCli
162
162
  end
163
163
  end
164
164
 
165
+ def publish(local_theme, remote_theme)
166
+ raise "This command is meant for dev themes only" unless remote_theme.dev?
167
+
168
+ changes = ThemeDiff.new(source: local_theme, target: remote_theme)
169
+ if changes.any?
170
+ prompt.say "There are differences between your local and the remote version of your shop's development theme."
171
+ if prompt.yes_or_no? "Push your local changes now?", true
172
+ push(local_theme, remote_theme, delete: true)
173
+ else
174
+ prompt.say "No problem. Please make sure both versions are synced before publishing.", :magenta
175
+ exit(1)
176
+ end
177
+ end
178
+
179
+ delete_dev = prompt.yes_or_no? "Delete the development copy of your theme after publishing?", true
180
+ prompt.notice "Alrighty! Publishing your development theme..."
181
+ updated_theme = remote_theme.publish(delete: delete_dev)
182
+
183
+ prompt.notice "Yay! Your development theme has been made public. Take a look at #{remote_theme.path.sub('/preview/dev', '')}"
184
+ end
185
+
165
186
  def watch(dir, remote_theme, watcher: Listen)
166
187
  listener = watcher.to(dir) do |modified, added, removed|
167
188
  if modified.any?
@@ -200,25 +221,6 @@ module BooticCli
200
221
  Kernel.sleep
201
222
  end
202
223
 
203
- def publish(local_theme, remote_theme)
204
- raise "This command is meant for dev themes only" unless remote_theme.dev?
205
-
206
- changes = ThemeDiff.new(source: local_theme, target: remote_theme)
207
- if changes.any?
208
- prompt.say "There are some differences between your local and the remote version of your development theme."
209
- if prompt.yes_or_no? "Do you want to push your local changes now?", false
210
- push(local_theme, remote_theme, delete: true)
211
- else
212
- prompt.say "Oh well. Please make sure both versions are synced before publishing.", :magenta
213
- exit(1)
214
- end
215
- end
216
-
217
- prompt.notice "Alrighty! Publishing your development theme..."
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', '')}"
220
- end
221
-
222
224
  private
223
225
  attr_reader :prompt
224
226
 
@@ -1,3 +1,3 @@
1
1
  module BooticCli
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootic_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
+ - Tomás Pollak
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
12
+ date: 2018-08-02 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
@@ -139,6 +140,7 @@ dependencies:
139
140
  description: Bootic command-line client.
140
141
  email:
141
142
  - ismael@bootic.io
143
+ - tomas@bootic.io
142
144
  executables:
143
145
  - bootic
144
146
  extensions: []