busser 0.6.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7b72fd59135ca003d371dd87f7424b419b1c6b4c
4
- data.tar.gz: b54e624af6811629926648fb49b9506e8c3b4def
2
+ SHA256:
3
+ metadata.gz: 461cec059616e39a6f7f86d6c7bf2478e36116fab040dc2b9076dc09641963c7
4
+ data.tar.gz: 2a21f5a58dc7a107b6af55e86a267143f3d9d5212b8590b3d0996ac182625074
5
5
  SHA512:
6
- metadata.gz: e884518990da3a8a31c6076e2f9cbd386b5ef3aa940e70c8d346010f425418ec14cd5372e92aa0e8fb32ba50356b6188ce473b37bd18f9f9cb476525b9eab666
7
- data.tar.gz: a806bd91b9f165c6588c54b5ae69a6ba9972be466fa5b5ad3327355697f5e08310c002c33662a032fe98300e3dd612bc0118c9620f3ce7468a37896b2f357384
6
+ metadata.gz: d2f10dfebb25a155b78f91a0d9b06d7f06fe5bf33174c48ee5078543d271a44f1cdb040ca8ed54ce26c9b3210b5264c5e7e89406b6669f8a1e9126bec1063979
7
+ data.tar.gz: b29b1a3e4a4392dd74a6a4f0e2d3475b267bdd253b3d745da2687b44621777ae95c34beef7db82102a48dcdac6f1de22e1e7ef0ee6fa27e7e54d913ad3be2cda
data/.simplecov CHANGED
@@ -1,4 +1,4 @@
1
- SimpleCov.adapters.define 'gem' do
1
+ SimpleCov.profiles.define 'gem' do
2
2
  command_name 'Specs'
3
3
 
4
4
  add_filter '.gem/'
@@ -1,28 +1,52 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.0.0
5
- - 1.9.3
6
- - 1.9.2
7
- - ruby-head
4
+ - 2.2
5
+ - 2.1
6
+ - 2.0.0
7
+ - 1.9.3
8
+ - ruby-head
8
9
 
9
10
  env:
10
- - RUBYGEMS_VERSION=2.0.3 CHEF_VERSION=11.8.0
11
- - RUBYGEMS_VERSION=2.0.3 CHEF_VERSION=10.28.2
12
- - RUBYGEMS_VERSION=1.8.25 CHEF_VERSION=11.8.0
13
- - RUBYGEMS_VERSION=1.8.25 CHEF_VERSION=10.28.2
11
+ - RUBYGEMS_VERSION=
12
+ - RUBYGEMS_VERSION=2.4.5
13
+ - RUBYGEMS_VERSION=2.2.2
14
+ - RUBYGEMS_VERSION=2.1.11
15
+ - RUBYGEMS_VERSION=2.0.14
16
+ - RUBYGEMS_VERSION=1.8.29
14
17
 
15
18
  before_install:
16
- - gem update --system $RUBYGEMS_VERSION
19
+ - if [ -n "$RUBYGEMS_VERSION" ]; then gem update --system $RUBYGEMS_VERSION; fi
17
20
  - gem --version
18
21
 
19
22
  bundler_args: --without guard
20
23
 
24
+ sudo: false
25
+
21
26
  matrix:
22
- exclude:
23
- - rvm: 2.0.0
24
- env: RUBYGEMS_VERSION=1.8.25 CHEF_VERSION=10.28.2
25
- - rvm: 2.0.0
26
- env: RUBYGEMS_VERSION=1.8.25 CHEF_VERSION=11.8.0
27
27
  allow_failures:
28
- - rvm: ruby-head
28
+ - rvm: ruby-head
29
+ exclude:
30
+ - rvm: 2.2
31
+ env: RUBYGEMS_VERSION=2.2.2
32
+ - rvm: 2.2
33
+ env: RUBYGEMS_VERSION=2.1.11
34
+ - rvm: 2.2
35
+ env: RUBYGEMS_VERSION=2.0.14
36
+ - rvm: 2.2
37
+ env: RUBYGEMS_VERSION=1.8.29
38
+ - rvm: 2.1
39
+ env: RUBYGEMS_VERSION=1.8.29
40
+ - rvm: 2.0.0
41
+ env: RUBYGEMS_VERSION=1.8.29
42
+ - rvm: ruby-head
43
+ env: RUBYGEMS_VERSION=2.2.2
44
+ - rvm: ruby-head
45
+ env: RUBYGEMS_VERSION=2.1.11
46
+ - rvm: ruby-head
47
+ env: RUBYGEMS_VERSION=2.0.14
48
+ - rvm: ruby-head
49
+ env: RUBYGEMS_VERSION=1.8.29
50
+
51
+ notifications:
52
+ irc: "chat.freenode.net#kitchenci"
@@ -1,3 +1,41 @@
1
+ ## 0.8.0 / 2020-08-20
2
+
3
+ - Add http_proxy support to `busser plugin install`
4
+ - Use a SPDX compliant license string in the gemspec
5
+ - Remove the pin to bundler 1.x in the development gems
6
+ - Misc readme updates
7
+ - Add testing with Appveyor
8
+ - Pin the Aruba dev dep to prevent API churn
9
+
10
+ ## 0.7.1 / 2015-04-20
11
+
12
+ ### Bug fixes
13
+
14
+ * Pull request [#23][]: Dir.glob does not accept `/` but on windows hosts uses `/` when joining path segments - expanding the path corrects this. ([@tyler-ball][])
15
+
16
+ ## 0.7.0 / 2015-03-19
17
+
18
+ ### Bug fixes
19
+
20
+ * Pull request [#20][], issue [#17][]: Better detection of failed forked subprocess in `#run_ruby_script!` & `#run!`. ([@fnichol][], [@tyler-ball][], [@tknerr][])
21
+
22
+ ### New features
23
+
24
+ * Add optional `--type bat` flag to `busser setup` to support Windows platforms. ([@fnichol][])
25
+
26
+ ### Improvements
27
+
28
+ * Simplify busser binstub for more conservative bourne shell support. ([@fnichol][])
29
+ * Pull request [#15][]: Fix spelling in `busser test`. ([@obazoud][])
30
+
31
+
32
+ ## 0.6.2 / 2014-03-23
33
+
34
+ ### Bug fixes
35
+
36
+ * Pull request [#8][]: Invoke prepare.sh scripts with /bin/sh for platforms without bash. ([@fnichol][])
37
+
38
+
1
39
  ## 0.6.1 / 2014-03-23
2
40
 
3
41
  ### Bug fixes
@@ -99,7 +137,15 @@
99
137
  [#5]: https://github.com/test-kitchen/busser/issues/5
100
138
  [#6]: https://github.com/test-kitchen/busser/issues/6
101
139
  [#7]: https://github.com/test-kitchen/busser/issues/7
140
+ [#8]: https://github.com/test-kitchen/busser/issues/8
141
+ [#15]: https://github.com/test-kitchen/busser/issues/15
142
+ [#17]: https://github.com/test-kitchen/busser/issues/17
143
+ [#20]: https://github.com/test-kitchen/busser/issues/20
144
+ [#23]: https://github.com/test-kitchen/busser/issues/23
102
145
  [@fnichol]: https://github.com/fnichol
103
146
  [@jtimberman]: https://github.com/jtimberman
104
147
  [@neuhalje]: https://github.com/neuhalje
105
- [@sawanoboly]: https://github.com/sawanoboly
148
+ [@obazoud]: https://github.com/obazoud
149
+ [@sawanoboly]: https://github.com/sawanoboly
150
+ [@tknerr]: https://github.com/tknerr
151
+ [@tyler-ball]: https://github.com/tyler-ball
data/Gemfile CHANGED
@@ -3,15 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :guard do
6
- gem 'rb-inotify', :require => false
7
- gem 'rb-fsevent', :require => false
8
- gem 'rb-fchange', :require => false
9
6
  gem 'guard-minitest'
10
7
  gem 'guard-cucumber'
11
8
  gem 'guard-cane'
12
9
  end
13
-
14
- group :test do
15
- # allow CI to override the version of Chef for matrix testing
16
- gem 'chef', (ENV['CHEF_VERSION'] || '>= 0.10.10')
17
- end
data/README.md CHANGED
@@ -1,13 +1,18 @@
1
1
  # Busser
2
2
 
3
- [![Build Status](https://travis-ci.org/test-kitchen/busser.png?branch=master)](https://travis-ci.org/test-kitchen/busser)
4
- [![Code Climate](https://codeclimate.com/github/test-kitchen/busser.png)](https://codeclimate.com/github/test-kitchen/busser)
3
+ [![Gem Version](https://badge.fury.io/rb/busser.svg)](http://badge.fury.io/rb/busser)
4
+ [![Build Status](https://travis-ci.org/test-kitchen/busser.svg?branch=master)](https://travis-ci.org/test-kitchen/busser)
5
+ [![Code Climate](https://codeclimate.com/github/test-kitchen/busser.svg)](https://codeclimate.com/github/test-kitchen/busser)
5
6
 
6
7
  Busser is a test setup and execution framework designed to
7
8
  work on remote nodes whose system dependencies cannot be relied upon, except
8
9
  for an Omnibus installation of Chef. It uses a plugin architecture to add
9
10
  support for different testing strategies such minitest, cucumber, bash, etc.
10
11
 
12
+ ## Status
13
+
14
+ This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.
15
+
11
16
  ## Installation
12
17
 
13
18
  Add this line to your application's Gemfile:
data/Rakefile CHANGED
@@ -2,7 +2,6 @@ require "bundler/gem_tasks"
2
2
  require 'rake/testtask'
3
3
  require 'cucumber/rake/task'
4
4
  require 'cane/rake_task'
5
- require 'tailor/rake_task'
6
5
 
7
6
  Rake::TestTask.new(:unit) do |t|
8
7
  t.libs.push "lib"
@@ -11,7 +10,7 @@ Rake::TestTask.new(:unit) do |t|
11
10
  end
12
11
 
13
12
  Cucumber::Rake::Task.new(:features) do |t|
14
- t.cucumber_opts = ['features', '-x', '--format progress']
13
+ t.cucumber_opts = ['features', '-x', '--format progress', '--no-color', '-b']
15
14
  end
16
15
 
17
16
  desc "Run all test suites"
@@ -22,8 +21,6 @@ Cane::RakeTask.new do |cane|
22
21
  cane.canefile = './.cane'
23
22
  end
24
23
 
25
- Tailor::RakeTask.new
26
-
27
24
  desc "Display LOC stats"
28
25
  task :stats do
29
26
  puts "\n## Production Code Stats"
@@ -33,6 +30,6 @@ task :stats do
33
30
  end
34
31
 
35
32
  desc "Run all quality tasks"
36
- task :quality => [:cane, :tailor, :stats]
33
+ task :quality => [:cane, :stats]
37
34
 
38
35
  task :default => [:test, :quality]
@@ -0,0 +1,36 @@
1
+ version: "master-{build}"
2
+
3
+ os: Windows Server 2012 R2
4
+ platform:
5
+ - x64
6
+
7
+ environment:
8
+ matrix:
9
+ - ruby_version: "200-x64"
10
+ - ruby_version: "21"
11
+
12
+ clone_folder: c:\projects\busser
13
+ clone_depth: 1
14
+ skip_tags: true
15
+ branches:
16
+ only:
17
+ - master
18
+
19
+ install:
20
+ - systeminfo
21
+ - winrm quickconfig -q
22
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
23
+ - echo %PATH%
24
+ - ruby --version
25
+ - gem install bundler --quiet --no-ri --no-rdoc || gem install bundler --quiet --no-ri --no-rdoc || gem install bundler --quiet --no-ri --no-rdoc
26
+ - gem install rubygems-pkg/rubygems-update-2.4.6.gem
27
+ - update_rubygems
28
+ - gem --version
29
+ - bundler --version
30
+
31
+ build_script:
32
+ - bundle install || bundle install || bundle install
33
+
34
+ test_script:
35
+ - SET SPEC_OPTS=--format progress
36
+ - bundle exec rake
data/bin/busser CHANGED
@@ -2,7 +2,7 @@
2
2
  # -*- encoding: utf-8 -*-
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), %w{.. lib})
5
- require 'rubygems'
5
+ require 'rubygems' unless defined?(Gem)
6
6
  require 'busser/cli'
7
7
 
8
8
  Busser::CLI.start
@@ -22,17 +22,13 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'thor', '<= 0.19.0'
24
24
 
25
- spec.add_development_dependency "chef"
26
-
27
- spec.add_development_dependency "bundler", "~> 1.3"
28
- spec.add_development_dependency "rake"
25
+ spec.add_development_dependency 'aruba', "0.7.4"
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency 'cane'
28
+ spec.add_development_dependency 'countloc'
29
+ spec.add_development_dependency 'fakefs'
29
30
  spec.add_development_dependency 'minitest'
30
31
  spec.add_development_dependency 'mocha'
31
- spec.add_development_dependency 'fakefs'
32
- spec.add_development_dependency 'aruba'
33
-
34
- spec.add_development_dependency 'cane'
35
- spec.add_development_dependency 'tailor'
32
+ spec.add_development_dependency "rake"
36
33
  spec.add_development_dependency 'simplecov'
37
- spec.add_development_dependency 'countloc'
38
34
  end
@@ -7,11 +7,28 @@ Feature: Setup command
7
7
  Given a test BUSSER_ROOT directory named "busser-setup"
8
8
  And I delete the BUSSER_ROOT directory
9
9
 
10
- Scenario: Busser home is set up
11
- Given I run `busser setup`
10
+ Scenario: Busser home is set up with bourne binstub
11
+ Given I run `busser setup --type bourne`
12
12
  Then the BUSSER_ROOT directory should exist
13
13
  And a busser binstub file should contain:
14
14
  """
15
15
  This file was generated by Busser.
16
16
  """
17
+ And a busser binstub file should contain:
18
+ """
19
+ export BUSSER_ROOT
20
+ """
21
+ And the exit status should be 0
22
+
23
+ Scenario: Busser home is set up with bat binstub
24
+ Given I run `busser setup --type bat`
25
+ Then the BUSSER_ROOT directory should exist
26
+ And a bat busser binstub file should contain:
27
+ """
28
+ REM This file was generated by Busser.
29
+ """
30
+ And a bat busser binstub file should contain:
31
+ """
32
+ SET "BUSSER_EXIT_STATUS=%ERRORLEVEL%"
33
+ """
17
34
  And the exit status should be 0
@@ -1,9 +1,10 @@
1
- require 'simplecov'
2
1
  require 'aruba/cucumber'
3
-
4
2
  require 'busser/cucumber'
5
3
 
6
- SimpleCov.command_name "features"
4
+ if ENV["COVERAGE"]
5
+ require 'simplecov'
6
+ SimpleCov.command_name "features"
7
+ end
7
8
 
8
9
  Before do
9
10
  @aruba_timeout_seconds = 20
@@ -16,7 +16,7 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'pathname'
19
+ require 'pathname' unless defined?(Pathname)
20
20
 
21
21
  require 'busser/version'
22
22
 
@@ -37,6 +37,7 @@ module Busser
37
37
 
38
38
  register Busser::Command::Setup, "setup",
39
39
  "setup", "Creates a Busser home"
40
+ tasks["setup"].options = Busser::Command::Setup.class_options
40
41
 
41
42
  register Busser::Command::Plugin, "plugin",
42
43
  "plugin SUBCOMMAND", "Plugin subcommands"
@@ -16,8 +16,8 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'base64'
20
- require 'digest'
19
+ require 'base64' unless defined?(Base64)
20
+ require 'digest' unless defined?(Digest)
21
21
 
22
22
  require 'busser/thor'
23
23
 
@@ -16,7 +16,7 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'openssl'
19
+ require 'openssl' unless defined?(OpenSSL)
20
20
 
21
21
  require 'busser/rubygems'
22
22
  require 'busser/thor'
@@ -38,7 +38,15 @@ module Busser
38
38
  class_option :force_postinstall, :type => :boolean, :default => false,
39
39
  :desc => "Run the plugin's postinstall if it is already installed"
40
40
 
41
+ class_option :verbose, :type => :boolean, :default => false,
42
+ :desc => "Set a more verbose output"
43
+
41
44
  def install_all
45
+ if options[:verbose]
46
+ Gem.configuration.verbose = 2 if options[:verbose]
47
+ info("Using http_proxy=#{rbg_options[:http_proxy].inspect}")
48
+ end
49
+
42
50
  silence_gem_ui do
43
51
  plugins.each { |plugin| install(plugin) }
44
52
  end
@@ -29,6 +29,10 @@ module Busser
29
29
  #
30
30
  class Setup < Busser::Thor::BaseGroup
31
31
 
32
+ class_option :type,
33
+ :desc => "Type of binstub file to create (bourne or bat)",
34
+ :default => "bourne"
35
+
32
36
  def perform
33
37
  banner "Setting up Busser"
34
38
  create_busser_root
@@ -43,9 +47,58 @@ module Busser
43
47
  end
44
48
 
45
49
  def generate_busser_binstub
50
+ info "Creating busser binstub"
51
+
52
+ if options[:type] == "bat"
53
+ generate_busser_binstub_for_bat
54
+ else
55
+ generate_busser_binstub_for_bourne
56
+ end
57
+ end
58
+
59
+ def generate_busser_binstub_for_bat
60
+ binstub = root_path + "bin/busser.bat"
61
+ busser_root = root_path.to_s.gsub("/", "\\")
62
+
63
+ File.unlink(binstub) if File.exists?(binstub)
64
+ create_file(binstub, :verbose => false) do
65
+ <<-BUSSER_BINSTUB.gsub(/^ {12}/, '')
66
+ @ECHO OFF
67
+ REM This file was generated by Busser.
68
+ REM
69
+ REM The application 'busser' is installed as part of a gem, and
70
+ REM this file is here to facilitate running it.
71
+
72
+ REM Make sure any variables we set exist only for this batch file
73
+ SETLOCAL
74
+
75
+ REM Set Busser Root Path
76
+ SET "BUSSER_ROOT=#{busser_root}"
77
+
78
+ REM Export gem paths so that we use the isolated gems.
79
+ SET "GEM_HOME=#{gem_home}"
80
+ SET "GEM_PATH=#{gem_path}"
81
+ SET "GEM_CACHE=#{gem_home}\\cache"
82
+
83
+ REM Unset RUBYOPT, we don't want this bleeding into our runtime.
84
+ SET RUBYOPT=
85
+ SET GEMRC=
86
+
87
+ REM Call the actual Busser bin with our arguments
88
+ "#{ruby_bin}" "#{gem_bindir}\\busser" %*
89
+
90
+ REM Store the exit status so we can re-use it later
91
+ SET "BUSSER_EXIT_STATUS=%ERRORLEVEL%"
92
+
93
+ REM Exit with the proper exit status from Busser
94
+ exit /b %BUSSER_EXIT_STATUS%
95
+ BUSSER_BINSTUB
96
+ end
97
+ end
98
+
99
+ def generate_busser_binstub_for_bourne
46
100
  binstub = root_path + "bin/busser"
47
101
 
48
- info "Creating busser binstub"
49
102
  File.unlink(binstub) if File.exists?(binstub)
50
103
  create_file(binstub, :verbose => false) do
51
104
  <<-BUSSER_BINSTUB.gsub(/^ {12}/, '')
@@ -56,14 +109,7 @@ module Busser
56
109
  # The application 'busser' is installed as part of a gem, and
57
110
  # this file is here to facilitate running it.
58
111
  #
59
- if [ -n "$DEBUG" ] ; then set -x ; fi
60
-
61
- # Get the directory where this ruby is. This will also resolve
62
- # any symlinks in the directory/script, so it will be the fully
63
- # resolved path.
64
- SOURCE="#{ruby_bin}"
65
- while [ -h "$SOURCE" ] ; do SOURCE="`readlink "$SOURCE"`"; done
66
- DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
112
+ if test -n "$DEBUG"; then set -x; fi
67
113
 
68
114
  # Set Busser Root path
69
115
  BUSSER_ROOT="#{root_path}"
@@ -71,40 +117,44 @@ module Busser
71
117
  export BUSSER_ROOT
72
118
 
73
119
  # Export gem paths so that we use the isolated gems.
74
- GEM_HOME="#{gem_home}"
75
- GEM_PATH="#{gem_path}"
76
- GEM_CACHE="#{gem_home}/cache"
77
-
78
- export GEM_HOME GEM_PATH GEM_CACHE
120
+ GEM_HOME="#{gem_home}"; export GEM_HOME
121
+ GEM_PATH="#{gem_path}"; export GEM_PATH
122
+ GEM_CACHE="#{gem_home}/cache"; export GEM_CACHE
79
123
 
80
124
  # Unset RUBYOPT, we don't want this bleeding into our runtime.
81
125
  unset RUBYOPT GEMRC
82
126
 
83
127
  # Call the actual Busser bin with our arguments
84
- exec "${DIR}/ruby" "#{gem_bindir}/busser" "$@"
128
+ exec "#{ruby_bin}" "#{gem_bindir}/busser" "$@"
85
129
  BUSSER_BINSTUB
86
130
  end
87
131
  chmod(binstub, 0755, :verbose => false)
88
132
  end
89
133
 
90
134
  def ruby_bin
91
- if bindir = RbConfig::CONFIG["bindir"]
135
+ result = if bindir = RbConfig::CONFIG["bindir"]
92
136
  File.join(bindir, "ruby")
93
137
  else
94
138
  "ruby"
95
139
  end
140
+ result = result.gsub("/", "\\").concat(".exe") if bat?
141
+ result
96
142
  end
97
143
 
98
144
  def gem_home
99
- Gem.paths.home
145
+ Gem.paths.home.dup.tap { |p| p.gsub!("/", "\\") if bat? }
100
146
  end
101
147
 
102
148
  def gem_path
103
- Gem.paths.path.join(":")
149
+ Gem.paths.path.join(":").dup.tap { |p| p.gsub!("/", "\\") if bat? }
104
150
  end
105
151
 
106
152
  def gem_bindir
107
- Gem.bindir
153
+ Gem.bindir.dup.tap { |p| p.gsub!("/", "\\") if bat? }
154
+ end
155
+
156
+ def bat?
157
+ options[:type] == "bat"
108
158
  end
109
159
  end
110
160
  end
@@ -60,7 +60,7 @@ module Busser
60
60
 
61
61
  if prepare_sh_script.exist?
62
62
  banner "Preparing #{runner} suite with #{prepare_sh_script}"
63
- run!("bash #{prepare_sh_script}")
63
+ run!("/bin/sh #{prepare_sh_script}")
64
64
  end
65
65
  end
66
66
 
@@ -70,7 +70,7 @@ module Busser
70
70
  if prepare_recipe.exist?
71
71
  warn "Apologies, but Busser no longer supports the" +
72
72
  " prepare_recipe.rb file. Please use prepare.sh and optionally" +
73
- " shell out to chef-apply in an Omnibus installtion."
73
+ " shell out to chef-apply in an Omnibus installation."
74
74
  end
75
75
  end
76
76
  end
@@ -6,8 +6,8 @@ end
6
6
 
7
7
  require 'busser/cucumber/hooks'
8
8
 
9
- require 'tmpdir'
10
- require 'pathname'
9
+ require 'tmpdir' unless defined?(Dir.mktmpdir)
10
+ require 'pathname' unless defined?(Pathname)
11
11
 
12
12
  Given(/^a BUSSER_ROOT of "(.*?)"$/) do |busser_root|
13
13
  backup_envvar('BUSSER_ROOT')
@@ -66,7 +66,7 @@ end
66
66
 
67
67
  Then(/^the suite file "(.*?)" should contain exactly:$/) do |file, content|
68
68
  file_name = File.join(ENV['BUSSER_ROOT'], "suites", file)
69
- check_exact_file_content(file_name, content)
69
+ check_file_content(file_name, content)
70
70
  end
71
71
 
72
72
  Then(/^the vendor directory named "(.*?)" should exist$/) do |name|
@@ -102,14 +102,19 @@ end
102
102
 
103
103
  Then(/^a busser binstub file should contain:$/) do |partial_content|
104
104
  file = File.join(ENV['BUSSER_ROOT'], %w{bin busser})
105
- check_file_content(file, partial_content, true)
105
+ check_file_content(file, Regexp.new(Regexp.escape(partial_content)), true)
106
+ end
107
+
108
+ Then(/^a bat busser binstub file should contain:$/) do |partial_content|
109
+ file = File.join(ENV['BUSSER_ROOT'], %w{bin busser.bat})
110
+ check_file_content(file, Regexp.new(Regexp.escape(partial_content)), true)
106
111
  end
107
112
 
108
113
  Then(/^the file "(.*?)" should have permissions "(.*?)"$/) do |file, perms|
109
- in_current_dir do
114
+ in_current_directory do
110
115
  file_perms = sprintf("%o", File.stat(file).mode)
111
116
  file_perms = file_perms[2, 4]
112
- file_perms.should eq(perms)
117
+ expect(file_perms).to eq(perms)
113
118
  end
114
119
  end
115
120
 
@@ -16,7 +16,7 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'pathname'
19
+ require 'pathname' unless defined?(Pathname)
20
20
 
21
21
  require 'busser/rubygems'
22
22
 
@@ -33,13 +33,13 @@ module Busser
33
33
  def suite_path(name = nil)
34
34
  path = root_path + "suites"
35
35
  path += name if name
36
- path
36
+ path.expand_path
37
37
  end
38
38
 
39
39
  def vendor_path(product = nil)
40
40
  path = root_path + "vendor"
41
41
  path += product if product
42
- path
42
+ path.expand_path
43
43
  end
44
44
 
45
45
  def root_path
@@ -29,56 +29,38 @@ module Busser
29
29
  module_function
30
30
 
31
31
  def gem_installed?(name, version)
32
- installed = Array(Gem::Specification.find_all_by_name(name, version))
33
- version = latest_gem_version(name) if version.nil?
34
-
35
- if version.nil?
36
- ! installed.empty?
37
- else
38
- installed.find { |spec| spec.version.to_s == version }
39
- end
32
+ version = Gem::Requirement.default unless version
33
+ ! Gem::Dependency.new(name, version).matching_specs.empty?
40
34
  end
41
35
 
42
36
  def install_gem(gem, version)
43
- install_arg = gem =~ /\.gem$/ ? gem : new_dep(gem, version)
44
- spec = dep_installer.install(install_arg).find { |s| s.name == gem }
45
- Gem.clear_paths
46
- spec
47
- end
37
+ version = Gem::Requirement.default unless version
48
38
 
49
- def latest_gem_version(name)
50
- available_gems = dep_installer.find_gems_with_sources(new_dep(name))
39
+ inst = Gem::DependencyInstaller.new(rbg_options)
40
+ specs = inst.install(gem, Gem::Requirement.create(version))
51
41
 
52
- spec, source = if available_gems.respond_to?(:last)
53
- # DependencyInstaller sorts the results such that the last one is
54
- # always the one it considers best.
55
- spec_with_source = available_gems.last
56
- spec_with_source && spec_with_source
57
- else
58
- # Rubygems 2.0 returns a Gem::Available set, which is a
59
- # collection of AvailableSet::Tuple structs
60
- available_gems.pick_best!
61
- best_gem = available_gems.set.first
62
- best_gem && [best_gem.spec, best_gem.source]
63
- end
42
+ Gem.clear_paths
43
+ specs.find { |s| s.name == gem }
44
+ end
64
45
 
65
- spec && spec.version && spec.version.to_s
46
+ def rbg_options
47
+ @rbg_options ||= Gem::DependencyInstaller::DEFAULT_OPTIONS.merge(
48
+ :suggest_alternate => false,
49
+ :version => Gem::Requirement.default,
50
+ :without_groups => [],
51
+ :minimal_deps => true,
52
+ :http_proxy => ENV.fetch("http_proxy", ENV.fetch("HTTP_PROXY", nil))
53
+ )
66
54
  end
67
55
 
68
56
  def silence_gem_ui
69
57
  interaction = Gem::DefaultUserInteraction.ui
70
- Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
58
+ if !Gem.configuration.really_verbose
59
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
60
+ end
71
61
  yield
72
62
  ensure
73
63
  Gem::DefaultUserInteraction.ui = interaction
74
64
  end
75
-
76
- def dep_installer
77
- Gem::DependencyInstaller.new
78
- end
79
-
80
- def new_dep(name, version = nil)
81
- Gem::Dependency.new(name, version)
82
- end
83
65
  end
84
66
  end
@@ -16,7 +16,7 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'thor'
19
+ require 'thor' unless defined?(Thor)
20
20
 
21
21
  require 'busser/helpers'
22
22
  require 'busser/ui'
@@ -40,36 +40,56 @@ module Busser
40
40
  say(">>>>>> #{msg}")
41
41
  end
42
42
 
43
- def run!(cmd)
44
- run(cmd, :capture => false, :verbose => false)
43
+ def fatal(msg)
44
+ error("!!!!!! #{msg}")
45
+ end
45
46
 
46
- if status.success?
47
- true
48
- else
49
- code = status.exitstatus
50
- die "Command [#{cmd}] exit code was #{code}", code
47
+ def run!(cmd, config = {})
48
+ config = { :capture => false, :verbose => false }.merge(config)
49
+
50
+ handle_command("Command", cmd) do
51
+ run(cmd, config)
51
52
  end
52
53
  end
53
54
 
54
55
  def run_ruby_script!(cmd, config = {})
55
56
  config = { :capture => false, :verbose => false }.merge(config)
56
- run_ruby_script(cmd, config)
57
57
 
58
- if status.success?
59
- true
60
- else
61
- code = status.exitstatus
62
- die "Ruby Script [#{cmd}] exit code was #{code}", code
58
+ handle_command("Ruby Script", cmd) do
59
+ run_ruby_script(cmd, config)
63
60
  end
64
61
  end
65
62
 
66
63
  def die(msg, exitstatus = 1)
67
- $stderr.puts(msg)
64
+ fatal(msg)
68
65
  exit(exitstatus)
69
66
  end
70
67
 
71
68
  def status
72
69
  $?
73
70
  end
71
+
72
+ def handle_command(type, cmd)
73
+ begin
74
+ yield
75
+ rescue => e
76
+ fatal(
77
+ "#{type} [#{cmd}] raised an exception: #{e.message}\n" +
78
+ e.backtrace.join("\n"))
79
+ raise
80
+ end
81
+
82
+ if status.nil?
83
+ die(
84
+ "#{type} [#{cmd}] did not return a valid status. " \
85
+ "This instance could be starved for RAM or may have swap disabled."
86
+ )
87
+ elsif status.success?
88
+ true
89
+ else
90
+ code = status.exitstatus
91
+ die("#{type} [#{cmd}] exit code was #{code}", code)
92
+ end
93
+ end
74
94
  end
75
95
  end
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Busser
20
- VERSION = "0.6.1"
20
+ VERSION = "0.8.0"
21
21
  end
@@ -15,11 +15,11 @@ describe Busser::Helpers do
15
15
  describe "with a default root path" do
16
16
 
17
17
  it "returns a base path if no suite name is given" do
18
- suite_path.to_s.must_equal "/opt/busser/suites"
18
+ suite_path.to_s.must_match %r{/opt/busser/suites$}
19
19
  end
20
20
 
21
21
  it "returns a suite path given a suite name" do
22
- suite_path("fuzzy").to_s.must_equal "/opt/busser/suites/fuzzy"
22
+ suite_path("fuzzy").to_s.must_match %r{/opt/busser/suites/fuzzy$}
23
23
  end
24
24
  end
25
25
 
@@ -30,12 +30,12 @@ describe Busser::Helpers do
30
30
 
31
31
  it "returns a base path if no suite name is given" do
32
32
  ENV['BUSSER_ROOT'] = "/path/to/busser"
33
- suite_path.to_s.must_equal "/path/to/busser/suites"
33
+ suite_path.to_s.must_match %r{/path/to/busser/suites$}
34
34
  end
35
35
 
36
36
  it "returns a suite path given a suite name" do
37
37
  ENV['BUSSER_ROOT'] = "/path/to/busser"
38
- suite_path("fuzzy").to_s.must_equal "/path/to/busser/suites/fuzzy"
38
+ suite_path("fuzzy").to_s.must_match %r{/path/to/busser/suites/fuzzy$}
39
39
  end
40
40
  end
41
41
  end
@@ -49,11 +49,11 @@ describe Busser::Helpers do
49
49
  describe "with a default root path" do
50
50
 
51
51
  it "returns a base path if no product name is given" do
52
- vendor_path.to_s.must_equal "/opt/busser/vendor"
52
+ vendor_path.to_s.must_match %r{/opt/busser/vendor$}
53
53
  end
54
54
 
55
55
  it "returns a vendor path given a product name" do
56
- vendor_path("supreme").to_s.must_equal "/opt/busser/vendor/supreme"
56
+ vendor_path("supreme").to_s.must_match %r{/opt/busser/vendor/supreme$}
57
57
  end
58
58
  end
59
59
 
@@ -64,12 +64,13 @@ describe Busser::Helpers do
64
64
 
65
65
  it "returns a base path if no product name is given" do
66
66
  ENV['BUSSER_ROOT'] = "/path/to/busser"
67
- vendor_path.to_s.must_equal "/path/to/busser/vendor"
67
+ vendor_path.to_s.must_match %r{/path/to/busser/vendor$}
68
68
  end
69
69
 
70
70
  it "returns a suite path given a product name" do
71
71
  ENV['BUSSER_ROOT'] = "/path/to/busser"
72
- vendor_path("maximal").to_s.must_equal "/path/to/busser/vendor/maximal"
72
+ vendor_path("maximal").to_s.must_match \
73
+ %r{/path/to/busser/vendor/maximal$}
73
74
  end
74
75
  end
75
76
  end
@@ -14,6 +14,10 @@ class SneakyUI
14
14
  msg
15
15
  end
16
16
 
17
+ def error(msg)
18
+ $stderr.puts msg
19
+ end
20
+
17
21
  def run(cmd, opts)
18
22
  @run_args = [cmd, opts]
19
23
  end
@@ -33,7 +37,7 @@ class SneakyUI
33
37
 
34
38
  # these methods are technically private, so we'll avoid straight send
35
39
  # calls in the specs
36
- %w{banner info warn die run! run_ruby_script!}.each do |meth|
40
+ %w{banner info warn fatal die run! run_ruby_script!}.each do |meth|
37
41
  define_method("invoke_#{meth}") { |*args| send(meth, *args) }
38
42
  end
39
43
  end
@@ -72,9 +76,13 @@ describe Busser::UI do
72
76
  ui.invoke_warn("grinder").must_equal ">>>>>> grinder"
73
77
  end
74
78
 
79
+ it "#fatal should display a formatted message on stderr" do
80
+ capture_stderr { ui.invoke_fatal("grinder") }.must_equal "!!!!!! grinder\n"
81
+ end
82
+
75
83
  describe "#die" do
76
84
  it "prints a message to stderr" do
77
- capture_stderr { ui.invoke_die("noes") }.must_equal "noes\n"
85
+ capture_stderr { ui.invoke_die("noes") }.must_equal "!!!!!! noes\n"
78
86
  end
79
87
 
80
88
  it "calls exit with 1 by default" do
@@ -105,6 +113,14 @@ describe Busser::UI do
105
113
  ui.invoke_run!("great-stuff").must_equal true
106
114
  end
107
115
 
116
+ it "re-raises any exceptions from the underlying fork/exec" do
117
+ ui.stubs(:run).raises(Errno::ENOMEM)
118
+
119
+ capture_stderr {
120
+ proc { ui.invoke_run!("failwhale") }.must_raise Errno::ENOMEM
121
+ }.must_match /raised an exception/
122
+ end
123
+
108
124
  it "terminates the program if the command failed" do
109
125
  ui.status = FakeStatus.new(false)
110
126
  capture_stderr { ui.invoke_run!("failwhale") }
@@ -119,6 +135,14 @@ describe Busser::UI do
119
135
  ui.invoke_run!("failwhale").must_equal 24
120
136
  end
121
137
  end
138
+
139
+ it "terminates the program if status is nil" do
140
+ ui.status = nil
141
+ capture_stderr { ui.invoke_run!("failwhale") }.
142
+ must_match /did not return a valid status/
143
+
144
+ ui.died?.must_equal true
145
+ end
122
146
  end
123
147
 
124
148
  describe "#run_ruby_script!" do
@@ -145,6 +169,14 @@ describe Busser::UI do
145
169
  ui.invoke_run_ruby_script!("thewin.rb").must_equal true
146
170
  end
147
171
 
172
+ it "re-raises any exceptions from the underlying fork/exec" do
173
+ ui.stubs(:run_ruby_script).raises(Errno::ENOMEM)
174
+
175
+ capture_stderr {
176
+ proc { ui.invoke_run_ruby_script!("nope.rb") }.must_raise Errno::ENOMEM
177
+ }.must_match /raised an exception/
178
+ end
179
+
148
180
  it "terminates the program if the script failed" do
149
181
  ui.status = FakeStatus.new(false)
150
182
  capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }
@@ -159,6 +191,14 @@ describe Busser::UI do
159
191
  ui.invoke_run_ruby_script!("nadda.rb").must_equal 97
160
192
  end
161
193
  end
194
+
195
+ it "terminates the program if status is nil" do
196
+ ui.status = nil
197
+ capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }.
198
+ must_match /did not return a valid status/
199
+
200
+ ui.died?.must_equal true
201
+ end
162
202
  end
163
203
 
164
204
  def capture_stderr
@@ -16,9 +16,11 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
 
19
- require 'simplecov'
20
19
  require 'fakefs/safe'
21
20
  require 'minitest/autorun'
22
21
  require 'mocha/setup'
23
22
 
24
- SimpleCov.command_name "unit"
23
+ if ENV["COVERAGE"]
24
+ require 'simplecov'
25
+ SimpleCov.command_name "unit"
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: busser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-23 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -25,35 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.19.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: chef
28
+ name: aruba
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.7.4
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.7.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.3'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
@@ -67,7 +53,7 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: minitest
56
+ name: cane
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
@@ -81,7 +67,7 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: mocha
70
+ name: countloc
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
@@ -109,7 +95,7 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: aruba
98
+ name: minitest
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -123,7 +109,7 @@ dependencies:
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: cane
112
+ name: mocha
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: tailor
126
+ name: rake
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
@@ -164,20 +150,6 @@ dependencies:
164
150
  - - ">="
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: countloc
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
153
  description: Busser - Runs tests for projects in Test Kitchen
182
154
  email:
183
155
  - fnichol@nichol.ca
@@ -189,7 +161,6 @@ files:
189
161
  - ".cane"
190
162
  - ".gitignore"
191
163
  - ".simplecov"
192
- - ".tailor"
193
164
  - ".travis.yml"
194
165
  - CHANGELOG.md
195
166
  - Gemfile
@@ -197,6 +168,7 @@ files:
197
168
  - LICENSE
198
169
  - README.md
199
170
  - Rakefile
171
+ - appveyor.yml
200
172
  - bin/busser
201
173
  - busser.gemspec
202
174
  - features/deserialize_command.feature
@@ -254,7 +226,7 @@ homepage: https://github.com/test-kitchen/busser
254
226
  licenses:
255
227
  - Apache 2.0
256
228
  metadata: {}
257
- post_install_message:
229
+ post_install_message:
258
230
  rdoc_options: []
259
231
  require_paths:
260
232
  - lib
@@ -269,9 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
241
  - !ruby/object:Gem::Version
270
242
  version: '0'
271
243
  requirements: []
272
- rubyforge_project:
273
- rubygems_version: 2.2.2
274
- signing_key:
244
+ rubygems_version: 3.1.2
245
+ signing_key:
275
246
  specification_version: 4
276
247
  summary: Busser - Runs tests for projects in Test Kitchen
277
248
  test_files:
data/.tailor DELETED
@@ -1,4 +0,0 @@
1
- Tailor.config do |config|
2
- config.formatters "text"
3
- config.file_set 'lib/**/*.rb'
4
- end