secret_hub 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43f49eb823e6839d1fcdd99c1b06dc18fa0c0bcae324228a8a024c24e8743c2b
4
- data.tar.gz: b649439d4b9a740c6a2cbe2ad7f85aaf52cd23cba4287b47e6f6b5d013831055
3
+ metadata.gz: 55c57ad86eb27ea766d06923f3231e513dcb37da3050c6d1ac22de4831796140
4
+ data.tar.gz: d653818ddfd5967f66761ad76512a027c0b7e1942c72a3f0b3e91ce4c99a7bc3
5
5
  SHA512:
6
- metadata.gz: 10c662e3948d97f76be14de4afdf66d97a163b1449852261f0c10410b281bce3b205a3c3d3108b286b8e92ac34aa047983fac84ed9bd007b2ffa49001f518cea
7
- data.tar.gz: 565e5a95d926b8a78f8299fc3eb49ec36156a3013d98edce0d313929d60742ceea6ec1dc127460b3c95aa340aa4da6a8aa7b30753d25f69a3f00fa6020066e5d
6
+ metadata.gz: 3f7f20c2ac2b71264a73a33fae3436e22968083f3bb00855a5f3f74c0a0e528c80ac6b2d0d9d2a2ab374a19c2345212e1c79bed7601a3244fd8f08c4f981164d
7
+ data.tar.gz: 8e4b87a3229d977c6c61c5629481517e4cdc945825e0e00b8343f629ab1d4811c6ab1958c6aaedc5258bcd75c9f75b4cde95fbb3cf141b427e7fa9f96f629b3a
data/README.md CHANGED
@@ -61,7 +61,7 @@ Run secrethub COMMAND --help for command specific help
61
61
  $ secrethub repo
62
62
  Usage:
63
63
  secrethub repo list REPO
64
- secrethub repo save REPO KEY VALUE
64
+ secrethub repo save REPO KEY [VALUE]
65
65
  secrethub repo delete REPO KEY
66
66
  secrethub repo (-h|--help)
67
67
 
@@ -69,7 +69,7 @@ Usage:
69
69
  $ secrethub org
70
70
  Usage:
71
71
  secrethub org list ORG
72
- secrethub org save ORG KEY VALUE
72
+ secrethub org save ORG KEY [VALUE]
73
73
  secrethub org delete ORG KEY
74
74
  secrethub org (-h|--help)
75
75
 
@@ -4,7 +4,7 @@ module SecretHub
4
4
  summary "Manage organization secrets"
5
5
 
6
6
  usage "secrethub org list ORG"
7
- usage "secrethub org save ORG KEY VALUE"
7
+ usage "secrethub org save ORG KEY [VALUE]"
8
8
  usage "secrethub org delete ORG KEY"
9
9
  usage "secrethub org (-h|--help)"
10
10
 
@@ -14,9 +14,10 @@ module SecretHub
14
14
 
15
15
  param "ORG", "Name of the organization"
16
16
  param "KEY", "The name of the secret"
17
- param "VALUE", "The plain text secret value"
17
+ param "VALUE", "The plain text secret value. If not provided, it is expected to be set as an environment variable"
18
18
 
19
19
  example "secrethub org list myorg"
20
+ example "secrethub org save myorg PASSWORD"
20
21
  example "secrethub org save myorg PASSWORD s3cr3t"
21
22
  example "secrethub org delete myorg PASSWORD"
22
23
 
@@ -48,7 +49,12 @@ module SecretHub
48
49
  end
49
50
 
50
51
  def value
51
- args['VALUE']
52
+ result = args['VALUE'] || ENV[key]
53
+ if result
54
+ result
55
+ else
56
+ raise InvalidInput, "Please provide a value, either in the command line or in the environment variable '#{key}'"
57
+ end
52
58
  end
53
59
 
54
60
  end
@@ -4,7 +4,7 @@ module SecretHub
4
4
  summary "Manage repository secrets"
5
5
 
6
6
  usage "secrethub repo list REPO"
7
- usage "secrethub repo save REPO KEY VALUE"
7
+ usage "secrethub repo save REPO KEY [VALUE]"
8
8
  usage "secrethub repo delete REPO KEY"
9
9
  usage "secrethub repo (-h|--help)"
10
10
 
@@ -14,9 +14,10 @@ module SecretHub
14
14
 
15
15
  param "REPO", "Full name of the GitHub repository (user/repo)"
16
16
  param "KEY", "The name of the secret"
17
- param "VALUE", "The plain text secret value"
17
+ param "VALUE", "The plain text secret value. If not provided, it is expected to be set as an environment variable"
18
18
 
19
19
  example "secrethub repo list me/myrepo"
20
+ example "secrethub repo save me/myrepo PASSWORD"
20
21
  example "secrethub repo save me/myrepo PASSWORD s3cr3t"
21
22
  example "secrethub repo delete me/myrepo PASSWORD"
22
23
 
@@ -48,9 +49,13 @@ module SecretHub
48
49
  end
49
50
 
50
51
  def value
51
- args['VALUE']
52
+ result = args['VALUE'] || ENV[key]
53
+ if result
54
+ result
55
+ else
56
+ raise InvalidInput, "Please provide a value, either in the command line or in the environment variable '#{key}'"
57
+ end
52
58
  end
53
-
54
59
  end
55
60
  end
56
61
  end
@@ -1,6 +1,7 @@
1
1
  module SecretHub
2
2
  SecretHubError = Class.new StandardError
3
3
  ConfigurationError = Class.new SecretHubError
4
+ InvalidInput = Class.new SecretHubError
4
5
 
5
6
  class APIError < SecretHubError
6
7
  attr_reader :response
@@ -1,3 +1,3 @@
1
1
  module SecretHub
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secret_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mister_bin