Skip to content

Commit

Permalink
Merge pull request #13 from test-kitchen/testing
Browse files Browse the repository at this point in the history
Test on modern ruby releases & lint with Chefstyle
  • Loading branch information
tas50 authored Jan 15, 2020
2 parents bb37ec8 + 2ea198a commit ccd5485
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AllCops:
TargetRubyVersion: 2.3
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
language: ruby
cache: bundler

rvm:
- 2.1.1
- 2.0.0
- 2.3.8
- 2.4.9
- 2.5.7
- 2.6.5
- 2.7.0
- ruby-head

matrix:
allow_failures:
- rvm: ruby-head
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Encoding: UTF-8

source 'https://rubygems.org'
source "https://rubygems.org"

gemspec
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ Busser-Cucumber

[![Gem Version](https://badge.fury.io/rb/busser-cucumber.png)][fury]
[![Build Status](https://img.shields.io/travis/test-kitchen/busser-cucumber.svg)][travis]
[![Code Climate](https://img.shields.io/codeclimate/github/test-kitchen/busser-cucumber.svg)][codeclimate]

[fury]: http://badge.fury.io/rb/busser-cucumber
[travis]: https://travis-ci.org/test-kitchen/busser-cucumber
[codeclimate]: https://codeclimate.com/github/test-kitchen/busser-cucumber


A Busser runner plugin for Cucumber.

Expand Down
15 changes: 8 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Encoding: UTF-8

require 'bundler/setup'
require 'cane/rake_task'
require 'rubocop/rake_task'
require 'cucumber/rake/task'
require "bundler/setup"
require "cane/rake_task"
require "chefstyle"
require "rubocop/rake_task"
require "cucumber/rake/task"

Cane::RakeTask.new

desc 'Display LOC stats'
desc "Display LOC stats"
task :loc do
puts "\n## LOC stats"
Kernel.system 'countloc -r .'
Kernel.system "countloc -r ."
end

RuboCop::RakeTask.new

Cucumber::Rake::Task.new

task 'default' => [:cane, :loc, :rubocop, :cucumber]
task "default" => %i{cane loc rubocop cucumber}
36 changes: 18 additions & 18 deletions busser-cucumber.gemspec
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# Encoding: UTF-8

lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'busser/cucumber/version'
require "busser/cucumber/version"

Gem::Specification.new do |spec|
spec.name = 'busser-cucumber'
spec.name = "busser-cucumber"
spec.version = Busser::Cucumber::VERSION
spec.authors = ['Jonathan Hartman']
spec.email = %w([email protected])
spec.description = 'A Busser plugin for Cucumber'
spec.authors = ["Jonathan Hartman"]
spec.email = %w{[email protected]}
spec.description = "A Busser plugin for Cucumber"
spec.summary = spec.description
spec.homepage = 'https://github.com/test-kitchen/busser-cucumber'
spec.license = 'Apache 2.0'
spec.homepage = "https://github.com/test-kitchen/busser-cucumber"
spec.license = "Apache 2.0"

spec.files = `git ls-files -z`.split("\x0")
spec.executables = []
spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
spec.require_paths = %w(lib)
spec.require_paths = %w{lib}

spec.add_dependency 'busser'
spec.add_dependency "busser"

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'cane'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'countloc'
spec.add_development_dependency 'aruba', '0.6.1'
spec.add_development_dependency 'cucumber', '1.3.18'
spec.add_development_dependency 'rspec'
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
spec.add_development_dependency "cane"
spec.add_development_dependency "chefstyle"
spec.add_development_dependency "countloc"
spec.add_development_dependency "aruba", "0.6.1"
spec.add_development_dependency "cucumber", "1.3.18"
spec.add_development_dependency "rspec"
end
4 changes: 2 additions & 2 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Encoding: UTF-8

require 'aruba/cucumber'
require 'busser/cucumber'
require "aruba/cucumber"
require "busser/cucumber"

Before do
@aruba_timeout_seconds = 20
Expand Down
4 changes: 2 additions & 2 deletions lib/busser/cucumber/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'bundler/setup'
require 'cucumber/cli/main'
require "bundler/setup"
require "cucumber/cli/main"

exit Cucumber::Cli::Main.new(ARGV.dup).execute!
2 changes: 1 addition & 1 deletion lib/busser/cucumber/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ module Busser
#
# @author Jonathan Hartman <[email protected]>
module Cucumber
VERSION = '0.2.1.dev'.freeze
VERSION = "0.2.1.dev".freeze
end
end
34 changes: 18 additions & 16 deletions lib/busser/runner_plugin/cucumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'busser/runner_plugin'
require "busser/runner_plugin"

module Busser
module RunnerPlugin
Expand All @@ -27,8 +27,8 @@ module RunnerPlugin
#
class Cucumber < Busser::RunnerPlugin::Base
postinstall do
install_gem('cucumber')
install_gem('bundler')
install_gem("cucumber")
install_gem("bundler")
end

def test
Expand All @@ -43,42 +43,44 @@ def test

def chef_apply
return nil unless File.exist?(setup_file)
unless File.exist?('/opt/chef/bin/chef-apply')

unless File.exist?("/opt/chef/bin/chef-apply")
raise("You have a chef setup file at #{setup_file}, but " \
'/opt/chef/bin/chef-apply does not if exist')
"/opt/chef/bin/chef-apply does not if exist")
end
run("/opt/chef/bin/chef-apply #{setup_file}")
end

def bundle_install
gemfile_path = File.join(cuke_path, 'Gemfile')
gemfile_path = File.join(cuke_path, "Gemfile")
return nil unless File.exist?(gemfile_path)

# Bundle install local completes quickly if the gems are already found
# locally it fails if it needs to talk to the internet. The || below is
# the fallback to the internet-enabled version. It's a speed
# optimization.
banner('Bundle Installing..')
ENV['PATH'] = [
ENV['PATH'], Gem.bindir, Config::CONFIG['bindir']
banner("Bundle Installing..")
ENV["PATH"] = [
ENV["PATH"], Gem.bindir, Config::CONFIG["bindir"]
].join(File::PATH_SEPARATOR)
bundle_install = "#{File.join(Config::CONFIG['bindir'], 'ruby')} " \
"#{File.join(Gem.bindir, 'bundle')} install --gemfile #{gemfile_path}"
bundle_install = "#{File.join(Config::CONFIG["bindir"], "ruby")} " \
"#{File.join(Gem.bindir, "bundle")} install --gemfile #{gemfile_path}"
run("#{bundle_install} --local || #{bundle_install}")
end

def runner
File.expand_path(File.join(File.dirname(__FILE__),
'..',
'cucumber',
'runner.rb'))
"..",
"cucumber",
"runner.rb"))
end

def setup_file
File.join(cuke_path, 'setup-recipe.rb')
File.join(cuke_path, "setup-recipe.rb")
end

def cuke_path
suite_path('cucumber').to_s
suite_path("cucumber").to_s
end
end
end
Expand Down

0 comments on commit ccd5485

Please sign in to comment.