Skip to content

Commit

Permalink
Use a more standardized Rakefile
Browse files Browse the repository at this point in the history
Remove the old requires for the github changelog generator
Add the console task
Provide better error handling / messages when the gems aren't there
Make style/specs default and just run the default in Travis

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Sep 9, 2018
1 parent d9cd0cb commit 901d003
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ matrix:

script:
- bundle exec chefstyle -v
- bundle exec chefstyle
- bundle exec rake spec
- bundle exec rake
- bundle exec ohai
34 changes: 26 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
require "bundler/gem_tasks"
require "date"
require "ohai/version"

begin
require "rspec/core/rake_task"
Expand All @@ -11,14 +9,34 @@ begin
rescue LoadError
desc "rspec is not installed, this task is disabled"
task :spec do
abort "rspec is not installed. `(sudo) gem install rspec` to run unit tests"
abort "rspec is not installed. bundle install first to make sure all dependencies are installed."
end
end

task default: :spec
begin
require "chefstyle"
require "rubocop/rake_task"
desc "Run Chefstyle tests"
RuboCop::RakeTask.new(:style) do |task|
task.options += ["--display-cop-names", "--no-color"]
end
rescue LoadError
puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed."
end

require "chefstyle"
require "rubocop/rake_task"
RuboCop::RakeTask.new(:style) do |task|
task.options += ["--display-cop-names", "--no-color"]
begin
require "yard"
YARD::Rake::YardocTask.new(:docs)
rescue LoadError
puts "yard is not available. bundle install first to make sure all dependencies are installed."
end

task :console do
require "irb"
require "irb/completion"
require "ohai"
ARGV.clear
IRB.start
end

task default: [:style, :spec]

0 comments on commit 901d003

Please sign in to comment.