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

Skip Faker Deprecation Warnings; The CLI handles that - II #33

Merged
merged 1 commit into from
Jul 14, 2019
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
64 changes: 31 additions & 33 deletions lib/faker/bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,40 @@ module Faker
module Bot
class Base < Thor
Error = Class.new(StandardError)
# Skip default deprecation warning output; the Bot will display that.
Gem::Deprecate.skip_during do
desc 'version', 'Faker version'
def version
puts "v#{Faker::Bot::VERSION}"
end
map %w[--version -v] => :version

desc 'list', 'List all Faker constants'
method_option :help, aliases: '-h', type: :boolean,
desc: 'Display usage information'
method_option :show_methods, aliases: '-m', type: :boolean, default: true,
desc: 'Display Faker constants with methods'
method_option :verbose, aliases: '-v', type: :boolean,
desc: 'Include sample Faker output'
def list(*)
if options[:help]
invoke :help, ['list']
else
Faker::Bot::Commands::List.new(options).execute
end
desc 'version', 'Faker version'
def version
puts "v#{Faker::Bot::VERSION}"
end
map %w[--version -v] => :version

desc 'list', 'List all Faker constants'
method_option :help, aliases: '-h', type: :boolean,
desc: 'Display usage information'
method_option :show_methods, aliases: '-m', type: :boolean, default: true,
desc: 'Display Faker constants with methods'
method_option :verbose, aliases: '-v', type: :boolean,
desc: 'Include sample Faker output'
def list(*)
if options[:help]
invoke :help, ['list']
else
Faker::Bot::Commands::List.new(options).execute
end
end

desc 'search [Faker]', 'Search Faker method(s)'
method_option :help, aliases: '-h', type: :boolean,
desc: 'Display usage information'
method_option :show_methods, aliases: '-m', type: :boolean, default: true,
desc: 'Display Faker constants with methods'
method_option :verbose, aliases: '-v', type: :boolean,
desc: 'Include sample Faker output'
def search(query)
if options[:help]
invoke :help, ['search']
else
Faker::Bot::Commands::Search.new(options).execute(query)
end
desc 'search [Faker]', 'Search Faker method(s)'
method_option :help, aliases: '-h', type: :boolean,
desc: 'Display usage information'
method_option :show_methods, aliases: '-m', type: :boolean, default: true,
desc: 'Display Faker constants with methods'
method_option :verbose, aliases: '-v', type: :boolean,
desc: 'Include sample Faker output'
def search(query)
if options[:help]
invoke :help, ['search']
else
Faker::Bot::Commands::Search.new(options).execute(query)
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/faker/bot/reflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module Bot
#
class Reflector
Faker::Base.class_eval do
# Skip default deprecation warning output; the CLI will display that.
Gem::Deprecate.skip = true

# Select `Faker` subclasses
# @return [Array] `Faker::Base` sub classes
def self.descendants
Expand Down