raystool 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/__rays_exec.rb +31 -0
 - data/bin/__rays_init +79 -0
 - data/lib/rays/config/backup.rb +42 -0
 - data/lib/rays/config/configuration.rb +376 -0
 - data/lib/rays/config/environment.rb +73 -0
 - data/lib/rays/config/templates/global/global.yml +3 -0
 - data/lib/rays/config/templates/global/scripts/rays +187 -0
 - data/lib/rays/config/templates/project/.rays +0 -0
 - data/lib/rays/config/templates/project/config/environment.yml +68 -0
 - data/lib/rays/config/templates/project/config/project.yml +4 -0
 - data/lib/rays/core.rb +128 -0
 - data/lib/rays/exceptions/rays_exception.rb +25 -0
 - data/lib/rays/interface/commander.rb +394 -0
 - data/lib/rays/interface/controller.rb +365 -0
 - data/lib/rays/loaders/highline.rb +24 -0
 - data/lib/rays/loaders/logging.rb +60 -0
 - data/lib/rays/models/appmodule/base.rb +185 -0
 - data/lib/rays/models/appmodule/content.rb +35 -0
 - data/lib/rays/models/appmodule/ext.rb +36 -0
 - data/lib/rays/models/appmodule/hook.rb +36 -0
 - data/lib/rays/models/appmodule/layout.rb +36 -0
 - data/lib/rays/models/appmodule/manager.rb +130 -0
 - data/lib/rays/models/appmodule/portlet.rb +36 -0
 - data/lib/rays/models/appmodule/servicebuilder.rb +36 -0
 - data/lib/rays/models/appmodule/theme.rb +36 -0
 - data/lib/rays/models/project.rb +116 -0
 - data/lib/rays/servers/base.rb +70 -0
 - data/lib/rays/servers/database.rb +73 -0
 - data/lib/rays/servers/liferay.rb +64 -0
 - data/lib/rays/servers/solr.rb +111 -0
 - data/lib/rays/services/application_service.rb +116 -0
 - data/lib/rays/services/backup_service.rb +94 -0
 - data/lib/rays/services/database.rb +59 -0
 - data/lib/rays/services/remote.rb +75 -0
 - data/lib/rays/services/scm.rb +92 -0
 - data/lib/rays/services/sync.rb +90 -0
 - data/lib/rays/utils/common_utils.rb +153 -0
 - data/lib/rays/utils/file_utils.rb +118 -0
 - data/lib/rays/utils/network_utils.rb +50 -0
 - data/lib/rays/workers/base.rb +134 -0
 - data/lib/rays/workers/builder.rb +63 -0
 - data/lib/rays/workers/cleaner.rb +42 -0
 - data/lib/rays/workers/deployer.rb +92 -0
 - data/lib/rays/workers/generator.rb +49 -0
 - metadata +175 -0
 
| 
         @@ -0,0 +1,394 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            =begin
         
     | 
| 
      
 2 
     | 
    
         
            +
            Copyright (c) 2012 Dmitri Carpov
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 5 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 6 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 7 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 8 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 9 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 10 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 13 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 16 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 17 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 18 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
| 
      
 22 
     | 
    
         
            +
            =end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            require 'clamp'
         
     | 
| 
      
 25 
     | 
    
         
            +
            require 'rays/interface/controller'
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            class RaysCommand < Clamp::Command
         
     | 
| 
      
 28 
     | 
    
         
            +
              option '--silent', :flag, 'no output information'
         
     | 
| 
      
 29 
     | 
    
         
            +
              option '--debug', :flag, 'debug information'
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              usage '[option] command [sub-command] [command option]'
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              #
         
     | 
| 
      
 34 
     | 
    
         
            +
              # CREATE A NEW PROJECT
         
     | 
| 
      
 35 
     | 
    
         
            +
              #
         
     | 
| 
      
 36 
     | 
    
         
            +
              subcommand 'new', 'create a new project' do
         
     | 
| 
      
 37 
     | 
    
         
            +
                parameter 'project_name', 'project name'
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 40 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 41 
     | 
    
         
            +
                  Rays::Controller.instance.create_project project_name
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              #
         
     | 
| 
      
 46 
     | 
    
         
            +
              # INIT A PROJECT
         
     | 
| 
      
 47 
     | 
    
         
            +
              #
         
     | 
| 
      
 48 
     | 
    
         
            +
              subcommand 'init', 'init a project on the current directory' do
         
     | 
| 
      
 49 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 50 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 51 
     | 
    
         
            +
                  Rays::Controller.instance.init_project
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              #
         
     | 
| 
      
 57 
     | 
    
         
            +
              # SHOW ALL MODULES
         
     | 
| 
      
 58 
     | 
    
         
            +
              #
         
     | 
| 
      
 59 
     | 
    
         
            +
              subcommand 'modules', 'show all modules' do
         
     | 
| 
      
 60 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 61 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 62 
     | 
    
         
            +
                  Rays::Controller.instance.show_modules
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              #
         
     | 
| 
      
 68 
     | 
    
         
            +
              # GENERATORS
         
     | 
| 
      
 69 
     | 
    
         
            +
              #
         
     | 
| 
      
 70 
     | 
    
         
            +
              subcommand 'g', 'create a liferay module' do
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                subcommand 'portlet', 'create a portlet' do
         
     | 
| 
      
 73 
     | 
    
         
            +
                  parameter 'name', 'a module name'
         
     | 
| 
      
 74 
     | 
    
         
            +
                  option '--generator', 'GENERATOR', 'Generator name, maven by default'
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 77 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 78 
     | 
    
         
            +
                    Rays::Controller.instance.create_module 'portlet', name, generator
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                subcommand 'servicebuilder', 'create a service builder' do
         
     | 
| 
      
 83 
     | 
    
         
            +
                  parameter 'name', 'a module name'
         
     | 
| 
      
 84 
     | 
    
         
            +
                  option '--generator', 'GENERATOR', 'Generator name, maven by default'
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 87 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 88 
     | 
    
         
            +
                    Rays::Controller.instance.create_module 'servicebuilder', name, generator
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
                end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                subcommand 'ext', 'create an ext plugin' do
         
     | 
| 
      
 93 
     | 
    
         
            +
                  parameter 'name', 'a module name'
         
     | 
| 
      
 94 
     | 
    
         
            +
                  option '--generator', 'GENERATOR', 'Generator name, maven by default'
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 97 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 98 
     | 
    
         
            +
                    Rays::Controller.instance.create_module 'ext', name, generator
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
                end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                subcommand 'hook', 'create a hook' do
         
     | 
| 
      
 103 
     | 
    
         
            +
                  parameter 'name', 'a module name'
         
     | 
| 
      
 104 
     | 
    
         
            +
                  option '--generator', 'GENERATOR', 'Generator name, maven by default'
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 107 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 108 
     | 
    
         
            +
                    Rays::Controller.instance.create_module 'hook', name, generator
         
     | 
| 
      
 109 
     | 
    
         
            +
                  end
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                subcommand 'theme', 'create a theme' do
         
     | 
| 
      
 113 
     | 
    
         
            +
                  parameter 'name', 'a module name'
         
     | 
| 
      
 114 
     | 
    
         
            +
                  option '--generator', 'GENERATOR', 'Generator name, maven by default'
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 117 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 118 
     | 
    
         
            +
                    Rays::Controller.instance.create_module 'theme', name, generator
         
     | 
| 
      
 119 
     | 
    
         
            +
                  end
         
     | 
| 
      
 120 
     | 
    
         
            +
                end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                subcommand 'layout', 'create a layout' do
         
     | 
| 
      
 123 
     | 
    
         
            +
                  parameter 'name', 'a module name'
         
     | 
| 
      
 124 
     | 
    
         
            +
                  option '--generator', 'GENERATOR', 'Generator name, maven by default'
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 127 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 128 
     | 
    
         
            +
                    Rays::Controller.instance.create_module 'layout', name, generator
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
                end
         
     | 
| 
      
 131 
     | 
    
         
            +
              end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
              #
         
     | 
| 
      
 134 
     | 
    
         
            +
              # BUILDER
         
     | 
| 
      
 135 
     | 
    
         
            +
              #
         
     | 
| 
      
 136 
     | 
    
         
            +
              subcommand 'build', 'build module(s). build all modules if under project root or a specific module if under module\'s root' do
         
     | 
| 
      
 137 
     | 
    
         
            +
                parameter '[type]', 'a module type [portlet | hook | theme | layout]'
         
     | 
| 
      
 138 
     | 
    
         
            +
                parameter '[name]', 'a module name'
         
     | 
| 
      
 139 
     | 
    
         
            +
                option '--skip-test', :flag, 'use this option if you want to skip module tests'
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 142 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 143 
     | 
    
         
            +
                  modules = []
         
     | 
| 
      
 144 
     | 
    
         
            +
                  if type.nil? and !name.nil?
         
     | 
| 
      
 145 
     | 
    
         
            +
                    raise RaysException.new("Cannot build type w/o name.")
         
     | 
| 
      
 146 
     | 
    
         
            +
                  end
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
                  module_instance = nil
         
     | 
| 
      
 149 
     | 
    
         
            +
                  if !type.nil? and !name.nil?
         
     | 
| 
      
 150 
     | 
    
         
            +
                    module_instance = Rays::AppModule::Manager.instance.get(type, name)
         
     | 
| 
      
 151 
     | 
    
         
            +
                  else
         
     | 
| 
      
 152 
     | 
    
         
            +
                    module_instance = Rays::AppModule::Manager.instance.get_from_path(Dir.pwd)
         
     | 
| 
      
 153 
     | 
    
         
            +
                  end
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                  unless module_instance.nil?
         
     | 
| 
      
 156 
     | 
    
         
            +
                    modules << module_instance
         
     | 
| 
      
 157 
     | 
    
         
            +
                  else
         
     | 
| 
      
 158 
     | 
    
         
            +
                    modules.concat(Rays::AppModule::Manager.instance.all)
         
     | 
| 
      
 159 
     | 
    
         
            +
                  end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
                  Rays::Controller.instance.build skip_test?, modules
         
     | 
| 
      
 162 
     | 
    
         
            +
                end
         
     | 
| 
      
 163 
     | 
    
         
            +
              end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
              #
         
     | 
| 
      
 166 
     | 
    
         
            +
              # DEPLOYER
         
     | 
| 
      
 167 
     | 
    
         
            +
              #
         
     | 
| 
      
 168 
     | 
    
         
            +
              subcommand 'deploy', 'deploy module(s). deploy all modules if under project root or a specific module if under module\'s root' do
         
     | 
| 
      
 169 
     | 
    
         
            +
                parameter '[type]', 'a module type [portlet | hook | theme | layout]'
         
     | 
| 
      
 170 
     | 
    
         
            +
                parameter '[name]', 'a module name'
         
     | 
| 
      
 171 
     | 
    
         
            +
                option '--skip-test', :flag, 'use this option if you want to skip module tests'
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 174 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 175 
     | 
    
         
            +
                  modules = []
         
     | 
| 
      
 176 
     | 
    
         
            +
                  if type.nil? and !name.nil?
         
     | 
| 
      
 177 
     | 
    
         
            +
                    raise RaysException.new("Cannot build type w/o name.")
         
     | 
| 
      
 178 
     | 
    
         
            +
                  end
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
                  module_instance = nil
         
     | 
| 
      
 181 
     | 
    
         
            +
                  if !type.nil? and !name.nil?
         
     | 
| 
      
 182 
     | 
    
         
            +
                    module_instance = Rays::AppModule::Manager.instance.get(type, name)
         
     | 
| 
      
 183 
     | 
    
         
            +
                  else
         
     | 
| 
      
 184 
     | 
    
         
            +
                    module_instance = Rays::AppModule::Manager.instance.get_from_path(Dir.pwd)
         
     | 
| 
      
 185 
     | 
    
         
            +
                  end
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
                  unless module_instance.nil?
         
     | 
| 
      
 188 
     | 
    
         
            +
                    modules << module_instance
         
     | 
| 
      
 189 
     | 
    
         
            +
                  else
         
     | 
| 
      
 190 
     | 
    
         
            +
                    modules.concat(Rays::AppModule::Manager.instance.all)
         
     | 
| 
      
 191 
     | 
    
         
            +
                  end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
                  Rays::Controller.instance.deploy skip_test?, modules
         
     | 
| 
      
 194 
     | 
    
         
            +
                end
         
     | 
| 
      
 195 
     | 
    
         
            +
              end
         
     | 
| 
      
 196 
     | 
    
         
            +
             
     | 
| 
      
 197 
     | 
    
         
            +
              #
         
     | 
| 
      
 198 
     | 
    
         
            +
              # CLEANER
         
     | 
| 
      
 199 
     | 
    
         
            +
              #
         
     | 
| 
      
 200 
     | 
    
         
            +
              subcommand 'clean', 'clean module(s). clean all modules if under project root or a specific module if under module\'s root' do
         
     | 
| 
      
 201 
     | 
    
         
            +
                parameter '[type]', 'a module type [portlet | hook | theme | layout]'
         
     | 
| 
      
 202 
     | 
    
         
            +
                parameter '[name]', 'a module name'
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 205 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 206 
     | 
    
         
            +
                  modules = []
         
     | 
| 
      
 207 
     | 
    
         
            +
                  if type.nil? and !name.nil?
         
     | 
| 
      
 208 
     | 
    
         
            +
                    raise RaysException.new("Cannot build type w/o name.")
         
     | 
| 
      
 209 
     | 
    
         
            +
                  end
         
     | 
| 
      
 210 
     | 
    
         
            +
             
     | 
| 
      
 211 
     | 
    
         
            +
                  module_instance = nil
         
     | 
| 
      
 212 
     | 
    
         
            +
                  if !type.nil? and !name.nil?
         
     | 
| 
      
 213 
     | 
    
         
            +
                    module_instance = Rays::AppModule::Manager.instance.get(type, name)
         
     | 
| 
      
 214 
     | 
    
         
            +
                  else
         
     | 
| 
      
 215 
     | 
    
         
            +
                    module_instance = Rays::AppModule::Manager.instance.get_from_path(Dir.pwd)
         
     | 
| 
      
 216 
     | 
    
         
            +
                  end
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                  unless module_instance.nil?
         
     | 
| 
      
 219 
     | 
    
         
            +
                    modules << module_instance
         
     | 
| 
      
 220 
     | 
    
         
            +
                  else
         
     | 
| 
      
 221 
     | 
    
         
            +
                    modules.concat(Rays::AppModule::Manager.instance.all)
         
     | 
| 
      
 222 
     | 
    
         
            +
                  end
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
                  Rays::Controller.instance.clean modules
         
     | 
| 
      
 225 
     | 
    
         
            +
                end
         
     | 
| 
      
 226 
     | 
    
         
            +
              end
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
              #
         
     | 
| 
      
 229 
     | 
    
         
            +
              # Environment
         
     | 
| 
      
 230 
     | 
    
         
            +
              #
         
     | 
| 
      
 231 
     | 
    
         
            +
              subcommand 'env', 'show current environment' do
         
     | 
| 
      
 232 
     | 
    
         
            +
                parameter '[environment_name]', 'switch environment to the specified one'
         
     | 
| 
      
 233 
     | 
    
         
            +
                option '--list', :flag, 'list environments'
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 236 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 237 
     | 
    
         
            +
             
     | 
| 
      
 238 
     | 
    
         
            +
                  if list?
         
     | 
| 
      
 239 
     | 
    
         
            +
                    Rays::Controller.instance.list_environments
         
     | 
| 
      
 240 
     | 
    
         
            +
                    return
         
     | 
| 
      
 241 
     | 
    
         
            +
                  end
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
                  if environment_name.nil?
         
     | 
| 
      
 244 
     | 
    
         
            +
                    Rays::Controller.instance.current_environment
         
     | 
| 
      
 245 
     | 
    
         
            +
                    return
         
     | 
| 
      
 246 
     | 
    
         
            +
                  end
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
                  unless environment_name.nil?
         
     | 
| 
      
 249 
     | 
    
         
            +
                    Rays::Controller.instance.switch_environment environment_name
         
     | 
| 
      
 250 
     | 
    
         
            +
                    return
         
     | 
| 
      
 251 
     | 
    
         
            +
                  end
         
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
      
 253 
     | 
    
         
            +
                  $log.warn("cannot understand what to do")
         
     | 
| 
      
 254 
     | 
    
         
            +
                end
         
     | 
| 
      
 255 
     | 
    
         
            +
              end
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
              #
         
     | 
| 
      
 258 
     | 
    
         
            +
              # Points
         
     | 
| 
      
 259 
     | 
    
         
            +
              #
         
     | 
| 
      
 260 
     | 
    
         
            +
              subcommand 'point', 'remember current directory as a point. if no name specified it will consider the point as a default one' do
         
     | 
| 
      
 261 
     | 
    
         
            +
                parameter '[name]', 'point name. if no name is specified the point will be considered as default.'
         
     | 
| 
      
 262 
     | 
    
         
            +
                option '--remove', :flag, 'remove a point. if no name is specified the point will be considered as default.'
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 265 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 266 
     | 
    
         
            +
                  if remove?
         
     | 
| 
      
 267 
     | 
    
         
            +
                    Rays::Controller.instance.remove_point name
         
     | 
| 
      
 268 
     | 
    
         
            +
                  else
         
     | 
| 
      
 269 
     | 
    
         
            +
                    Rays::Controller.instance.point Dir.pwd, name
         
     | 
| 
      
 270 
     | 
    
         
            +
                  end
         
     | 
| 
      
 271 
     | 
    
         
            +
                end
         
     | 
| 
      
 272 
     | 
    
         
            +
              end
         
     | 
| 
      
 273 
     | 
    
         
            +
             
     | 
| 
      
 274 
     | 
    
         
            +
              subcommand 'points', 'show all points' do
         
     | 
| 
      
 275 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 276 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 277 
     | 
    
         
            +
                  Rays::Controller.instance.points
         
     | 
| 
      
 278 
     | 
    
         
            +
                end
         
     | 
| 
      
 279 
     | 
    
         
            +
              end
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
              subcommand 'go', 'switch directory using point name. use rays point to crete points' do
         
     | 
| 
      
 283 
     | 
    
         
            +
                parameter '[name]', 'point name. if no name is specified the point will be considered as default.'
         
     | 
| 
      
 284 
     | 
    
         
            +
             
     | 
| 
      
 285 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 286 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 287 
     | 
    
         
            +
                  Rays::Controller.instance.go name
         
     | 
| 
      
 288 
     | 
    
         
            +
                end
         
     | 
| 
      
 289 
     | 
    
         
            +
              end
         
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
      
 291 
     | 
    
         
            +
              #
         
     | 
| 
      
 292 
     | 
    
         
            +
              # BACKUP
         
     | 
| 
      
 293 
     | 
    
         
            +
              #
         
     | 
| 
      
 294 
     | 
    
         
            +
              subcommand 'backup', 'backup current environment' do
         
     | 
| 
      
 295 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 296 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 297 
     | 
    
         
            +
                  Rays::Controller.instance.backup
         
     | 
| 
      
 298 
     | 
    
         
            +
                end
         
     | 
| 
      
 299 
     | 
    
         
            +
              end
         
     | 
| 
      
 300 
     | 
    
         
            +
             
     | 
| 
      
 301 
     | 
    
         
            +
              #
         
     | 
| 
      
 302 
     | 
    
         
            +
              # SYNC
         
     | 
| 
      
 303 
     | 
    
         
            +
              #
         
     | 
| 
      
 304 
     | 
    
         
            +
              subcommand 'sync', 'synchronize local environment with the current one' do
         
     | 
| 
      
 305 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 306 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 307 
     | 
    
         
            +
                  Rays::Controller.instance.sync
         
     | 
| 
      
 308 
     | 
    
         
            +
                end
         
     | 
| 
      
 309 
     | 
    
         
            +
              end
         
     | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
              #
         
     | 
| 
      
 313 
     | 
    
         
            +
              # LIFERAY
         
     | 
| 
      
 314 
     | 
    
         
            +
              #
         
     | 
| 
      
 315 
     | 
    
         
            +
              subcommand 'liferay', 'manage liferay application server' do
         
     | 
| 
      
 316 
     | 
    
         
            +
                parameter 'action', 'start | debug | stop | status | log'
         
     | 
| 
      
 317 
     | 
    
         
            +
                option '--force', :flag, 'use it only to [start | stop] remote servers. be careful!'
         
     | 
| 
      
 318 
     | 
    
         
            +
             
     | 
| 
      
 319 
     | 
    
         
            +
                def execute
         
     | 
| 
      
 320 
     | 
    
         
            +
                  process_global_options
         
     | 
| 
      
 321 
     | 
    
         
            +
                  if action.eql? 'start'
         
     | 
| 
      
 322 
     | 
    
         
            +
                    Rays::Controller.instance.liferay_start(force?)
         
     | 
| 
      
 323 
     | 
    
         
            +
                  elsif action.eql? 'debug'
         
     | 
| 
      
 324 
     | 
    
         
            +
                    Rays::Controller.instance.liferay_debug(force?)
         
     | 
| 
      
 325 
     | 
    
         
            +
                  elsif action.eql? 'stop'
         
     | 
| 
      
 326 
     | 
    
         
            +
                    Rays::Controller.instance.liferay_stop(force?)
         
     | 
| 
      
 327 
     | 
    
         
            +
                  elsif action.eql? 'status'
         
     | 
| 
      
 328 
     | 
    
         
            +
                    Rays::Controller.instance.liferay_status
         
     | 
| 
      
 329 
     | 
    
         
            +
                  elsif action.eql? 'log'
         
     | 
| 
      
 330 
     | 
    
         
            +
                    Rays::Controller.instance.liferay_log
         
     | 
| 
      
 331 
     | 
    
         
            +
                  else
         
     | 
| 
      
 332 
     | 
    
         
            +
                    $log.error('I cannot do what you ask. see <!rays liferay --help!>.')
         
     | 
| 
      
 333 
     | 
    
         
            +
                  end
         
     | 
| 
      
 334 
     | 
    
         
            +
                end
         
     | 
| 
      
 335 
     | 
    
         
            +
              end
         
     | 
| 
      
 336 
     | 
    
         
            +
             
     | 
| 
      
 337 
     | 
    
         
            +
              #
         
     | 
| 
      
 338 
     | 
    
         
            +
              # SOLR
         
     | 
| 
      
 339 
     | 
    
         
            +
              #
         
     | 
| 
      
 340 
     | 
    
         
            +
              subcommand 'solr', 'manage solr server of the current environment' do
         
     | 
| 
      
 341 
     | 
    
         
            +
                subcommand 'clean', 'delete all records from the solr index' do
         
     | 
| 
      
 342 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 343 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 344 
     | 
    
         
            +
                    Rays::Controller.instance.clean_solr_index
         
     | 
| 
      
 345 
     | 
    
         
            +
                  end
         
     | 
| 
      
 346 
     | 
    
         
            +
                end
         
     | 
| 
      
 347 
     | 
    
         
            +
             
     | 
| 
      
 348 
     | 
    
         
            +
                subcommand 'start', 'start solr server' do
         
     | 
| 
      
 349 
     | 
    
         
            +
                  option '--force', :flag, 'use it only to start a remote server. be careful!'
         
     | 
| 
      
 350 
     | 
    
         
            +
             
     | 
| 
      
 351 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 352 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 353 
     | 
    
         
            +
                    Rays::Controller.instance.solr_start(force?)
         
     | 
| 
      
 354 
     | 
    
         
            +
                  end
         
     | 
| 
      
 355 
     | 
    
         
            +
                end
         
     | 
| 
      
 356 
     | 
    
         
            +
             
     | 
| 
      
 357 
     | 
    
         
            +
                subcommand 'stop', 'stop solr server' do
         
     | 
| 
      
 358 
     | 
    
         
            +
                  option '--force', :flag, 'use it only to stop a remote server. be careful!'
         
     | 
| 
      
 359 
     | 
    
         
            +
             
     | 
| 
      
 360 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 361 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 362 
     | 
    
         
            +
                    Rays::Controller.instance.solr_stop(force?)
         
     | 
| 
      
 363 
     | 
    
         
            +
                  end
         
     | 
| 
      
 364 
     | 
    
         
            +
                end
         
     | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
      
 366 
     | 
    
         
            +
                subcommand 'log', 'show solr server log' do
         
     | 
| 
      
 367 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 368 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 369 
     | 
    
         
            +
                    Rays::Controller.instance.solr_log
         
     | 
| 
      
 370 
     | 
    
         
            +
                  end
         
     | 
| 
      
 371 
     | 
    
         
            +
                end
         
     | 
| 
      
 372 
     | 
    
         
            +
             
     | 
| 
      
 373 
     | 
    
         
            +
                subcommand 'status', 'show solr server status' do
         
     | 
| 
      
 374 
     | 
    
         
            +
                  def execute
         
     | 
| 
      
 375 
     | 
    
         
            +
                    process_global_options
         
     | 
| 
      
 376 
     | 
    
         
            +
                    Rays::Controller.instance.solr_status
         
     | 
| 
      
 377 
     | 
    
         
            +
                  end
         
     | 
| 
      
 378 
     | 
    
         
            +
                end
         
     | 
| 
      
 379 
     | 
    
         
            +
              end
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
      
 381 
     | 
    
         
            +
             
     | 
| 
      
 382 
     | 
    
         
            +
              private
         
     | 
| 
      
 383 
     | 
    
         
            +
             
     | 
| 
      
 384 
     | 
    
         
            +
              #
         
     | 
| 
      
 385 
     | 
    
         
            +
              # OPTIONS PROCESSOR
         
     | 
| 
      
 386 
     | 
    
         
            +
              #
         
     | 
| 
      
 387 
     | 
    
         
            +
              def process_global_options
         
     | 
| 
      
 388 
     | 
    
         
            +
                if debug?
         
     | 
| 
      
 389 
     | 
    
         
            +
                  $log.debug_on
         
     | 
| 
      
 390 
     | 
    
         
            +
                elsif silent?
         
     | 
| 
      
 391 
     | 
    
         
            +
                  $log.silent_on
         
     | 
| 
      
 392 
     | 
    
         
            +
                end
         
     | 
| 
      
 393 
     | 
    
         
            +
              end
         
     | 
| 
      
 394 
     | 
    
         
            +
            end
         
     |