diff --git a/.travis.yml b/.travis.yml index e10c011..41b77f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: false language: ruby rvm: - - 2.0.0-p247 + - 2.1 script: rspec spec diff --git a/Gemfile b/Gemfile index 13c60e1..49db604 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,11 @@ source 'https://rubygems.org' -gem 'commander' -gem 'faraday', '0.9.2' -gem 'colorize', '~> 0.8' - -gem 'rspec' -gem 'webmock', '1.21.0' -gem 'rake' - gemspec + +gem 'rake', require: false + +group :test do + gem 'rspec', '~> 3.5.0' + gem 'rubocop', '~> 0.47' + gem 'webmock', '1.21.0' +end diff --git a/Rakefile b/Rakefile index 755ebc1..efbd5a9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,7 @@ require 'rubygems' require 'bundler/setup' require 'rspec/core/rake_task' +require 'rubocop/rake_task' # Immediately sync all stdout so that tools like buildbot can # immediately load in the output. @@ -8,7 +9,7 @@ $stdout.sync = true $stderr.sync = true # Change to the directory of this file. -Dir.chdir(File.expand_path("../", __FILE__)) +Dir.chdir(File.expand_path('../', __FILE__)) # This installs the tasks that help with gem creation and # publishing. @@ -16,7 +17,13 @@ Bundler::GemHelper.install_tasks # Install the `spec` task so that we can run tests. RSpec::Core::RakeTask.new(:spec) do |t| - t.rspec_opts = "--order defined" + t.rspec_opts = '--order defined' end + +desc 'Run RuboCop' +RuboCop::RakeTask.new(:rubocop) do |task| + task.options << '--display-cop-names' +end + # Default task is to run the unit tests -task :default => :spec +task default: :spec diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 3161e25..80684ff 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -16,7 +16,7 @@ class Vmfloaty include Commander::Methods def run - program :version, Version.get + program :version, Vmfloaty::VERSION program :description, 'A CLI helper tool for Puppet Labs vmpooler to help you stay afloat' config = Conf.read_config diff --git a/lib/vmfloaty/version.rb b/lib/vmfloaty/version.rb index 8674f33..9e40ace 100644 --- a/lib/vmfloaty/version.rb +++ b/lib/vmfloaty/version.rb @@ -1,8 +1,3 @@ - -class Version - @version = '0.7.8' - - def self.get - @version - end +class Vmfloaty + VERSION = '0.7.8'.freeze end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8eaa8b4..decf5e7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,8 @@ require 'vmfloaty' require 'webmock/rspec' + +RSpec.configure do |config| + config.color = true + config.tty = true + config.formatter = :documentation +end diff --git a/vmfloaty.gemspec b/vmfloaty.gemspec index 15284d9..52820b6 100644 --- a/vmfloaty.gemspec +++ b/vmfloaty.gemspec @@ -1,17 +1,22 @@ +$LOAD_PATH.push File.expand_path('../lib', __FILE__) +require 'vmfloaty/version' + Gem::Specification.new do |s| s.name = 'vmfloaty' - s.version = '0.7.8' + s.version = Vmfloaty::VERSION s.authors = ['Brian Cain'] s.email = ['brian.cain@puppetlabs.com'] - s.license = 'Apache' + s.license = 'Apache-2.0' s.homepage = 'https://github.com/briancain/vmfloaty' s.description = 'A helper tool for vmpooler to help you stay afloat' s.summary = 'CLI application to interface with vmpooler' + s.executables = ['floaty'] s.files = Dir['LICENSE', 'README.md', 'lib/**/*'] s.test_files = Dir['spec/**/*'] s.require_path = 'lib' - s.add_dependency 'commander', '~> 4.3' - s.add_dependency 'faraday', '~> 0.9' - s.add_dependency 'colorize', '0.8.1' + + s.add_dependency 'commander', '~> 4.3.0' + s.add_dependency 'faraday', '~> 0.9.0' + s.add_dependency 'colorize', '~> 0.8.1' end