Skip to content

Commit b6b4ea4

Browse files
authored
Move the mastodon/*_cli files to mastodon/cli/* (mastodon#24139)
1 parent c9f980b commit b6b4ea4

23 files changed

Lines changed: 150 additions & 152 deletions

.rubocop.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Layout/LineLength:
4343
- !ruby/regexp / \# .*$/
4444
- !ruby/regexp /^\# .*$/
4545
Exclude:
46-
- lib/**/*cli*.rb
46+
- 'lib/mastodon/cli/*.rb'
4747
- db/*migrate/**/*
4848
- db/seeds/**/*
4949

@@ -57,7 +57,7 @@ Lint/UselessAccessModifier:
5757
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsabcsize
5858
Metrics/AbcSize:
5959
Exclude:
60-
- 'lib/**/*cli*.rb'
60+
- 'lib/mastodon/cli/*.rb'
6161
- db/*migrate/**/*
6262

6363
# Reason: Some functions cannot be broken up, but others may be refactor candidates
@@ -66,7 +66,7 @@ Metrics/BlockLength:
6666
CountAsOne: ['array', 'hash', 'heredoc', 'method_call']
6767
Exclude:
6868
- 'config/routes.rb'
69-
- 'lib/mastodon/*_cli.rb'
69+
- 'lib/mastodon/cli/*.rb'
7070
- 'lib/tasks/*.rake'
7171
- 'app/models/concerns/account_associations.rb'
7272
- 'app/models/concerns/account_interactions.rb'
@@ -95,14 +95,14 @@ Metrics/BlockLength:
9595
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocknesting
9696
Metrics/BlockNesting:
9797
Exclude:
98-
- 'lib/mastodon/*_cli.rb'
98+
- 'lib/mastodon/cli/*.rb'
9999

100100
# Reason: Some Excluded files would be candidates for refactoring but not currently addressed
101101
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsclasslength
102102
Metrics/ClassLength:
103103
CountAsOne: ['array', 'hash', 'heredoc', 'method_call']
104104
Exclude:
105-
- 'lib/mastodon/*_cli.rb'
105+
- 'lib/mastodon/cli/*.rb'
106106
- 'app/controllers/admin/accounts_controller.rb'
107107
- 'app/controllers/api/base_controller.rb'
108108
- 'app/controllers/api/v1/admin/accounts_controller.rb'
@@ -146,15 +146,15 @@ Metrics/ClassLength:
146146
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity
147147
Metrics/CyclomaticComplexity:
148148
Exclude:
149-
- lib/mastodon/*cli*.rb
149+
- lib/mastodon/cli/*.rb
150150
- db/*migrate/**/*
151151

152152
# Reason: Currently disabled in .rubocop_todo.yml
153153
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmethodlength
154154
Metrics/MethodLength:
155155
CountAsOne: [array, heredoc]
156156
Exclude:
157-
- 'lib/mastodon/*_cli.rb'
157+
- 'lib/mastodon/cli/*.rb'
158158

159159
# Reason:
160160
# https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength
@@ -176,9 +176,7 @@ Rails/HttpStatus:
176176
Rails/Exit:
177177
Exclude:
178178
- 'config/boot.rb'
179-
- 'lib/mastodon/*_cli.rb'
180-
- 'lib/mastodon/cli_helper.rb'
181-
- 'lib/cli.rb'
179+
- 'lib/mastodon/cli/*.rb'
182180

183181
# Reason: Some single letter camel case files shouldn't be split
184182
# https://docs.rubocop.org/rubocop-rspec/cops_rspec.html#rspecfilepath

.rubocop_todo.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,9 @@ Rails/SkipsModelValidations:
846846
- 'db/post_migrate/20220617202502_migrate_roles.rb'
847847
- 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb'
848848
- 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb'
849-
- 'lib/cli.rb'
850-
- 'lib/mastodon/accounts_cli.rb'
851-
- 'lib/mastodon/maintenance_cli.rb'
849+
- 'lib/mastodon/cli/accounts.rb'
850+
- 'lib/mastodon/cli/main.rb'
851+
- 'lib/mastodon/cli/maintenance.rb'
852852
- 'spec/controllers/api/v1/admin/accounts_controller_spec.rb'
853853
- 'spec/lib/activitypub/activity/follow_spec.rb'
854854
- 'spec/services/follow_service_spec.rb'
@@ -929,7 +929,7 @@ Rails/WhereExists:
929929
- 'app/validators/vote_validator.rb'
930930
- 'app/workers/move_worker.rb'
931931
- 'db/migrate/20190529143559_preserve_old_layout_for_existing_users.rb'
932-
- 'lib/mastodon/email_domain_blocks_cli.rb'
932+
- 'lib/mastodon/cli/email_domain_blocks.rb'
933933
- 'lib/tasks/tests.rake'
934934
- 'spec/controllers/api/v1/accounts/notes_controller_spec.rb'
935935
- 'spec/controllers/api/v1/tags_controller_spec.rb'
@@ -991,7 +991,7 @@ Style/FormatStringToken:
991991
Exclude:
992992
- 'app/models/privacy_policy.rb'
993993
- 'config/initializers/devise.rb'
994-
- 'lib/mastodon/maintenance_cli.rb'
994+
- 'lib/mastodon/cli/maintenance.rb'
995995
- 'lib/paperclip/color_extractor.rb'
996996

997997
# This cop supports unsafe autocorrection (--autocorrect-all).
@@ -1436,9 +1436,9 @@ Style/GuardClause:
14361436
- 'db/post_migrate/20220704024901_migrate_settings_to_user_roles.rb'
14371437
- 'lib/devise/two_factor_ldap_authenticatable.rb'
14381438
- 'lib/devise/two_factor_pam_authenticatable.rb'
1439-
- 'lib/mastodon/accounts_cli.rb'
1440-
- 'lib/mastodon/maintenance_cli.rb'
1441-
- 'lib/mastodon/media_cli.rb'
1439+
- 'lib/mastodon/cli/accounts.rb'
1440+
- 'lib/mastodon/cli/maintenance.rb'
1441+
- 'lib/mastodon/cli/media.rb'
14421442
- 'lib/paperclip/attachment_extensions.rb'
14431443
- 'lib/tasks/repo.rake'
14441444

bin/tootctl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
APP_PATH = File.expand_path('../config/application', __dir__)
33

44
require_relative '../config/boot'
5-
require_relative '../lib/cli'
5+
require_relative '../lib/mastodon/cli/main'
66

77
begin
88
Chewy.strategy(:mastodon) do
9-
Mastodon::CLI.start(ARGV)
9+
Mastodon::CLI::Main.start(ARGV)
1010
end
1111
rescue Interrupt
1212
exit(130)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# frozen_string_literal: true
22

33
require 'set'
4-
require_relative '../../config/boot'
5-
require_relative '../../config/environment'
6-
require_relative 'cli_helper'
4+
require_relative '../../../config/boot'
5+
require_relative '../../../config/environment'
6+
require_relative 'helper'
77

8-
module Mastodon
9-
class AccountsCLI < Thor
10-
include CLIHelper
8+
module Mastodon::CLI
9+
class Accounts < Thor
10+
include Helper
1111

1212
def self.exit_on_failure?
1313
true
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

3-
require_relative '../../config/boot'
4-
require_relative '../../config/environment'
5-
require_relative 'cli_helper'
3+
require_relative '../../../config/boot'
4+
require_relative '../../../config/environment'
5+
require_relative 'helper'
66

7-
module Mastodon
8-
class CacheCLI < Thor
9-
include CLIHelper
7+
module Mastodon::CLI
8+
class Cache < Thor
9+
include Helper
1010

1111
def self.exit_on_failure?
1212
true

lib/mastodon/canonical_email_blocks_cli.rb renamed to lib/mastodon/cli/canonical_email_blocks.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# frozen_string_literal: true
22

33
require 'concurrent'
4-
require_relative '../../config/boot'
5-
require_relative '../../config/environment'
6-
require_relative 'cli_helper'
4+
require_relative '../../../config/boot'
5+
require_relative '../../../config/environment'
6+
require_relative 'helper'
77

8-
module Mastodon
9-
class CanonicalEmailBlocksCLI < Thor
10-
include CLIHelper
8+
module Mastodon::CLI
9+
class CanonicalEmailBlocks < Thor
10+
include Helper
1111

1212
def self.exit_on_failure?
1313
true
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# frozen_string_literal: true
22

33
require 'concurrent'
4-
require_relative '../../config/boot'
5-
require_relative '../../config/environment'
6-
require_relative 'cli_helper'
4+
require_relative '../../../config/boot'
5+
require_relative '../../../config/environment'
6+
require_relative 'helper'
77

8-
module Mastodon
9-
class DomainsCLI < Thor
10-
include CLIHelper
8+
module Mastodon::CLI
9+
class Domains < Thor
10+
include Helper
1111

1212
def self.exit_on_failure?
1313
true
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# frozen_string_literal: true
22

33
require 'concurrent'
4-
require_relative '../../config/boot'
5-
require_relative '../../config/environment'
6-
require_relative 'cli_helper'
4+
require_relative '../../../config/boot'
5+
require_relative '../../../config/environment'
6+
require_relative 'helper'
77

8-
module Mastodon
9-
class EmailDomainBlocksCLI < Thor
10-
include CLIHelper
8+
module Mastodon::CLI
9+
class EmailDomainBlocks < Thor
10+
include Helper
1111

1212
def self.exit_on_failure?
1313
true
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

33
require 'rubygems/package'
4-
require_relative '../../config/boot'
5-
require_relative '../../config/environment'
6-
require_relative 'cli_helper'
4+
require_relative '../../../config/boot'
5+
require_relative '../../../config/environment'
6+
require_relative 'helper'
77

8-
module Mastodon
9-
class EmojiCLI < Thor
8+
module Mastodon::CLI
9+
class Emoji < Thor
1010
def self.exit_on_failure?
1111
true
1212
end
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

3-
require_relative '../../config/boot'
4-
require_relative '../../config/environment'
5-
require_relative 'cli_helper'
3+
require_relative '../../../config/boot'
4+
require_relative '../../../config/environment'
5+
require_relative 'helper'
66

7-
module Mastodon
8-
class FeedsCLI < Thor
9-
include CLIHelper
7+
module Mastodon::CLI
8+
class Feeds < Thor
9+
include Helper
1010
include Redisable
1111

1212
def self.exit_on_failure?

0 commit comments

Comments
 (0)