Class: BridgetownPluginNano::Commands::Nano
- Inherits:
-
Thor
- Object
- Thor
- BridgetownPluginNano::Commands::Nano
show all
- Includes:
- Bridgetown::Commands::ConfigurationOverridable, DatabaseHelpers, EmailHelpers, GeneralHelpers, JobsHelpers, Thor::Actions
- Defined in:
- lib/bridgetown-plugin-nano/command.rb,
lib/bridgetown-plugin-nano/command_helpers/jobs_helpers.rb,
lib/bridgetown-plugin-nano/command_helpers/email_helpers.rb,
lib/bridgetown-plugin-nano/command_helpers/general_helpers.rb,
lib/bridgetown-plugin-nano/command_helpers/database_helpers.rb
Defined Under Namespace
Modules: DatabaseHelpers, EmailHelpers, GeneralHelpers, JobsHelpers
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#configure_active_job
#configure_new_nano_app
#configure_action_mailer
#finish_database_setup, #setup_postgresql
Instance Attribute Details
#database_prefix ⇒ Object
Returns the value of attribute database_prefix.
20
21
22
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 20
def database_prefix
@database_prefix
end
|
#folder_name ⇒ Object
Returns the value of attribute folder_name.
20
21
22
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 20
def folder_name
@folder_name
end
|
Class Method Details
.source_root ⇒ Object
27
28
29
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 27
def self.source_root
File.expand_path("templates", __dir__)
end
|
Instance Method Details
#about ⇒ Object
45
46
47
48
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 45
def about
determine_folder_name
system("cd #{folder_name} && bundle exec rails about")
end
|
#console ⇒ Object
87
88
89
90
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 87
def console
determine_folder_name
system("cd #{folder_name} && bundle exec rails console")
end
|
#database(type_prefix) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 52
def database(type_prefix)
dbtype, @database_prefix = type_prefix.split(":")
determine_folder_name
case dbtype
when "postgresql"
setup_postgresql
else
raise "The #{dbtype} database type is not supported"
end
finish_database_setup end
|
#email ⇒ Object
69
70
71
72
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 69
def email
determine_folder_name
configure_action_mailer
end
|
#exec(*args) ⇒ Object
81
82
83
84
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 81
def exec(*args)
determine_folder_name
system("cd #{folder_name} && bundle exec rails #{args.join(" ")}")
end
|
#generate(*args) ⇒ Object
93
94
95
96
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 93
def generate(*args)
determine_folder_name
system("cd #{folder_name} && bundle exec rails generate #{args.join(" ")}")
end
|
#jobs ⇒ Object
75
76
77
78
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 75
def jobs
determine_folder_name
configure_active_job
end
|
#new(folder_name = "backend") ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/bridgetown-plugin-nano/command.rb', line 33
def new(folder_name = "backend")
@folder_name = folder_name
self.destination_root = File.expand_path(folder_name)
say_status :nano, %(Setting up Nano in "#{folder_name}")
directory "new_app", ".", exclude_pattern: %r!DS_Store$!
self.destination_root = File.expand_path(".")
configure_new_nano_app end
|