Add CLI Base class for command line code (#25106)
This commit is contained in:
parent
d2e5430d4a
commit
384345b0de
33 changed files with 238 additions and 155 deletions
|
@ -1,18 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'set'
|
require 'set'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Accounts < Thor
|
class Accounts < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :all, type: :boolean
|
option :all, type: :boolean
|
||||||
desc 'rotate [USERNAME]', 'Generate and broadcast new keys'
|
desc 'rotate [USERNAME]', 'Generate and broadcast new keys'
|
||||||
long_desc <<-LONG_DESC
|
long_desc <<-LONG_DESC
|
||||||
|
|
19
lib/mastodon/cli/base.rb
Normal file
19
lib/mastodon/cli/base.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative '../../../config/boot'
|
||||||
|
require_relative '../../../config/environment'
|
||||||
|
|
||||||
|
require 'thor'
|
||||||
|
require_relative 'helper'
|
||||||
|
|
||||||
|
module Mastodon
|
||||||
|
module CLI
|
||||||
|
class Base < Thor
|
||||||
|
include CLI::Helper
|
||||||
|
|
||||||
|
def self.exit_on_failure?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,17 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Cache < Thor
|
class Cache < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'clear', 'Clear out the cache storage'
|
desc 'clear', 'Clear out the cache storage'
|
||||||
def clear
|
def clear
|
||||||
Rails.cache.clear
|
Rails.cache.clear
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'concurrent'
|
require 'concurrent'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class CanonicalEmailBlocks < Thor
|
class CanonicalEmailBlocks < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'find EMAIL', 'Find a given e-mail address in the canonical e-mail blocks'
|
desc 'find EMAIL', 'Find a given e-mail address in the canonical e-mail blocks'
|
||||||
long_desc <<-LONG_DESC
|
long_desc <<-LONG_DESC
|
||||||
When suspending a local user, a hash of a "canonical" version of their e-mail
|
When suspending a local user, a hash of a "canonical" version of their e-mail
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'concurrent'
|
require 'concurrent'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Domains < Thor
|
class Domains < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :concurrency, type: :numeric, default: 5, aliases: [:c]
|
option :concurrency, type: :numeric, default: 5, aliases: [:c]
|
||||||
option :verbose, type: :boolean, aliases: [:v]
|
option :verbose, type: :boolean, aliases: [:v]
|
||||||
option :dry_run, type: :boolean
|
option :dry_run, type: :boolean
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'concurrent'
|
require 'concurrent'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class EmailDomainBlocks < Thor
|
class EmailDomainBlocks < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'list', 'List blocked e-mail domains'
|
desc 'list', 'List blocked e-mail domains'
|
||||||
def list
|
def list
|
||||||
EmailDomainBlock.where(parent_id: nil).order(id: 'DESC').find_each do |entry|
|
EmailDomainBlock.where(parent_id: nil).order(id: 'DESC').find_each do |entry|
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rubygems/package'
|
require 'rubygems/package'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Emoji < Thor
|
class Emoji < Base
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :prefix
|
option :prefix
|
||||||
option :suffix
|
option :suffix
|
||||||
option :overwrite, type: :boolean
|
option :overwrite, type: :boolean
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Feeds < Thor
|
class Feeds < Base
|
||||||
include Helper
|
|
||||||
include Redisable
|
include Redisable
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :all, type: :boolean, default: false
|
option :all, type: :boolean, default: false
|
||||||
option :concurrency, type: :numeric, default: 5, aliases: [:c]
|
option :concurrency, type: :numeric, default: 5, aliases: [:c]
|
||||||
option :verbose, type: :boolean, aliases: [:v]
|
option :verbose, type: :boolean, aliases: [:v]
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rubygems/package'
|
require 'rubygems/package'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class IpBlocks < Thor
|
class IpBlocks < Base
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :severity, required: true, enum: %w(no_access sign_up_requires_approval sign_up_block), desc: 'Severity of the block'
|
option :severity, required: true, enum: %w(no_access sign_up_requires_approval sign_up_block), desc: 'Severity of the block'
|
||||||
option :comment, aliases: [:c], desc: 'Optional comment'
|
option :comment, aliases: [:c], desc: 'Optional comment'
|
||||||
option :duration, aliases: [:d], type: :numeric, desc: 'Duration of the block in seconds'
|
option :duration, aliases: [:d], type: :numeric, desc: 'Duration of the block in seconds'
|
||||||
|
|
|
@ -1,29 +1,25 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'thor'
|
require_relative 'base'
|
||||||
require_relative 'media'
|
|
||||||
require_relative 'emoji'
|
|
||||||
require_relative 'accounts'
|
require_relative 'accounts'
|
||||||
|
require_relative 'cache'
|
||||||
|
require_relative 'canonical_email_blocks'
|
||||||
|
require_relative 'domains'
|
||||||
|
require_relative 'email_domain_blocks'
|
||||||
|
require_relative 'emoji'
|
||||||
require_relative 'feeds'
|
require_relative 'feeds'
|
||||||
|
require_relative 'ip_blocks'
|
||||||
|
require_relative 'maintenance'
|
||||||
|
require_relative 'media'
|
||||||
|
require_relative 'preview_cards'
|
||||||
require_relative 'search'
|
require_relative 'search'
|
||||||
require_relative 'settings'
|
require_relative 'settings'
|
||||||
require_relative 'statuses'
|
require_relative 'statuses'
|
||||||
require_relative 'domains'
|
|
||||||
require_relative 'preview_cards'
|
|
||||||
require_relative 'cache'
|
|
||||||
require_relative 'upgrade'
|
require_relative 'upgrade'
|
||||||
require_relative 'email_domain_blocks'
|
|
||||||
require_relative 'canonical_email_blocks'
|
|
||||||
require_relative 'ip_blocks'
|
|
||||||
require_relative 'maintenance'
|
|
||||||
require_relative '../version'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Main < Thor
|
class Main < Base
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'media SUBCOMMAND ...ARGS', 'Manage media files'
|
desc 'media SUBCOMMAND ...ARGS', 'Manage media files'
|
||||||
subcommand 'media', Media
|
subcommand 'media', Media
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'tty-prompt'
|
require 'tty-prompt'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Maintenance < Thor
|
class Maintenance < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
MIN_SUPPORTED_VERSION = 2019_10_01_213028
|
MIN_SUPPORTED_VERSION = 2019_10_01_213028
|
||||||
MAX_SUPPORTED_VERSION = 2022_11_04_133904
|
MAX_SUPPORTED_VERSION = 2022_11_04_133904
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Media < Thor
|
class Media < Base
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
include Helper
|
|
||||||
|
|
||||||
VALID_PATH_SEGMENTS_SIZE = [7, 10].freeze
|
VALID_PATH_SEGMENTS_SIZE = [7, 10].freeze
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :days, type: :numeric, default: 7, aliases: [:d]
|
option :days, type: :numeric, default: 7, aliases: [:d]
|
||||||
option :prune_profiles, type: :boolean, default: false
|
option :prune_profiles, type: :boolean, default: false
|
||||||
option :remove_headers, type: :boolean, default: false
|
option :remove_headers, type: :boolean, default: false
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'tty-prompt'
|
require 'tty-prompt'
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class PreviewCards < Thor
|
class PreviewCards < Base
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :days, type: :numeric, default: 180
|
option :days, type: :numeric, default: 180
|
||||||
option :concurrency, type: :numeric, default: 5, aliases: [:c]
|
option :concurrency, type: :numeric, default: 5, aliases: [:c]
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Search < Thor
|
class Search < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
# Indices are sorted by amount of data to be expected in each, so that
|
# Indices are sorted by amount of data to be expected in each, so that
|
||||||
# smaller indices can go online sooner
|
# smaller indices can go online sooner
|
||||||
INDICES = [
|
INDICES = [
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Registrations < Thor
|
class Registrations < Base
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'open', 'Open registrations'
|
desc 'open', 'Open registrations'
|
||||||
def open
|
def open
|
||||||
Setting.registrations_mode = 'open'
|
Setting.registrations_mode = 'open'
|
||||||
|
@ -37,7 +31,7 @@ module Mastodon::CLI
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Settings < Thor
|
class Settings < Base
|
||||||
desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations'
|
desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations'
|
||||||
subcommand 'registrations', Registrations
|
subcommand 'registrations', Registrations
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Statuses < Thor
|
class Statuses < Base
|
||||||
include Helper
|
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
option :days, type: :numeric, default: 90
|
option :days, type: :numeric, default: 90
|
||||||
option :batch_size, type: :numeric, default: 1_000, aliases: [:b], desc: 'Number of records in each batch'
|
option :batch_size, type: :numeric, default: 1_000, aliases: [:b], desc: 'Number of records in each batch'
|
||||||
option :continue, type: :boolean, default: false, desc: 'If remove is not completed, execute from the previous continuation'
|
option :continue, type: :boolean, default: false, desc: 'If remove is not completed, execute from the previous continuation'
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative '../../../config/boot'
|
require_relative 'base'
|
||||||
require_relative '../../../config/environment'
|
|
||||||
require_relative 'helper'
|
|
||||||
|
|
||||||
module Mastodon::CLI
|
module Mastodon::CLI
|
||||||
class Upgrade < Thor
|
class Upgrade < Base
|
||||||
include Helper
|
|
||||||
|
|
||||||
def self.exit_on_failure?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
CURRENT_STORAGE_SCHEMA_VERSION = 1
|
CURRENT_STORAGE_SCHEMA_VERSION = 1
|
||||||
|
|
||||||
option :dry_run, type: :boolean, default: false
|
option :dry_run, type: :boolean, default: false
|
||||||
|
|
12
spec/lib/mastodon/cli/accounts_spec.rb
Normal file
12
spec/lib/mastodon/cli/accounts_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/accounts'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Accounts do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/cache_spec.rb
Normal file
12
spec/lib/mastodon/cli/cache_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/cache'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Cache do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/canonical_email_blocks_spec.rb
Normal file
12
spec/lib/mastodon/cli/canonical_email_blocks_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/canonical_email_blocks'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::CanonicalEmailBlocks do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/domains_spec.rb
Normal file
12
spec/lib/mastodon/cli/domains_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/domains'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Domains do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/email_domain_blocks_spec.rb
Normal file
12
spec/lib/mastodon/cli/email_domain_blocks_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/email_domain_blocks'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::EmailDomainBlocks do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/emoji_spec.rb
Normal file
12
spec/lib/mastodon/cli/emoji_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/emoji'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Emoji do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/feeds_spec.rb
Normal file
12
spec/lib/mastodon/cli/feeds_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/feeds'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Feeds do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,9 +3,15 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
require 'mastodon/cli/ip_blocks'
|
require 'mastodon/cli/ip_blocks'
|
||||||
|
|
||||||
RSpec.describe Mastodon::CLI::IpBlocks do
|
describe Mastodon::CLI::IpBlocks do
|
||||||
let(:cli) { described_class.new }
|
let(:cli) { described_class.new }
|
||||||
|
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#add' do
|
describe '#add' do
|
||||||
let(:ip_list) do
|
let(:ip_list) do
|
||||||
[
|
[
|
||||||
|
|
|
@ -4,6 +4,12 @@ require 'rails_helper'
|
||||||
require 'mastodon/cli/main'
|
require 'mastodon/cli/main'
|
||||||
|
|
||||||
describe Mastodon::CLI::Main do
|
describe Mastodon::CLI::Main do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'version' do
|
describe 'version' do
|
||||||
it 'returns the Mastodon version' do
|
it 'returns the Mastodon version' do
|
||||||
expect { described_class.new.invoke(:version) }.to output(
|
expect { described_class.new.invoke(:version) }.to output(
|
||||||
|
|
12
spec/lib/mastodon/cli/maintenance_spec.rb
Normal file
12
spec/lib/mastodon/cli/maintenance_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/maintenance'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Maintenance do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/media_spec.rb
Normal file
12
spec/lib/mastodon/cli/media_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/media'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Media do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/preview_cards_spec.rb
Normal file
12
spec/lib/mastodon/cli/preview_cards_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/preview_cards'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::PreviewCards do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/search_spec.rb
Normal file
12
spec/lib/mastodon/cli/search_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/search'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Search do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,7 +3,13 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
require 'mastodon/cli/settings'
|
require 'mastodon/cli/settings'
|
||||||
|
|
||||||
RSpec.describe Mastodon::CLI::Settings do
|
describe Mastodon::CLI::Settings do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'subcommand "registrations"' do
|
describe 'subcommand "registrations"' do
|
||||||
let(:cli) { Mastodon::CLI::Registrations.new }
|
let(:cli) { Mastodon::CLI::Registrations.new }
|
||||||
|
|
||||||
|
|
12
spec/lib/mastodon/cli/statuses_spec.rb
Normal file
12
spec/lib/mastodon/cli/statuses_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/statuses'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Statuses do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
spec/lib/mastodon/cli/upgrade_spec.rb
Normal file
12
spec/lib/mastodon/cli/upgrade_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
require 'mastodon/cli/upgrade'
|
||||||
|
|
||||||
|
describe Mastodon::CLI::Upgrade do
|
||||||
|
describe '.exit_on_failure?' do
|
||||||
|
it 'returns true' do
|
||||||
|
expect(described_class.exit_on_failure?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue