Class: Servactory::Generators::InstallGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::Base
- Base
- Servactory::Generators::InstallGenerator
show all
- Defined in:
- lib/generators/servactory/install/install_generator.rb
Constant Summary
collapse
- VALID_NAMESPACE_REGEX =
/\A[A-Z][a-zA-Z0-9_]*(::[A-Z][a-zA-Z0-9_]*)*\z/
Instance Method Summary
collapse
Methods inherited from Base
gem_locales_path, gem_root
Instance Method Details
#copy_locales ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/generators/servactory/install/install_generator.rb', line 43
def copy_locales
return if locales.blank?
locales.each do |locale|
locale_file = "servactory.#{locale}.yml"
source_path = File.join(gem_locales_path, "#{locale}.yml")
if File.exist?(source_path)
copy_file source_path, "config/locales/#{locale_file}"
else
say "Locale file not found: #{locale} (expected at #{source_path})", :yellow
end
end
end
|
#create_application_service ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/generators/servactory/install/install_generator.rb', line 32
def create_application_service
validate_namespace!
template "application_service/base.rb.tt", service_path("base.rb")
template "application_service/exceptions.rb.tt", service_path("exceptions.rb")
template "application_service/result.rb.tt", service_path("result.rb")
create_file service_path("dynamic_options/.keep"), ""
create_file service_path("extensions/.keep"), ""
end
|