Class: Voom::Presenters::Generators::Plugin

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/voom/presenters/generators/plugin.rb

Constant Summary collapse

TEMPLATES_ROOT =
File.join('templates','plugin')
LIB_ROOT =
File.join('lib','voom','presenters','plugins')

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = [], local_options = {}, config = {}) ⇒ Plugin

Returns a new instance of Plugin.



13
14
15
16
# File 'lib/voom/presenters/generators/plugin.rb', line 13

def initialize(args = [], local_options = {}, config = {})
  @inflector = Dry::Inflector.new
  super
end

Class Method Details

.source_rootObject



18
19
20
# File 'lib/voom/presenters/generators/plugin.rb', line 18

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_action_filesObject



93
94
95
96
97
98
99
100
101
102
103
104
105
# 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_filesObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# 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_filesObject



107
108
109
110
111
# 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_pluginObject



69
70
71
# File 'lib/voom/presenters/generators/plugin.rb', line 69

def create_plugin
  template_file('plugin.rb', "#{underscored_name}.rb", LIB_ROOT)
end

#create_root_filesObject



61
62
63
64
65
66
67
# 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