Class: Toys::Templates::Rubocop
- Inherits:
-
Object
- Object
- Toys::Templates::Rubocop
- Includes:
- Toys::Template
- Defined in:
- lib/toys/templates/rubocop.rb
Overview
A template for tools that run rubocop
Constant Summary collapse
- DEFAULT_GEM_VERSION_REQUIREMENTS =
Default version requirements for the rubocop gem.
[].freeze
- DEFAULT_TOOL_NAME =
Default tool name
"rubocop"
Instance Attribute Summary collapse
-
#bundler ⇒ Boolean, Hash
writeonly
Set the bundler state and options for this tool.
-
#context_directory ⇒ String
writeonly
Custom context directory for this tool.
-
#fail_on_error ⇒ Boolean
writeonly
Whether to exit with a nonzero code if Rubocop fails.
-
#gem_version ⇒ String, ...
writeonly
Version requirements for the rdoc gem.
-
#name ⇒ String
writeonly
Name of the tool to create.
-
#options ⇒ Array<String>
writeonly
Additional options to pass to Rubocop.
Instance Method Summary collapse
-
#initialize(name: DEFAULT_TOOL_NAME, gem_version: nil, fail_on_error: true, options: [], bundler: false, context_directory: nil) ⇒ Rubocop
constructor
Create the template settings for the Rubocop template.
-
#use_bundler(**opts) ⇒ self
Activate bundler for this tool.
Methods included from Toys::Template
Constructor Details
#initialize(name: DEFAULT_TOOL_NAME, gem_version: nil, fail_on_error: true, options: [], bundler: false, context_directory: nil) ⇒ Rubocop
Create the template settings for the Rubocop template.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/toys/templates/rubocop.rb', line 42 def initialize(name: DEFAULT_TOOL_NAME, gem_version: nil, fail_on_error: true, options: [], bundler: false, context_directory: nil) @name = name @gem_version = gem_version @fail_on_error = fail_on_error @options = @bundler = bundler @context_directory = context_directory end |
Instance Attribute Details
#bundler=(value) ⇒ Boolean, Hash (writeonly)
Set the bundler state and options for this tool.
Pass false
to disable bundler. Pass true
or a hash of options to
enable bundler. See the documentation for the
bundler mixin
for information on the options that can be passed.
110 111 112 |
# File 'lib/toys/templates/rubocop.rb', line 110 def bundler=(value) @bundler = value end |
#context_directory=(value) ⇒ String
Custom context directory for this tool.
97 98 99 |
# File 'lib/toys/templates/rubocop.rb', line 97 def context_directory=(value) @context_directory = value end |
#fail_on_error=(value) ⇒ Boolean
Whether to exit with a nonzero code if Rubocop fails.
81 82 83 |
# File 'lib/toys/templates/rubocop.rb', line 81 def fail_on_error=(value) @fail_on_error = value end |
#gem_version=(value) ⇒ String, ...
Version requirements for the rdoc gem.
If set to nil
, uses the bundled version if bundler is enabled, or
defaults to DEFAULT_GEM_VERSION_REQUIREMENTS if bundler is not
enabled.
73 74 75 |
# File 'lib/toys/templates/rubocop.rb', line 73 def gem_version=(value) @gem_version = value end |
#name=(value) ⇒ String
Name of the tool to create.
62 63 64 |
# File 'lib/toys/templates/rubocop.rb', line 62 def name=(value) @name = value end |
#options=(value) ⇒ Array<String>
Additional options to pass to Rubocop
89 90 91 |
# File 'lib/toys/templates/rubocop.rb', line 89 def (value) @options = value end |
Instance Method Details
#use_bundler(**opts) ⇒ self
Activate bundler for this tool.
See the documentation for the bundler mixin for information on the options that can be passed.
122 123 124 125 |
# File 'lib/toys/templates/rubocop.rb', line 122 def use_bundler(**opts) @bundler = opts self end |