Class: Dev::Template::Docker::Ruby::Application
- Inherits:
-
ApplicationInterface
- Object
- BaseInterface
- ApplicationInterface
- Dev::Template::Docker::Ruby::Application
- Defined in:
- lib/firespring_dev_commands/templates/docker/ruby/application.rb
Overview
Class for default rake tasks associated with a ruby project
Instance Attribute Summary collapse
-
#ruby ⇒ Object
readonly
Returns the value of attribute ruby.
Attributes inherited from ApplicationInterface
Attributes inherited from BaseInterface
Instance Method Summary collapse
-
#create_audit_task! ⇒ Object
Create the rake task which runs the security audits for the application packages.
-
#create_install_task! ⇒ Object
Create the rake task which runs the install command for the application packages.
-
#create_lint_task! ⇒ Object
Create the rake task which runs linting for the application name.
-
#create_test_task! ⇒ Object
Create the rake task which runs all tests for the application name.
-
#initialize(application, container_path: nil, local_path: nil, exclude: []) ⇒ Application
constructor
Allow for custom container path for the application.
Methods inherited from BaseInterface
Constructor Details
#initialize(application, container_path: nil, local_path: nil, exclude: []) ⇒ Application
Allow for custom container path for the application
13 14 15 16 |
# File 'lib/firespring_dev_commands/templates/docker/ruby/application.rb', line 13 def initialize(application, container_path: nil, local_path: nil, exclude: []) @ruby = Dev::Ruby.new(container_path:, local_path:) super(application, exclude:) end |
Instance Attribute Details
#ruby ⇒ Object (readonly)
Returns the value of attribute ruby.
10 11 12 |
# File 'lib/firespring_dev_commands/templates/docker/ruby/application.rb', line 10 def ruby @ruby end |
Instance Method Details
#create_audit_task! ⇒ Object
Create the rake task which runs the security audits for the application packages
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/firespring_dev_commands/templates/docker/ruby/application.rb', line 106 def create_audit_task! # Have to set a local variable to be accessible inside of the instance_eval block application = @name ruby = @ruby exclude = @exclude return if exclude.include?(:audit) DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do desc 'Run all security audits' task audit: [:'ruby:audit'] do # This is just a placeholder to execute the dependencies end namespace :ruby do desc 'Run Bundle Audit on the target application' \ "\n\tuse MIN_SEVERITY=(info low moderate high critical) to fetch only severity type selected and above (default=high)." \ "\n\tuse IGNORELIST=(comma delimited list of ids) removes the entry from the list." task audit: %w(init_docker up_no_deps) do opts = [] opts << '-T' if Dev::Common.new.running_codebuild? # Retrieve results of the scan. data = Dev::Docker::Compose.new(services: application, options: opts, capture: true).exec(*ruby.audit_command) Dev::Ruby::Audit.new(data).to_report.check end # namespace :audit do # desc 'Run NPM Audit fix command' # task fix: %w(init_docker up_no_deps) do # raise 'not implemented' # # Dev::Docker::Compose.new(services: application).exec(*ruby.audit_fix_command) # end # end end end end end |
#create_install_task! ⇒ Object
Create the rake task which runs the install command for the application packages
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/firespring_dev_commands/templates/docker/ruby/application.rb', line 86 def create_install_task! # Have to set a local variable to be accessible inside of the instance_eval block application = @name ruby = @ruby exclude = @exclude return if exclude.include?(:install) DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do namespace :ruby do desc 'Install all bundled gems' task install: %w(init_docker up_no_deps) do Dev::Docker::Compose.new(services: application).exec(*ruby.install_command) end end end end end |
#create_lint_task! ⇒ Object
Create the rake task which runs linting for the application name
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/firespring_dev_commands/templates/docker/ruby/application.rb', line 19 def create_lint_task! application = @name ruby = @ruby exclude = @exclude return if exclude.include?(:lint) DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do desc 'Run all linting software' task lint: %w(ruby:lint) do # This is just a placeholder to execute the dependencies end namespace :ruby do desc "Run the ruby linting software against the #{application}'s codebase" task lint: %w(init_docker up_no_deps) do LOG.debug("Check for ruby linting errors in the #{application} codebase") = [] << '-T' if Dev::Common.new.running_codebuild? Dev::Docker::Compose.new(services: application, options:).exec(*ruby.lint_command) end namespace :lint do desc "Run the ruby linting software against the #{application}'s codebase and apply all available fixes" task fix: %w(init_docker up_no_deps) do LOG.debug("Check and fix all ruby linting errors in the #{application} codebase") = [] << '-T' if Dev::Common.new.running_codebuild? Dev::Docker::Compose.new(services: application, options:).exec(*ruby.lint_fix_command) end end end end end end |
#create_test_task! ⇒ Object
Create the rake task which runs all tests for the application name
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/firespring_dev_commands/templates/docker/ruby/application.rb', line 58 def create_test_task! application = @name ruby = @ruby exclude = @exclude return if exclude.include?(:test) DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace application do desc 'Run all tests' task test: [:'ruby:test'] do # This is just a placeholder to execute the dependencies end namespace :ruby do desc "Run all ruby tests against the #{application}'s codebase" task test: %w(init_docker up_no_deps) do LOG.debug("Running all ruby tests in the #{application} codebase") = [] << '-T' if Dev::Common.new.running_codebuild? Dev::Docker::Compose.new(services: application, options:).exec(*ruby.test_command) end end end end end |