raystool 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -312,6 +312,9 @@ module Rays
312
312
  remote = create_remote_for config
313
313
  unless application_service_config.nil?
314
314
  path = absolute_path(root, application_service_config['path'])
315
+ deploy = application_service_config['deploy']
316
+ deploy = absolute_path(path, deploy) unless deploy.nil?
317
+
315
318
  path = "" if path.nil?
316
319
  start_script = File.join(path, application_service_config['start_command'])
317
320
  debug_script = nil
@@ -326,7 +329,7 @@ module Rays
326
329
  application_remote = nil
327
330
  end
328
331
 
329
- application_service = Service::ApplicationService.new name, host, port, start_script, debug_script, stop_script, log_file, application_remote, path
332
+ application_service = Service::ApplicationService.new name, host, port, start_script, debug_script, stop_script, log_file, application_remote, path, deploy
330
333
  end
331
334
  application_service
332
335
  end
@@ -48,15 +48,19 @@ _rays_dir () {
48
48
  done
49
49
  }
50
50
 
51
- _rays_module_types="portlet hook theme layout ext"
51
+ _rays_module_types="portlet hook theme servicebuilder layout ext ejb"
52
52
 
53
53
  _rays_module_find () {
54
54
  local dir="$1/$2s" glob="*-$2"
55
+ if [ $2 = "ejb" ]; then
56
+ local dir="$1/ee/ejb"
57
+ fi
58
+
55
59
 
56
60
  case "$2" in ext) dir="$1/$2" ;; esac
57
61
 
58
62
  if [ -d "$dir" ]; then
59
- find "$dir/" -maxdepth 1 -type d -name "$glob" -printf "%f "
63
+ find "$dir/" -maxdepth 2 -type d -name "$glob" -printf "%f "
60
64
  fi
61
65
  }
62
66
 
@@ -67,7 +71,7 @@ _rays_module () {
67
71
 
68
72
  while [[ $c -lt $COMP_CWORD ]] && [ -z "$module_dir" ]; do
69
73
  case "${COMP_WORDS[c]}" in
70
- portlet|hook|theme|layout|ext|servicebuilder)
74
+ portlet|hook|theme|layout|ext|servicebuilder|ejb)
71
75
  _rays_module_find "$dir" "${COMP_WORDS[c]}"
72
76
  return
73
77
  ;;
@@ -5,15 +5,13 @@ local:
5
5
  root: /opt/liferay-portal
6
6
  deploy: deploy # will be added to the root
7
7
  data: data # will be added to the root
8
- java:
9
- home: /usr/lib/jvm/java-6-sun
10
- bin: /usr/bin/java
11
8
  service:
12
9
  path: tomcat # will be added to the root
13
10
  start_command: "JAVA_OPTS=\"$JAVA_OPTS -Dexternal-properties=portal-developer.properties\" && bin/startup.sh"
14
11
  debug_command: bin/catalina.sh jpda start
15
12
  stop_command: bin/shutdown.sh
16
13
  log_file: logs/catalina.out
14
+ deploy: "" # use it for jee6 servers to deploy ejb
17
15
  database:
18
16
  host: localhost
19
17
  port: 3306
@@ -30,9 +28,6 @@ local:
30
28
  start_command: bin/startup.sh
31
29
  stop_command: bin/shutdown.sh
32
30
  log_file: logs/catalina.out
33
- backup:
34
- directory: /tmp/backup
35
- stop: false
36
31
  test:
37
32
  liferay:
38
33
  host: 127.0.0.1
@@ -42,15 +37,13 @@ test:
42
37
  ssh:
43
38
  user: liferay
44
39
  port: 22
45
- java:
46
- home: /usr/lib/jvm/java-6-sun
47
- bin: /usr/bin/java
48
40
  service:
49
41
  path: /opt/liferay-portal/tomcat
50
42
  start_command: bin/startup.sh
51
43
  debug_command: bin/catalina.sh jpda start
52
44
  stop_command: bin/shutdown.sh
53
45
  log_file: logs/catalina.out
46
+ deploy: ""
54
47
  database:
55
48
  host: localhost
56
49
  port: 3306
@@ -67,6 +60,3 @@ test:
67
60
  start_command: bin/startup.sh
68
61
  stop_command: bin/shutdown.sh
69
62
  log_file: logs/catalina.out
70
- backup:
71
- directory: /tmp/backup
72
- stop: false
data/lib/rays/core.rb CHANGED
@@ -101,6 +101,7 @@ module Rays
101
101
  require 'rays/models/appmodule/portlet'
102
102
  require 'rays/models/appmodule/servicebuilder'
103
103
  require 'rays/models/appmodule/ext'
104
+ require 'rays/models/appmodule/ejb'
104
105
  require 'rays/models/appmodule/hook'
105
106
  require 'rays/models/appmodule/theme'
106
107
  require 'rays/models/appmodule/layout'
@@ -112,6 +112,15 @@ class RaysCommand < Clamp::Command
112
112
  end
113
113
  end
114
114
 
115
+ subcommand 'ejb', 'create an EJB' do
116
+ parameter 'name', 'a module name'
117
+ option '--generator', 'GENERATOR', 'Generator name, maven by default'
118
+
119
+ def execute
120
+ Rays::Controller.instance.create_module 'ejb', name, generator
121
+ end
122
+ end
123
+
115
124
  subcommand 'hook', 'create a hook' do
116
125
  parameter 'name', 'a module name'
117
126
  option '--generator', 'GENERATOR', 'Generator name, maven by default'
@@ -144,7 +153,7 @@ class RaysCommand < Clamp::Command
144
153
  # BUILDER
145
154
  #
146
155
  subcommand 'build', 'build module(s). build all modules if under project root or a specific module if under module\'s root' do
147
- parameter '[type]', 'a module type [portlet | hook | theme | layout]'
156
+ parameter '[type]', 'a module type [portlet | hook | theme | layout | ext | ejb]'
148
157
  parameter '[name]', 'a module name'
149
158
  option '--skip-test', :flag, 'use this option if you want to skip module tests'
150
159
 
@@ -175,7 +184,7 @@ class RaysCommand < Clamp::Command
175
184
  # DEPLOYER
176
185
  #
177
186
  subcommand 'deploy', 'deploy module(s). deploy all modules if under project root or a specific module if under module\'s root' do
178
- parameter '[type]', 'a module type [portlet | hook | theme | layout]'
187
+ parameter '[type]', 'a module type [portlet | hook | theme | layout | ext | ejb]'
179
188
  parameter '[name]', 'a module name'
180
189
  option '--skip-test', :flag, 'use this option if you want to skip module tests'
181
190
 
@@ -210,7 +219,7 @@ class RaysCommand < Clamp::Command
210
219
  # CLEANER
211
220
  #
212
221
  subcommand 'clean', 'clean module(s). clean all modules if under project root or a specific module if under module\'s root' do
213
- parameter '[type]', 'a module type [portlet | hook | theme | layout]'
222
+ parameter '[type]', 'a module type [portlet | hook | theme | layout | ext | ejb]'
214
223
  parameter '[name]', 'a module name'
215
224
 
216
225
  def execute
@@ -0,0 +1,35 @@
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
+ module Rays
25
+ module AppModule
26
+ class EJBModule < Module
27
+ register :ejb
28
+ directory 'ee/ejb'
29
+ generator Worker::Manager.instance.create :generator, :ejb_maven
30
+ builder Worker::Manager.instance.create :builder, :ejb_maven
31
+ deployer Worker::Manager.instance.create :deployer, :ejb
32
+ cleaner Worker::Manager.instance.create :cleaner, :maven
33
+ end
34
+ end
35
+ end
@@ -25,7 +25,7 @@ module Rays
25
25
  module Service
26
26
  class ApplicationService
27
27
 
28
- def initialize(name, host, port, start_script, debug_script, stop_script, log_file, remote, path)
28
+ def initialize(name, host, port, start_script, debug_script, stop_script, log_file, remote, path, deploy)
29
29
  @name = name
30
30
  @host = host
31
31
  @port = port
@@ -35,6 +35,7 @@ module Rays
35
35
  @log_file = log_file
36
36
  @remote = remote
37
37
  @path = path
38
+ @deploy = deploy
38
39
  end
39
40
 
40
41
  def host
@@ -52,6 +53,11 @@ module Rays
52
53
  @path
53
54
  end
54
55
 
56
+ def deploy
57
+ raise RaysException.new(missing_environment_option('service', 'deploy')) if @deploy.nil?
58
+ @deploy
59
+ end
60
+
55
61
  # Start service
56
62
  def start
57
63
  unless alive?
@@ -47,11 +47,12 @@ module Rays
47
47
  @updaters[Gem::Version.create('1.2.1')] = 'update_1_2_1'
48
48
  @updaters[Gem::Version.create('1.2.2')] = 'update_1_2_2'
49
49
  @updaters[Gem::Version.create('1.2.3')] = 'update_1_2_3'
50
+ @updaters[Gem::Version.create('1.2.4')] = 'update_1_2_4'
50
51
  end
51
52
 
52
53
  def check
53
54
  if @current_version < @updaters.keys.max
54
- $log.error "Your project version is #{@current_version.to_s}. Your rays version is #{@updaters.keys.max.to_s}. Press 'Enter' to update or 'ctrl+c' to abort."
55
+ $log.error "Your project version is #{@current_version.to_s}.\nYour rays version is #{@updaters.keys.max.to_s}.\nPress 'Enter' to upgrade or 'ctrl+c' to abort."
55
56
  begin
56
57
  STDIN.gets.chomp
57
58
  rescue Interrupt
@@ -59,7 +60,7 @@ module Rays
59
60
  end
60
61
  update
61
62
  elsif @current_version > @updaters.keys.max
62
- $log.error "Your project version is higher than rays one. It is highly recommended to upgrade your rays ('gem update raystool') before continue. Press 'Enter' to continue or 'ctrl+c' to abort."
63
+ $log.error "Your project version is higher than rays one.\nIt is highly recommended to upgrade your rays ('<!gem update raystool!>') before continue.\nPress 'Enter' to continue or 'ctrl+c' to abort."
63
64
  begin
64
65
  STDIN.gets.chomp
65
66
  rescue Interrupt
@@ -115,6 +116,13 @@ module Rays
115
116
  $log.info "Update info: now you can root option in your environment.yml to get rid of absolute paths for data, deploy and service/path. Create a new project to see an example."
116
117
  end
117
118
 
119
+ def update_1_2_4
120
+ $log.info "Update info: added ejb support.
121
+ \t<!rays g ejb <module name>!> will create ee/ejb/<module name> plugin.
122
+ \t<!rays build ejb <module>!> will package and install ejb with it's client to the local maven repository.
123
+ \t<!rays install ejb <module name>!> will deploy it on a jee6 server, see deploy parameter for service."
124
+ end
125
+
118
126
  def sync_version version
119
127
  @rays_content.properties['version'] = version.to_s
120
128
  @rays_content.write
@@ -66,6 +66,7 @@ module Rays
66
66
  def process_pom(module_pom)
67
67
  check_parent_pom
68
68
  add_parent_pom_to module_pom
69
+ enable_client_ejb module_pom
69
70
  end
70
71
 
71
72
  private
@@ -138,6 +139,36 @@ module Rays
138
139
  File.open(module_pom, 'w') { |file| file.write doc.to_xml }
139
140
  end
140
141
 
142
+ def enable_client_ejb(module_pom)
143
+ doc = Nokogiri::XML(open(module_pom), &:noblanks)
144
+
145
+ doc.css('project > build > plugins > plugin').each do |node|
146
+ group_id = node.css('groupId').text
147
+ artifact_id = node.css('artifactId').text
148
+
149
+ if group_id.eql?('org.apache.maven.plugins') and artifact_id.eql?('maven-ejb-plugin') and
150
+ node.css('configuration > generateClient').empty?
151
+
152
+ $log.info 'Enabling client generation for EJB module ...'
153
+ configuration_node = node.css('configuration')
154
+
155
+ if configuration_node.empty?
156
+ configuration_node = Nokogiri::XML::Node.new('configuration', doc)
157
+ node.add_child configuration_node
158
+ else
159
+ configuration_node = configuration_node[0]
160
+ end
161
+
162
+ generate_client_node = Nokogiri::XML::Node.new('generateClient', doc)
163
+ generate_client_node.content = 'true'
164
+
165
+ configuration_node.add_child generate_client_node
166
+
167
+ File.open(module_pom, 'w') { |file| file.write doc.to_xml }
168
+ end
169
+ end
170
+ end
171
+
141
172
  private
142
173
  def parent_group_id
143
174
  "#{Project.instance.package}.#{Project.instance.name}"
@@ -24,7 +24,7 @@ module Rays
24
24
  module Worker
25
25
  module Builder
26
26
 
27
- # Maven builder
27
+ # Liferay Maven builder
28
28
  class Maven < BaseWorker
29
29
  register :builder, :maven
30
30
  include Singleton
@@ -39,7 +39,25 @@ module Rays
39
39
  end
40
40
  end
41
41
 
42
+ # EJB Maven builder
43
+ class EJBMaven < BaseWorker
44
+ register :builder, :ejb_maven
45
+ include Singleton
46
+
47
+ def build(app_module, skip_test = false)
48
+ execute('build', app_module) do
49
+ test_args = ''
50
+ test_args = '-Dmaven.skip.tests=true' if skip_test
51
+
52
+ rays_exec("#{$rays_config.mvn} clean")
53
+ $log.info("Installing EJB with it's client to the local maven repository")
54
+ rays_exec("#{$rays_config.mvn} install #{test_args}")
55
+ end
56
+ end
57
+ end
58
+
42
59
  # Content builder
60
+ # deprecated
43
61
  class Content < BaseWorker
44
62
  register :builder, :content_sync
45
63
  include Singleton
@@ -26,7 +26,7 @@ module Rays
26
26
  module Worker
27
27
  module Deployer
28
28
 
29
- # Maven deployer
29
+ # Liferay Maven deployer
30
30
  class Maven < BaseWorker
31
31
  register :deployer, :maven
32
32
 
@@ -46,7 +46,27 @@ module Rays
46
46
  end
47
47
  end
48
48
 
49
+ # EJB deployer
50
+ class EJBDeploy < BaseWorker
51
+ register :deployer, :ejb
52
+
53
+ include Singleton
54
+
55
+ def deploy(app_module)
56
+ execute('deploy', app_module) do
57
+ env = $rays_config.environment
58
+ file_to_deploy = File.expand_path("./target/#{app_module.name}-#{Project.instance.version}.jar")
59
+ if env.liferay.remote?
60
+ env.liferay.remote.copy_to(file_to_deploy, env.liferay.service.deploy)
61
+ else
62
+ FileUtils.cp(file_to_deploy, env.liferay.service.deploy)
63
+ end
64
+ end
65
+ end
66
+ end
67
+
49
68
  # Content deployer
69
+ # deprecated
50
70
  class Content < BaseWorker
51
71
  register :deployer, :content_sync
52
72
 
@@ -24,7 +24,7 @@ module Rays
24
24
  module Worker
25
25
  module Generator
26
26
 
27
- # Maven generator
27
+ # Liferay Maven generator
28
28
  class Maven < BaseWorker
29
29
  register :generator, :maven
30
30
 
@@ -46,6 +46,28 @@ module Rays
46
46
  end
47
47
  end
48
48
  end
49
+
50
+ # EJB Maven generator
51
+ class EJBMaven < BaseWorker
52
+ register :generator, :ejb_maven
53
+
54
+ include Singleton
55
+
56
+ def create(app_module)
57
+ create_cmd = "#{$rays_config.mvn} archetype:generate" <<
58
+ " -DarchetypeGroupId=org.codehaus.mojo.archetypes" <<
59
+ " -DarchetypeArtifactId=ejb-javaee6" <<
60
+ " -DarchetypeVersion=1.5" <<
61
+ " -DgroupId=#{Project.instance.package}.#{app_module.type}" <<
62
+ " -DartifactId=#{app_module.name}" <<
63
+ " -Dversion=#{Project.instance.version}" <<
64
+ " -Dpackaging=war -B"
65
+ rays_exec(create_cmd)
66
+ Utils::FileUtils.find_down(app_module.path, 'pom\.xml').each do |pom_file|
67
+ MavenUtil.process_pom pom_file
68
+ end
69
+ end
70
+ end
49
71
  end
50
72
  end
51
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raystool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-06 00:00:00.000000000 Z
12
+ date: 2012-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
16
- requirement: &71272460 !ruby/object:Gem::Requirement
16
+ requirement: &72689490 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *71272460
24
+ version_requirements: *72689490
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rsolr
27
- requirement: &71272240 !ruby/object:Gem::Requirement
27
+ requirement: &72689270 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *71272240
35
+ version_requirements: *72689270
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: colorize
38
- requirement: &71272030 !ruby/object:Gem::Requirement
38
+ requirement: &72689060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *71272030
46
+ version_requirements: *72689060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: net-ssh
49
- requirement: &71271820 !ruby/object:Gem::Requirement
49
+ requirement: &72688850 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *71271820
57
+ version_requirements: *72688850
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: highline
60
- requirement: &71271610 !ruby/object:Gem::Requirement
60
+ requirement: &72688640 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *71271610
68
+ version_requirements: *72688640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: safe_shell
71
- requirement: &71271400 !ruby/object:Gem::Requirement
71
+ requirement: &72688430 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *71271400
79
+ version_requirements: *72688430
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: nokogiri
82
- requirement: &71271190 !ruby/object:Gem::Requirement
82
+ requirement: &72688220 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *71271190
90
+ version_requirements: *72688220
91
91
  description: Command line tool to create and manage liferay projects
92
92
  email: dmitri.carpov@gmail.com
93
93
  executables:
@@ -100,6 +100,7 @@ files:
100
100
  - lib/rays/loaders/highline.rb
101
101
  - lib/rays/models/project.rb
102
102
  - lib/rays/models/appmodule/content.rb
103
+ - lib/rays/models/appmodule/ejb.rb
103
104
  - lib/rays/models/appmodule/ext.rb
104
105
  - lib/rays/models/appmodule/manager.rb
105
106
  - lib/rays/models/appmodule/base.rb