Class: Rays::AppModule::Module
- Inherits:
-
Object
- Object
- Rays::AppModule::Module
- Defined in:
- lib/rays/models/appmodule/base.rb
Direct Known Subclasses
ContentModule, EARModule, EJBModule, ExtModule, HookModule, LayoutModule, PortletModule, ServiceBuilderModule, ThemeModule
Class Attribute Summary collapse
-
.archetype_name ⇒ Object
readonly
Returns the value of attribute archetype_name.
-
.base_directory ⇒ Object
readonly
Returns the value of attribute base_directory.
-
.build_worker ⇒ Object
readonly
Returns the value of attribute build_worker.
-
.clean_worker ⇒ Object
readonly
Returns the value of attribute clean_worker.
-
.deploy_worker ⇒ Object
readonly
Returns the value of attribute deploy_worker.
-
.generate_worker ⇒ Object
readonly
Returns the value of attribute generate_worker.
-
.type ⇒ Object
readonly
Returns the value of attribute type.
Instance Attribute Summary collapse
-
#archetype_name ⇒ Object
readonly
INSTANCE.
-
#name ⇒ Object
readonly
INSTANCE.
-
#skip_mass_deploy ⇒ Object
readonly
INSTANCE.
-
#type ⇒ Object
readonly
INSTANCE.
Class Method Summary collapse
- .archetype(archetype) ⇒ Object
-
.base_path ⇒ Object
Get module’s base directory path.
- .builder(build_worker) ⇒ Object
- .cleaner(clean_worker) ⇒ Object
- .deployer(deploy_worker) ⇒ Object
- .directory(directory_name) ⇒ Object
- .generator(generate_worker) ⇒ Object
-
.register(type) ⇒ Object
Class initializers.
Instance Method Summary collapse
-
#build(skip_test = false) ⇒ Object
Builder.
-
#clean ⇒ Object
Clean.
-
#create(generator_name = nil) ⇒ Object
Create a new module or initialize if a directory exists but no .module file.
-
#deploy ⇒ Object
Deploy.
-
#group_id ⇒ Object
Group ID.
-
#initialize(name) ⇒ Module
constructor
A new instance of Module.
- #path ⇒ Object
Constructor Details
#initialize(name) ⇒ Module
Returns a new instance of Module.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/rays/models/appmodule/base.rb', line 79 def initialize(name) @name = name # transfer class properties to instance properties @type = self.class.type @archetype_name = self.class.archetype_name @generator = self.class.generate_worker @builder = self.class.build_worker @deployer = self.class.deploy_worker @cleaner = self.class.clean_worker @skip_mass_deploy = false descriptor = load_descriptor unless descriptor.nil? unless descriptor['builder'].nil? @builder = Worker::Manager.instnace.create :builder, descriptor['builder'].to_sym end unless descriptor['deployer'].nil? @deployer = Worker::Manager.instnace.create :deployer, descriptor['deployer'].to_sym end unless descriptor['cleaner'].nil? @cleaner = Worker::Manager.instnace.create :cleaner, descriptor['cleaner'].to_sym end unless descriptor['skip_mass_deploy'].nil? @skip_mass_deploy = true if descriptor['skip_mass_deploy'].to_s.strip.eql? 'true' end end end |
Class Attribute Details
.archetype_name ⇒ Object (readonly)
Returns the value of attribute archetype_name.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def archetype_name @archetype_name end |
.base_directory ⇒ Object (readonly)
Returns the value of attribute base_directory.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def base_directory @base_directory end |
.build_worker ⇒ Object (readonly)
Returns the value of attribute build_worker.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def build_worker @build_worker end |
.clean_worker ⇒ Object (readonly)
Returns the value of attribute clean_worker.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def clean_worker @clean_worker end |
.deploy_worker ⇒ Object (readonly)
Returns the value of attribute deploy_worker.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def deploy_worker @deploy_worker end |
.generate_worker ⇒ Object (readonly)
Returns the value of attribute generate_worker.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def generate_worker @generate_worker end |
.type ⇒ Object (readonly)
Returns the value of attribute type.
33 34 35 |
# File 'lib/rays/models/appmodule/base.rb', line 33 def type @type end |
Instance Attribute Details
#archetype_name ⇒ Object (readonly)
INSTANCE
77 78 79 |
# File 'lib/rays/models/appmodule/base.rb', line 77 def archetype_name @archetype_name end |
#name ⇒ Object (readonly)
INSTANCE
77 78 79 |
# File 'lib/rays/models/appmodule/base.rb', line 77 def name @name end |
#skip_mass_deploy ⇒ Object (readonly)
INSTANCE
77 78 79 |
# File 'lib/rays/models/appmodule/base.rb', line 77 def skip_mass_deploy @skip_mass_deploy end |
#type ⇒ Object (readonly)
INSTANCE
77 78 79 |
# File 'lib/rays/models/appmodule/base.rb', line 77 def type @type end |
Class Method Details
.archetype(archetype) ⇒ Object
46 47 48 |
# File 'lib/rays/models/appmodule/base.rb', line 46 def archetype(archetype) @archetype_name = archetype end |
.base_path ⇒ Object
Get module’s base directory path.
69 70 71 |
# File 'lib/rays/models/appmodule/base.rb', line 69 def base_path File.join($rays_config.project_root, @base_directory) end |
.builder(build_worker) ⇒ Object
54 55 56 |
# File 'lib/rays/models/appmodule/base.rb', line 54 def builder(build_worker) @build_worker = build_worker end |
.cleaner(clean_worker) ⇒ Object
62 63 64 |
# File 'lib/rays/models/appmodule/base.rb', line 62 def cleaner(clean_worker) @clean_worker = clean_worker end |
.deployer(deploy_worker) ⇒ Object
58 59 60 |
# File 'lib/rays/models/appmodule/base.rb', line 58 def deployer(deploy_worker) @deploy_worker = deploy_worker end |
.directory(directory_name) ⇒ Object
42 43 44 |
# File 'lib/rays/models/appmodule/base.rb', line 42 def directory(directory_name) @base_directory = directory_name end |
.generator(generate_worker) ⇒ Object
50 51 52 |
# File 'lib/rays/models/appmodule/base.rb', line 50 def generator(generate_worker) @generate_worker = generate_worker end |
.register(type) ⇒ Object
Class initializers
37 38 39 40 |
# File 'lib/rays/models/appmodule/base.rb', line 37 def register(type) @type = type.to_s Manager.instance.register_module_type(@type, self) end |
Instance Method Details
#build(skip_test = false) ⇒ Object
Builder
111 112 113 |
# File 'lib/rays/models/appmodule/base.rb', line 111 def build(skip_test = false) @builder.build self, skip_test end |
#clean ⇒ Object
Clean
125 126 127 |
# File 'lib/rays/models/appmodule/base.rb', line 125 def clean @cleaner.clean self end |
#create(generator_name = nil) ⇒ Object
Create a new module or initialize if a directory exists but no .module file.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/rays/models/appmodule/base.rb', line 132 def create(generator_name=nil) if Dir.exist?(path) task("found <!#{@type} #{@name}!>", "", "failed to initialize <!#{@type} #{@name}!>") do create_descriptor end else generator = nil begin generator = Worker::Manager.instance.create(:generator, generator_name.to_sym) unless generator_name.nil? rescue RaysException # do nothing end generator ||= @generator FileUtils.mkdir_p(self.class.base_path) unless Dir.exist?(self.class.base_path) in_directory(self.class.base_path) do task("creating <!#{@type} #{@name}!>", "done", "failed") do generator.create self create_descriptor end end end end |
#deploy ⇒ Object
Deploy
118 119 120 |
# File 'lib/rays/models/appmodule/base.rb', line 118 def deploy @deployer.deploy self end |
#group_id ⇒ Object
Group ID
162 163 164 |
# File 'lib/rays/models/appmodule/base.rb', line 162 def group_id "#{Project.instance.package}.#{type}" end |
#path ⇒ Object
166 167 168 169 170 171 |
# File 'lib/rays/models/appmodule/base.rb', line 166 def path if 'ear'.eql? type return self.class.base_path end File.join(self.class.base_path, @name) end |