diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-29 09:02:16 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-29 09:02:16 -0700 |
commit | 004176acf0139227536741cf3516aa97b056526f (patch) | |
tree | 9cb47d99e9d98991b4182dae42955ef478f7eba3 | |
parent | c3b5e2dbd77f194e2891b436675e6ca13d56fb20 (diff) | |
download | chef-004176acf0139227536741cf3516aa97b056526f.tar.gz |
Sync rake tasks with Chef 14
The package update tasks were busted
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | Rakefile | 40 | ||||
-rw-r--r-- | tasks/announce.rb | 2 | ||||
-rw-r--r-- | tasks/dependencies.rb | 44 | ||||
-rw-r--r-- | tasks/maintainers.rb | 20 | ||||
-rw-r--r-- | tasks/rspec.rb | 4 | ||||
-rw-r--r-- | tasks/templates/prerelease.md.erb | 13 | ||||
-rw-r--r-- | tasks/templates/release.md.erb | 10 |
7 files changed, 56 insertions, 77 deletions
@@ -1,7 +1,7 @@ # # Author:: Adam Jacob (<adam@chef.io>) # Author:: Daniel DeLeo (<dan@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,24 +17,24 @@ # limitations under the License. # -VERSION = IO.read(File.expand_path("../VERSION", __FILE__)).strip - -require "rubygems" -require "chef/version" -require "chef-config/package_task" -require "rdoc/task" require_relative "tasks/rspec" require_relative "tasks/maintainers" -require_relative "tasks/cbgb" require_relative "tasks/dependencies" require_relative "tasks/announce" -ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "Chef", "chef") do |package| - package.component_paths = ["chef-config"] - package.generate_version_class = true - package.use_versionstring = true +# hack the chef-config install to run before the traditional install task +task :super_install do + chef_config_path = ::File.join(::File.dirname(__FILE__), "chef-config") + Dir.chdir(chef_config_path) + sh("rake install") end +task install: :super_install + +# make sure we build the correct gemspec on windows +gemspec = Gem.win_platform? ? "chef-universal-mingw32" : "chef" +Bundler::GemHelper.install_tasks name: gemspec + task :pedant, :chef_zero_spec task :build_eventlog do @@ -56,21 +56,17 @@ begin task.options += ["--display-cop-names", "--no-color"] end rescue LoadError - puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking." + puts "chefstyle/rubocop is not available. bundle install first to make sure all dependencies are installed." end begin require "yard" - DOC_FILES = [ "README.rdoc", "LICENSE", "spec/tiny_server.rb", "lib/**/*.rb" ] - namespace :yard do - desc "Create YARD documentation" + DOC_FILES = [ "spec/tiny_server.rb", "lib/**/*.rb" ].freeze - YARD::Rake::YardocTask.new(:html) do |t| - t.files = DOC_FILES - t.options = ["--format", "html"] - end + YARD::Rake::YardocTask.new(:docs) do |t| + t.files = DOC_FILES + t.options = ["--format", "html"] end - rescue LoadError - puts "yard is not available. (sudo) gem install yard to generate yard documentation." + puts "yard is not available. bundle install first to make sure all dependencies are installed." end diff --git a/tasks/announce.rb b/tasks/announce.rb index 0399137eb0..b6b701f04b 100644 --- a/tasks/announce.rb +++ b/tasks/announce.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright (c) 2016 Chef Software Inc. +# Copyright:: Copyright 2016-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb index 1dba2b4190..ccdb8389ad 100644 --- a/tasks/dependencies.rb +++ b/tasks/dependencies.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright (c) 2016-2017, Chef Software Inc. +# Copyright:: Copyright (c) 2016-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,31 +15,16 @@ # limitations under the License. # +require "bundler" + desc "Tasks to update and check dependencies" namespace :dependencies do - # Running update_ci on your local system wont' work. The best way to update - # dependencies locally is by running the dependency update script. - desc "Update all dependencies. dependencies:update to update as little as possible." - task :update do |t, rake_args| - # FIXME: probably broken, and needs less indirection - system("#{File.join(Dir.pwd, "ci", "dependency_update.sh")}") - end - - desc "Force update (when adding new gems to Gemfiles)" - task :force_update do |t, rake_args| - # FIXME: probably broken, and needs less indirection - FileUtils.rm_f(File.join(Dir.pwd, ".bundle", "config")) - system("#{File.join(Dir.pwd, "ci", "dependency_update.sh")}") - end - # Update all dependencies to the latest constraint-matching version - desc "Update all dependencies. dependencies:update to update as little as possible (CI-only)." - task :update_ci => %w{ + desc "Update all dependencies." + task update: %w{ dependencies:update_gemfile_lock dependencies:update_omnibus_gemfile_lock - dependencies:update_acceptance_gemfile_lock - dependencies:update_audit_tests_berksfile_lock } def bundle_update_locked_multiplatform_task(task_name, dir) @@ -67,26 +52,7 @@ namespace :dependencies do end end - def berks_update_task(task_name, dir) - desc "Update #{dir}/Berksfile.lock." - task task_name do - FileUtils.rm_f("#{dir}/Berksfile.lock") - Dir.chdir(dir) do - Bundler.with_clean_env do - sh "bundle exec berks install" - end - end - end - end - bundle_update_locked_multiplatform_task :update_gemfile_lock, "." bundle_update_locked_multiplatform_task :update_omnibus_gemfile_lock, "omnibus" - bundle_update_task :update_acceptance_gemfile_lock, "acceptance" - berks_update_task :update_audit_tests_berksfile_lock, "kitchen-tests/cookbooks/audit_test" end - -desc "Update all dependencies and check for outdated gems." -task :dependencies_ci => [ "dependencies:update_ci" ] -task :dependencies => [ "dependencies:update" ] -task :update => [ "dependencies:update" ] diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb index f6385860c4..7465f7ba9e 100644 --- a/tasks/maintainers.rb +++ b/tasks/maintainers.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2015-2016, Chef Software, Inc. +# Copyright:: Copyright 2015-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,7 @@ REPOSITORIES = ["chef/chef", "chef/chef-dk", "chef/chef-census", "chef/chef-repo "chef/client-docs", "chef/ffi-yajl", "chef/libyajl2-gem", "chef/mixlib-authentication", "chef/mixlib-cli", "chef/mixlib-config", "chef/mixlib-install", "chef/mixlib-log", - "chef/mixlib-shellout", "chef/ohai", "chef/omnibus-chef"] + "chef/mixlib-shellout", "chef/ohai", "chef/omnibus-chef"].freeze begin require "tomlrb" @@ -33,7 +33,7 @@ begin require "pp" namespace :maintainers do - task :default => :generate + task default: :generate desc "Generate MarkDown version of MAINTAINERS file" task :generate do @@ -63,7 +63,7 @@ begin end def github - @github ||= Octokit::Client.new(:netrc => true) + @github ||= Octokit::Client.new(netrc: true) end def source @@ -131,7 +131,7 @@ begin else %w{maintainers lieutenant title}.each { |k| cmp.delete(k) } end - cmp.each { |_k, v| prepare_teams(v) } + cmp.each_value { |v| prepare_teams(v) } end def update_team(team, additions, deletions) @@ -181,15 +181,15 @@ begin def format_components(cmp) out = "## " + cmp.delete("title") + "\n\n" - out << cmp.delete("text") + "\n" if cmp.has_key?("text") - out << "To mention the team, use @chef/#{cmp.delete("team")}\n\n" if cmp.has_key?("team") - if cmp.has_key?("lieutenant") + out << cmp.delete("text") + "\n" if cmp.key?("text") + out << "To mention the team, use @chef/#{cmp.delete("team")}\n\n" if cmp.key?("team") + if cmp.key?("lieutenant") out << "### Lieutenant\n\n" out << format_person(cmp.delete("lieutenant")) + "\n\n" end - out << format_maintainers(cmp.delete("maintainers")) + "\n" if cmp.has_key?("maintainers") + out << format_maintainers(cmp.delete("maintainers")) + "\n" if cmp.key?("maintainers") cmp.delete("paths") - cmp.each { |k, v| out << format_components(v) } + cmp.each_value { |v| out << format_components(v) } out end diff --git a/tasks/rspec.rb b/tasks/rspec.rb index 848c50eb40..afd7d12705 100644 --- a/tasks/rspec.rb +++ b/tasks/rspec.rb @@ -35,9 +35,9 @@ begin end end - task :default => :spec + task default: :spec - task :spec => :component_specs + task spec: :component_specs desc "Run standard specs (minus long running specs)" RSpec::Core::RakeTask.new(:spec) do |t| diff --git a/tasks/templates/prerelease.md.erb b/tasks/templates/prerelease.md.erb index 0c5c55cffc..cab7f11fff 100644 --- a/tasks/templates/prerelease.md.erb +++ b/tasks/templates/prerelease.md.erb @@ -9,7 +9,7 @@ We have selected <%= @version %> as our Chef v<%= @maj_minor %> release candidat Please see the [CHANGELOG](https://github.com/chef/chef/blob/master/CHANGELOG.md) for the complete list of changes. # Get the Build -As always, you can download binaries directly from [downloads.chef.io](https://downloads.chef.io/chef/current/<%= @version %>) or by using the new `mixlib-install` command line utility available in ChefDK 0.19.6 or greater. +As always, you can download binaries directly from [downloads.chef.io](https://downloads.chef.io/chef/current/<%= @version %>) or by using the `mixlib-install` command line utility: ```shell $ mixlib-install download chef -v <%= @version %> -c current @@ -21,6 +21,15 @@ Alternatively, you can install Chef using one of the following command options: # In Shell $ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v <%= @version %> -c current -# In Windows Powershell +# In Windows PowerShell . { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project chef -version <%= @version %> -channel current ``` + +If you want to give this version a spin in Test Kitchen, create or add the following to your `kitchen.yml` file: + +```yaml +provisioner: + product_name: chef + channel: current + product_version: <%= @version %> +``` diff --git a/tasks/templates/release.md.erb b/tasks/templates/release.md.erb index 2c6ff0b7c6..366ae2b0a6 100644 --- a/tasks/templates/release.md.erb +++ b/tasks/templates/release.md.erb @@ -9,7 +9,7 @@ We're happy to announce the release of Chef v<%= @maj_minor %>! Please see the [CHANGELOG](https://github.com/chef/chef/blob/master/CHANGELOG.md) for the complete list of changes. # Get the Build -As always, you can download binaries directly from [downloads.chef.io](https://downloads.chef.io/chef/<%= @version %>) or by using the new `mixlib-install` command line utility available in ChefDK 0.19.6 or greater. +As always, you can download binaries directly from [downloads.chef.io](https://downloads.chef.io/chef/<%= @version %>) or by using the `mixlib-install` command line utility: ```shell $ mixlib-install download chef -v <%= @version %> @@ -24,3 +24,11 @@ $ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chef -v <%= @ve # In Windows Powershell . { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -project chef -version <%= @version %> ``` + +If you want to give this version a spin in Test Kitchen, create or add the following to your `kitchen.yml` file: + +```yaml +provisioner: + product_name: chef + product_version: <%= @version %> +``` |