vagrant-exec 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/LICENSE.md +1 -1
- data/README.md +7 -7
- data/Rakefile +1 -1
- data/features/step_definitions/steps.rb +4 -4
- data/features/vagrant-exec/binstubs.feature +18 -4
- data/features/vagrant-exec/directory.feature +1 -1
- data/features/vagrant-exec/environment_variables.feature +6 -6
- data/features/vagrant-exec/prepend.feature +3 -3
- data/lib/vagrant-exec/command.rb +2 -1
- data/lib/vagrant-exec/config.rb +2 -2
- data/lib/vagrant-exec/support/ssh_helper.rb +1 -1
- data/lib/vagrant-exec/templates/binstub.erb +1 -1
- data/lib/vagrant-exec/version.rb +1 -1
- data/vagrant-exec.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2776dc85cb5d8a7df0e61045fa2f1956247d0129
|
4
|
+
data.tar.gz: f42c5e89c60a7e99f1118cea5b217477dd66e8d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40f6d1b255f9f4f9e8a6791edb1425f97f03f9ae5b7021c8df6722556270365c0dd07565bca0dbb406bf4eb4e003bc4abb19d76690cc4cf9a63df81375991356
|
7
|
+
data.tar.gz: e4b0a564806da2874e4eceb3b241385e3cffe85812156d303e8987a5a794f5e2b4b8129b73d4d0fd6dff3625df5b2246d7d54bf22ff9bb442a79159bbef463c3
|
data/CHANGELOG.md
CHANGED
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -83,7 +83,7 @@ Vagrant.configure('2') do |config|
|
|
83
83
|
# ➜ vagrant exec rspec spec/
|
84
84
|
# # is the same as
|
85
85
|
# ➜ vagrant ssh -c "cd /vagrant && bundle exec rspec spec/"
|
86
|
-
config.exec.commands %w
|
86
|
+
config.exec.commands %w[rails rspec], prepend: 'bundle exec'
|
87
87
|
end
|
88
88
|
```
|
89
89
|
|
@@ -97,14 +97,14 @@ Vagrant.configure('2') do |config|
|
|
97
97
|
# ➜ vagrant exec ruby -e 'puts 1'
|
98
98
|
# # is the same as
|
99
99
|
# ➜ vagrant ssh -c "cd /vagrant && export RUBY_GC_MALLOC_LIMIT=100000000 && ruby -e 'puts 1'"
|
100
|
-
config.exec.commands 'ruby', env: {
|
100
|
+
config.exec.commands 'ruby', env: {'RUBY_GC_MALLOC_LIMIT' => 100000000}
|
101
101
|
end
|
102
102
|
```
|
103
103
|
|
104
104
|
Binstubs
|
105
105
|
----------------
|
106
106
|
|
107
|
-
It is possible
|
107
|
+
It is possible to generate binstubs for all your configured commands. You might want to do this to avoid typing `vagrant exec` every time before command, or if you want integrate your flow in editor (e.g. running tests from editor).
|
108
108
|
|
109
109
|
Assuming you have the following configuration:
|
110
110
|
|
@@ -112,8 +112,8 @@ Assuming you have the following configuration:
|
|
112
112
|
Vagrant.configure('2') do |config|
|
113
113
|
config.vm.box = 'precise32'
|
114
114
|
config.exec.commands 'bundle'
|
115
|
-
config.exec.commands %w
|
116
|
-
config.exec.commands %w
|
115
|
+
config.exec.commands %w[rails rake], prepend: 'bundle exec'
|
116
|
+
config.exec.commands %w[rspec cucumber], prepend: 'spring'
|
117
117
|
end
|
118
118
|
```
|
119
119
|
|
@@ -177,10 +177,10 @@ Note on Patches/Pull Requests
|
|
177
177
|
* Fork the project.
|
178
178
|
* Make your feature addition or bug fix.
|
179
179
|
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
180
|
-
* Commit, do not mess with
|
180
|
+
* Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
181
181
|
* Send me a pull request. Bonus points for topic branches.
|
182
182
|
|
183
183
|
Copyright
|
184
184
|
---------
|
185
185
|
|
186
|
-
Copyright (c) 2013-
|
186
|
+
Copyright (c) 2013-2015 Alex Rodionov. See LICENSE.md for details.
|
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Then(/^SHH subprocess should execute command "(.+)"$/) do |command|
|
2
|
-
ssh = %w
|
3
|
-
ssh += %w
|
4
|
-
ssh += %w
|
5
|
-
ssh += %W
|
2
|
+
ssh = %w[vagrant@127.0.0.1 -p 2200 -o Compression=yes]
|
3
|
+
ssh += %w[-o DSAAuthentication=yes -o LogLevel=FATAL]
|
4
|
+
ssh += %w[-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null]
|
5
|
+
ssh += %W[-o IdentitiesOnly=yes -i #{Dir.home}/.vagrant.d/insecure_private_key]
|
6
6
|
ssh += ['-q', '-t', "bash -l -c '#{command.delete("''")}'"]
|
7
7
|
assert_partial_output("Executing SSH in subprocess: #{ssh}", all_output)
|
8
8
|
end
|
@@ -12,7 +12,7 @@ Feature: vagrant-exec binstubs
|
|
12
12
|
Vagrant.configure('2') do |config|
|
13
13
|
config.vm.box = 'vagrant_exec'
|
14
14
|
config.exec.commands 'echo', directory: '/tmp'
|
15
|
-
config.exec.commands %w
|
15
|
+
config.exec.commands %w[pwd echo], prepend: 'test -d . &&', env: {'TEST' => 1}
|
16
16
|
end
|
17
17
|
"""
|
18
18
|
And I run `bundle exec vagrant up`
|
@@ -43,7 +43,7 @@ Feature: vagrant-exec binstubs
|
|
43
43
|
Then the exit status should be 0
|
44
44
|
And the output should contain "/vagrant"
|
45
45
|
|
46
|
-
Scenario: dumps vagrant ssh-config to file
|
46
|
+
Scenario: dumps vagrant ssh-config to file for default box
|
47
47
|
Given I write to "Vagrantfile" with:
|
48
48
|
"""
|
49
49
|
Vagrant.configure('2') do |config|
|
@@ -56,6 +56,20 @@ Feature: vagrant-exec binstubs
|
|
56
56
|
Then a file named ".vagrant/ssh_config" should exist
|
57
57
|
And the file ".vagrant/ssh_config" should contain result of vagrant ssh-config
|
58
58
|
|
59
|
+
Scenario: dumps vagrant ssh-config to file for defined box
|
60
|
+
Given I write to "Vagrantfile" with:
|
61
|
+
"""
|
62
|
+
Vagrant.configure('2') do |config|
|
63
|
+
config.vm.box = 'vagrant_exec'
|
64
|
+
config.vm.define 'vagrant'
|
65
|
+
config.exec.commands 'echo'
|
66
|
+
end
|
67
|
+
"""
|
68
|
+
And I run `bundle exec vagrant up`
|
69
|
+
When I run `bundle exec vagrant exec --binstubs`
|
70
|
+
Then a file named ".vagrant/ssh_config" should exist
|
71
|
+
And the file ".vagrant/ssh_config" should contain result of vagrant ssh-config
|
72
|
+
|
59
73
|
Scenario: respects configured shell
|
60
74
|
Given I write to "Vagrantfile" with:
|
61
75
|
"""
|
@@ -79,7 +93,7 @@ Feature: vagrant-exec binstubs
|
|
79
93
|
"""
|
80
94
|
Vagrant.configure('2') do |config|
|
81
95
|
config.vm.box = 'vagrant_exec'
|
82
|
-
config.exec.commands 'echo', env: {
|
96
|
+
config.exec.commands 'echo', env: {'TEST' => 'one two'}
|
83
97
|
end
|
84
98
|
"""
|
85
99
|
And I run `bundle exec vagrant up`
|
@@ -108,7 +122,7 @@ Feature: vagrant-exec binstubs
|
|
108
122
|
"""
|
109
123
|
Vagrant.configure('2') do |config|
|
110
124
|
config.vm.box = 'vagrant_exec'
|
111
|
-
config.exec.commands '*', env: {
|
125
|
+
config.exec.commands '*', env: {'TEST' => 'one two'}
|
112
126
|
end
|
113
127
|
"""
|
114
128
|
And I run `bundle exec vagrant up`
|
@@ -35,7 +35,7 @@ Feature: vagrant-exec directory
|
|
35
35
|
"""
|
36
36
|
Vagrant.configure('2') do |config|
|
37
37
|
config.vm.box = 'vagrant_exec'
|
38
|
-
config.exec.commands %w
|
38
|
+
config.exec.commands %w[pwd echo], directory: '/tmp'
|
39
39
|
end
|
40
40
|
"""
|
41
41
|
And I run `bundle exec vagrant up`
|
@@ -10,7 +10,7 @@ Feature: vagrant-exec environment variables
|
|
10
10
|
"""
|
11
11
|
Vagrant.configure('2') do |config|
|
12
12
|
config.vm.box = 'vagrant_exec'
|
13
|
-
config.exec.commands '*', env: {
|
13
|
+
config.exec.commands '*', env: {'TEST1' => true, 'TEST2' => false}
|
14
14
|
end
|
15
15
|
"""
|
16
16
|
And I run `bundle exec vagrant up`
|
@@ -24,7 +24,7 @@ Feature: vagrant-exec environment variables
|
|
24
24
|
Vagrant.configure('2') do |config|
|
25
25
|
config.vm.box = 'vagrant_exec'
|
26
26
|
config.exec.commands 'cmd', env: { 'TEST1' => 'yo' }
|
27
|
-
config.exec.commands %w
|
27
|
+
config.exec.commands %w[pwd echo], env: {'TEST2' => true, 'TEST3' => false}
|
28
28
|
end
|
29
29
|
"""
|
30
30
|
And I run `bundle exec vagrant up`
|
@@ -42,9 +42,9 @@ Feature: vagrant-exec environment variables
|
|
42
42
|
"""
|
43
43
|
Vagrant.configure('2') do |config|
|
44
44
|
config.vm.box = 'vagrant_exec'
|
45
|
-
config.exec.commands '*', env: {
|
46
|
-
config.exec.commands 'pwd', env: {
|
47
|
-
config.exec.commands %w
|
45
|
+
config.exec.commands '*', env: {'TEST1' => true}
|
46
|
+
config.exec.commands 'pwd', env: {'TEST2' => false}
|
47
|
+
config.exec.commands %w[pwd echo], env: {'TEST3' => false}
|
48
48
|
end
|
49
49
|
"""
|
50
50
|
And I run `bundle exec vagrant up`
|
@@ -60,7 +60,7 @@ Feature: vagrant-exec environment variables
|
|
60
60
|
"""
|
61
61
|
Vagrant.configure('2') do |config|
|
62
62
|
config.vm.box = 'vagrant_exec'
|
63
|
-
config.exec.commands 'pwd', env: {
|
63
|
+
config.exec.commands 'pwd', env: {'TEST' => 'one two'}
|
64
64
|
end
|
65
65
|
"""
|
66
66
|
And I run `bundle exec vagrant up`
|
@@ -24,7 +24,7 @@ Feature: vagrant-exec prepend
|
|
24
24
|
Vagrant.configure('2') do |config|
|
25
25
|
config.vm.box = 'vagrant_exec'
|
26
26
|
config.exec.commands 'cmd', prepend: 'echo vagrant-exec1 &&'
|
27
|
-
config.exec.commands %w
|
27
|
+
config.exec.commands %w[pwd echo], prepend: 'echo vagrant-exec2 &&'
|
28
28
|
end
|
29
29
|
"""
|
30
30
|
And I run `bundle exec vagrant up`
|
@@ -44,7 +44,7 @@ Feature: vagrant-exec prepend
|
|
44
44
|
config.vm.box = 'vagrant_exec'
|
45
45
|
config.exec.commands '*', prepend: 'echo vagrant-exec1 &&'
|
46
46
|
config.exec.commands 'pwd', prepend: 'echo vagrant-exec2 &&'
|
47
|
-
config.exec.commands %w
|
47
|
+
config.exec.commands %w[pwd echo], prepend: 'echo vagrant-exec3 &&'
|
48
48
|
end
|
49
49
|
"""
|
50
50
|
And I run `bundle exec vagrant up`
|
@@ -61,7 +61,7 @@ Feature: vagrant-exec prepend
|
|
61
61
|
Vagrant.configure('2') do |config|
|
62
62
|
config.vm.box = 'vagrant_exec'
|
63
63
|
config.exec.commands 'pwd', prepend: 'bundle exec'
|
64
|
-
config.exec.commands 'pwd', env: {
|
64
|
+
config.exec.commands 'pwd', env: {'TEST' => true}
|
65
65
|
end
|
66
66
|
"""
|
67
67
|
And I run `bundle exec vagrant up`
|
data/lib/vagrant-exec/command.rb
CHANGED
@@ -19,7 +19,7 @@ module VagrantPlugins
|
|
19
19
|
command << ' ' << cmd_args.join(' ') if cmd_args.any?
|
20
20
|
|
21
21
|
@logger.info("Executing single command on remote machine: #{command}")
|
22
|
-
ssh_opts = {
|
22
|
+
ssh_opts = {extra_args: ['-q']} # make it quiet
|
23
23
|
env = vm.action(:ssh_run, ssh_run_command: command, ssh_opts: ssh_opts)
|
24
24
|
|
25
25
|
status = env[:ssh_run_exit_status] || 0
|
@@ -93,6 +93,7 @@ module VagrantPlugins
|
|
93
93
|
command[:constructed].gsub!('"', '\"') # escape double-quotes
|
94
94
|
|
95
95
|
variables = {
|
96
|
+
ssh_host: vm.name || 'default',
|
96
97
|
ssh_config: SSH_CONFIG,
|
97
98
|
shell: shell,
|
98
99
|
command: command[:constructed],
|
data/lib/vagrant-exec/config.rb
CHANGED
@@ -33,7 +33,7 @@ module VagrantPlugins
|
|
33
33
|
if args.empty?
|
34
34
|
@commands
|
35
35
|
else
|
36
|
-
@commands << {
|
36
|
+
@commands << {cmd: args[0], opts: args[1] || {}}
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -61,7 +61,7 @@ module VagrantPlugins
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
{
|
64
|
+
{'exec' => errors}
|
65
65
|
end
|
66
66
|
|
67
67
|
def finalize!
|
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
ssh -F <%= ssh_config %> -q -t
|
2
|
+
ssh -F <%= ssh_config %> -q -t <%= ssh_host %> "<%= shell %> -c '<%= command %> $@'"
|
data/lib/vagrant-exec/version.rb
CHANGED
data/vagrant-exec.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
|
-
s.require_paths = %w
|
18
|
+
s.require_paths = %w[lib]
|
19
19
|
|
20
20
|
s.add_development_dependency 'aruba'
|
21
21
|
s.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-exec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.2.
|
105
|
+
rubygems_version: 2.2.2
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Execute commands in Vagrant synced folder
|