vagrant-exec 0.5.0 → 0.5.1

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: 4b89068882edbaa84b37d2ba85e1e590560304f3
4
- data.tar.gz: 2b75d7b7fddae121d5497ff896883fa02adda639
3
+ metadata.gz: 2776dc85cb5d8a7df0e61045fa2f1956247d0129
4
+ data.tar.gz: f42c5e89c60a7e99f1118cea5b217477dd66e8d1
5
5
  SHA512:
6
- metadata.gz: a2d2a14a6cdb183e07c4bfec1549a606348e61590b5489ce8914f33cc9d681317eaa301e8abe2fd3b191ae4e102ad55f1f3c329ff9e0a7e2bda6061ca94321fb
7
- data.tar.gz: 84098dcd483f3ae1c58ec57d7c5830432e146c0bbe89750cea35b19154edee28c8b5ecb5c128a545bb593bda4a2c7e1a728964c7dac1925233d63653de21fcc5
6
+ metadata.gz: 40f6d1b255f9f4f9e8a6791edb1425f97f03f9ae5b7021c8df6722556270365c0dd07565bca0dbb406bf4eb4e003bc4abb19d76690cc4cf9a63df81375991356
7
+ data.tar.gz: e4b0a564806da2874e4eceb3b241385e3cffe85812156d303e8987a5a794f5e2b4b8129b73d4d0fd6dff3625df5b2246d7d54bf22ff9bb442a79159bbef463c3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 0.5.0 (unreleased)
1
+ ## 0.5.1
2
+
3
+ * Fixed binstubs for defined primary VM (#10 thanks @mikechau)
4
+
5
+ ## 0.5.0
2
6
 
3
7
  * Added binstubs support
4
8
 
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2104 Alex Rodionov
1
+ Copyright (c) 2013-2015 Alex Rodionov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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(rails rspec), prepend: 'bundle exec'
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: { 'RUBY_GC_MALLOC_LIMIT' => 100000000 }
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 can 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).
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(rails rake), prepend: 'bundle exec'
116
- config.exec.commands %w(rspec cucumber), prepend: 'spring'
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 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)
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-2014 Alex Rodionov. See LICENSE.md for details.
186
+ Copyright (c) 2013-2015 Alex Rodionov. See LICENSE.md for details.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ namespace :features do
9
9
  end
10
10
 
11
11
  Cucumber::Rake::Task.new(:run) do |t|
12
- t.cucumber_opts = %w(--format pretty)
12
+ t.cucumber_opts = %w[--format pretty]
13
13
  end
14
14
 
15
15
  desc 'Removes testing vagrant box.'
@@ -1,8 +1,8 @@
1
1
  Then(/^SHH subprocess should execute command "(.+)"$/) do |command|
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)
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(pwd echo), prepend: 'test -d . &&', env: { 'TEST' => 1 }
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: { 'TEST' => 'one two' }
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: { 'TEST' => 'one two' }
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(pwd echo), directory: '/tmp'
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: { 'TEST1' => true, 'TEST2' => false }
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(pwd echo), env: { 'TEST2' => true, 'TEST3' => false }
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: { 'TEST1' => true }
46
- config.exec.commands 'pwd', env: { 'TEST2' => false }
47
- config.exec.commands %w(pwd echo), env: { 'TEST3' => false }
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: { 'TEST' => 'one two' }
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(pwd echo), prepend: 'echo vagrant-exec2 &&'
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(pwd echo), prepend: 'echo vagrant-exec3 &&'
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: { 'TEST' => true }
64
+ config.exec.commands 'pwd', env: {'TEST' => true}
65
65
  end
66
66
  """
67
67
  And I run `bundle exec vagrant up`
@@ -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 = { extra_args: ['-q'] } # make it quiet
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],
@@ -33,7 +33,7 @@ module VagrantPlugins
33
33
  if args.empty?
34
34
  @commands
35
35
  else
36
- @commands << { cmd: args[0], opts: args[1] || {} }
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
- { 'exec' => errors }
64
+ {'exec' => errors}
65
65
  end
66
66
 
67
67
  def finalize!
@@ -11,7 +11,7 @@ module VagrantPlugins
11
11
  raise Vagrant::Errors::SSHNotReady if ssh_info.nil?
12
12
 
13
13
  variables = {
14
- host_key: host || "vagrant",
14
+ host_key: host || 'vagrant',
15
15
  ssh_host: ssh_info[:host],
16
16
  ssh_port: ssh_info[:port],
17
17
  ssh_user: ssh_info[:username],
@@ -1,2 +1,2 @@
1
1
  #!/bin/bash
2
- ssh -F <%= ssh_config %> -q -t default "<%= shell %> -c '<%= command %> $@'"
2
+ ssh -F <%= ssh_config %> -q -t <%= ssh_host %> "<%= shell %> -c '<%= command %> $@'"
@@ -1,7 +1,7 @@
1
1
  module VagrantPlugins
2
2
  module Exec
3
3
 
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
 
6
6
  end # Exec
7
7
  end # VagrantPlugins
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(lib)
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.0
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: 2014-05-30 00:00:00.000000000 Z
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.0
105
+ rubygems_version: 2.2.2
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Execute commands in Vagrant synced folder