nimbu 0.10.3 → 0.10.4

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: a2618df82f9784a6cca7aea7964f2fdb868495909c85a9e7310d50d77d2d2d70
4
- data.tar.gz: 895cb9e94e5d80ac5feba8cba950f4eda96a88cb424669f6a5ec44ed55e4e0f1
3
+ metadata.gz: c258adca42192cb79c6dfdf1e8ff0b83ea64c204be2fecf91c30f0450ea26b2d
4
+ data.tar.gz: a8f018a41f46a3d77dfd11bd71fc8d195c6644c55a38c9d00956506530e4f328
5
5
  SHA512:
6
- metadata.gz: bfd2dcbb1198e4ebc8c5a80acf5c13f45807e00a30152f55f9468ab238bf4b0b1d9fb42449203fd1c3c59d46ac21d26a48f8b0e87cfc3529fcf00e117e852823
7
- data.tar.gz: 9a8bc78a3997b4f94116ec088ae36cb885aa75191381783b7b98a06370416109a35bd219b7d0530aa76a0a46b9baf79fa553843d0e4aaca625d554e0dc81ddf3
6
+ metadata.gz: 3a21d79911c4e7ba0c0f53d81b5ff997b18407e8bf13316d993053fed5bf27a2c957cb89a7facb80844c3e1709d2b7db2b649dadac538856385b213a360370df
7
+ data.tar.gz: d9b783cc35d575446b35723605152baf61150462ad26ee5c6aac047bf52e462739c8a028bcf577a8652ba620553c77f8ea85a4c66baf9dcd7587f21203017af9
data/lib/nimbu/auth.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  require "yaml"
3
3
  require "nimbu"
4
4
  require "nimbu/helpers"
5
+ require 'term/ansicolor'
5
6
 
6
7
  class Nimbu::Auth
7
8
  class << self
@@ -297,5 +298,14 @@ class Nimbu::Auth
297
298
  60.times { print "#"}
298
299
  print "\n"
299
300
  end
301
+
302
+ def invalid_access!
303
+ puts invalid_access_message.bold.red
304
+ end
305
+
306
+ def invalid_access_message
307
+ "Error! You do not have access to #{Nimbu::Auth.site}.#{Nimbu::Auth.admin_host}! " +
308
+ "Please check your site id or request access to your site owner."
309
+ end
300
310
  end
301
311
  end
@@ -17,8 +17,6 @@ class Nimbu::Command::Sites < Nimbu::Command::Base
17
17
  end
18
18
  else
19
19
  display "You don't have access to any Nimbu sites."
20
- display ""
21
- display "Visit http://nimbu.io, start your 30-day trial and discover our amazing platform!"
22
20
  end
23
21
  end
24
22
 
@@ -21,6 +21,8 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
21
21
  end
22
22
  puts ""
23
23
  puts "Currently this directory is configured for '#{Nimbu::Auth.theme.red.bold}'"
24
+ rescue ::Nimbu::Error::Forbidden
25
+ Nimbu::Auth.invalid_access!
24
26
  end
25
27
 
26
28
  # themes:list
@@ -63,6 +65,8 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
63
65
  display " - #{a["folder"]}/#{a["name"]}"
64
66
  end
65
67
  end
68
+ rescue ::Nimbu::Error::Forbidden
69
+ Nimbu::Auth.invalid_access!
66
70
  end
67
71
 
68
72
  # themes
@@ -81,6 +85,8 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
81
85
  display "\nShowing differences between local and server\nlayouts, templates, snippets and assets for '#{theme.green.bold}':"
82
86
  json = nimbu.themes(:subdomain => Nimbu::Auth.site).get(theme)
83
87
  check_differences(json, theme, "layouts", "templates", "snippets")
88
+ rescue ::Nimbu::Error::Forbidden
89
+ Nimbu::Auth.invalid_access!
84
90
  end
85
91
 
86
92
  # themes:push
@@ -227,7 +233,8 @@ class Nimbu::Command::Themes < Nimbu::Command::Base
227
233
  print " (ok)\n"
228
234
  end
229
235
  end
230
-
236
+ rescue ::Nimbu::Error::Forbidden
237
+ Nimbu::Auth.invalid_access!
231
238
  end
232
239
 
233
240
  private
@@ -110,8 +110,11 @@ module Nimbu
110
110
  headers encoded_headers
111
111
  end
112
112
  body Base64.decode64(results["body"])
113
+ rescue ::Nimbu::Error::Forbidden
114
+ Nimbu::Auth.invalid_access!
115
+ Nimbu::Auth.invalid_access_message
113
116
  rescue Exception => error
114
- puts error if Nimbu.debug
117
+ puts error.message if Nimbu.debug
115
118
  puts "Error! #{error.http_body if error.respond_to?(:http_body)}"
116
119
  error.http_body
117
120
  end
data/lib/nimbu/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Nimbu
3
- VERSION = "0.10.3"
3
+ VERSION = "0.10.4"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimbu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zenjoy BVBA