ey_secrets 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +8 -0
- data/README.md +3 -0
- data/lib/ey_secrets/actions/copy_files.rb +1 -1
- data/lib/ey_secrets/adapters/engine_yard.rb +3 -1
- data/lib/ey_secrets/version.rb +1 -1
- data/spec/features/update_spec.rb +8 -2
- data/spec/integration/ey_secrets/git_spec.rb +21 -9
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZWI0YWIyNjc5OTg0NzViMDVhMGViZDk0MTM0N2NhNTFiNTg2YTY3ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 021cde289ba89d3c0de9cda34f67ceb7a60aa184
|
4
|
+
data.tar.gz: 43b14d1814258a1889c7916a3f9a9d9c0927f442
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Njc0MTEyYzg2NGQ1NzQ4ZGY5OWM0NzBmMjgyMThjMjZmOTg5OWJlNmJlNjQ1
|
11
|
-
N2ZjYmE2ODlkNWU2ZjFlOTNkMWZmNDRmNjdiZDUyNzBkMDY3ZTA=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Yzg1NTRlODc0MTJmYjdjYmVlOTg1ZmJiYjYyMDg1ZmMyMjliMmJjMmM5MTQx
|
14
|
-
MDU0NGUwYmU5YjQzMTE5ZTRlMWQ1YjU3NzE2MDE3NDJiNjQ5MmNlNzYyMzJm
|
15
|
-
ZjMxMmQxMWZmYzkyZDRmMDVmYzk1ZDkyYzYyZTU2NmQ5ZTNhOWQ=
|
6
|
+
metadata.gz: 364b3da59878494e1ed88c8c7625d014f8d1250431d434aafb1e4719161400c91b66ed83028dddde4ab9b3127b05eae5e68191b4655b41feca39866c1d60e831
|
7
|
+
data.tar.gz: 94cdd39ef98f15a0b85170d1c73be900297f0244099822badb55b8343134c46d88f7278028306e4301ccaefd4c0e246b67068223b6a46c7e2f24d0fbfd43e3b1
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Engine Yard Secrets
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/ey_secrets.svg)](http://badge.fury.io/rb/ey_secrets)
|
4
|
+
[![Build Status](https://travis-ci.org/tf/ey_secrets.svg?branch=master)](https://travis-ci.org/tf/ey_secrets)
|
5
|
+
|
3
6
|
Manage sensible configuration files accross Engine Yard instances.
|
4
7
|
|
5
8
|
## Installation
|
@@ -20,7 +20,9 @@ module EySecrets
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def environments_from(ey_app)
|
23
|
-
ey_app.app_environments
|
23
|
+
ey_app_environments = ey_app.app_environments || []
|
24
|
+
|
25
|
+
ey_app_environments.map do |ey_app_environment|
|
24
26
|
environment_from(ey_app, ey_app_environment.environment)
|
25
27
|
end
|
26
28
|
end
|
data/lib/ey_secrets/version.rb
CHANGED
@@ -14,7 +14,11 @@ module EySecrets
|
|
14
14
|
|
15
15
|
def repository(options = {})
|
16
16
|
Repository.new(['git@git.exmaple.com:my_app_config.git'],
|
17
|
-
[
|
17
|
+
[
|
18
|
+
'production/secrets.env', 'staging/secrets.env',
|
19
|
+
'production/secrets.yml', 'staging/secrets.yml',
|
20
|
+
'production/secrets.json', 'staging/secrets.json',
|
21
|
+
],
|
18
22
|
options.fetch(:ready_for_update, true))
|
19
23
|
end
|
20
24
|
|
@@ -26,12 +30,14 @@ module EySecrets
|
|
26
30
|
}.to raise_error(Repository::NotReadyForUpdate)
|
27
31
|
end
|
28
32
|
|
29
|
-
it 'copies
|
33
|
+
it 'copies files from environment directory to instances' do
|
30
34
|
options = {app: 'my_app', environment: 'production'}
|
31
35
|
|
32
36
|
commands = Update.new(applications, repository, options).commands
|
33
37
|
|
34
38
|
expect(commands).to include('scp production/secrets.env user@host:/data/my_app/shared/config/secrets.env')
|
39
|
+
expect(commands).to include('scp production/secrets.yml user@host:/data/my_app/shared/config/secrets.yml')
|
40
|
+
expect(commands).to include('scp production/secrets.json user@host:/data/my_app/shared/config/secrets.json')
|
35
41
|
end
|
36
42
|
|
37
43
|
it 'restarts monit' do
|
@@ -10,7 +10,7 @@ module EySecrets
|
|
10
10
|
it 'returns repository uris' do
|
11
11
|
in_sandbox do
|
12
12
|
create_bare_repo('origin_repo', ['file'])
|
13
|
-
|
13
|
+
clone_repo('origin_repo', 'repo')
|
14
14
|
|
15
15
|
remotes = Git.repository('repo').remotes
|
16
16
|
|
@@ -23,7 +23,7 @@ module EySecrets
|
|
23
23
|
it 'returns paths relative to CWD' do
|
24
24
|
in_sandbox do
|
25
25
|
create_bare_repo('origin_repo', ['file', 'some/file'])
|
26
|
-
|
26
|
+
clone_repo('origin_repo', 'repo')
|
27
27
|
|
28
28
|
files = Git.repository('repo').files
|
29
29
|
|
@@ -34,7 +34,7 @@ module EySecrets
|
|
34
34
|
it 'removes leading dot' do
|
35
35
|
in_sandbox do
|
36
36
|
create_bare_repo('origin_repo', ['file'])
|
37
|
-
|
37
|
+
clone_repo('origin_repo', 'repo')
|
38
38
|
|
39
39
|
files = Dir.chdir('repo') do
|
40
40
|
Git.repository('.').files
|
@@ -49,7 +49,7 @@ module EySecrets
|
|
49
49
|
it 'is true after clone' do
|
50
50
|
in_sandbox do
|
51
51
|
create_bare_repo('origin_repo', ['file'])
|
52
|
-
|
52
|
+
clone_repo('origin_repo', 'repo')
|
53
53
|
|
54
54
|
repository = Git.repository('repo')
|
55
55
|
|
@@ -60,7 +60,7 @@ module EySecrets
|
|
60
60
|
it 'is false if repo has untracked files' do
|
61
61
|
in_sandbox do
|
62
62
|
create_bare_repo('origin_repo', ['file'])
|
63
|
-
|
63
|
+
clone_repo('origin_repo', 'repo')
|
64
64
|
`touch repo/other`
|
65
65
|
|
66
66
|
repository = Git.repository('repo')
|
@@ -72,7 +72,7 @@ module EySecrets
|
|
72
72
|
it 'is false if repo has modified files' do
|
73
73
|
in_sandbox do
|
74
74
|
create_bare_repo('origin_repo', ['file'])
|
75
|
-
|
75
|
+
clone_repo('origin_repo', 'repo')
|
76
76
|
`echo "change" > repo/file`
|
77
77
|
|
78
78
|
repository = Git.repository('repo')
|
@@ -84,7 +84,7 @@ module EySecrets
|
|
84
84
|
it 'is false if repo has unpushed commits' do
|
85
85
|
in_sandbox do
|
86
86
|
create_bare_repo('origin_repo', ['file'])
|
87
|
-
|
87
|
+
clone_repo('origin_repo', 'repo')
|
88
88
|
`(cd repo; echo "change" > file; git add .; git commit -m "change")`
|
89
89
|
|
90
90
|
repository = Git.repository('repo')
|
@@ -96,7 +96,7 @@ module EySecrets
|
|
96
96
|
it 'is true if all commits have been pushed' do
|
97
97
|
in_sandbox do
|
98
98
|
create_bare_repo('origin_repo', ['file'])
|
99
|
-
|
99
|
+
clone_repo('origin_repo', 'repo')
|
100
100
|
`(cd repo; echo "change" > file; git add .; git commit -m "change"; git push origin master 2> /dev/null)`
|
101
101
|
|
102
102
|
repository = Git.repository('repo')
|
@@ -106,17 +106,29 @@ module EySecrets
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
|
110
|
+
def clone_repo(from, to)
|
111
|
+
`git clone #{from} #{to} 2> /dev/null`
|
112
|
+
Dir.chdir(to) { configure_git_user }
|
113
|
+
end
|
114
|
+
|
109
115
|
def create_bare_repo(name, files = {})
|
110
116
|
mkdir('original_repo')
|
111
117
|
Dir.chdir('original_repo') do
|
112
118
|
`git init`
|
119
|
+
configure_git_user
|
113
120
|
files.each do |file|
|
114
121
|
mkdir_p(File.dirname(file))
|
115
122
|
touch(file)
|
116
123
|
end
|
117
124
|
`git add .; git commit -m "initial commit"`
|
118
125
|
end
|
119
|
-
`git clone --bare original_repo #{name}`
|
126
|
+
`git clone --bare original_repo #{name} 2> /dev/null`
|
127
|
+
end
|
128
|
+
|
129
|
+
def configure_git_user
|
130
|
+
`git config user.email spec@example.com`
|
131
|
+
`git config user.name "EySecrets Spec"`
|
120
132
|
end
|
121
133
|
|
122
134
|
def in_sandbox(&block)
|
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_secrets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Fischbach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: engineyard-cloud-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rainbow
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.4'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
97
|
description:
|
@@ -102,7 +102,8 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
106
107
|
- Gemfile
|
107
108
|
- LICENSE.txt
|
108
109
|
- README.md
|
@@ -142,17 +143,17 @@ require_paths:
|
|
142
143
|
- lib
|
143
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
145
|
requirements:
|
145
|
-
- -
|
146
|
+
- - ">="
|
146
147
|
- !ruby/object:Gem::Version
|
147
148
|
version: '0'
|
148
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
150
|
requirements:
|
150
|
-
- -
|
151
|
+
- - ">="
|
151
152
|
- !ruby/object:Gem::Version
|
152
153
|
version: '0'
|
153
154
|
requirements: []
|
154
155
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.5.1
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: Manage sensible configuration files accross Engine Yard instances.
|