Class: ChiliprojectPluginGenerator

Inherits:
Rails::Generator::NamedBase
  • Object
show all
Defined in:
lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb

Overview

– copyright ChiliProject is a project management system.

Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

See doc/COPYRIGHT.rdoc for more details. ++

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime_args, runtime_options = {}) ⇒ ChiliprojectPluginGenerator

Returns a new instance of ChiliprojectPluginGenerator.


18
19
20
21
22
23
# File 'lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb', line 18

def initialize(runtime_args, runtime_options = {})
  super
  @plugin_name = "chiliproject_#{file_name.underscore}"
  @plugin_pretty_name = plugin_name.titleize
  @plugin_path = "vendor/plugins/#{plugin_name}"
end

Instance Attribute Details

#plugin_nameObject (readonly)

Returns the value of attribute plugin_name


16
17
18
# File 'lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb', line 16

def plugin_name
  @plugin_name
end

#plugin_pathObject (readonly)

Returns the value of attribute plugin_path


16
17
18
# File 'lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb', line 16

def plugin_path
  @plugin_path
end

#plugin_pretty_nameObject (readonly)

Returns the value of attribute plugin_pretty_name


16
17
18
# File 'lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb', line 16

def plugin_pretty_name
  @plugin_pretty_name
end

Instance Method Details

#manifestObject


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb', line 25

def manifest
  record do |m|
    m.directory "#{plugin_path}/app/controllers"
    m.directory "#{plugin_path}/app/helpers"
    m.directory "#{plugin_path}/app/models"
    m.directory "#{plugin_path}/app/views"
    m.directory "#{plugin_path}/db/migrate"
    m.directory "#{plugin_path}/lib/tasks"
    m.directory "#{plugin_path}/assets/images"
    m.directory "#{plugin_path}/assets/javascripts"
    m.directory "#{plugin_path}/assets/stylesheets"
    m.directory "#{plugin_path}/lang"
    m.directory "#{plugin_path}/config/locales"
    m.directory "#{plugin_path}/test"

    m.template 'README.rdoc',    "#{plugin_path}/README.rdoc"
    m.template 'init.rb.erb',   "#{plugin_path}/init.rb"
    m.template 'en.yml',    "#{plugin_path}/lang/en.yml"
    m.template 'en_rails_i18n.yml',    "#{plugin_path}/config/locales/en.yml"
    m.template 'test_helper.rb.erb',    "#{plugin_path}/test/test_helper.rb"
  end
end