annotate .svn/pristine/ae/aece43382595a414583466234e19e24279ff6883.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 require 'rails_generator/base'
Chris@909 2 require 'rails_generator/generators/components/controller/controller_generator'
Chris@909 3
Chris@909 4 class RedminePluginControllerGenerator < ControllerGenerator
Chris@909 5 attr_reader :plugin_path, :plugin_name, :plugin_pretty_name
Chris@909 6
Chris@909 7 def initialize(runtime_args, runtime_options = {})
Chris@909 8 runtime_args = runtime_args.dup
Chris@909 9 usage if runtime_args.empty?
Chris@909 10 @plugin_name = "redmine_" + runtime_args.shift.underscore
Chris@909 11 @plugin_pretty_name = plugin_name.titleize
Chris@909 12 @plugin_path = "vendor/plugins/#{plugin_name}"
Chris@909 13 super(runtime_args, runtime_options)
Chris@909 14 end
Chris@909 15
Chris@909 16 def destination_root
Chris@909 17 File.join(Rails.root, plugin_path)
Chris@909 18 end
Chris@909 19
Chris@909 20 def manifest
Chris@909 21 record do |m|
Chris@909 22 # Check for class naming collisions.
Chris@909 23 m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"
Chris@909 24
Chris@909 25 # Controller, helper, views, and test directories.
Chris@909 26 m.directory File.join('app/controllers', class_path)
Chris@909 27 m.directory File.join('app/helpers', class_path)
Chris@909 28 m.directory File.join('app/views', class_path, file_name)
Chris@909 29 m.directory File.join('test/functional', class_path)
Chris@909 30
Chris@909 31 # Controller class, functional test, and helper class.
Chris@909 32 m.template 'controller.rb.erb',
Chris@909 33 File.join('app/controllers',
Chris@909 34 class_path,
Chris@909 35 "#{file_name}_controller.rb")
Chris@909 36
Chris@909 37 m.template 'functional_test.rb.erb',
Chris@909 38 File.join('test/functional',
Chris@909 39 class_path,
Chris@909 40 "#{file_name}_controller_test.rb")
Chris@909 41
Chris@909 42 m.template 'helper.rb.erb',
Chris@909 43 File.join('app/helpers',
Chris@909 44 class_path,
Chris@909 45 "#{file_name}_helper.rb")
Chris@909 46
Chris@909 47 # View template for each action.
Chris@909 48 actions.each do |action|
Chris@909 49 path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
Chris@909 50 m.template 'view.html.erb', path,
Chris@909 51 :assigns => { :action => action, :path => path }
Chris@909 52 end
Chris@909 53 end
Chris@909 54 end
Chris@909 55 end