Class: Toys::Templates::Rake
- Inherits:
-
Object
- Object
- Toys::Templates::Rake
- Includes:
- Toys::Template
- Defined in:
- lib/toys/templates/rake.rb
Overview
A template that generates tools matching a rakefile.
Constant Summary collapse
- DEFAULT_RAKEFILE_PATH =
Default path to the Rakefile.
"Rakefile"
Instance Attribute Summary collapse
-
#bundler ⇒ Boolean, Hash
writeonly
Set the bundler state and options for all Rake tools.
-
#context_directory ⇒ String
writeonly
Custom context directory for this tool.
-
#gem_version ⇒ String, ...
writeonly
Version requirements for the minitest gem.
-
#only_described ⇒ Boolean
writeonly
Whether to generate tools only for rake tasks with descriptions.
-
#rakefile_path ⇒ String?
writeonly
Path to the Rakefile.
-
#use_flags ⇒ Boolean
writeonly
Whether generated tools should use flags instead of positional arguments to pass arguments to rake tasks.
Instance Method Summary collapse
-
#initialize(gem_version: nil, rakefile_path: nil, only_described: false, use_flags: false, bundler: false, context_directory: nil) ⇒ Rake
constructor
Create the template settings for the rake template.
-
#use_bundler(**opts) ⇒ self
Use bundler for all Rake tools.
Methods included from Toys::Template
Constructor Details
#initialize(gem_version: nil, rakefile_path: nil, only_described: false, use_flags: false, bundler: false, context_directory: nil) ⇒ Rake
Create the template settings for the rake template.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/toys/templates/rake.rb', line 37 def initialize(gem_version: nil, rakefile_path: nil, only_described: false, use_flags: false, bundler: false, context_directory: nil) @gem_version = gem_version @rakefile_path = rakefile_path @only_described = only_described @use_flags = use_flags @bundler = bundler @context_directory = context_directory end |
Instance Attribute Details
#bundler=(value) ⇒ Boolean, Hash (writeonly)
Set the bundler state and options for all Rake tools.
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.
106 107 108 |
# File 'lib/toys/templates/rake.rb', line 106 def bundler=(value) @bundler = value end |
#context_directory=(value) ⇒ String
Custom context directory for this tool.
93 94 95 |
# File 'lib/toys/templates/rake.rb', line 93 def context_directory=(value) @context_directory = value end |
#gem_version=(value) ⇒ String, ...
Version requirements for the minitest gem.
If set to nil
, has no version requirement (unless one is specified in
the bundle.)
59 60 61 |
# File 'lib/toys/templates/rake.rb', line 59 def gem_version=(value) @gem_version = value end |
#only_described=(value) ⇒ Boolean
Whether to generate tools only for rake tasks with descriptions.
76 77 78 |
# File 'lib/toys/templates/rake.rb', line 76 def only_described=(value) @only_described = value end |
#rakefile_path=(value) ⇒ String?
Path to the Rakefile.
If set to nil
, defaults to DEFAULT_RAKEFILE_PATH.
68 69 70 |
# File 'lib/toys/templates/rake.rb', line 68 def rakefile_path=(value) @rakefile_path = value end |
#use_flags=(value) ⇒ Boolean
Whether generated tools should use flags instead of positional arguments to pass arguments to rake tasks.
85 86 87 |
# File 'lib/toys/templates/rake.rb', line 85 def use_flags=(value) @use_flags = value end |
Instance Method Details
#use_bundler(**opts) ⇒ self
Use bundler for all Rake tools.
See the documentation for the bundler mixin for information on the options that can be passed.
118 119 120 121 |
# File 'lib/toys/templates/rake.rb', line 118 def use_bundler(**opts) @bundler = opts self end |