Class: JBootstrap::Generators::Component
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- JBootstrap::Generators::Component
- Includes:
- Thor::Actions
- Defined in:
- lib/jbootstrap/generators/component.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#singular_name ⇒ Object
Returns the value of attribute singular_name.
Class Method Summary collapse
Instance Method Summary collapse
- #create_backend ⇒ Object
- #create_frontend ⇒ Object
- #create_helpers ⇒ Object
- #create_manifest ⇒ Object
- #create_readme ⇒ Object
- #init_git ⇒ Object
- #set_variables ⇒ Object
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
6 7 8 |
# File 'lib/jbootstrap/generators/component.rb', line 6 def date @date end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/jbootstrap/generators/component.rb', line 6 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/jbootstrap/generators/component.rb', line 6 def name @name end |
#singular_name ⇒ Object
Returns the value of attribute singular_name.
6 7 8 |
# File 'lib/jbootstrap/generators/component.rb', line 6 def singular_name @singular_name end |
Class Method Details
.source_root ⇒ Object
11 12 13 |
# File 'lib/jbootstrap/generators/component.rb', line 11 def self.source_root File.(File.join(File.dirname(__FILE__), %w[.. templates component])) end |
Instance Method Details
#create_backend ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jbootstrap/generators/component.rb', line 30 def create_backend directory "admin/abstracts" copy_file "admin/install.php", "admin/install.php" copy_file "admin/uninstall.php", "admin/uninstall.php" template "admin/admin.COM_NAME.php.tt", "admin/admin.#{@name.downcase}.php" template "admin/language/en-GB/en-GB.com_COM_NAME.ini.tt", "admin/language/en-GB/en-GB.com_#{@name.downcase}.ini" template "admin/language/en-GB/en-GB.com_COM_NAME.menu.ini.tt", "admin/language/fr-FR/fr-FR.com_#{@name.downcase}.ini" template "admin/language/en-GB/en-GB.com_COM_NAME.menu.ini.tt", "admin/language/en-GB/en-GB.com_#{@name.downcase}.menu.ini" template "admin/language/en-GB/en-GB.com_COM_NAME.menu.ini.tt", "admin/language/fr-FR/fr-FR.com_#{@name.downcase}.menu.ini" end |
#create_frontend ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/jbootstrap/generators/component.rb', line 41 def create_frontend directory "site/abstracts" template "site/language/en-GB/en-GB.com_COM_NAME.ini.tt", "site/language/en-GB/en-GB.com_#{@name.downcase}.ini" template "site/language/fr-FR/fr-FR.com_COM_NAME.ini.tt", "site/language/fr-FR/fr-FR.com_#{@name.downcase}.ini" template "site/COM_NAME.php.tt", "site/#{@name.downcase}.php" template "site/controller.php.tt" end |
#create_helpers ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/jbootstrap/generators/component.rb', line 49 def create_helpers copy_file "gitignore", ".gitignore" copy_file "Guardfile" copy_file "Gemfile" run "bundle check" run "bundle install" end |
#create_manifest ⇒ Object
26 27 28 |
# File 'lib/jbootstrap/generators/component.rb', line 26 def create_manifest template "com_COM_NAME.xml.tt", "com_#{@name.downcase}.xml" end |
#create_readme ⇒ Object
22 23 24 |
# File 'lib/jbootstrap/generators/component.rb', line 22 def create_readme template 'README.md.tt' end |
#init_git ⇒ Object
57 58 59 60 61 |
# File 'lib/jbootstrap/generators/component.rb', line 57 def init_git run "git init ." run "git add -A" run "git commit -m 'Initial import.'" end |
#set_variables ⇒ Object
15 16 17 18 19 20 |
# File 'lib/jbootstrap/generators/component.rb', line 15 def set_variables @name = name @singular_name = name.chop @description = description @date = Date.today.strftime '%B %Y' end |