Class: Saruman::Generators::Observer

Inherits:
Thor::Group
  • Object
show all
Includes:
Base, Thor::Actions
Defined in:
lib/saruman/generators/observer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#app_design_frontend_base_layout_local_xml_path, #app_design_frontend_base_layout_path, #app_design_frontend_base_path, #app_design_frontend_base_template_namespace_path, #app_design_frontend_base_template_path, #author, #block_klass_name, #combined_namespace, #command, #config_has_tag?, #controller?, #controller_block_file_path, #controller_block_path, #controller_front_name, #controller_path, #controllers, #extension_base_path, #extension_config_file_path, #extension_config_path, #extension_current_version, #extension_name_lower, #extension_temp_path, #extension_upgrade_version, #global_config_basepath, #global_config_file_path, #helper?, #helper_path, #insert_tag_at_node, #insert_xml_at_node, #model?, #model_klass_name, #model_path, #models, #name, #name_lower, #namespace, #namespace_lower, #observer?, #observers, #read_extension_config, #resource_model_klass_name, #resource_model_name, #resource_model_path, #setup_base_path, #version, #write_extension_config

Class Method Details

.source_rootObject



12
13
14
# File 'lib/saruman/generators/observer.rb', line 12

def self.source_root
  File.dirname(__FILE__) + "/observer/templates"
end

Instance Method Details

#create_observersObject



38
39
40
# File 'lib/saruman/generators/observer.rb', line 38

def create_observers
  template("Observer.php", "#{model_path}Observer.php")
end

#load_buildersObject



16
17
18
# File 'lib/saruman/generators/observer.rb', line 16

def load_builders
  @observer_xml_config_builder = Saruman::ObserverXmlConfigBuilder.new(observers, self)
end

#modify_configObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/saruman/generators/observer.rb', line 20

def modify_config
  
  @config = read_extension_config
  
  unless config_has_tag?("config frontend")
    insert_tag_at_node("frontend", "config")
  end
  
  unless config_has_tag?("config frontend events")
    insert_tag_at_node("events", "config frontend")
  end
  
  insert_xml_at_node(@observer_xml_config_builder.config_frontend_events_observers_xml, "config frontend events")
  
  write_extension_config
  
end