Rakefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # frozen_string_literal: true
  2. require 'rake'
  3. require "bundler/gem_tasks"
  4. require 'rake/testtask'
  5. require 'rubocop/rake_task'
  6. Rake::TestTask.new(:test) do |test|
  7. test.libs << 'lib' << 'test'
  8. test.pattern = 'test/**/*_test.rb'
  9. test.warning = false
  10. end
  11. RuboCop::RakeTask.new
  12. begin
  13. require 'rcov/rcovtask'
  14. Rcov::RcovTask.new do |test|
  15. test.libs << 'test'
  16. test.pattern = 'test/**/*_test.rb'
  17. test.verbose = true
  18. end
  19. rescue LoadError
  20. task(:rcov) do
  21. abort("RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov")
  22. end
  23. end
  24. task(default: [:test, :rubocop, :verify_docs])
  25. require 'verify_docs'
  26. task(:verify_docs) do
  27. unless VerifyDocs.call
  28. abort("\nWARNING: docs/index.md and README.md no longer have identical content. Please correct this.")
  29. end
  30. end
  31. require 'rdoc/task'
  32. Rake::RDocTask.new do |rdoc|
  33. if File.exist?('VERSION.yml')
  34. config = YAML.load(File.read('VERSION.yml'))
  35. version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
  36. else
  37. version = ""
  38. end
  39. rdoc.rdoc_dir = 'rdoc'
  40. rdoc.title = "shopify_api #{version}"
  41. rdoc.rdoc_files.include('README*')
  42. rdoc.rdoc_files.include('lib/**/*.rb')
  43. end
  44. task(:docker) do
  45. cmd = "docker-compose up -d && docker exec -i -t shopify_api bash"
  46. exec(cmd, err: File::NULL)
  47. end