command_tower 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +59 -0
- data/Rakefile +32 -0
- data/app/controllers/command_tower/admin_controller.rb +104 -0
- data/app/controllers/command_tower/application_controller.rb +81 -0
- data/app/controllers/command_tower/auth/plain_text_controller.rb +132 -0
- data/app/controllers/command_tower/inbox/message_blast_controller.rb +89 -0
- data/app/controllers/command_tower/inbox/message_controller.rb +79 -0
- data/app/controllers/command_tower/user_controller.rb +49 -0
- data/app/controllers/command_tower/username_controller.rb +26 -0
- data/app/helpers/command_tower/application_helper.rb +4 -0
- data/app/helpers/command_tower/schema_helper.rb +29 -0
- data/app/jobs/command_tower/application_job.rb +4 -0
- data/app/mailers/command_tower/application_mailer.rb +8 -0
- data/app/mailers/command_tower/email_verification_mailer.rb +12 -0
- data/app/models/command_tower/application_record.rb +45 -0
- data/app/models/message.rb +30 -0
- data/app/models/message_blast.rb +27 -0
- data/app/models/user.rb +61 -0
- data/app/models/user_secret.rb +72 -0
- data/app/services/command_tower/README.md +49 -0
- data/app/services/command_tower/argument_validation/README.md +192 -0
- data/app/services/command_tower/argument_validation/class_methods.rb +178 -0
- data/app/services/command_tower/argument_validation/instance_methods.rb +148 -0
- data/app/services/command_tower/argument_validation.rb +11 -0
- data/app/services/command_tower/authorize/validate.rb +49 -0
- data/app/services/command_tower/inbox_service/blast/delete.rb +23 -0
- data/app/services/command_tower/inbox_service/blast/metadata.rb +26 -0
- data/app/services/command_tower/inbox_service/blast/new_user_blaster.rb +24 -0
- data/app/services/command_tower/inbox_service/blast/retrieve.rb +30 -0
- data/app/services/command_tower/inbox_service/blast/upsert.rb +67 -0
- data/app/services/command_tower/inbox_service/message/metadata.rb +35 -0
- data/app/services/command_tower/inbox_service/message/modify.rb +44 -0
- data/app/services/command_tower/inbox_service/message/retrieve.rb +36 -0
- data/app/services/command_tower/inbox_service/message/send.rb +33 -0
- data/app/services/command_tower/jwt/authenticate_user.rb +86 -0
- data/app/services/command_tower/jwt/decode.rb +21 -0
- data/app/services/command_tower/jwt/encode.rb +15 -0
- data/app/services/command_tower/jwt/login_create.rb +21 -0
- data/app/services/command_tower/jwt/time_delay_token.rb +17 -0
- data/app/services/command_tower/login_strategy/plain_text/create.rb +43 -0
- data/app/services/command_tower/login_strategy/plain_text/email_verification/generate.rb +29 -0
- data/app/services/command_tower/login_strategy/plain_text/email_verification/required.rb +20 -0
- data/app/services/command_tower/login_strategy/plain_text/email_verification/send.rb +23 -0
- data/app/services/command_tower/login_strategy/plain_text/email_verification/verify.rb +24 -0
- data/app/services/command_tower/login_strategy/plain_text/login.rb +50 -0
- data/app/services/command_tower/secrets/cleanse.rb +14 -0
- data/app/services/command_tower/secrets/generate.rb +62 -0
- data/app/services/command_tower/secrets/verify.rb +27 -0
- data/app/services/command_tower/secrets.rb +15 -0
- data/app/services/command_tower/service_base.rb +89 -0
- data/app/services/command_tower/service_logging.rb +41 -0
- data/app/services/command_tower/user_attributes/modify.rb +68 -0
- data/app/services/command_tower/user_attributes/roles.rb +27 -0
- data/app/services/command_tower/username/available.rb +64 -0
- data/app/views/command_tower/email_verification_mailer/verify_email.html.erb +26 -0
- data/config/routes.rb +55 -0
- data/db/migrate/20241117043720_create_command_tower_users.rb +42 -0
- data/db/migrate/20241204065708_create_command_tower_user_secrets.rb +16 -0
- data/db/migrate/20250223023306_create_command_tower_messages.rb +12 -0
- data/db/migrate/20250223023313_create_command_tower_message_blasts.rb +14 -0
- data/lib/command_tower/authorization/default.yml +42 -0
- data/lib/command_tower/authorization/entity.rb +101 -0
- data/lib/command_tower/authorization/role.rb +101 -0
- data/lib/command_tower/authorization.rb +85 -0
- data/lib/command_tower/configuration/admin/config.rb +18 -0
- data/lib/command_tower/configuration/application/config.rb +40 -0
- data/lib/command_tower/configuration/authorization/config.rb +24 -0
- data/lib/command_tower/configuration/base.rb +11 -0
- data/lib/command_tower/configuration/config.rb +77 -0
- data/lib/command_tower/configuration/email/config.rb +87 -0
- data/lib/command_tower/configuration/jwt/config.rb +22 -0
- data/lib/command_tower/configuration/login/config.rb +18 -0
- data/lib/command_tower/configuration/login/strategy/plain_text/config.rb +57 -0
- data/lib/command_tower/configuration/login/strategy/plain_text/email_verify.rb +50 -0
- data/lib/command_tower/configuration/login/strategy/plain_text/lockable.rb +27 -0
- data/lib/command_tower/configuration/otp/config.rb +54 -0
- data/lib/command_tower/configuration/user/config.rb +56 -0
- data/lib/command_tower/configuration/username/check.rb +31 -0
- data/lib/command_tower/configuration/username/config.rb +41 -0
- data/lib/command_tower/engine.rb +53 -0
- data/lib/command_tower/error.rb +5 -0
- data/lib/command_tower/schema/admin/users.rb +15 -0
- data/lib/command_tower/schema/error/base.rb +15 -0
- data/lib/command_tower/schema/error/invalid_argument.rb +15 -0
- data/lib/command_tower/schema/error/invalid_argument_response.rb +17 -0
- data/lib/command_tower/schema/inbox/blast_request.rb +15 -0
- data/lib/command_tower/schema/inbox/blast_response.rb +16 -0
- data/lib/command_tower/schema/inbox/message_blast_entity.rb +16 -0
- data/lib/command_tower/schema/inbox/message_blast_metadata.rb +16 -0
- data/lib/command_tower/schema/inbox/message_entity.rb +14 -0
- data/lib/command_tower/schema/inbox/metadata.rb +18 -0
- data/lib/command_tower/schema/inbox/modified.rb +13 -0
- data/lib/command_tower/schema/page.rb +14 -0
- data/lib/command_tower/schema/plain_text/create_user_request.rb +18 -0
- data/lib/command_tower/schema/plain_text/create_user_response.rb +17 -0
- data/lib/command_tower/schema/plain_text/email_verify_request.rb +11 -0
- data/lib/command_tower/schema/plain_text/email_verify_response.rb +11 -0
- data/lib/command_tower/schema/plain_text/email_verify_send_request.rb +9 -0
- data/lib/command_tower/schema/plain_text/email_verify_send_response.rb +11 -0
- data/lib/command_tower/schema/plain_text/login_request.rb +15 -0
- data/lib/command_tower/schema/plain_text/login_response.rb +13 -0
- data/lib/command_tower/schema/user.rb +28 -0
- data/lib/command_tower/schema.rb +38 -0
- data/lib/command_tower/spec_helper.rb +19 -0
- data/lib/command_tower/version.rb +5 -0
- data/lib/command_tower.rb +33 -0
- data/lib/generators/api_engine_base/configure/USAGE +8 -0
- data/lib/generators/api_engine_base/configure/configure_generator.rb +12 -0
- data/lib/tasks/auto_annotate_models.rake +60 -0
- metadata +255 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "command_tower/schema/user"
|
4
|
+
require "command_tower/schema/page"
|
5
|
+
|
6
|
+
module CommandTower
|
7
|
+
module Schema
|
8
|
+
module Admin
|
9
|
+
class Users < JsonSchematize::Generator
|
10
|
+
add_field name: :users, array_of_types: true, type: CommandTower::Schema::User
|
11
|
+
add_field name: :pagination, type: CommandTower::Schema::Page, required: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json_schematize/generator"
|
4
|
+
|
5
|
+
module CommandTower
|
6
|
+
module Schema
|
7
|
+
module Error
|
8
|
+
class Base < JsonSchematize::Generator
|
9
|
+
add_field name: :status, type: String
|
10
|
+
add_field name: :message, type: String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module Error
|
6
|
+
class InvalidArgument < JsonSchematize::Generator
|
7
|
+
add_field name: :schema, type: JsonSchematize::Generator, required: true, converter: ->(val) { val }
|
8
|
+
add_field name: :argument, type: String, required: true
|
9
|
+
add_field name: :argument_type, type: String, required: true
|
10
|
+
add_field name: :reason, type: String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "command_tower/schema/error/invalid_argument"
|
4
|
+
|
5
|
+
module CommandTower
|
6
|
+
module Schema
|
7
|
+
module Error
|
8
|
+
class InvalidArgumentResponse < JsonSchematize::Generator
|
9
|
+
add_field name: :message, type: String, required: true
|
10
|
+
add_field name: :status, type: String, required: true
|
11
|
+
add_field name: :invalid_arguments, array_of_types: true, type: InvalidArgument
|
12
|
+
add_field name: :invalid_argument_keys, type: Array
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module Inbox
|
6
|
+
class BlastRequest < JsonSchematize::Generator
|
7
|
+
add_field name: :existing_users, type: JsonSchematize::Boolean
|
8
|
+
add_field name: :new_users, type: JsonSchematize::Boolean
|
9
|
+
add_field name: :title, type: String
|
10
|
+
add_field name: :text, type: String
|
11
|
+
add_field name: :id, type: Integer, required: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module Inbox
|
6
|
+
class BlastResponse < JsonSchematize::Generator
|
7
|
+
add_field name: :created_by, type: CommandTower::Schema::User
|
8
|
+
add_field name: :existing_users, type: JsonSchematize::Boolean
|
9
|
+
add_field name: :new_users, type: JsonSchematize::Boolean
|
10
|
+
add_field name: :title, type: String
|
11
|
+
add_field name: :text, type: String
|
12
|
+
add_field name: :id, type: Integer, required: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module Inbox
|
6
|
+
class MessageBlastEntity < JsonSchematize::Generator
|
7
|
+
add_field name: :created_by, type: CommandTower::Schema::User, required: false # to allow metadata call to be fast
|
8
|
+
add_field name: :text, type: String, required: false # to allow metadata call to be fast
|
9
|
+
add_field name: :title, type: String
|
10
|
+
add_field name: :id, type: Integer
|
11
|
+
add_field name: :existing_users, type: JsonSchematize::Boolean
|
12
|
+
add_field name: :new_users, type: JsonSchematize::Boolean
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "command_tower/schema/inbox/message_blast_entity"
|
4
|
+
require "command_tower/schema/page"
|
5
|
+
|
6
|
+
module CommandTower
|
7
|
+
module Schema
|
8
|
+
module Inbox
|
9
|
+
class MessageBlastMetadata < JsonSchematize::Generator
|
10
|
+
add_field name: :entities, array_of_types: true, type: CommandTower::Schema::Inbox::MessageBlastEntity, required: false
|
11
|
+
add_field name: :count, type: Integer
|
12
|
+
add_field name: :pagination, type: CommandTower::Schema::Page, required: false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module Inbox
|
6
|
+
class MessageEntity < JsonSchematize::Generator
|
7
|
+
add_field name: :title, type: String
|
8
|
+
add_field name: :id, type: Integer
|
9
|
+
add_field name: :text, type: String, required: false
|
10
|
+
add_field name: :viewed, type: JsonSchematize::Boolean
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "command_tower/schema/inbox/message_entity"
|
4
|
+
require "command_tower/schema/page"
|
5
|
+
|
6
|
+
module CommandTower
|
7
|
+
module Schema
|
8
|
+
module Inbox
|
9
|
+
class Metadata < JsonSchematize::Generator
|
10
|
+
# schema_default option: :dig_type, value: :string
|
11
|
+
|
12
|
+
add_field name: :entities, array_of_types: true, type: CommandTower::Schema::Inbox::MessageEntity, required: false
|
13
|
+
add_field name: :count, type: Integer
|
14
|
+
add_field name: :pagination, type: CommandTower::Schema::Page, required: false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module Inbox
|
6
|
+
class Modified < JsonSchematize::Generator
|
7
|
+
add_field name: :type, type: Symbol
|
8
|
+
add_field name: :ids, type: Array
|
9
|
+
add_field name: :count, type: Integer
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
class Page < JsonSchematize::Generator
|
6
|
+
schema_default option: :dig_type, value: :string
|
7
|
+
|
8
|
+
add_field name: :count, type: Integer
|
9
|
+
add_field name: :cursor, type: Integer
|
10
|
+
add_field name: :limit, type: Integer
|
11
|
+
add_field name: :next, type: String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module PlainText
|
6
|
+
class CreateUserRequest < JsonSchematize::Generator
|
7
|
+
schema_default option: :dig_type, value: :string
|
8
|
+
|
9
|
+
add_field name: :first_name, type: String, required: false
|
10
|
+
add_field name: :last_name, type: String, required: false
|
11
|
+
add_field name: :username, type: String, required: false
|
12
|
+
add_field name: :email, type: String, required: false
|
13
|
+
add_field name: :password, type: String, required: false
|
14
|
+
add_field name: :password_confirmation, type: String, required: false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module PlainText
|
6
|
+
class CreateUserResponse < JsonSchematize::Generator
|
7
|
+
add_field name: :full_name, type: String
|
8
|
+
add_field name: :first_name, type: String
|
9
|
+
add_field name: :last_name, type: String
|
10
|
+
add_field name: :username, type: String
|
11
|
+
add_field name: :email, type: String
|
12
|
+
add_field name: :msg, type: String
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module PlainText
|
6
|
+
class LoginRequest < JsonSchematize::Generator
|
7
|
+
schema_default option: :dig_type, value: :string
|
8
|
+
|
9
|
+
add_field name: :username, type: String, required: false
|
10
|
+
add_field name: :email, type: String, required: false
|
11
|
+
add_field name: :password, type: String, required: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
module PlainText
|
6
|
+
class LoginResponse < JsonSchematize::Generator
|
7
|
+
add_field name: :token, type: String
|
8
|
+
add_field name: :header_name, type: String
|
9
|
+
add_field name: :message, type: String
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
class User < JsonSchematize::Generator
|
6
|
+
schema_default option: :dig_type, value: :string
|
7
|
+
|
8
|
+
def self.convert_user_object(user:)
|
9
|
+
attributes = CommandTower.config.user.default_attributes.map(&:to_s)
|
10
|
+
object = user.attributes.slice(*attributes)
|
11
|
+
|
12
|
+
new(object)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Gets assigned during configuration phase via
|
16
|
+
# lib/command_tower/configuration/user/config.rb
|
17
|
+
def self.assign!
|
18
|
+
attributes = CommandTower.config.user.default_attributes
|
19
|
+
attributes.each do |attribute|
|
20
|
+
if metadata = ::User.attribute_to_type_mapping[attribute]
|
21
|
+
type = metadata[:serialized_type] ? metadata[:serialized_type] : metadata[:base]
|
22
|
+
add_field(name: attribute, type:)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module Schema
|
5
|
+
require "json_schematize"
|
6
|
+
require "json_schematize/generator"
|
7
|
+
|
8
|
+
## Generic Error Schemas
|
9
|
+
require "command_tower/schema/error/base"
|
10
|
+
require "command_tower/schema/error/invalid_argument_response"
|
11
|
+
|
12
|
+
## Plain Text Controller
|
13
|
+
require "command_tower/schema/plain_text/create_user_response"
|
14
|
+
require "command_tower/schema/plain_text/create_user_request"
|
15
|
+
|
16
|
+
require "command_tower/schema/plain_text/email_verify_request"
|
17
|
+
require "command_tower/schema/plain_text/email_verify_response"
|
18
|
+
|
19
|
+
require "command_tower/schema/plain_text/email_verify_send_response"
|
20
|
+
require "command_tower/schema/plain_text/email_verify_send_request"
|
21
|
+
|
22
|
+
require "command_tower/schema/plain_text/login_request"
|
23
|
+
require "command_tower/schema/plain_text/login_response"
|
24
|
+
|
25
|
+
require "command_tower/schema/admin/users"
|
26
|
+
|
27
|
+
require "command_tower/schema/user"
|
28
|
+
require "command_tower/schema/page"
|
29
|
+
|
30
|
+
require "command_tower/schema/inbox/metadata"
|
31
|
+
require "command_tower/schema/inbox/message_entity"
|
32
|
+
require "command_tower/schema/inbox/modified"
|
33
|
+
require "command_tower/schema/inbox/blast_response"
|
34
|
+
require "command_tower/schema/inbox/blast_request"
|
35
|
+
require "command_tower/schema/inbox/message_blast_entity"
|
36
|
+
require "command_tower/schema/inbox/message_blast_metadata"
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandTower
|
4
|
+
module SpecHelper
|
5
|
+
def set_jwt_token!(user:, with_reset: false, token: nil)
|
6
|
+
if token.nil?
|
7
|
+
result = CommandTower::Jwt::LoginCreate.(user:)
|
8
|
+
token = result.token
|
9
|
+
end
|
10
|
+
|
11
|
+
@request.headers[CommandTower::ApplicationController::AUTHENTICATION_HEADER] = "Bearer: #{token}"
|
12
|
+
@request.headers[CommandTower::ApplicationController::AUTHENTICATION_WITH_RESET] = "true" if with_reset
|
13
|
+
end
|
14
|
+
|
15
|
+
def unset_jwt_token!
|
16
|
+
@request.headers[CommandTower::ApplicationController::AUTHENTICATION_HEADER] = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "command_tower/error"
|
2
|
+
|
3
|
+
require "command_tower/version"
|
4
|
+
require "command_tower/engine"
|
5
|
+
require "command_tower/configuration/config"
|
6
|
+
|
7
|
+
module CommandTower
|
8
|
+
def self.config
|
9
|
+
@config ||= Configuration::Config.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
yield(config)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.config=(configuration)
|
17
|
+
raise ArgumentError, "Expected Configuration::Config. Given #{configuration.class}" unless Configuration::Config === configuration
|
18
|
+
|
19
|
+
@config = configuration
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.app_name
|
23
|
+
Proc === config.app.app_name ? config.app.app_name.() : config.app.app_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.app_name_for_comms
|
27
|
+
Proc === config.app.communication_name ? config.app.communication_name.() : config.app.communication_name
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.default_app_name
|
31
|
+
::Rails.application.class.module_parent_name
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CommandTower::ConfigureGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path("templates", __dir__)
|
3
|
+
|
4
|
+
def create_config_file
|
5
|
+
create_file Rails.root.join("config", "initializers", "command_tower.rb"),
|
6
|
+
CommandTower.config.class.composer_generate_config(wrapping: "CommandTower.configure", require_file: "command_tower")
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_route
|
10
|
+
route "mount CommandTower::Engine => \"/\""
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# NOTE: only doing this in development as some production environments (Heroku)
|
2
|
+
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
|
3
|
+
# NOTE: to have a dev-mode tool do its thing in production.
|
4
|
+
|
5
|
+
# if Rails.env.development?
|
6
|
+
require 'annotate'
|
7
|
+
task :set_annotation_options do
|
8
|
+
# You can override any of these by setting an environment variable of the
|
9
|
+
# same name.
|
10
|
+
Annotate.set_defaults(
|
11
|
+
'active_admin' => 'false',
|
12
|
+
'additional_file_patterns' => [],
|
13
|
+
'routes' => 'false',
|
14
|
+
'models' => 'true',
|
15
|
+
'position_in_routes' => 'before',
|
16
|
+
'position_in_class' => 'before',
|
17
|
+
'position_in_test' => 'before',
|
18
|
+
'position_in_fixture' => 'before',
|
19
|
+
'position_in_factory' => 'before',
|
20
|
+
'position_in_serializer' => 'before',
|
21
|
+
'show_foreign_keys' => 'true',
|
22
|
+
'show_complete_foreign_keys' => 'false',
|
23
|
+
'show_indexes' => 'true',
|
24
|
+
'simple_indexes' => 'false',
|
25
|
+
'model_dir' => 'app/models',
|
26
|
+
'root_dir' => '',
|
27
|
+
'include_version' => 'false',
|
28
|
+
'require' => '',
|
29
|
+
'exclude_tests' => 'false',
|
30
|
+
'exclude_fixtures' => 'false',
|
31
|
+
'exclude_factories' => 'false',
|
32
|
+
'exclude_serializers' => 'false',
|
33
|
+
'exclude_scaffolds' => 'true',
|
34
|
+
'exclude_controllers' => 'true',
|
35
|
+
'exclude_helpers' => 'true',
|
36
|
+
'exclude_sti_subclasses' => 'false',
|
37
|
+
'ignore_model_sub_dir' => 'false',
|
38
|
+
'ignore_columns' => nil,
|
39
|
+
'ignore_routes' => nil,
|
40
|
+
'ignore_unknown_models' => 'false',
|
41
|
+
'hide_limit_column_types' => 'integer,bigint,boolean',
|
42
|
+
'hide_default_column_types' => 'json,jsonb,hstore',
|
43
|
+
'skip_on_db_migrate' => 'false',
|
44
|
+
'format_bare' => 'true',
|
45
|
+
'format_rdoc' => 'false',
|
46
|
+
'format_yard' => 'false',
|
47
|
+
'format_markdown' => 'false',
|
48
|
+
'sort' => 'false',
|
49
|
+
'force' => 'false',
|
50
|
+
'frozen' => 'false',
|
51
|
+
'classified_sort' => 'true',
|
52
|
+
'trace' => 'false',
|
53
|
+
'wrapper_open' => nil,
|
54
|
+
'wrapper_close' => nil,
|
55
|
+
'with_comment' => 'true'
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
Annotate.load_tasks
|
60
|
+
# end
|