codebase4 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/codebase/cli.rb +16 -2
  2. metadata +1 -1
data/lib/codebase/cli.rb CHANGED
@@ -13,7 +13,7 @@ module Codebase
13
13
  elsif cmd.respond_to?(command)
14
14
  cmd.send(command, *args)
15
15
  else
16
- raise Error, "Command not found"
16
+ raise Error, "Command '#{command}' not found"
17
17
  end
18
18
  rescue Error => e
19
19
  $stderr.puts e.message
@@ -29,6 +29,20 @@ module Codebase
29
29
  Codebase.config.save
30
30
  puts "Added token for '#{account_name}'"
31
31
  end
32
+
33
+ def test(account_name)
34
+ token = Codebase.config.tokens.is_a?(Hash) && Codebase.config.tokens[account_name]
35
+ if token.nil?
36
+ raise Error, "This account has no token configured locally, use 'codebase token [account] [token]' to configure it"
37
+ end
38
+
39
+ begin
40
+ Codebase.request("https://#{account_name}/check_access_token", {:access_token => token})
41
+ puts "OK"
42
+ rescue
43
+ puts "Test failed, are your credentials in ~/.codebase4 correct?"
44
+ end
45
+ end
32
46
 
33
47
  def deploy(start_ref, end_ref, *options)
34
48
  options = options_to_hash(options)
@@ -70,7 +84,7 @@ module Codebase
70
84
  Codebase.request("#{protocol}://#{host}/projects/#{project}/repositories/#{repo}/deployments/add", hash)
71
85
  puts "Deployment added successfully"
72
86
  end
73
-
87
+
74
88
  private
75
89
 
76
90
  def options_to_hash(options)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: codebase4
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.7
5
+ version: 1.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam Cooke