secret_service 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/secret_service/capistrano.rb +21 -19
- data/lib/secret_service/version.rb +1 -1
- metadata +1 -1
@@ -1,27 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
if stream == :out and out =~ /^Enter/
|
7
|
-
input.send_data STDIN.gets
|
8
|
-
end
|
1
|
+
def run_with_prompt(command)
|
2
|
+
run command do |input, stream, out|
|
3
|
+
puts out
|
4
|
+
if stream == :out and out =~ /^Enter/
|
5
|
+
input.send_data STDIN.gets
|
9
6
|
end
|
10
7
|
end
|
8
|
+
end
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
rake = fetch(:rake, "rake")
|
15
|
-
rails_env = fetch(:rails_env, "production")
|
10
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
11
|
+
namespace :secret_service do
|
16
12
|
|
17
|
-
|
18
|
-
|
13
|
+
desc "Store a secret using secret_service"
|
14
|
+
task :store, :roles => :db, :only => { :primary => true } do
|
15
|
+
rake = fetch(:rake, "rake")
|
16
|
+
rails_env = fetch(:rails_env, "production")
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
run_with_prompt("cd #{current_path} && #{rake} RAILS_ENV=#{rails_env} secret_service:store")
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Show a secret previously stored with secret_service"
|
22
|
+
task :show, :roles => :db, :only => { :primary => true } do
|
23
|
+
rake = fetch(:rake, "rake")
|
24
|
+
rails_env = fetch(:rails_env, "production")
|
24
25
|
|
25
|
-
|
26
|
+
run_with_prompt("cd #{current_path} && #{rake} RAILS_ENV=#{rails_env} secret_service:show")
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|