Class: Arfi::Commands::Project
- Inherits:
-
Thor
- Object
- Thor
- Arfi::Commands::Project
- Defined in:
- lib/arfi/commands/project.rb
Overview
Arfi::Commands::Project class is used to create ‘db/functions` directory.
Constant Summary collapse
- ADAPTERS =
%i[postgresql mysql].freeze
Instance Method Summary collapse
-
#create ⇒ void
Arfi::Commands::Project#create -> void.
-
#functions_dir ⇒ Pathname
private
Arfi::Commands::Project#functions_dir -> Pathname.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Arfi::Commands::Project#create -> void
This command is used to create ‘db/functions` directory.
29 30 31 32 33 34 35 |
# File 'lib/arfi/commands/project.rb', line 29 def create raise Arfi::Errors::InvalidSchemaFormat unless ActiveRecord.schema_format == :ruby # steep:ignore NoMethod return puts "Directory #{functions_dir} already exists" if Dir.exist?(functions_dir) FileUtils.mkdir_p(functions_dir) puts "Created: #{functions_dir}" end |
#functions_dir ⇒ Pathname (private)
Arfi::Commands::Project#functions_dir -> Pathname
Helper method to get path to ‘db/functions` directory.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/arfi/commands/project.rb', line 46 def functions_dir # steep:ignore:start if [:adapter] raise Arfi::Errors::AdapterNotSupported unless ADAPTERS.include?([:adapter].to_sym) Rails.root.join("db/functions/#{[:adapter]}") # steep:ignore:end else Rails.root.join('db/functions') end end |