Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading trollop to optimist to remove deprecation warnings #268

Merged
merged 1 commit into from
Oct 6, 2018
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
2 changes: 1 addition & 1 deletion hiera-eyaml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]

gem.add_dependency('trollop', '~> 2.0')
gem.add_dependency('optimist')
gem.add_dependency('highline', '~> 1.6.19')
end
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/CLI.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'trollop'
require 'optimist'
require 'hiera/backend/eyaml'
require 'hiera/backend/eyaml/logginghelper'
require 'hiera/backend/eyaml/utils'
Expand Down
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/subcommand.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def self.parse
me = self
all = self.all_options

options = Trollop::options do
options = Optimist::options do

version "Hiera-eyaml version " + Hiera::Backend::Eyaml::VERSION.to_s
banner ["eyaml #{me.prettyname}: #{me.description}", me.helptext, "Options:"].compact.join("\n\n")
Expand Down
4 changes: 2 additions & 2 deletions lib/hiera/backend/eyaml/subcommands/decrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def self.description

def self.validate options
sources = [:eyaml, :password, :string, :file, :stdin].collect {|x| x if options[x]}.compact
Trollop::die "You must specify a source" if sources.count.zero?
Trollop::die "You can only specify one of (#{sources.join(', ')})" if sources.count > 1
Optimist::die "You must specify a source" if sources.count.zero?
Optimist::die "You can only specify one of (#{sources.join(', ')})" if sources.count > 1
options[:source] = sources.first

options[:input_data] = case options[:source]
Expand Down
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/subcommands/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def self.preamble
end

def self.validate options
Trollop::die "You must specify an eyaml file" if ARGV.empty?
Optimist::die "You must specify an eyaml file" if ARGV.empty?
options[:source] = :eyaml
options[:eyaml] = ARGV.shift
if File.exists? options[:eyaml]
Expand Down
4 changes: 2 additions & 2 deletions lib/hiera/backend/eyaml/subcommands/encrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def self.description

def self.validate options
sources = [:password, :string, :file, :stdin, :eyaml].collect {|x| x if options[x]}.compact
Trollop::die "You must specify a source" if sources.count.zero?
Trollop::die "You can only specify one of (#{sources.join(', ')})" if sources.count > 1
Optimist::die "You must specify a source" if sources.count.zero?
Optimist::die "You can only specify one of (#{sources.join(', ')})" if sources.count > 1
options[:source] = sources.first

options[:input_data] = case options[:source]
Expand Down
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/subcommands/recrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.helptext
end

def self.validate options
Trollop::die "You must specify an eyaml file" if ARGV.empty?
Optimist::die "You must specify an eyaml file" if ARGV.empty?
options[:source] = :eyaml
options[:eyaml] = ARGV.shift
options[:input_data] = File.read options[:eyaml]
Expand Down