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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd24960afca58b87794380c99c0482f885d4d2a9
4
- data.tar.gz: 6ffbeeb83d025654a463bdbe3cc1fc120d538d01
3
+ metadata.gz: 94fdbc6e029b1e587bd78584afed3fcee6b9fa82
4
+ data.tar.gz: 99f625f87c6f92f46c0aed5247b760d234efdaa5
5
5
  SHA512:
6
- metadata.gz: 0cc553efd833313068883ff160cf60299db9fd1c3830246421258f010a76535ff58801fa2ef1eda153f3c59282ffea96eb8d67ce2ad93f5fca086b0c1c82daec
7
- data.tar.gz: c38e7217aff732c52ced5f67801fb6309e91a0763354b979679d12d3195a1c797b1d507324b51526d9520ededac8118c3ed6fd2af6ca8a55ad6a52a5e4564fca
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
- block.call(args, options, Net::SSH::Connection::LocalSession.new)
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
@@ -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
- environment: 'production'
21
+ env: 'production'
22
22
 
23
23
  do_unless Escualo::Env.present?(ssh, :ESCUALO_BASE_VERSION),
24
24
  'This host has already been bootstrapped',
@@ -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
@@ -18,7 +18,7 @@ command 'script' do |c|
18
18
  end
19
19
 
20
20
  step 'Running remote commands...' do
21
- Net::SSH.start($hostname, $username, $ssh_options.compact) do |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.environment)
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
@@ -1,4 +1,4 @@
1
1
  module Escualo
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  BASE_VERSION = '3.2'
4
4
  end
data/lib/escualo.rb CHANGED
@@ -1,8 +1,15 @@
1
+ require 'timeout'
2
+
3
+ def timeout(*args, &block)
4
+ Timeout.timeout(*args, &block)
5
+ end
6
+
1
7
  require 'net/ssh'
2
8
  require 'net/scp'
3
9
  require 'yaml'
4
10
  require 'mumukit/core'
5
11
 
12
+
6
13
  module Escualo
7
14
  end
8
15
 
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escualo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli