Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
@@ -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

30 changes: 23 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions .rspec

This file was deleted.

26 changes: 13 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
34 changes: 19 additions & 15 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
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"
RuboCop::RakeTask.new(:style) do |task|
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
9 changes: 0 additions & 9 deletions features/mixlib_cli.feature

This file was deleted.

Empty file.
9 changes: 0 additions & 9 deletions features/support/env.rb

This file was deleted.

10 changes: 5 additions & 5 deletions lib/mixlib/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def initialize(*args)
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
Expand All @@ -231,7 +231,7 @@ def parse_options(argv = ARGV)

# 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
Expand Down Expand Up @@ -308,9 +308,9 @@ def opt_parser
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]
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/cli/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Mixlib
module CLI
VERSION = "1.7.2"
VERSION = "1.7.2".freeze
end
end
9 changes: 0 additions & 9 deletions mixlib-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) }
Expand Down
12 changes: 12 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down