class Voom::Presenters::Generators::Plugin
Constants
- LIB_ROOT
- TEMPLATES_ROOT
Public Class Methods
new(args = [], local_options = {}, config = {})
click to toggle source
Calls superclass method
# File lib/voom/presenters/generators/plugin.rb, line 13 def initialize(args = [], local_options = {}, config = {}) @inflector = Dry::Inflector.new super end
source_root()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 18 def self.source_root File.dirname(__FILE__) end
Public Instance Methods
create_action_files()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 93 def create_action_files template_file('action.rb', "#{underscored_name}_action.rb", lib_dir('components', 'actions'), named_dir('components', 'actions')) template_file('dsl.rb', "#{underscored_name}_dsl.rb", lib_dir('components', 'actions'), named_dir('components', 'actions')) template_file('data.rb', "#{underscored_name}_data.rb", lib_dir('web_client', 'components', 'actions'), named_dir('web_client', 'components', 'actions')) template_file('action.js', "#{underscored_name}.js", dir('views', 'assets', 'js', 'components', 'actions')) end
create_component_files()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 73 def create_component_files template_file('component.rb', "#{underscored_name}_component.rb", lib_dir('components'), named_dir('components')) template_file('dsl.rb', "#{underscored_name}_dsl.rb", lib_dir('components'), named_dir('components')) template_file('render.rb', "#{underscored_name}_render.rb", lib_dir('web_client', 'components'), named_dir('web_client', 'components')) template_file('component.css', "#{underscored_name}.css", dir('views', 'assets', 'css', 'components')) template_file('component.js', "#{underscored_name}.js", dir('views', 'assets', 'js', 'components')) template_file('component.erb', "#{underscored_name}.erb", dir('views', 'components')) template_file('component_header.erb', "#{underscored_name}_header.erb", dir('views', 'components')) end
create_helper_files()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 107 def create_helper_files template_file('helper.rb', "#{underscored_name}_helper.rb", lib_dir('helpers'), named_dir('helpers')) end
create_plugin()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 69 def create_plugin template_file('plugin.rb', "#{underscored_name}.rb", LIB_ROOT) end
create_root_files()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 61 def create_root_files file('.gitignore') file('Gemfile') template_file('LICENSE.txt') template_file('presenter_plugin.gemspec', "#{underscored_name}_presenter_plugin.gemspec") file 'README.md' end
dir(*args)
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 48 def dir(*args) join_path(*args) end
file(file, target_filename=file, source_path=nil, target_path=nil)
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 36 def file(file, target_filename=file, source_path=nil, target_path=nil) underscore_name = underscored_name source = join_path(TEMPLATES_ROOT, source_path, file) destination = join_path(underscore_name, target_path, target_filename) copy_file source, destination end
join_path(*parts)
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 25 def join_path(*parts) File.join(*parts.compact) end
lib_dir(*args)
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 44 def lib_dir(*args) dir(LIB_ROOT, *args) end
named_dir(*args)
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 52 def named_dir(*args) lib_dir(underscored_name, *args) end
template_file(template, target_filename=template, source_path=nil, target_path=source_path)
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 29 def template_file(template, target_filename=template, source_path=nil, target_path=source_path) underscore_name = underscored_name source = join_path(TEMPLATES_ROOT, source_path, "#{template}.tt") destination = join_path(underscore_name, target_path, target_filename) template source, destination end
underscored_name()
click to toggle source
# File lib/voom/presenters/generators/plugin.rb, line 56 def underscored_name underscore(name) end