escualo 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OWY3ZjE5YWNiNGZhZWFiZGJkZWExNzdiOTZkZWNlYzI0NWFkMzMyOA==
5
- data.tar.gz: !binary |-
6
- MzJiM2MxMjcxMmY0Mzk5M2Y5ZjMyMTU4MTMwYWUxMjQ2M2U1YTYxYQ==
2
+ SHA1:
3
+ metadata.gz: a7735e5b6aa9c1a1865ec1719c0b0628239dd98d
4
+ data.tar.gz: fc8f3fa5e936c4146a0d14c64d4c20ce7f4dce28
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZGM5Yjg4NDNlYWRmZDQwOGVlYjA5OTJhYjk1YjIwNjVhY2ExNTFiY2I1OWYw
10
- YmVmOTE1MTFmODgxZGFjYTJkMjY2YzhjM2U5YTU5NzI0YzU2ZTA3M2YxMjQz
11
- ZDNmOWY3MjViNDU5ZDY1ZDMwMWQ2OGZjZTFjY2ZlODhiNDY2Yzk=
12
- data.tar.gz: !binary |-
13
- NGQxNTY2MmFhNzRkYmRlZTYzODhiZWIyNDM2MDhjNmYzZTBjYmYyZWJjOTc5
14
- Y2ZmZTIyMDAyMWJkMzJkMWZkN2Q0MmM4ZjRhNjYwYzNmNjRkYTlmNjE4Y2Ey
15
- MzBmM2ZlYThjMzc2NWEyMjczMDUwMjNkMjM4ZGQ0MDFlNjdhODU=
6
+ metadata.gz: 829ce07501eaa8ccd5c863a0b8851e12765f8bae79e066fa4f6c73807f96748b7d6136e4464336b357720af33bdca93299f369804f451b8d5fe496ccf7e8953e
7
+ data.tar.gz: 2ea012c64d7bf9e43d6c21ad5a8c4a3ac26186b0964aa675de7e1604d0d75db1c1f0c8cf8fbf36a2cfd2ce908306cd9d016d183457998717db556b69eb1c9308
data/lib/command.rb CHANGED
@@ -1,8 +1,13 @@
1
1
  class Commander::Command
2
2
  def ssh_action(&block)
3
3
  action do |args, options|
4
- Net::SSH.start($hostname, $username, $ssh_options.compact) do |ssh|
5
- block.call(args, options, ssh)
4
+ if $ssh_remote
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
+ else
10
+ block.call(args, options, Net::SSH::Connection::LocalSession.new)
6
11
  end
7
12
  end
8
13
  end
data/lib/escualo.rb CHANGED
@@ -1,18 +1,17 @@
1
1
  require 'net/ssh'
2
2
  require 'net/scp'
3
- require 'securerandom'
4
3
  require 'yaml'
5
4
  require 'mumukit/core'
6
5
 
7
6
  module Escualo
8
7
  end
9
8
 
10
- require_relative './session'
11
9
  require_relative './template'
10
+ require_relative './ssh'
12
11
 
13
12
  require_relative './escualo/version'
14
13
  require_relative './escualo/env'
15
14
  require_relative './escualo/bootstrap'
16
15
  require_relative './escualo/plugin'
17
16
  require_relative './escualo/remote'
18
- require_relative './escualo/artifact'
17
+ require_relative './escualo/artifact'
data/lib/ssh.rb ADDED
@@ -0,0 +1,4 @@
1
+ require_relative './ssh/perform'
2
+ require_relative './ssh/upload'
3
+ require_relative './ssh/local_session'
4
+ require_relative './ssh/session'
metadata CHANGED
@@ -1,144 +1,145 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escualo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-28 00:00:00.000000000 Z
11
+ date: 2016-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '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: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: net-ssh
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: net-scp
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '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: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mumukit-core
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
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: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.11'
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: '1.11'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.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: '10.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '3.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.0'
111
- description: ! "escualo.rb is command-line tools that implements of the escualo provisioning
112
- format used by Mumuki Platform.\n It allows to deploy mumuki
113
- artifacts to any host"
111
+ description: |-
112
+ escualo.rb is command-line tools that implements of the escualo provisioning format used by Mumuki Platform.
113
+ It allows to deploy mumuki artifacts to any host
114
114
  email:
115
115
  - flbulgarelli@yahoo.com.ar
116
- executables: []
116
+ executables:
117
+ - escualo
117
118
  extensions: []
118
119
  extra_rdoc_files: []
119
120
  files:
120
121
  - bin/escualo
121
122
  - lib/command.rb
122
123
  - lib/escualo.rb
123
- - lib/session.rb
124
+ - lib/ssh.rb
124
125
  - lib/template.rb
125
126
  homepage: http://github.com/mumuki/escualo.rb
126
127
  licenses:
127
128
  - MIT
128
129
  metadata:
129
- allowed_push_host: ! 'TODO: Set to ''http://mygemserver.com'''
130
+ allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
130
131
  post_install_message:
131
132
  rdoc_options: []
132
133
  require_paths:
133
134
  - lib
134
135
  required_ruby_version: !ruby/object:Gem::Requirement
135
136
  requirements:
136
- - - ! '>='
137
+ - - ">="
137
138
  - !ruby/object:Gem::Version
138
139
  version: '0'
139
140
  required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  requirements:
141
- - - ! '>='
142
+ - - ">="
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
data/lib/session.rb DELETED
@@ -1,64 +0,0 @@
1
- class Net::SSH::Connection::Session
2
- def upload_template!(destination, name, bindings)
3
- Mumukit::Core::Template
4
- .new(File.join(__dir__, 'templates', "#{name}.erb"), bindings)
5
- .with_tempfile!('template') do |file|
6
- scp.upload! file, destination
7
- end
8
- end
9
-
10
- def tell!(command)
11
- channel = self.open_channel do |ch|
12
- ch.exec command do |ch, success|
13
- raise 'could not execute command' unless success
14
- ch.on_data do |c, data|
15
- $stdout.print data
16
- end
17
- ch.on_extended_data do |c, type, data|
18
- $stderr.print data
19
- end
20
- end
21
- end
22
- channel.wait
23
- end
24
-
25
- def shell
26
- Shell.new self
27
- end
28
-
29
- def perform!(command, options)
30
- if options.verbose
31
- tell! command
32
- else
33
- exec! command
34
- end
35
- end
36
-
37
- class Shell
38
- attr_reader :ssh
39
-
40
- def initialize(ssh)
41
- @ssh = ssh
42
- end
43
-
44
- def perform!(command, options)
45
- ssh.perform! wrap(command), options
46
- end
47
-
48
- def exec!(command)
49
- ssh.exec! wrap(command)
50
- end
51
-
52
- def tell!(command)
53
- ssh.tell! wrap(command)
54
- end
55
-
56
- private
57
-
58
- def wrap(command)
59
- "bash -i -s <<EOBASH
60
- #{command}
61
- EOBASH"
62
- end
63
- end
64
- end