summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-09-08 22:06:52 -0700
committerTim Smith <tsmith@chef.io>2018-09-08 22:06:52 -0700
commit901d003e42839145fe099172a6c56d2432c824ad (patch)
tree076674a2dcbc4bd7626275e5276def282ffbf49a
parentd9cd0cb6071dfc8e0670f0bb87589ec18c822774 (diff)
downloadohai-901d003e42839145fe099172a6c56d2432c824ad.tar.gz
Use a more standardized Rakefile
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>
-rw-r--r--.travis.yml3
-rw-r--r--Rakefile34
2 files changed, 27 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml
index c8b4ecca..171aa74b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,5 @@ matrix:
script:
- bundle exec chefstyle -v
- - bundle exec chefstyle
- - bundle exec rake spec
+ - bundle exec rake
- bundle exec ohai
diff --git a/Rakefile b/Rakefile
index eda2219f..83e36d8f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,6 +1,4 @@
require "bundler/gem_tasks"
-require "date"
-require "ohai/version"
begin
require "rspec/core/rake_task"
@@ -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]