escualo 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/command.rb +2 -4
- data/lib/commands/bootstrap.rb +1 -1
- data/lib/commands/globals.rb +8 -1
- data/lib/commands/script.rb +1 -1
- data/lib/escualo/env.rb +2 -1
- data/lib/escualo/version.rb +1 -1
- data/lib/escualo.rb +7 -0
- data/lib/ssh/local_session.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94fdbc6e029b1e587bd78584afed3fcee6b9fa82
|
4
|
+
data.tar.gz: 99f625f87c6f92f46c0aed5247b760d234efdaa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010338220fb75ac626f542cea1dc4a215f5474fcb08c633318e5cd87994590af13cadeee49edf5928d15147838dc390e5367dd5b94ebd9bfc0667ee80b778955
|
7
|
+
data.tar.gz: 79ff646ed04f46ba5544d7a7313c58ba0f2f7317bddaa65e3edaf5fb95b49b1f04bfea90d4343f1dcbf229c93c4f820ee9d909a144c75d9ebb60fb64c254e877
|
data/lib/command.rb
CHANGED
@@ -3,12 +3,10 @@ class Commander::Command
|
|
3
3
|
action do |args, options|
|
4
4
|
if $ssh_remote
|
5
5
|
say "Connecting to remote host #{$hostname}... " if options.verbose
|
6
|
-
Net::SSH.start($hostname, $username, $ssh_options.compact) do |ssh|
|
7
|
-
block.call(args, options, ssh)
|
8
|
-
end
|
9
6
|
else
|
10
|
-
|
7
|
+
say 'Running commands locally... ' if options.verbose
|
11
8
|
end
|
9
|
+
Net::SSH.with_session(ssh_session_options) { |ssh| block.call(args, options, ssh) }
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
data/lib/commands/bootstrap.rb
CHANGED
@@ -18,7 +18,7 @@ command 'bootstrap' do |c|
|
|
18
18
|
c.ssh_action do |_args, options, ssh|
|
19
19
|
ask_monit_password(options) unless options.monit_password || options.no_monit
|
20
20
|
options.default monit_version: '5.16',
|
21
|
-
|
21
|
+
env: 'production'
|
22
22
|
|
23
23
|
do_unless Escualo::Env.present?(ssh, :ESCUALO_BASE_VERSION),
|
24
24
|
'This host has already been bootstrapped',
|
data/lib/commands/globals.rb
CHANGED
@@ -31,4 +31,11 @@ global_option '--ssh-port PORT', String, 'The ssh port to connect. Defaults to 2
|
|
31
31
|
$ssh_remote = true
|
32
32
|
end
|
33
33
|
|
34
|
-
global_option '--verbose', TrueClass, 'Dumps extra output'
|
34
|
+
global_option '--verbose', TrueClass, 'Dumps extra output'
|
35
|
+
|
36
|
+
def ssh_session_options
|
37
|
+
$ssh_options.merge(
|
38
|
+
username: $username,
|
39
|
+
hostname: $hostname,
|
40
|
+
local: !$ssh_remote).compact
|
41
|
+
end
|
data/lib/commands/script.rb
CHANGED
@@ -18,7 +18,7 @@ command 'script' do |c|
|
|
18
18
|
end
|
19
19
|
|
20
20
|
step 'Running remote commands...' do
|
21
|
-
Net::SSH.
|
21
|
+
Net::SSH.with_session(ssh_session_options) do |ssh|
|
22
22
|
run_commands_for! file['remote'], ssh, options
|
23
23
|
end
|
24
24
|
end
|
data/lib/escualo/env.rb
CHANGED
@@ -13,7 +13,7 @@ module Escualo
|
|
13
13
|
def self.set_builtins(ssh, options)
|
14
14
|
set ssh, ESCUALO_BASE_VERSION: Escualo::BASE_VERSION
|
15
15
|
set ssh, Escualo::Env.locale_variables
|
16
|
-
set ssh, Escualo::Env.environment_variables(options.
|
16
|
+
set ssh, Escualo::Env.environment_variables(options.env)
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.list(ssh)
|
@@ -21,6 +21,7 @@ module Escualo
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.clean(ssh, options)
|
24
|
+
options.env = get(ssh, 'RACK_ENV').split('=').second.strip
|
24
25
|
ssh.exec!("rm ~/.escualo/vars/*")
|
25
26
|
set_builtins ssh, options
|
26
27
|
end
|
data/lib/escualo/version.rb
CHANGED
data/lib/escualo.rb
CHANGED
data/lib/ssh/local_session.rb
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'open3'
|
3
3
|
|
4
|
+
module Net::SSH
|
5
|
+
def self.with_session(options, &block)
|
6
|
+
if options.delete(:local)
|
7
|
+
block.call(Net::SSH::Connection::LocalSession.new)
|
8
|
+
else
|
9
|
+
start(options.delete(:hostname),
|
10
|
+
options.delete(:username),
|
11
|
+
options.compact) do |ssh|
|
12
|
+
block.call(ssh)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
class Net::SSH::Connection::LocalSession
|
5
19
|
include Net::SSH::Connection::Perform
|
6
20
|
include Net::SSH::Connection::Upload
|