bootic_cli 0.6.2 → 0.6.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
- SHA1:
3
- metadata.gz: fbe63e3f8892b9be422288d367464522beb7bcfd
4
- data.tar.gz: 2d9849bf9eb82a019a5982b004d73a56ae1d659c
2
+ SHA256:
3
+ metadata.gz: 19dcc9147bd84c2b93d61e879276f62c9a2f6cd9eaa5743c6253ac0fa228e2e7
4
+ data.tar.gz: 5d8b8b62298052e7e1288c56f6157a52074f3f206acc8ef6d54387dc280ed7a4
5
5
  SHA512:
6
- metadata.gz: 2638f38d560a340c7728f5a98a8b0423742516cbe85a147f6aec63ed6fd3eeed6e9a6d630c24b193d729a56917826e9d53f7715808321cc98e39cf1e9f3836ef
7
- data.tar.gz: 7904fa01e25336adc20f4a7f53f35a84f0ce28b84861192c27aa3637b20eaf8bf2861905a24b169394a2f067693b067093f40687a828d98b7849aebe2b00062d
6
+ metadata.gz: a39d8dc64b83fd85cfbfeb2560804ed4339a008593074e8145c65c91c9fd054465681d79948776e8bc22f632e4d4605864e10f39bf12817d9254e6187fc00419
7
+ data.tar.gz: c7c5cff0786564b00ece4d3135a246f401115eba87f348912b8c177a2e85b4e359c91ba006c29887f13a98c097d84efc4d97315474925e7fe56e05578dcad815
@@ -177,7 +177,12 @@ module BooticCli
177
177
  IRB.conf[:PROMPT_MODE] = :CUSTOM
178
178
  IRB.conf[:AUTO_INDENT] = false
179
179
 
180
- IRB.irb nil, context
180
+ begin
181
+ IRB.irb nil, context
182
+ rescue ThreadError => e
183
+ # puts "#{e.class} -> #{e.message}"
184
+ exit(1)
185
+ end
181
186
  end
182
187
  end
183
188
 
@@ -27,17 +27,17 @@ module BooticCli
27
27
  def ==(other)
28
28
  if digest.to_s == '' || other.digest.to_s == ''
29
29
  # puts "One or the other digest is empty: #{digest} -- #{other.digest}"
30
- return super
30
+ return super
31
31
  end
32
32
 
33
33
  # file sizes may differ as they are served by CDN (that shrinks them)
34
34
  self.digest == other.digest # && self.file_size == other.file_size
35
35
  end
36
36
 
37
- def fetch_data(attempt = 1)
37
+ def fetch_data(attempt = 1, skip_verify = false)
38
38
  uri = URI.parse(rels[:file].href)
39
39
  opts = REQUEST_OPTS.merge({
40
- # verify_mode: OpenSSL::SSL::VERIFY_PEER # OpenSSL::SSL::VERIFY_NONE
40
+ verify_mode: skip_verify ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER,
41
41
  use_ssl: uri.port == 443
42
42
  })
43
43
 
@@ -50,6 +50,9 @@ module BooticCli
50
50
  raise if attempt > 3 # max attempts
51
51
  # puts "#{e.class} for #{File.basename(uri.path)}! Retrying request..."
52
52
  fetch_data(attempt + 1)
53
+ rescue OpenSSL::SSL::SSLError => e
54
+ # retry but skipping verification
55
+ fetch_data(attempt + 1, true)
53
56
  end
54
57
  end
55
58
 
@@ -113,7 +116,12 @@ module BooticCli
113
116
 
114
117
  def remove_template(file_name)
115
118
  tpl = theme.templates.find { |t| t.file_name == file_name }
116
- check_errors!(tpl.delete_template) if tpl && tpl.can?(:delete_template)
119
+ if tpl && tpl.can?(:delete_template)
120
+ res = tpl.delete_template
121
+ check_errors!(res) if res.respond_to?(:can?)
122
+ else
123
+ puts "Cannot delete #{file_name}"
124
+ end
117
125
  end
118
126
 
119
127
  def add_asset(file_name, file)
@@ -124,8 +132,13 @@ module BooticCli
124
132
  end
125
133
 
126
134
  def remove_asset(file_name)
127
- asset = theme.assets.find{|t| t.file_name == file_name }
128
- check_errors!(asset.delete_theme_asset) if asset
135
+ asset = theme.assets.find { |t| t.file_name == file_name }
136
+ if asset and asset.can?(:delete_theme_asset)
137
+ res = asset.delete_theme_asset
138
+ check_errors!(res) if res.respond_to?(:can?)
139
+ else
140
+ puts "Cannot delete asset: #{file_name}"
141
+ end
129
142
  end
130
143
 
131
144
  private
@@ -267,15 +267,21 @@ module BooticCli
267
267
  end
268
268
 
269
269
  def remove_all(from, to)
270
- from.templates.each { |f| to.remove_template(f.file_name) }
271
- from.assets.each { |f| to.remove_asset(f.file_name) }
270
+ from.templates.each do |f|
271
+ puts "Removing template #{highlight(f.file_name)}"
272
+ to.remove_template(f.file_name)
273
+ end
274
+ from.assets.each do |f|
275
+ puts "Removing asset #{highlight(f.file_name)}"
276
+ to.remove_asset(f.file_name)
277
+ end
272
278
  end
273
279
 
274
280
  def copy_templates(from, to, opts = {})
275
281
  from.templates.each do |t|
276
282
  handle_file_errors(:template, t) do
277
283
  to.add_template(t.file_name, t.body)
278
- puts "Copied #{highlight(t.file_name)}"
284
+ puts "Copied template #{highlight(t.file_name)}"
279
285
  end
280
286
  end
281
287
  end
@@ -332,6 +338,8 @@ module BooticCli
332
338
  theme.remove_template(file_name)
333
339
  when :asset
334
340
  theme.remove_asset(file_name)
341
+ else
342
+ raise "Invalid type: #{type}"
335
343
  end
336
344
  puts "Deleted remote #{type}: #{highlight(file_name)}"
337
345
  end
@@ -361,7 +369,7 @@ module BooticCli
361
369
  prompt.say("#{file.file_name} looks like a binary file, not a template. Skipping...", :red)
362
370
  # abort
363
371
 
364
- rescue Net::OpenTimeout, Net::ReadTimeout => e
372
+ rescue Net::OpenTimeout, Net::ReadTimeout => e
365
373
  prompt.say("I'm having trouble connecting to the server. Please try again in a minute.", :red)
366
374
  abort
367
375
 
@@ -1,3 +1,3 @@
1
1
  module BooticCli
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
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.2
4
+ version: 0.6.3
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-06-19 00:00:00.000000000 Z
12
+ date: 2019-08-09 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.6.13
204
+ rubygems_version: 2.7.3
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Bootic command-line client.