bootic_cli 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{exe/btc → bin/bootic} +1 -2
- data/bootic_cli.gemspec +11 -10
- data/lib/bootic_cli/cli.rb +103 -30
- data/lib/bootic_cli/command.rb +8 -0
- data/lib/bootic_cli/commands/orders.rb +1 -1
- data/lib/bootic_cli/commands/themes.rb +66 -38
- data/lib/bootic_cli/connectivity.rb +31 -16
- data/lib/bootic_cli/themes/theme_selector.rb +7 -7
- data/lib/bootic_cli/themes/workflows.rb +7 -7
- data/lib/bootic_cli/version.rb +1 -1
- data/lib/bootic_cli.rb +1 -6
- data/libexec/inspector +5 -0
- metadata +15 -16
- data/.rspec +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14a54ce4a89784dff4a594eb5d16ee9b9a3bc10e
|
4
|
+
data.tar.gz: 3ccae9ef9c150991409e60ec8ffd2763728eaab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0571df846d44ca03ca5385573a9e0f5dae6928bda9dbe210f3c8a403b8fbed3518c68996fd54d15fb4bfd8d9eed6c24a30cc9a5db37c5fa5a3b72adecbded13
|
7
|
+
data.tar.gz: 29d21d81ef59ac13ce3e832f099fa90aa453e36769646e738957ffe672d6521e1e8b2d2f2d62fea47c3b265966ff0c88650aa464572da8638d2920fe469335f2
|
data/{exe/btc → bin/bootic}
RENAMED
data/bootic_cli.gemspec
CHANGED
@@ -7,17 +7,17 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "bootic_cli"
|
8
8
|
spec.version = BooticCli::VERSION
|
9
9
|
spec.authors = ["Ismael Celis"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["ismael@bootic.io"]
|
11
11
|
|
12
|
-
spec.summary = %q{Bootic command
|
13
|
-
spec.description = %q{Bootic command
|
14
|
-
spec.homepage = "http://www.bootic.
|
12
|
+
spec.summary = %q{Bootic command-line client.}
|
13
|
+
spec.description = %q{Bootic command-line client.}
|
14
|
+
spec.homepage = "http://www.bootic.io"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
19
|
-
spec.executables = spec.files.grep(%r{^
|
20
|
-
spec.require_paths = [
|
18
|
+
spec.bindir = 'bin'
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
spec.add_dependency 'thor', '~> 0'
|
23
23
|
spec.add_dependency 'bootic_client', "~> 0.0.19"
|
@@ -31,9 +31,10 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "byebug", "~> 9"
|
32
32
|
|
33
33
|
spec.post_install_message = <<-END
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
-------------------------------------------------------------
|
35
|
+
Woot! You've just installed the Bootic command-line client!
|
36
|
+
Please run `bootic setup` to configure your credentials.
|
37
|
+
-------------------------------------------------------------
|
37
38
|
END
|
38
39
|
|
39
40
|
end
|
data/lib/bootic_cli/cli.rb
CHANGED
@@ -1,32 +1,78 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'bootic_cli/version'
|
2
3
|
require 'bootic_cli/connectivity'
|
3
4
|
require 'bootic_cli/formatters'
|
4
5
|
|
5
6
|
module BooticCli
|
7
|
+
|
6
8
|
class CLI < Thor
|
7
9
|
include Thor::Actions
|
8
10
|
include BooticCli::Connectivity
|
9
11
|
|
10
|
-
DEFAULT_ENV = 'production'.freeze
|
11
12
|
CUSTOM_COMMANDS_DIR = ENV.fetch("BTC_CUSTOM_COMMANDS_PATH") { File.join(ENV["HOME"], "btc") }
|
12
13
|
|
13
|
-
|
14
|
+
# override Thor's help method to print banner and check for keys
|
15
|
+
def help
|
16
|
+
say "Bootic CLI v#{BooticCli::VERSION}\n\n", :bold
|
17
|
+
super
|
18
|
+
check_client_keys
|
19
|
+
end
|
20
|
+
|
21
|
+
map %w[--version -v] => :__print_version
|
22
|
+
desc "--version, -v", "Prints package version"
|
23
|
+
def __print_version
|
24
|
+
puts BooticCli::VERSION
|
25
|
+
end
|
14
26
|
|
15
|
-
desc 'setup', 'Setup
|
27
|
+
desc 'setup', 'Setup Bootic application credentials'
|
16
28
|
def setup
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
29
|
+
apps_host = "auth.bootic.net"
|
30
|
+
dev_app_url = "#{apps_host}/dev/cli"
|
31
|
+
|
32
|
+
if session.setup?
|
33
|
+
input = ask "Looks like you're already set up. Do you want to re-enter your app's credentials? [n]", :magenta
|
34
|
+
if input != 'y'
|
35
|
+
say 'Thought so. Bye!'
|
36
|
+
exit(1)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
say "This CLI uses the #{bold('Bootic API')} in order to interact with your shop's data."
|
40
|
+
say "This means you need to create a Bootic app at #{bold(dev_app_url)} to access the API and use the CLI.\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
input = ask "Have you created a Bootic app yet? [n]"
|
44
|
+
if input == 'y'
|
45
|
+
say "Great. Remember you can get your app's credentials at #{bold(dev_app_url)}."
|
46
|
+
else
|
47
|
+
say "Please visit https://#{bold(dev_app_url)} and hit the 'Create' button."
|
48
|
+
sleep 2
|
49
|
+
# Launchy.open(apps_url)
|
50
|
+
say ""
|
51
|
+
end
|
52
|
+
|
53
|
+
if current_env != DEFAULT_ENV
|
54
|
+
auth_host = ask("Enter auth endpoint host (#{BooticClient::AUTH_HOST}):", :bold).chomp
|
55
|
+
api_root = ask("Enter API root (#{BooticClient::API_ROOT}):", :bold).chomp
|
21
56
|
auth_host = nil if auth_host == ""
|
22
57
|
api_root = nil if api_root == ""
|
23
58
|
end
|
24
|
-
|
25
|
-
|
59
|
+
|
60
|
+
client_id = ask("Enter your application's client_id:", :bold)
|
61
|
+
client_secret = ask("Enter your application's client_secret:", :bold)
|
26
62
|
|
27
63
|
session.setup(client_id, client_secret, auth_host: auth_host, api_root: api_root)
|
28
64
|
|
29
|
-
|
65
|
+
if current_env == DEFAULT_ENV
|
66
|
+
say "Credentials stored!", :magenta
|
67
|
+
else
|
68
|
+
say "Credentials stored for #{current_env} env.", :magenta
|
69
|
+
end
|
70
|
+
|
71
|
+
return if ENV['nologin']
|
72
|
+
|
73
|
+
say ""
|
74
|
+
sleep 3
|
75
|
+
login
|
30
76
|
end
|
31
77
|
|
32
78
|
desc 'login', 'Login to your Bootic account'
|
@@ -36,44 +82,67 @@ module BooticCli
|
|
36
82
|
invoke :setup, []
|
37
83
|
end
|
38
84
|
|
39
|
-
|
40
|
-
|
85
|
+
if session.logged_in?
|
86
|
+
input = ask "Looks like you're already logged in. Do you want to redo this step? [n]", :magenta
|
87
|
+
if input != 'y'
|
88
|
+
say 'Thought so. Bye!'
|
89
|
+
exit(1)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
username = ask("Enter your Bootic email:", :bold)
|
94
|
+
pwd = ask("Enter your Bootic password:", :bold, echo: false)
|
41
95
|
|
42
|
-
|
96
|
+
if username.strip == '' or pwd.strip == ''
|
97
|
+
say "\nPlease make sure to enter valid data.", :red
|
98
|
+
exit 1
|
99
|
+
end
|
100
|
+
|
101
|
+
say "\n\nAlrighty! Getting access token for #{username}...\n"
|
43
102
|
|
44
103
|
begin
|
45
|
-
session.login
|
46
|
-
say "
|
47
|
-
say "
|
104
|
+
session.login(username, pwd, scope)
|
105
|
+
say "Great success! You're now logged in as #{username} (#{scope})", :green
|
106
|
+
say "For a list of available commands, run `bootic help`."
|
48
107
|
rescue StandardError => e
|
49
|
-
say e.message
|
108
|
+
say e.message, :red
|
109
|
+
if e.message['No application with client ID']
|
110
|
+
sleep 2
|
111
|
+
say "\nTry running `bootic setup` again. Or perhaps you missed the ENV variable?", :magenta
|
112
|
+
end
|
50
113
|
end
|
51
114
|
end
|
52
115
|
|
53
116
|
desc 'logout', 'Log out (delete access token)'
|
54
117
|
def logout
|
55
|
-
session.
|
56
|
-
|
118
|
+
if session.logged_in?
|
119
|
+
session.logout!
|
120
|
+
say 'Done. You are now logged out.', :magenta
|
121
|
+
else
|
122
|
+
say "You're not logged in. Did you mean `bootic login` perhaps?", :red
|
123
|
+
end
|
57
124
|
end
|
58
125
|
|
59
126
|
desc "erase", "clear all credentials from this computer"
|
60
127
|
def erase
|
61
|
-
session.
|
62
|
-
|
128
|
+
if session.setup?
|
129
|
+
session.erase!
|
130
|
+
say "Ok mister. All credentials have been erased.", :magenta
|
131
|
+
else
|
132
|
+
say "Couldn't find any stored credentials.", :red
|
133
|
+
end
|
63
134
|
end
|
64
135
|
|
65
|
-
desc '
|
66
|
-
def
|
136
|
+
desc 'check', 'Test API connectivity'
|
137
|
+
def check
|
67
138
|
logged_in_action do
|
139
|
+
say "Yup, API connection is working!\n\n", :green
|
140
|
+
|
68
141
|
print_table([
|
69
|
-
['
|
70
|
-
['
|
71
|
-
['
|
72
|
-
['shop', "#{shop.url} (#{shop.subdomain})"],
|
73
|
-
['custom commands dir', CUSTOM_COMMANDS_DIR]
|
142
|
+
[bold('Email'), root.email],
|
143
|
+
[bold('Shop'), "#{shop.url} (#{shop.subdomain})"],
|
144
|
+
[bold('Scopes'), root.scopes]
|
74
145
|
])
|
75
|
-
|
76
|
-
say_status 'OK', 'API connection is working', :green
|
77
146
|
end
|
78
147
|
end
|
79
148
|
|
@@ -119,6 +188,10 @@ module BooticCli
|
|
119
188
|
|
120
189
|
private
|
121
190
|
|
191
|
+
def bold(str)
|
192
|
+
set_color(str, :bold)
|
193
|
+
end
|
194
|
+
|
122
195
|
def self.underscore(str)
|
123
196
|
str.gsub(/::/, '/').
|
124
197
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
data/lib/bootic_cli/command.rb
CHANGED
@@ -6,6 +6,14 @@ module BooticCli
|
|
6
6
|
include Thor::Actions
|
7
7
|
include BooticCli::Connectivity
|
8
8
|
|
9
|
+
# override Thor's help method to print banner and check for keys
|
10
|
+
def help(some, arg)
|
11
|
+
say "Bootic CLI v#{BooticCli::VERSION}\n\n", :bold
|
12
|
+
super
|
13
|
+
|
14
|
+
examples if respond_to?(:examples)
|
15
|
+
end
|
16
|
+
|
9
17
|
def self.declare(klass, descr)
|
10
18
|
BooticCli::CLI.sub klass, descr
|
11
19
|
end
|
@@ -5,12 +5,19 @@ require 'bootic_cli/themes/theme_selector'
|
|
5
5
|
module BooticCli
|
6
6
|
module Commands
|
7
7
|
class Themes < BooticCli::Command
|
8
|
-
|
8
|
+
|
9
|
+
# def examples
|
10
|
+
# say "Note: By [shop] we always mean the shop's subdomain. For example:"
|
11
|
+
# say "bootic themes clone dir --shop=foobar (assuming my shop runs at foobar.bootic.net)"
|
12
|
+
# end
|
13
|
+
|
14
|
+
desc 'clone [dir]', 'Clone remote theme into directory [dir]'
|
15
|
+
option :shop, banner: '<shop_subdomain>', type: :string
|
9
16
|
option :destroy, banner: '<true|false>', type: :boolean, default: true
|
10
17
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
11
|
-
def clone(
|
18
|
+
def clone(dir = nil)
|
12
19
|
logged_in_action do
|
13
|
-
local_theme, remote_theme = theme_selector.setup_theme_pair(
|
20
|
+
local_theme, remote_theme = theme_selector.setup_theme_pair(options['shop'], dir, options['public'])
|
14
21
|
workflows.pull(local_theme, remote_theme, destroy: options['destroy'])
|
15
22
|
end
|
16
23
|
end
|
@@ -18,9 +25,9 @@ module BooticCli
|
|
18
25
|
desc 'pull', 'Pull remote changes into current theme directory'
|
19
26
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
20
27
|
option :destroy, banner: '<true|false>', type: :boolean, default: true
|
21
|
-
def pull
|
22
|
-
|
23
|
-
local_theme, remote_theme = theme_selector.select_theme_pair(
|
28
|
+
def pull
|
29
|
+
within_theme do
|
30
|
+
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
24
31
|
workflows.pull(local_theme, remote_theme, destroy: options['destroy'])
|
25
32
|
end
|
26
33
|
end
|
@@ -28,67 +35,88 @@ module BooticCli
|
|
28
35
|
desc 'push', 'Push all local theme files in current dir to remote shop'
|
29
36
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
30
37
|
option :destroy, banner: '<true|false>', type: :boolean, default: true
|
31
|
-
def push
|
32
|
-
|
33
|
-
local_theme, remote_theme = theme_selector.select_theme_pair(
|
38
|
+
def push
|
39
|
+
within_theme do
|
40
|
+
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
34
41
|
workflows.push(local_theme, remote_theme, destroy: options['destroy'])
|
35
42
|
end
|
36
43
|
end
|
37
44
|
|
38
45
|
desc 'sync', 'Sync local theme copy in local dir with remote shop'
|
39
46
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
40
|
-
def sync
|
41
|
-
|
42
|
-
local_theme, remote_theme = theme_selector.select_theme_pair(
|
47
|
+
def sync
|
48
|
+
within_theme do
|
49
|
+
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
43
50
|
workflows.sync(local_theme, remote_theme)
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
47
54
|
desc 'compare', 'Show differences between local and remote copies'
|
48
55
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
49
|
-
def compare
|
50
|
-
|
51
|
-
local_theme, remote_theme = theme_selector.select_theme_pair(
|
56
|
+
def compare
|
57
|
+
within_theme do
|
58
|
+
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
52
59
|
workflows.compare(local_theme, remote_theme)
|
53
60
|
end
|
54
61
|
end
|
55
62
|
|
56
|
-
desc 'watch', 'Watch theme directory
|
63
|
+
desc 'watch', 'Watch local theme directory and create/update/delete remote one when any file changes'
|
57
64
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
58
|
-
def watch
|
59
|
-
|
60
|
-
_, remote_theme = theme_selector.select_theme_pair(
|
61
|
-
workflows.watch(
|
65
|
+
def watch
|
66
|
+
within_theme do
|
67
|
+
_, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
68
|
+
workflows.watch(current_dir, remote_theme)
|
62
69
|
end
|
63
70
|
end
|
64
71
|
|
65
72
|
desc 'publish', 'Publish local files to remote public theme'
|
66
|
-
def publish
|
67
|
-
|
68
|
-
local_theme, remote_theme = theme_selector.select_theme_pair(
|
73
|
+
def publish
|
74
|
+
within_theme do
|
75
|
+
local_theme, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, false)
|
69
76
|
workflows.publish(local_theme, remote_theme)
|
70
77
|
end
|
71
78
|
end
|
72
79
|
|
73
80
|
desc 'open', 'Open theme preview URL in a browser'
|
74
81
|
option :public, banner: '<true|false>', type: :boolean, default: false, aliases: '-p'
|
75
|
-
def open
|
76
|
-
|
77
|
-
_, remote_theme = theme_selector.select_theme_pair(
|
82
|
+
def open
|
83
|
+
within_theme do
|
84
|
+
_, remote_theme = theme_selector.select_theme_pair(default_subdomain, current_dir, options['public'])
|
78
85
|
Launchy.open remote_theme.path
|
79
86
|
end
|
80
87
|
end
|
81
88
|
|
82
|
-
desc 'pair
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
89
|
+
desc 'pair', 'Pair this directory to remote [shop]'
|
90
|
+
option :shop, banner: '<shop_subdomain>', type: :string, required: true
|
91
|
+
def pair
|
92
|
+
within_theme do
|
93
|
+
local_theme = theme_selector.pair(options['shop'], current_dir)
|
94
|
+
prompt.say "Directory #{local_theme.path} paired with shop #{options['shop']}", :green
|
87
95
|
end
|
88
96
|
end
|
89
97
|
|
90
98
|
private
|
91
99
|
|
100
|
+
def within_theme(&block)
|
101
|
+
dir = File.expand_path(current_dir)
|
102
|
+
unless File.exist?(File.join(dir, 'layout.html'))
|
103
|
+
prompt.say "This directory doesn't look like a Bootic theme! (#{dir})", :magenta
|
104
|
+
abort
|
105
|
+
end
|
106
|
+
|
107
|
+
logged_in_action do
|
108
|
+
yield
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def current_dir
|
113
|
+
'.'
|
114
|
+
end
|
115
|
+
|
116
|
+
def default_subdomain
|
117
|
+
nil
|
118
|
+
end
|
119
|
+
|
92
120
|
def prompt
|
93
121
|
@prompt ||= Prompt.new
|
94
122
|
end
|
@@ -108,29 +136,29 @@ module BooticCli
|
|
108
136
|
|
109
137
|
def yes_or_no?(question, default_answer)
|
110
138
|
default_char = default_answer ? 'y' : 'n'
|
111
|
-
input = shell.ask("
|
139
|
+
input = shell.ask("#{question} [#{default_char}]").strip
|
112
140
|
return default_answer if input == '' || input.downcase == default_char
|
113
141
|
!default_answer
|
114
142
|
end
|
115
143
|
|
116
144
|
def notice(str)
|
117
145
|
parts = [" --->", str]
|
118
|
-
highlight parts.join(' ')
|
119
|
-
end
|
120
|
-
|
121
|
-
def highlight(str, color = :bold)
|
122
|
-
say str, color
|
146
|
+
puts highlight parts.join(' ')
|
123
147
|
end
|
124
148
|
|
125
149
|
def say(str, color = nil)
|
126
150
|
shell.say str, color
|
127
151
|
end
|
128
152
|
|
153
|
+
def highlight(str, color = :bold)
|
154
|
+
shell.set_color str, color
|
155
|
+
end
|
156
|
+
|
129
157
|
private
|
130
158
|
attr_reader :shell
|
131
159
|
end
|
132
160
|
|
133
|
-
declare self, '
|
161
|
+
declare self, 'Manage shop themes'
|
134
162
|
end
|
135
163
|
end
|
136
164
|
end
|
@@ -4,15 +4,21 @@ require 'bootic_cli/session'
|
|
4
4
|
module BooticCli
|
5
5
|
module Connectivity
|
6
6
|
|
7
|
+
DEFAULT_ENV = 'production'.freeze
|
8
|
+
|
7
9
|
private
|
8
10
|
|
9
11
|
def session
|
10
12
|
@session ||= (
|
11
|
-
store = BooticCli::Store.new(base_dir: ENV['HOME'], namespace:
|
13
|
+
store = BooticCli::Store.new(base_dir: ENV['HOME'], namespace: current_env)
|
12
14
|
BooticCli::Session.new(store)
|
13
15
|
)
|
14
16
|
end
|
15
17
|
|
18
|
+
def current_env
|
19
|
+
ENV['ENV'] || DEFAULT_ENV
|
20
|
+
end
|
21
|
+
|
16
22
|
def root
|
17
23
|
@root ||= session.client.root
|
18
24
|
end
|
@@ -22,26 +28,35 @@ module BooticCli
|
|
22
28
|
end
|
23
29
|
|
24
30
|
def logged_in_action(&block)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
return
|
33
|
-
end
|
31
|
+
check_client_keys!
|
32
|
+
check_access_token!
|
33
|
+
yield
|
34
|
+
rescue StandardError => e
|
35
|
+
say e.message, :red
|
36
|
+
nil
|
37
|
+
end
|
34
38
|
|
39
|
+
def check_access_token!
|
35
40
|
if !session.logged_in?
|
36
|
-
|
37
|
-
return
|
41
|
+
raise "No access token found! Please run `bootic login`."
|
38
42
|
end
|
43
|
+
end
|
39
44
|
|
40
|
-
|
45
|
+
def check_client_keys
|
46
|
+
has_client_keys? or say "CLI not configured yet! Please run `bootic setup`.", :magenta
|
47
|
+
end
|
41
48
|
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
def check_client_keys!
|
50
|
+
has_client_keys? or raise "CLI not configured yet! Please run `bootic setup`."
|
51
|
+
end
|
52
|
+
|
53
|
+
def has_client_keys?
|
54
|
+
if session.needs_upgrade?
|
55
|
+
say "Old store data structure, restructuring to support multiple environments...", :cyan
|
56
|
+
session.upgrade!
|
57
|
+
end
|
58
|
+
|
59
|
+
session.setup?
|
45
60
|
end
|
46
61
|
end
|
47
62
|
end
|
@@ -11,30 +11,30 @@ module BooticCli
|
|
11
11
|
|
12
12
|
def setup_theme_pair(subdomain, dir = nil, production = false)
|
13
13
|
shop = find_remote_shop(subdomain)
|
14
|
-
raise "
|
14
|
+
raise "No shop with subdomain #{subdomain}" unless shop
|
15
15
|
|
16
16
|
path = dir || shop.subdomain
|
17
17
|
local_theme = select_local_theme(path, shop.subdomain)
|
18
18
|
remote_theme = select_remote_theme(shop, production)
|
19
19
|
|
20
20
|
prompt.say "Cloning theme files into #{local_theme.path}"
|
21
|
-
prompt.say "Preview
|
21
|
+
prompt.say "Preview this theme at #{remote_theme.path}", :magenta
|
22
22
|
[local_theme, remote_theme]
|
23
23
|
end
|
24
24
|
|
25
25
|
def select_theme_pair(subdomain, dir, production = false)
|
26
26
|
local_theme = select_local_theme(dir)
|
27
27
|
shop = find_remote_shop(local_theme.subdomain)
|
28
|
-
raise "
|
28
|
+
raise "No shop with subdomain #{local_theme.subdomain}" unless shop
|
29
29
|
remote_theme = select_remote_theme(shop, production)
|
30
30
|
|
31
|
-
prompt.say "Preview
|
31
|
+
prompt.say "Preview this theme at #{remote_theme.path}", :magenta
|
32
32
|
[local_theme, remote_theme]
|
33
33
|
end
|
34
34
|
|
35
35
|
def pair(subdomain, dir)
|
36
36
|
shop = find_remote_shop(subdomain)
|
37
|
-
raise "
|
37
|
+
raise "No shop with subdomain #{subdomain}" unless shop
|
38
38
|
select_local_theme(dir, subdomain)
|
39
39
|
end
|
40
40
|
|
@@ -63,11 +63,11 @@ module BooticCli
|
|
63
63
|
|
64
64
|
def resolve_remote_theme(shop, production = false)
|
65
65
|
if production
|
66
|
-
prompt.say "Working on
|
66
|
+
prompt.say "Working on public theme of shop #{shop.subdomain}", :red
|
67
67
|
return shop.theme
|
68
68
|
end
|
69
69
|
|
70
|
-
prompt.say "Working on development theme", :green
|
70
|
+
prompt.say "Working on development theme of shop #{shop.subdomain}", :green
|
71
71
|
themes = shop.themes
|
72
72
|
if themes.has?(:dev_theme)
|
73
73
|
themes.dev_theme
|
@@ -185,15 +185,15 @@ module BooticCli
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def publish(local_theme, remote_theme)
|
188
|
-
keep_old_theme = prompt.yes_or_no?("Do you want to keep
|
188
|
+
keep_old_theme = prompt.yes_or_no?("Do you want to keep your old public theme as your dev theme?", false)
|
189
189
|
# first push local files to dev theme
|
190
|
-
prompt.say "
|
190
|
+
prompt.say "Pushing local changes to development theme"
|
191
191
|
push local_theme, remote_theme, destroy: true
|
192
192
|
# now publish remote dev theme
|
193
193
|
# let it fail if remote_theme doesn't respond to #publish
|
194
|
-
prompt.notice "
|
194
|
+
prompt.notice "Publishing development theme"
|
195
195
|
remote_theme.publish(!keep_old_theme) # swap remote themes
|
196
|
-
prompt.
|
196
|
+
prompt.notice "Published to #{remote_theme.href}", :yellow
|
197
197
|
end
|
198
198
|
|
199
199
|
private
|
@@ -205,11 +205,11 @@ module BooticCli
|
|
205
205
|
|
206
206
|
dupes.each do |downcased|
|
207
207
|
arr = list.select { |f| f.file_name.downcase == downcased }
|
208
|
-
|
208
|
+
prompt.say(" --> Name clash between files: " + arr.map(&:file_name).join(', '), :red)
|
209
209
|
end
|
210
210
|
|
211
211
|
if dupes.any?
|
212
|
-
|
212
|
+
prompt.say("Please ensure there are no name clashes before continuing. Thanks!")
|
213
213
|
abort
|
214
214
|
end
|
215
215
|
end
|
@@ -256,7 +256,7 @@ module BooticCli
|
|
256
256
|
else
|
257
257
|
target_asset = to.assets.find{ |t| t.file_name == a.file_name }
|
258
258
|
if target_asset
|
259
|
-
opts[:interactive] && prompt.yes_or_no?("Asset exists: #{a.file_name}. Overwrite?", false)
|
259
|
+
opts[:interactive] && prompt.yes_or_no?("Asset exists: #{highlight(a.file_name)}. Overwrite?", false)
|
260
260
|
else
|
261
261
|
true
|
262
262
|
end
|
data/lib/bootic_cli/version.rb
CHANGED
data/lib/bootic_cli.rb
CHANGED
data/libexec/inspector
ADDED
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -136,25 +136,22 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '9'
|
139
|
-
description: Bootic command
|
139
|
+
description: Bootic command-line client.
|
140
140
|
email:
|
141
|
-
-
|
141
|
+
- ismael@bootic.io
|
142
142
|
executables:
|
143
|
-
-
|
143
|
+
- bootic
|
144
144
|
extensions: []
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
147
|
- ".gitignore"
|
148
|
-
- ".rspec"
|
149
148
|
- ".travis.yml"
|
150
149
|
- Gemfile
|
151
150
|
- LICENSE.txt
|
152
151
|
- README.md
|
153
152
|
- Rakefile
|
154
|
-
- bin/
|
155
|
-
- bin/setup
|
153
|
+
- bin/bootic
|
156
154
|
- bootic_cli.gemspec
|
157
|
-
- exe/btc
|
158
155
|
- lib/bootic_cli.rb
|
159
156
|
- lib/bootic_cli/cli.rb
|
160
157
|
- lib/bootic_cli/command.rb
|
@@ -176,14 +173,16 @@ files:
|
|
176
173
|
- lib/bootic_cli/themes/workflows.rb
|
177
174
|
- lib/bootic_cli/version.rb
|
178
175
|
- lib/bootic_cli/worker_pool.rb
|
179
|
-
|
176
|
+
- libexec/inspector
|
177
|
+
homepage: http://www.bootic.io
|
180
178
|
licenses:
|
181
179
|
- MIT
|
182
180
|
metadata: {}
|
183
|
-
post_install_message: |
|
184
|
-
|
185
|
-
|
186
|
-
|
181
|
+
post_install_message: |2
|
182
|
+
-------------------------------------------------------------
|
183
|
+
Woot! You've just installed the Bootic command-line client!
|
184
|
+
Please run `bootic setup` to configure your credentials.
|
185
|
+
-------------------------------------------------------------
|
187
186
|
rdoc_options: []
|
188
187
|
require_paths:
|
189
188
|
- lib
|
@@ -202,5 +201,5 @@ rubyforge_project:
|
|
202
201
|
rubygems_version: 2.6.13
|
203
202
|
signing_key:
|
204
203
|
specification_version: 4
|
205
|
-
summary: Bootic command
|
204
|
+
summary: Bootic command-line client.
|
206
205
|
test_files: []
|
data/.rspec
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "bootic_cli"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|