Class: Toys::Templates::Rubocop
- Inherits:
-
Object
- Object
- Toys::Templates::Rubocop
- Includes:
- 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.
-
#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) ⇒ Rubocop
constructor
Create the template settings for the Rubocop template.
-
#use_bundler(**opts) ⇒ self
Activate bundler for this tool.
Constructor Details
#initialize(name: DEFAULT_TOOL_NAME, gem_version: nil, fail_on_error: true, options: [], bundler: false) ⇒ Rubocop
Create the template settings for the Rubocop template.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/toys/templates/rubocop.rb', line 40 def initialize(name: DEFAULT_TOOL_NAME, gem_version: nil, fail_on_error: true, options: [], bundler: false) @name = name @gem_version = gem_version @fail_on_error = fail_on_error @options = @bundler = bundler 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.
98 99 100 |
# File 'lib/toys/templates/rubocop.rb', line 98 def bundler=(value) @bundler = value end |
#fail_on_error=(value) ⇒ Boolean
Whether to exit with a nonzero code if Rubocop fails.
77 78 79 |
# File 'lib/toys/templates/rubocop.rb', line 77 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.
69 70 71 |
# File 'lib/toys/templates/rubocop.rb', line 69 def gem_version=(value) @gem_version = value end |
#name=(value) ⇒ String
Name of the tool to create.
58 59 60 |
# File 'lib/toys/templates/rubocop.rb', line 58 def name=(value) @name = value end |
#options=(value) ⇒ Array<String>
Additional options to pass to Rubocop
85 86 87 |
# File 'lib/toys/templates/rubocop.rb', line 85 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.
110 111 112 113 |
# File 'lib/toys/templates/rubocop.rb', line 110 def use_bundler(**opts) @bundler = opts self end |