bootic_cli 0.6.7 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/GUIA.md +1 -1
- data/lib/bootic_cli/cli.rb +13 -6
- data/lib/bootic_cli/commands/themes.rb +23 -0
- data/lib/bootic_cli/themes/workflows.rb +7 -2
- data/lib/bootic_cli/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 346b8d30dccaeeb709f98d6a1666150e7f0f07d5
|
4
|
+
data.tar.gz: 106a59cc10fde05fc9ac522c22b0d0e53aaa83a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f38c5c0ed18e56f998ffbebe171f775ca4275ccb5b630851df266391fabf16d6204bf316ab1162f0ccfc16da916d578a746c4261728e1acc9707dda689dc0341
|
7
|
+
data.tar.gz: 35aab050d28d1d51c4494743c372687665dbb9f5f2ce182670bb72d2a83992ef6366bd042457625040d23a35d8eae7db8d606a468ce6d33d8a00d6199a778fcd
|
data/GUIA.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Guía para usar la línea de comandos de Bootic (Bootic CLI)
|
2
2
|
|
3
|
-
El CLI de Bootic es una herramienta para diseñadores y desarrolladores que
|
3
|
+
El [CLI de Bootic](https://github.com/bootic/bootic_cli) es una herramienta para diseñadores y desarrolladores que
|
4
4
|
quieran realizan tareas con la API de Bootic en forma local, ya sea para ver
|
5
5
|
o modificar datos, o bien para realizar cambios en la plantilla de la tienda.
|
6
6
|
|
data/lib/bootic_cli/cli.rb
CHANGED
@@ -161,8 +161,7 @@ module BooticCli
|
|
161
161
|
require 'irb'
|
162
162
|
require 'irb/completion'
|
163
163
|
IRB.setup nil
|
164
|
-
|
165
|
-
require 'irb/ext/multi-irb'
|
164
|
+
|
166
165
|
require 'bootic_cli/console'
|
167
166
|
context = Console.new(session)
|
168
167
|
prompt = "/#{shop.subdomain} (#{root.user_name}|#{root.scopes}) $ "
|
@@ -174,14 +173,22 @@ module BooticCli
|
|
174
173
|
:PROMPT_N => prompt,
|
175
174
|
:RETURN => "=> %s\n"
|
176
175
|
}
|
176
|
+
|
177
177
|
IRB.conf[:PROMPT_MODE] = :CUSTOM
|
178
178
|
IRB.conf[:AUTO_INDENT] = false
|
179
|
+
irb = IRB::Irb.new(IRB::WorkSpace.new(context))
|
180
|
+
IRB.conf[:MAIN_CONTEXT] = irb.context
|
181
|
+
|
182
|
+
trap('SIGINT') do
|
183
|
+
irb.signal_handle
|
184
|
+
end
|
179
185
|
|
180
186
|
begin
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
187
|
+
catch(:IRB_EXIT) do
|
188
|
+
irb.eval_input
|
189
|
+
end
|
190
|
+
ensure
|
191
|
+
IRB.irb_at_exit
|
185
192
|
end
|
186
193
|
end
|
187
194
|
end
|
@@ -133,8 +133,15 @@ module BooticCli
|
|
133
133
|
|
134
134
|
desc 'watch', 'Watch local theme dir and update remote when any file changes'
|
135
135
|
option :public, banner: '<true|false>', type: :boolean, aliases: '-p', desc: 'Pushes any changes to public theme, even if dev theme exists'
|
136
|
+
option :force, banner: '<true|false>', type: :boolean, aliases: '-f', desc: 'Force watch to run even if lockfile is found'
|
136
137
|
def watch
|
137
138
|
within_theme do
|
139
|
+
if options['force'].nil? && has_lockfile?
|
140
|
+
prompt.say("Looks like there's another process already watching this dir.")
|
141
|
+
prompt.say("If this is not the case, please run this command with --force (or -f)")
|
142
|
+
abort
|
143
|
+
end
|
144
|
+
|
138
145
|
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
139
146
|
warn_about_public if remote_theme.public? and options['public'].nil?
|
140
147
|
|
@@ -146,6 +153,8 @@ module BooticCli
|
|
146
153
|
end
|
147
154
|
end
|
148
155
|
|
156
|
+
write_lockfile
|
157
|
+
at_exit { remove_lockfile }
|
149
158
|
workflows.watch(current_dir, remote_theme)
|
150
159
|
end
|
151
160
|
end
|
@@ -228,6 +237,20 @@ module BooticCli
|
|
228
237
|
|
229
238
|
private
|
230
239
|
|
240
|
+
DEFAULT_LOCKFILE = '.lock'.freeze
|
241
|
+
|
242
|
+
def has_lockfile?(dir = current_dir, filename = DEFAULT_LOCKFILE)
|
243
|
+
File.exist?(File.join(dir, filename))
|
244
|
+
end
|
245
|
+
|
246
|
+
def write_lockfile(dir = current_dir, filename = DEFAULT_LOCKFILE)
|
247
|
+
File.open(File.join(dir, filename), 'w') { |f| f.write($$) }
|
248
|
+
end
|
249
|
+
|
250
|
+
def remove_lockfile(dir = current_dir, filename = DEFAULT_LOCKFILE)
|
251
|
+
FileUtils.rm_f(File.join(dir, filename))
|
252
|
+
end
|
253
|
+
|
231
254
|
def warn_about_public
|
232
255
|
unless prompt.yes_or_no?("You're pushing changes directly to your public theme. Are you sure?", true)
|
233
256
|
prompt.say("Ok, sure. You can skip the above warning prompt by passing a `--public` flag.")
|
@@ -216,8 +216,12 @@ module BooticCli
|
|
216
216
|
|
217
217
|
# ctrl-c
|
218
218
|
Signal.trap('INT') {
|
219
|
-
|
220
|
-
|
219
|
+
begin
|
220
|
+
listener.stop
|
221
|
+
rescue ThreadError => e # cant be called from trap context
|
222
|
+
# nil
|
223
|
+
end
|
224
|
+
puts "\nSee you in another lifetime, brother."
|
221
225
|
exit
|
222
226
|
}
|
223
227
|
|
@@ -318,6 +322,7 @@ module BooticCli
|
|
318
322
|
end
|
319
323
|
|
320
324
|
def upsert_file(theme, path)
|
325
|
+
return if File.basename(path)[0] == '.' # filter out .lock and .state
|
321
326
|
item, type = FSTheme.resolve_file(path)
|
322
327
|
handle_file_errors(type, item) do
|
323
328
|
case type
|
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.
|
4
|
+
version: 0.7.0
|
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:
|
12
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|
203
203
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.
|
204
|
+
rubygems_version: 2.6.13
|
205
205
|
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Bootic command-line client.
|