Class: Foobara::Generators::CommandGenerator::WriteCommandToDisk
- Inherits:
-
WriteGeneratedFilesToDisk
- Object
- Command
- WriteGeneratedFilesToDisk
- Foobara::Generators::CommandGenerator::WriteCommandToDisk
- Defined in:
- foobara-command-generator-0.0.3/src/write_command_to_disk.rb
Constant Summary
Constants included from TruncatedInspect
Instance Attribute Summary
Attributes inherited from WriteGeneratedFilesToDisk
Attributes included from CommandPatternImplementation::Concerns::Subcommands
Attributes included from CommandPatternImplementation::Concerns::Runtime
Attributes included from CommandPatternImplementation::Concerns::Errors
Attributes included from CommandPatternImplementation::Concerns::Inputs
Class Method Summary collapse
Instance Method Summary collapse
- #default_output_directory ⇒ Object
- #execute ⇒ Object
- #generate_file_contents ⇒ Object
- #output_directory ⇒ Object
- #rubocop_autocorrect ⇒ Object
- #run_post_generation_tasks ⇒ Object
Methods inherited from WriteGeneratedFilesToDisk
#delete_old_files_if_needed, #generate_generated_files_json, #generated_files_json_filename, #run_cmd_and_return_output, #run_cmd_and_write_output, #stats, #write_all_files_to_disk, #write_file_to_disk
Methods inherited from Command
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods included from CommandPatternImplementation::Concerns::Reflection
Methods included from CommandPatternImplementation::Concerns::DomainMappers
#domain_map, #domain_map!, #run_mapped_subcommand!
Methods included from CommandPatternImplementation::Concerns::Subcommands
#run_subcommand!, #subcommand?
Methods included from CommandPatternImplementation::Concerns::Entities
Methods included from CommandPatternImplementation::Concerns::Transactions
#auto_detect_current_transactions, #commit_transaction, #open_transaction, #opened_transactions, #relevant_entity_classes, #rollback_transaction, #transactions
Methods included from CommandPatternImplementation::Concerns::StateMachine
Methods included from CommandPatternImplementation::Concerns::Runtime
#halt!, #run, #run!, #run_execute, #succeed, #success?, #validate, #validate_records
Methods included from CommandPatternImplementation::Concerns::Errors
Methods included from CommandPatternImplementation::Concerns::Inputs
#cast_and_validate_inputs, #initialize, #method_missing, #respond_to_missing?, #respond_to_missing_for_inputs?
Methods included from TruncatedInspect
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::CommandPatternImplementation::Concerns::Inputs
Class Method Details
.generator_key ⇒ Object
8 9 10 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 8 def generator_key "command" end |
Instance Method Details
#default_output_directory ⇒ Object
33 34 35 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 33 def default_output_directory "." end |
#execute ⇒ Object
21 22 23 24 25 26 27 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 21 def execute generate_file_contents write_all_files_to_disk run_post_generation_tasks stats end |
#generate_file_contents ⇒ Object
37 38 39 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 37 def generate_file_contents self.paths_to_source_code = run_subcommand!(GenerateCommand, command_config.original_attributes) end |
#output_directory ⇒ Object
29 30 31 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 29 def output_directory inputs[:output_directory] || default_output_directory end |
#rubocop_autocorrect ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 47 def rubocop_autocorrect # :nocov: Open3.popen3("bundle exec rubocop --no-server -A") do |_stdin, _stdout, stderr, wait_thr| exit_status = wait_thr.value unless exit_status.success? raise "could not rubocop --no-server -A. #{stderr.read}" end end # :nocov: end |
#run_post_generation_tasks ⇒ Object
41 42 43 44 45 |
# File 'foobara-command-generator-0.0.3/src/write_command_to_disk.rb', line 41 def run_post_generation_tasks Dir.chdir output_directory do rubocop_autocorrect end end |