vagrant-babushka 0.1.1 → 0.1.2

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: c3e4fbf03d84d215e28bba59e99a4a4977320e97
4
- data.tar.gz: e7cb954be61dd2e063d4c1f2c1072e89f199def8
3
+ metadata.gz: 945fa78a5766333ea60149445306c614976a7871
4
+ data.tar.gz: c8c9dc4590166a89504da041e92bc041b88aec69
5
5
  SHA512:
6
- metadata.gz: 459b3436c488c3cd84e7388a14db363f2ab912771e30ca807f6daf4e23c897458d48ebe19761a70557c5b0ba2b6c73116474e8998d9b11d958d248cde919e087
7
- data.tar.gz: 04d9b502b199e485260ebb9148ff4e321c707bd73c776b668e24f2a6cee83e23f1d1925b7ca2b347680d9d124cd7844e981b8f2c63848ee605209fb8176df286
6
+ metadata.gz: 753bf4a56e36c05c0fa386b284ed57a04949e19cad9d345789016a9e895043205ca764e528758843357e129d05b41facd7cbf768b613fc269f3d3a38b45365ac
7
+ data.tar.gz: 47d0cc20dbc85047f9cc688c277dc2746fd3313052c9cdc6357961ae4cfc1239e4412129db7794bb2393039bc83c371789a69e3f4ea4f3a09a7fbfa9f6f97f86
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/README.md CHANGED
@@ -5,6 +5,8 @@ using [Babushka][2].
5
5
 
6
6
  Based on a [plugin concept][3] by @tcurdt.
7
7
 
8
+ [![Build Status](https://travis-ci.org/vvalgis/vagrant-babushka.png)](https://travis-ci.org/vvalgis/vagrant-babushka.png)
9
+
8
10
  [1]: <https://www.vagrantup.com>
9
11
  [2]: <https://babushka.me>
10
12
  [3]: <https://github.com/tcurdt/vagrant-boxes/blob/master/plugins/babushka_provisioner.rb>
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ task :default => :spec
4
+ RSpec::Core::RakeTask.new
data/dist/babushka.rb ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This is a modified version of the Babushka binary that is distributed
4
+ # with Babushka. It's been modified to ensure that stdout and stderr
5
+ # are automatically flushed when written to, and not buffered.
6
+ #
7
+ # When running inside Vagrant, this is more important than the
8
+ # performance gains associated with output buffering. This is because
9
+ # Babushka often prints messages like "installing..." during a long
10
+ # operation, and these usually aren't followed by a newline. So these
11
+ # types of messages will often sit in the buffer (unseen by the user)
12
+ # for the entire duration of the long operation. The user will only see
13
+ # the "installing" message after the next newline is printed, which
14
+ # will only happen when the installation is already complete!
15
+ $stdout.sync = true
16
+ $stderr.sync = true
17
+
18
+ # This file is what gets run when babushka is invoked from the command line.
19
+
20
+ # First, load babushka itself, by traversing from the actual location of
21
+ # this file (it might have been invoked via a symlink in the PATH) to the
22
+ # corresponding lib/babushka.rb.
23
+ require File.expand_path(
24
+ File.join(
25
+ File.dirname(File.expand_path(
26
+ File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
27
+ )),
28
+ '../lib/babushka'
29
+ )
30
+ )
31
+
32
+ # Mix in the #Dep, #dep & #meta top-level helper methods, since we're running
33
+ # standalone.
34
+ Object.send :include, Babushka::DSL
35
+
36
+ # Handle ctrl-c gracefully during babushka runs.
37
+ Babushka::Base.exit_on_interrupt!
38
+
39
+ # Invoke babushka, returning the correct exit status to the shell.
40
+ exit !!Babushka::Base.run
@@ -4,6 +4,8 @@ rescue LoadError
4
4
  raise "vagrant-babushka must be loaded from within Vagrant."
5
5
  end
6
6
 
7
+ I18n.load_path << File.expand_path("../../locales/en.yml", __FILE__)
8
+
7
9
  require "vagrant-babushka/version"
8
10
  require "vagrant-babushka/dep"
9
11
  require "vagrant-babushka/config"
@@ -98,6 +98,7 @@ module VagrantPlugins
98
98
  install_curl! unless in_path? "curl"
99
99
  create_destination!
100
100
  install_babushka!
101
+ patch_babushka_binary!
101
102
  ui.info "\n\n\n"
102
103
  end
103
104
  end
@@ -119,7 +120,8 @@ module VagrantPlugins
119
120
  config.deps.each do |dep|
120
121
  ui.info "Meeting Babushka dep '#{dep.id}'", :scope => name
121
122
  ui.info "Executing '#{command_for(dep).strip}'...", :scope => name
122
- communicate.execute command_for(dep), &log_stdout
123
+ options = {:error_key => "vagrant_babushka_provision_error"}
124
+ communicate.execute command_for(dep), options, &log_stdout
123
125
  end
124
126
  end
125
127
  end
@@ -179,6 +181,22 @@ module VagrantPlugins
179
181
  communicate.execute install_babushka_command, &log_stdout
180
182
  end
181
183
 
184
+ # Installs the patched binary distributed with this plugin
185
+ #
186
+ # The patched binary ensures stdout and stderr are unbuffered,
187
+ # so they will be flushed after every write. This avoids
188
+ # progress bars and status messages from being hidden during
189
+ # long-running processes.
190
+ #
191
+ # The patched binary is at dist/babushka.rb, relative to the
192
+ # root of this project.
193
+ def patch_babushka_binary!
194
+ ui.info "Patching Babushka binary...", :scope => name
195
+ root = File.expand_path '../..', File.dirname(__FILE__)
196
+ source = File.join root, 'dist', 'babushka.rb'
197
+ communicate.upload source, '/usr/local/bin/babushka'
198
+ end
199
+
182
200
  # The command used to install Babushka on the virtual machine
183
201
  def install_babushka_command
184
202
  %Q[#{vars} sh -c "`#{vars} curl #{escape config.bootstrap_url}`"]
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Babushka
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
data/locales/en.yml ADDED
@@ -0,0 +1,6 @@
1
+ en:
2
+ vagrant:
3
+ errors:
4
+ vagrant_babushka_provision_error: |-
5
+ An error occurred during the last Babushka run. Please check
6
+ the output above for information about what went wrong.
@@ -60,6 +60,7 @@ describe VagrantPlugins::Babushka::Provisioner do
60
60
  expect(provisioner).to receive(:install_curl!)
61
61
  expect(provisioner).to receive(:create_destination!)
62
62
  expect(provisioner).to receive(:install_babushka!)
63
+ expect(provisioner).to receive(:patch_babushka_binary!)
63
64
  expect(ui).to receive(:info).with("\n\n\n")
64
65
  subject.prepare
65
66
  end
@@ -71,6 +72,7 @@ describe VagrantPlugins::Babushka::Provisioner do
71
72
  expect(provisioner).to_not receive(:install_curl!)
72
73
  expect(provisioner).to receive(:create_destination!)
73
74
  expect(provisioner).to receive(:install_babushka!)
75
+ expect(provisioner).to receive(:patch_babushka_binary!)
74
76
  expect(ui).to receive(:info).with("\n\n\n")
75
77
  subject.prepare
76
78
  end
@@ -112,9 +114,9 @@ describe VagrantPlugins::Babushka::Provisioner do
112
114
  expect(ui).to receive(:info).with("Meeting Babushka dep 'the dep 2'", :scope => "the name")
113
115
  expect(ui).to receive(:info).with("Executing 'bar'...", :scope => "the name")
114
116
  expect(provisioner).to receive(:command_for).with(dep1).twice().and_return("foo")
115
- expect(communicate).to receive(:execute).with("foo")
117
+ expect(communicate).to receive(:execute).with("foo", :error_key => "vagrant_babushka_provision_error")
116
118
  expect(provisioner).to receive(:command_for).with(dep2).twice().and_return("bar")
117
- expect(communicate).to receive(:execute).with("bar")
119
+ expect(communicate).to receive(:execute).with("bar", :error_key => "vagrant_babushka_provision_error")
118
120
  subject.do_babushka_run
119
121
  end
120
122
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-babushka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Valgis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-25 00:00:00.000000000 Z
12
+ date: 2013-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -76,17 +76,20 @@ extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
78
  - .gitignore
79
+ - .travis.yml
79
80
  - Gemfile
80
81
  - LICENSE.txt
81
82
  - README.md
82
83
  - Rakefile
83
84
  - Vagrantfile
85
+ - dist/babushka.rb
84
86
  - lib/vagrant-babushka.rb
85
87
  - lib/vagrant-babushka/config.rb
86
88
  - lib/vagrant-babushka/dep.rb
87
89
  - lib/vagrant-babushka/plugin.rb
88
90
  - lib/vagrant-babushka/provisioner.rb
89
91
  - lib/vagrant-babushka/version.rb
92
+ - locales/en.yml
90
93
  - spec/spec_helper.rb
91
94
  - spec/unit/vagrant-babushka/config_spec.rb
92
95
  - spec/unit/vagrant-babushka/dep_spec.rb