rcredstash 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: a910b2a8a3b77bc116c1466ce17a04bee4e0f54c
4
- data.tar.gz: 1b6b12222a108f089ff5759e646b9381626c1b2f
3
+ metadata.gz: 01346a89bdc206884178c9b88a70383b487614a7
4
+ data.tar.gz: 5c0a22d91b59d25bbc7bce6b5845638c204f845b
5
5
  SHA512:
6
- metadata.gz: 4e72395c9949808360df91414c3c0be3cf8d97a7addc8492ac72959a9fa4a7400afb328ac7d17009378e466ad2f86e18839a5f8d5de9c5ac3a9e307dbb676d1e
7
- data.tar.gz: 0a0cd2c952afeabdfcefa06719aa0bde40f416b0032b245c2252e319464b8cfc7a13836ca3719384916083e00732ee1fa9d640f617cad68a5aba7a00a5f7b0e9
6
+ metadata.gz: a58c364392fa4b35a78f6ce4fd71bee33e81ba3a5dfa812b45fe726e1f67df44e1f9937213cfa19fa6e8da49094edbe677da988e1f2f5273f0061ec9de225ff9
7
+ data.tar.gz: 6b7f4c0eaf091342ab0ddbe29c98ea149f995a7af13590ba781d21cc9801ce8b4ff1a29d6339858d6af79702f0882d51fb95965f875b6c06d5e40d395ff1bd09
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.2.3
4
+ - 2.3.1
5
+ - 2.2.5
5
6
  before_install: gem install bundler -v 1.12.5
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
- # Rcredstash
1
+ # RCredStash [![Build Status](https://travis-ci.org/adorechic/rcredstash.svg?branch=master)](https://travis-ci.org/adorechic/rcredstash)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rcredstash`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ RCredStash is a ruby port of [CredStash](https://github.com/fugue/credstash)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,7 +21,23 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ ```ruby
25
+ CredStash.get(key)
26
+ CredStash.put(key, value)
27
+ CredStash.list
28
+ CredStash.delete(key)
29
+ ```
30
+
31
+ ### AWS credentials
32
+ RCredStash uses [aws-sdk v2](https://github.com/aws/aws-sdk-ruby), so configuration options provided by aws-sdk such as `ENV['AWS_ACCESS_KEY_ID']` and `ENV['AWS_SECRET_ACCESS_KEY']` are available.
33
+
34
+ ### Configurations
35
+
36
+ ```ruby
37
+ CredStash.configure do |config|
38
+ config.table_name = 'your_dynamodb_table_name'
39
+ end
40
+ ```
26
41
 
27
42
  ## Development
28
43
 
@@ -32,10 +47,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
47
 
33
48
  ## Contributing
34
49
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rcredstash.
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/adorechic/rcredstash.
36
51
 
37
52
 
38
53
  ## License
39
54
 
40
55
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -0,0 +1,23 @@
1
+ module CredStash
2
+ class << self
3
+ def configure
4
+ yield config
5
+ end
6
+
7
+ def config
8
+ @config ||= Config.new
9
+ end
10
+ end
11
+
12
+ class Config
13
+ attr_accessor :table_name
14
+
15
+ def initialize
16
+ reset!
17
+ end
18
+
19
+ def reset!
20
+ @table_name = 'credential-store'
21
+ end
22
+ end
23
+ end
@@ -26,7 +26,7 @@ class CredStash::Repository
26
26
 
27
27
  def select(name, pluck: nil, limit: nil)
28
28
  params = {
29
- table_name: 'credential-store',
29
+ table_name: CredStash.config.table_name,
30
30
  consistent_read: true,
31
31
  key_condition_expression: "#name = :name",
32
32
  expression_attribute_names: { "#name" => "name"},
@@ -54,7 +54,7 @@ class CredStash::Repository
54
54
 
55
55
  def put(item)
56
56
  @client.put_item(
57
- table_name: 'credential-store',
57
+ table_name: CredStash.config.table_name,
58
58
  item: {
59
59
  name: item.name,
60
60
  version: item.version,
@@ -69,7 +69,7 @@ class CredStash::Repository
69
69
 
70
70
  def list
71
71
  @client.scan(
72
- table_name: 'credential-store',
72
+ table_name: CredStash.config.table_name,
73
73
  projection_expression: '#name, version',
74
74
  expression_attribute_names: { "#name" => "name" },
75
75
  ).items.map do |item|
@@ -79,7 +79,7 @@ class CredStash::Repository
79
79
 
80
80
  def delete(item)
81
81
  @client.delete_item(
82
- table_name: 'credential-store',
82
+ table_name: CredStash.config.table_name,
83
83
  key: {
84
84
  name: item.name,
85
85
  version: item.version
@@ -1,3 +1,3 @@
1
1
  module CredStash
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/cred_stash.rb CHANGED
@@ -45,6 +45,7 @@ module CredStash
45
45
  end
46
46
  end
47
47
 
48
+ require 'cred_stash/config'
48
49
  require 'cred_stash/cipher_key'
49
50
  require 'cred_stash/cipher'
50
51
  require 'cred_stash/error'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcredstash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - adorechic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-30 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -86,6 +86,7 @@ files:
86
86
  - lib/cred_stash.rb
87
87
  - lib/cred_stash/cipher.rb
88
88
  - lib/cred_stash/cipher_key.rb
89
+ - lib/cred_stash/config.rb
89
90
  - lib/cred_stash/error.rb
90
91
  - lib/cred_stash/repository.rb
91
92
  - lib/cred_stash/secret.rb
@@ -112,8 +113,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  version: '0'
113
114
  requirements: []
114
115
  rubyforge_project:
115
- rubygems_version: 2.6.4
116
+ rubygems_version: 2.5.2
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: A Ruby port of CredStash
119
120
  test_files: []
121
+ has_rdoc: