Class: Pleiades::SetupGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pleiades::SetupGenerator
show all
- Defined in:
- lib/pleiades/generators/pleiades/setup/setup_generator.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *_) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/pleiades/generators/pleiades/setup/setup_generator.rb', line 44
def method_missing(method, *_)
method_name = /^(([a-z]+_)+)exist\?$/.match(method.to_s)
return super unless method_name
File.exist? method(:"#{method_name[1]}path").call
end
|
Instance Method Details
#gen_base_command ⇒ Object
19
20
21
22
23
|
# File 'lib/pleiades/generators/pleiades/setup/setup_generator.rb', line 19
def gen_base_command
return if base_command_exist?
copy_file File.basename(base_command_path), base_command_path
end
|
#gen_command_concern ⇒ Object
25
26
27
28
29
|
# File 'lib/pleiades/generators/pleiades/setup/setup_generator.rb', line 25
def gen_command_concern
return if command_concern_exist?
template File.basename(command_concern_path('e')), command_concern_path
end
|
#gen_controller ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/pleiades/generators/pleiades/setup/setup_generator.rb', line 31
def gen_controller
return if controller_file_exist?
generate 'controller', controller_dir
route routes_drowing_str
File.delete controller_file_path
copy_file File.basename(controller_file_path), controller_file_path
end
|
12
13
14
15
16
17
|
# File 'lib/pleiades/generators/pleiades/setup/setup_generator.rb', line 12
def gen_user_related_files
return unless options['user_related_files']
gen_user_table unless user_table_exist?
gen_users_command unless users_command_exist?
end
|