aws-s3crets 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +6 -2
- data/README.md +3 -1
- data/aws-s3crets.gemspec +1 -0
- data/lib/s3crets/actions/init.rb +23 -1
- data/lib/s3crets/cli.rb +2 -0
- data/lib/s3crets/version.rb +1 -1
- data/spec/lib/s3crets/actions/init_spec.rb +13 -0
- data/spec/spec_helper.rb +2 -0
- data/templates/gitignore.erb +4 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2Q2Nzg2YWY0MDNhNDNlYzk5ODcxZjM0ZjY0NjViNTVmM2FmZWY0MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODQwNzk0OTAxOTJmMjc3ZjZiNzAzMTkzMTY4ZTNiNGQ1ZmYyYmFjZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmU2OTgzYjY2MmExYmEwYmM2ODg4ZDQ1NjExYTEzM2JhNzgyZmE0N2E2MmRj
|
10
|
+
NzFiZWRiOTNhNDYxZDExYzZlNmIzYzg0M2JlYjdlMTc3N2Q2OGI5OGZhZTU1
|
11
|
+
NmIyYzUwMWZmZWJlMjc4NDE2OTBmYzZkZGQwODJmYTIwNTAxYzI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzVkY2Y0ZTg1YjBlMzc5ZGE1NmM2MzFjM2QzM2UzYjk1NzhiNjc3MDI2YTFi
|
14
|
+
OGExZGVkNTM1MzAwN2EwNWQ3NTFlMGNjMTRkYjY2ZDY1MDUyMzZhZjQyOTVk
|
15
|
+
YTczMzQ1MmY3NTljMjMzYzMzMzYyYTBjMTk3MzE5N2RjMThjODc=
|
data/.travis.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
2
3
|
rvm:
|
3
|
-
- 2.1.0
|
4
|
-
- 2.0.0
|
4
|
+
- 2.1.0
|
5
5
|
deploy:
|
6
6
|
provider: rubygems
|
7
7
|
gem: aws-s3crets
|
@@ -10,3 +10,7 @@ deploy:
|
|
10
10
|
all_branches: true
|
11
11
|
api_key:
|
12
12
|
secure: crwL3RJgh7X9hJK3+3gJQ3ucn9uJjJNytEGqgmnVHvAw2WNcg3oHLnro/529wfMc961ZtwMSQ75Zc4jAeDLlxR6AdMTrUJ7SOmvaIkrvmJCUaadu3C8JXY/EoIx/8tJ4V+4u5hkDvcZUoZ9g9kI68r1NtBopJMaSCgrBbYCoCZA=
|
13
|
+
addons:
|
14
|
+
code_climate:
|
15
|
+
repo_token:
|
16
|
+
secure: VEkZMvbAusvOuQGrbYXpA2YFm6PXa5pteZ7Fa1JYqfKZOP1M2R2feFO4cPhLaOlcW1hgWgXN1mZZpBNNpEG3eNZU+MdkC8TuRYI/Ok05lCcyQMy3Vrl/89WfqNN+bZdF4U6sXLU5PjOzf18RQFT9/YcMXZ1PkC2/imV/rr9BV8M=
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# S3crets
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/maclennann/s3crets.svg?branch=master)](https://travis-ci.org/maclennann/s3crets)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/maclennann/s3crets/badges/gpa.svg)](https://codeclimate.com/github/maclennann/s3crets)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/maclennann/s3crets/badges/coverage.svg)](https://codeclimate.com/github/maclennann/s3crets)
|
4
6
|
|
5
7
|
`s3crets` is a gem that allows you to fetch secret files (password, certs, keys,
|
6
8
|
etc) from an S3 bucket via the command-line, rake, or ruby script.
|
@@ -19,7 +21,7 @@ And then execute:
|
|
19
21
|
|
20
22
|
Or install it yourself as:
|
21
23
|
|
22
|
-
$ gem install s3crets
|
24
|
+
$ gem install aws-s3crets
|
23
25
|
|
24
26
|
## Usage
|
25
27
|
|
data/aws-s3crets.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
25
25
|
spec.add_development_dependency 'fakefs', '~> 0.6'
|
26
26
|
spec.add_development_dependency 'gem-path', '~> 0.6'
|
27
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
27
28
|
|
28
29
|
spec.add_dependency 'aws-sdk', '~> 2.0'
|
29
30
|
spec.add_dependency 'thor'
|
data/lib/s3crets/actions/init.rb
CHANGED
@@ -3,14 +3,16 @@ require 's3crets/error'
|
|
3
3
|
require 'ostruct'
|
4
4
|
require 'erb'
|
5
5
|
require 's3crets/defaults'
|
6
|
+
require 'English'
|
6
7
|
|
7
8
|
module S3crets
|
8
9
|
module Actions
|
9
|
-
# Create a new
|
10
|
+
# Create a new Secretfile
|
10
11
|
class Init < Base
|
11
12
|
def run
|
12
13
|
check_for_secretfile
|
13
14
|
write_template
|
15
|
+
write_gitignore if safe_to_gitignore
|
14
16
|
end
|
15
17
|
|
16
18
|
private
|
@@ -28,6 +30,13 @@ module S3crets
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
33
|
+
def write_gitignore
|
34
|
+
template = TemplateRenderer.new(options)
|
35
|
+
File.open('.gitignore', 'w') do |f|
|
36
|
+
f.write template.render(File.read(source_root.join('templates/gitignore.erb')))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
31
40
|
# Allows us to easily feed our options hash
|
32
41
|
# to an ERB
|
33
42
|
class TemplateRenderer < OpenStruct
|
@@ -35,6 +44,19 @@ module S3crets
|
|
35
44
|
ERB.new(template).result(binding)
|
36
45
|
end
|
37
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def git_repo?
|
51
|
+
`git status`
|
52
|
+
$CHILD_STATUS.success?
|
53
|
+
rescue => _
|
54
|
+
false
|
55
|
+
end
|
56
|
+
|
57
|
+
def safe_to_gitignore
|
58
|
+
git_repo? && !File.exist?('.gitignore') && !options['noignore']
|
59
|
+
end
|
38
60
|
end
|
39
61
|
end
|
40
62
|
end
|
data/lib/s3crets/cli.rb
CHANGED
@@ -35,6 +35,8 @@ module S3crets
|
|
35
35
|
desc: 'The S3 bucket to connect to.'
|
36
36
|
option 'region', type: :string, aliases: :r, default: 'us-west-2',
|
37
37
|
desc: 'The AWS region to use.'
|
38
|
+
option 'noignore', type: :boolean, default: false, aliases: :i,
|
39
|
+
desc: "Don't write a .gitignore to the current directory."
|
38
40
|
option 'credential_file', type: :string, aliases: :f,
|
39
41
|
default: '~/.aws/credential',
|
40
42
|
desc: 'The AWS credential file'
|
data/lib/s3crets/version.rb
CHANGED
@@ -19,6 +19,19 @@ describe S3crets::Cli do
|
|
19
19
|
expect(File.read S3crets::SECRETFILE_NAME).to match(/Fill in secrets/)
|
20
20
|
end
|
21
21
|
|
22
|
+
it 'should generate a .gitignore' do
|
23
|
+
expect(FakeFS::FileTest.file? '.gitignore').to be(false)
|
24
|
+
subject.init
|
25
|
+
expect(FakeFS::FileTest.file? '.gitignore').to be(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should respect existing .gitignores' do
|
29
|
+
File.write('.gitignore', '*')
|
30
|
+
expect(FakeFS::FileTest.file? '.gitignore').to be(true)
|
31
|
+
subject.init
|
32
|
+
expect(File.read '.gitignore').to eq('*')
|
33
|
+
end
|
34
|
+
|
22
35
|
it 'should accept settings as options' do
|
23
36
|
subject.options = { 'region' => 'us-east-1',
|
24
37
|
'bucket' => 'an_example_bucket',
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-s3crets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Norm MacLennan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: codeclimate-test-reporter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: aws-sdk
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +171,7 @@ files:
|
|
157
171
|
- spec/lib/s3crets/actions/init_spec.rb
|
158
172
|
- spec/spec_helper.rb
|
159
173
|
- templates/Secretfile.erb
|
174
|
+
- templates/gitignore.erb
|
160
175
|
homepage: ''
|
161
176
|
licenses:
|
162
177
|
- MIT
|