diff options
author | Tim Smith <tsmith@chef.io> | 2018-07-30 09:17:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-30 09:17:45 -0700 |
commit | 0b033b8572c02ecc5c36f7d9ae00043a511ac9c1 (patch) | |
tree | bebf4f20663421a54b9be65eea5135eaa5cc9b65 | |
parent | c840d03377eac0a5131ff8ae9dbd29775124164f (diff) | |
parent | 8f2697818cb5be0519244d2595c201080c4add6f (diff) | |
download | mixlib-cli-0b033b8572c02ecc5c36f7d9ae00043a511ac9c1.tar.gz |
Merge pull request #45 from chef/sync
Update testing and contributing boilerplate
-rw-r--r-- | .expeditor/config.yml | 34 | ||||
-rw-r--r-- | .gitignore | 30 | ||||
-rw-r--r-- | .rspec | 2 | ||||
-rw-r--r-- | .travis.yml | 26 | ||||
-rw-r--r-- | Gemfile | 25 | ||||
-rw-r--r-- | NOTICE | 2 | ||||
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | Rakefile | 34 | ||||
-rw-r--r-- | features/mixlib_cli.feature | 9 | ||||
-rw-r--r-- | features/step_definitions/mixlib_cli_steps.rb | 0 | ||||
-rw-r--r-- | features/support/env.rb | 9 | ||||
-rw-r--r-- | lib/mixlib/cli.rb | 10 | ||||
-rw-r--r-- | lib/mixlib/cli/version.rb | 2 | ||||
-rw-r--r-- | mixlib-cli.gemspec | 9 | ||||
-rw-r--r-- | spec/spec_helper.rb | 12 |
15 files changed, 136 insertions, 88 deletions
diff --git a/.expeditor/config.yml b/.expeditor/config.yml index 0806604..a1e8ede 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -1,34 +1,42 @@ -# For more information about Expeditor, visit http://expeditor.es.chef.io +# Documentation available at https://expeditor.chef.io/docs/getting-started/ --- +# Slack channel in Chef Software slack to send notifications about build failures, etc slack: - notify_channel: releng-notify + notify_channel: chef-notify + +# This publish is triggered by the `built_in:publish_rubygems` artifact_action. +rubygems: + - mixlib-cli github: - version_tag_format: "v{{version}}" + # This deletes the GitHub PR branch after successfully merged into the release branch delete_branch_on_merge: true + # The tag format to use (e.g. v1.0.0) + version_tag_format: "v{{version}}" + # The Github Team primarily responsible for handling incoming Pull Requests. + maintainer_group: chef/client-maintainers + # allow bumping the minor release via label minor_bump_labels: - - "Version: Bump Minor" + - "Expeditor: Bump Minor Version" -rubygems: - - mixlib-cli +# These actions are taken, in order they are specified, anytime a Pull Request is merged. merge_actions: - built_in:bump_version: ignore_labels: - - "Version: Skip Bump" + - "Expeditor: Skip Version Bump" - "Expeditor: Skip All" - bash:.expeditor/update_version.sh: - only_if: - - built_in:bump_version + only_if: built_in:bump_version - built_in:update_changelog: ignore_labels: - - "Changelog: Skip Update" + - "Expeditor: Exclude From Changelog" - "Expeditor: Skip All" - built_in:build_gem: - only_if: - - built_in:bump_version + only_if: built_in:bump_version promote: action: - - built_in:publish_rubygems - built_in:rollover_changelog + - built_in:publish_rubygems + @@ -1,11 +1,27 @@ -*.sw? +_yardoc +.bundle +.config .DS_Store -coverage -rdoc -pkg +.idea +.rvmrc .rake_tasks~ -.bundle +.rspec +.ruby-version +.yardoc +.yardopts +*.gem +*.rbc +*.sw? +bin/ +coverage +doc +Gemfile.local Gemfile.lock +InstalledFiles +lib/bundler/man +pkg +spec/reports +test/tmp +test/version_tmp +tmp vendor -.idea/ -.ruby-version @@ -1,2 +0,0 @@ ---colour ---format documentation diff --git a/.travis.yml b/.travis.yml index ee342c0..72a3f67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,21 @@ +sudo: false language: ruby cache: bundler -sudo: false +matrix: + include: + - rvm: 2.2.10 + - rvm: 2.3.7 + - rvm: 2.4.4 + - rvm: 2.5.1 + - rvm: ruby-head + allow_failures: + - rvm: ruby-head branches: only: - - master + - master -before_install: - - bundle --version - - gem --version -rvm: - - 2.2.10 - - 2.3.7 - - 2.4.4 - - 2.5.1 +bundler_args: --without docs development -script: - - bundle exec chefstyle - - bundle exec rake spec +script: bundle exec rake @@ -1,3 +1,28 @@ source "https://rubygems.org" gemspec + +group :docs do + gem "yard" + gem "redcarpet" + gem "github-markup" +end + +group :test do + gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master" + gem "rspec", "~> 3.0" + gem "rake" +end + +group :development do + gem "pry" + gem "pry-byebug" + gem "pry-stack_explorer" + gem "rb-readline" +end + +instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"] + +# If you want to load debugging tools into the bundle exec sandbox, +# add these additional dependencies into Gemfile.local +eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local") @@ -4,7 +4,7 @@ Mixin::CLI NOTICE Developed at Chef (http://www.chef.io). - * Copyright 2009-2016, Chef Software, Inc. <legal@chef.io> + * Copyright 2009-2018, Chef Software, Inc. <legal@chef.io> Mixin::CLI incorporates code from Chef. The Chef notice file follows: @@ -68,10 +68,10 @@ MyConfig[:log_level] # :debug Available arguments to 'option': - `:short`: The short option, just like from optparse. Example: "-l LEVEL" -- `:long`: The long option, just like from optparse. Example: "--level LEVEL" +- `:long`: The long option, just like from optparse. Example: "--level LEVEL" - `:description`: The description for this item, just like from optparse. - `:default`: A default value for this option -- `:required`: Prints a message informing the user of the missing requirement, and exits. Default is false. +- `:required`: Prints a message informing the user of the missing requirement, and exits. Default is false. - `:on`: Set to :tail to appear at the end, or `:head`: to appear at the top. - `:boolean:`: If this option takes no arguments, set this to true. - `:show_options`: If you want the option list printed when this option is called, set this to true. @@ -88,9 +88,21 @@ cli.parse_options cli.cli_arguments # [ 'file1', 'file2', 'file3' ] ``` -## LICENSE: +## Documentation -- Copyright:: Copyright (c) 2008-2016 Chef Software, Inc. +All documentation is written using YARD. You can generate a by running: + +``` +rake yard +``` + +## Contributing + +For information on contributing to this project please see our [Contributing Documentation](https://github.com/chef/chef/blob/master/CONTRIBUTING.md) + +## License & Copyright + +- Copyright:: Copyright (c) 2008-2018 Chef Software, Inc. - License:: Apache License, Version 2.0 ```text @@ -1,26 +1,15 @@ -require "bundler" -require "rubygems" -require "rubygems/package_task" -require "rdoc/task" +require "bundler/gem_tasks" require "rspec/core/rake_task" -require "mixlib/cli/version" -Bundler::GemHelper.install_tasks +task default: [:style, :spec] -task default: :spec +Bundler::GemHelper.install_tasks desc "Run specs" RSpec::Core::RakeTask.new(:spec) do |spec| spec.pattern = "spec/**/*_spec.rb" end -RDoc::Task.new do |rdoc| - rdoc.rdoc_dir = "rdoc" - rdoc.title = "mixlib-cli #{Mixlib::CLI::VERSION}" - rdoc.rdoc_files.include("README*") - rdoc.rdoc_files.include("lib/**/*.rb") -end - begin require "chefstyle" require "rubocop/rake_task" @@ -28,5 +17,20 @@ 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" + YARD::Rake::YardocTask.new(:doc) +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 "mixlib/cli" + ARGV.clear + IRB.start end diff --git a/features/mixlib_cli.feature b/features/mixlib_cli.feature deleted file mode 100644 index b908b60..0000000 --- a/features/mixlib_cli.feature +++ /dev/null @@ -1,9 +0,0 @@ -Feature: something something - In order to something something - A user something something - something something something - - Scenario: something something - Given inspiration - When I create a sweet new gem - Then everyone should see how awesome I am diff --git a/features/step_definitions/mixlib_cli_steps.rb b/features/step_definitions/mixlib_cli_steps.rb deleted file mode 100644 index e69de29..0000000 --- a/features/step_definitions/mixlib_cli_steps.rb +++ /dev/null diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 3855024..0000000 --- a/features/support/env.rb +++ /dev/null @@ -1,9 +0,0 @@ -$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../../lib") -require "mixlib_cli" - -require "spec/expectations" - -World do |world| - - world -end diff --git a/lib/mixlib/cli.rb b/lib/mixlib/cli.rb index e097649..0516926 100644 --- a/lib/mixlib/cli.rb +++ b/lib/mixlib/cli.rb @@ -210,7 +210,7 @@ module Mixlib config_opts[:exit] ||= nil config_opts[:in] ||= nil - if config_opts.has_key?(:default) + if config_opts.key?(:default) defaults_container[config_key] = config_opts[:default] end end @@ -231,7 +231,7 @@ module Mixlib # Deal with any required values options.each do |opt_key, opt_value| - if opt_value[:required] && !config.has_key?(opt_key) + if opt_value[:required] && !config.key?(opt_key) reqarg = opt_value[:short] || opt_value[:long] puts "You must supply #{reqarg}!" puts @opt_parser @@ -308,9 +308,9 @@ module Mixlib def build_option_arguments(opt_setting) arguments = Array.new - arguments << opt_setting[:short] if opt_setting.has_key?(:short) - arguments << opt_setting[:long] if opt_setting.has_key?(:long) - if opt_setting.has_key?(:description) + arguments << opt_setting[:short] if opt_setting.key?(:short) + arguments << opt_setting[:long] if opt_setting.key?(:long) + if opt_setting.key?(:description) description = opt_setting[:description].dup description << " (required)" if opt_setting[:required] description << " (included in ['#{opt_setting[:in].join("', '")}'])" if opt_setting[:in] diff --git a/lib/mixlib/cli/version.rb b/lib/mixlib/cli/version.rb index 174bf41..1a662de 100644 --- a/lib/mixlib/cli/version.rb +++ b/lib/mixlib/cli/version.rb @@ -1,5 +1,5 @@ module Mixlib module CLI - VERSION = "1.7.2" + VERSION = "1.7.2".freeze end end diff --git a/mixlib-cli.gemspec b/mixlib-cli.gemspec index e3951de..da25754 100644 --- a/mixlib-cli.gemspec +++ b/mixlib-cli.gemspec @@ -4,8 +4,6 @@ require "mixlib/cli/version" Gem::Specification.new do |s| s.name = "mixlib-cli" s.version = Mixlib::CLI::VERSION - s.platform = Gem::Platform::RUBY - s.has_rdoc = true s.extra_rdoc_files = ["README.md", "LICENSE", "NOTICE"] s.summary = "A simple mixin for CLI interfaces, including option parsing" s.description = s.summary @@ -14,13 +12,6 @@ Gem::Specification.new do |s| s.homepage = "https://www.chef.io" s.license = "Apache-2.0" - # Uncomment this to add a dependency - #s.add_dependency "mixlib-log" - s.add_development_dependency "rake", "~> 11.0" - s.add_development_dependency "rspec", "~> 3.0" - s.add_development_dependency "rdoc" - s.add_development_dependency "chefstyle" - s.require_path = "lib" s.files = %w{LICENSE README.md Gemfile Rakefile NOTICE} + Dir.glob("*.gemspec") + Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 13432c6..6f3d7e2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,18 @@ class TestCLI end RSpec.configure do |config| + # Use documentation format + config.formatter = "doc" + + # Use color in STDOUT + config.color = true + + # Use color not only in STDOUT but also in pagers and files + config.tty = true + + # run the examples in random order + config.order = :rand + config.filter_run focus: true config.run_all_when_everything_filtered = true config.warnings = true |