raystool 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,5 +30,7 @@ begin
30
30
  end
31
31
  require 'rays/interface/commander'
32
32
  RaysCommand.run('rays', ARGV, {})
33
+ rescue SystemExit, Interrupt
33
34
  rescue => e
35
+ $log.error e.message
34
36
  end
@@ -1 +1 @@
1
- version: 1.2.7
1
+ version: 1.2.8
@@ -159,17 +159,17 @@ class RaysCommand < Clamp::Command
159
159
 
160
160
  def execute
161
161
  modules = []
162
- if !type.nil? and name.nil? and !'ear'.eql? type
163
- $log.error "Please specify the name of #{type}"
164
- return
162
+ module_name = name
163
+ if !type.nil? and module_name.nil? and !'ear'.eql? type
164
+ raise RaysException.new("Please specify the name of #{type}")
165
165
  end
166
166
 
167
167
  if 'ear'.eql? type
168
- name = 'application'
168
+ module_name = 'application'
169
169
  end
170
170
 
171
- if !type.nil? and !name.nil?
172
- module_instance = Rays::AppModule::Manager.instance.get(type, name)
171
+ if !type.nil? and !module_name.nil?
172
+ module_instance = Rays::AppModule::Manager.instance.get(type, module_name)
173
173
  else
174
174
  module_instance = Rays::AppModule::Manager.instance.get_from_path(Dir.pwd)
175
175
  end
@@ -194,17 +194,17 @@ class RaysCommand < Clamp::Command
194
194
 
195
195
  def execute
196
196
  modules = []
197
- if !type.nil? and name.nil? and !'ear'.eql? type
198
- $log.error "Please specify the name of #{type}"
199
- return
197
+ module_name = name
198
+ if !type.nil? and module_name.nil? and !'ear'.eql? type
199
+ raise RaysException.new("Please specify the name of #{type}")
200
200
  end
201
201
 
202
202
  if 'ear'.eql? type
203
- name = 'application'
203
+ module_name = 'application'
204
204
  end
205
205
 
206
- if !type.nil? and !name.nil?
207
- module_instance = Rays::AppModule::Manager.instance.get(type, name)
206
+ if !type.nil? and !module_name.nil?
207
+ module_instance = Rays::AppModule::Manager.instance.get(type, module_name)
208
208
  else
209
209
  module_instance = Rays::AppModule::Manager.instance.get_from_path(Dir.pwd)
210
210
  end
@@ -232,17 +232,17 @@ class RaysCommand < Clamp::Command
232
232
 
233
233
  def execute
234
234
  modules = []
235
- if type.nil? and !name.nil? and !'ear'.eql? type
236
- raise RaysException.new("Please specify name for #{type}")
235
+ module_name = name
236
+ if !type.nil? and module_name.nil? and !'ear'.eql? type
237
+ raise RaysException.new("Please specify the name of #{type}")
237
238
  end
238
239
 
239
240
  if 'ear'.eql? type
240
- name = 'application'
241
+ module_name = 'application'
241
242
  end
242
243
 
243
- module_instance = nil
244
- if !type.nil? and !name.nil?
245
- module_instance = Rays::AppModule::Manager.instance.get(type, name)
244
+ if !type.nil? and !module_name.nil?
245
+ module_instance = Rays::AppModule::Manager.instance.get(type, module_name)
246
246
  else
247
247
  module_instance = Rays::AppModule::Manager.instance.get_from_path(Dir.pwd)
248
248
  end
@@ -50,7 +50,8 @@ module Rays
50
50
  @updaters[Gem::Version.create('1.2.4')] = 'update_1_2_4'
51
51
  @updaters[Gem::Version.create('1.2.5')] = 'update_1_2_5'
52
52
  @updaters[Gem::Version.create('1.2.6')] = 'update_1_2_6'
53
- @updaters[Gem::Version.create('1.2.6')] = 'update_1_2_7'
53
+ @updaters[Gem::Version.create('1.2.7')] = 'update_1_2_7'
54
+ @updaters[Gem::Version.create('1.2.8')] = 'update_1_2_8'
54
55
  end
55
56
 
56
57
  def check
@@ -63,7 +64,7 @@ module Rays
63
64
  end
64
65
  update
65
66
  elsif @current_version > @updaters.keys.max
66
- $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."
67
+ $log.error "Your project version #{@current_version.to_s} is higher than the rays one #{@updaters.keys.max}.\nIt is highly recommended to upgrade your rays ('<!gem update raystool!>') before continue.\nPress 'Enter' to continue or 'ctrl+c' to abort."
67
68
  begin
68
69
  STDIN.gets.chomp
69
70
  rescue Interrupt
@@ -138,6 +139,10 @@ module Rays
138
139
  $log.info "Update info: fixed ear packaging bugs"
139
140
  end
140
141
 
142
+ def update_1_2_8
143
+ $log.info "Update info: improved errors log"
144
+ end
145
+
141
146
  def sync_version version
142
147
  @rays_content.properties['version'] = version.to_s
143
148
  @rays_content.write
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.7
4
+ version: 1.2.8
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-20 00:00:00.000000000 Z
12
+ date: 2012-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
16
- requirement: &78910310 !ruby/object:Gem::Requirement
16
+ requirement: &71598290 !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: *78910310
24
+ version_requirements: *71598290
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rsolr
27
- requirement: &78910090 !ruby/object:Gem::Requirement
27
+ requirement: &71597820 !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: *78910090
35
+ version_requirements: *71597820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: colorize
38
- requirement: &78909880 !ruby/object:Gem::Requirement
38
+ requirement: &71597340 !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: *78909880
46
+ version_requirements: *71597340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: net-ssh
49
- requirement: &78909670 !ruby/object:Gem::Requirement
49
+ requirement: &71596800 !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: *78909670
57
+ version_requirements: *71596800
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: highline
60
- requirement: &78909460 !ruby/object:Gem::Requirement
60
+ requirement: &71595920 !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: *78909460
68
+ version_requirements: *71595920
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: safe_shell
71
- requirement: &78909250 !ruby/object:Gem::Requirement
71
+ requirement: &71595450 !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: *78909250
79
+ version_requirements: *71595450
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: nokogiri
82
- requirement: &78909040 !ruby/object:Gem::Requirement
82
+ requirement: &71594830 !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: *78909040
90
+ version_requirements: *71594830
91
91
  description: Command line tool to create and manage liferay projects
92
92
  email: dmitri.carpov@gmail.com
93
93
  executables:
@@ -113,7 +113,6 @@ files:
113
113
  - lib/rays/config/backup.rb
114
114
  - lib/rays/config/configuration.rb
115
115
  - lib/rays/config/environment.rb
116
- - lib/rays/config/templates/project/Rakefile
117
116
  - lib/rays/config/templates/project/config/project.yml
118
117
  - lib/rays/config/templates/project/config/environment.yml
119
118
  - lib/rays/config/templates/global/global.yml
@@ -1,150 +0,0 @@
1
- require 'yaml'
2
- require 'open-uri'
3
- require 'pathname'
4
- require 'rays/core'
5
-
6
- task :default => [:create]
7
-
8
- task :create do
9
- server = RaysServerUtil.new
10
- server.create_server
11
- server.init_database
12
- end
13
-
14
- task :refresh do
15
- server = RaysServerUtil.new
16
- server.init_database
17
- server.recreate_server
18
- end
19
-
20
- task :update do
21
- server = RaysServerUtil.new
22
- server.configure_liferay
23
- end
24
-
25
- class RaysServerUtil
26
- def initialize
27
- @liferay_archive = 'liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip'
28
- @liferay_archive_path = File.join(ENV['HOME'], 'Downloads', @liferay_archive)
29
- @extracted_name = 'liferay-portal-6.1.0-ce-ga1'
30
- @url = 'http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.0%20GA1/liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2FLiferay%2520Portal%2F6.1.0%2520GA1%2F&ts=1332039099&use_mirror=superb-sea2'
31
- init_liferay_archive
32
- end
33
-
34
- def refresh
35
- init_database
36
- recreate_server
37
- end
38
-
39
- def init_database
40
- log_block("(re)create database") do
41
- db_type = environment.database.type
42
- rays_exec('psql -U postgres < support-files/init.sql') if 'postgres'.eql? db_type
43
- rays_exec('mysql -uroot -p < support-files/init.sql') if 'mysql'.eql? db_type
44
- end
45
- end
46
-
47
- def recreate_server
48
- remove_server_directory
49
- create_server
50
- end
51
-
52
- def create_server
53
- if Dir.exist? server_root
54
- $log.error 'server has already been created'
55
- exit 1
56
- else
57
- copy_liferay_archive_to_server_base
58
- extract_liferay_archive
59
- configure_liferay
60
- cleanup_portlets
61
- end
62
- end
63
-
64
-
65
- def configure_liferay
66
- $log.info 'copy server configuration files'
67
- FileUtils.cp(File.join(Dir.pwd, 'support-files/portal-ext.properties'), liferay_root)
68
- FileUtils.cp(File.join(Dir.pwd, 'support-files/ROOT.xml'), File.join(server_root, 'conf/Catalina/localhost/ROOT.xml'))
69
- end
70
-
71
- private
72
- def in_directory(directory)
73
- if Dir.exist? directory
74
- original_directory = Dir.pwd
75
- Dir.chdir directory
76
- begin
77
- yield
78
- ensure
79
- Dir.chdir original_directory
80
- end
81
- end
82
- end
83
-
84
- def remove_server_directory
85
- $log.info "remove server directory"
86
- FileUtils.rm_rf liferay_root
87
- end
88
-
89
- def server_root
90
- environment.liferay.service.path
91
- end
92
-
93
- def liferay_root
94
- File.dirname server_root
95
- end
96
-
97
- def liferay_base
98
- File.dirname liferay_root
99
- end
100
-
101
- def copy_liferay_archive_to_server_base
102
- $log.info 'copy liferay archive to destination directory'
103
- FileUtils.cp @liferay_archive_path, liferay_base
104
- end
105
-
106
- def extract_liferay_archive
107
- in_directory liferay_base do
108
- $log.info 'extracting liferay'
109
- rays_exec "unzip #{@liferay_archive}"
110
-
111
- $log.info 'removing archive'
112
- FileUtils.rm_f(@liferay_archive)
113
- FileUtils.mv(@extracted_name, File.basename(liferay_root))
114
- end
115
- end
116
-
117
- def cleanup_portlets
118
- in_directory File.join(server_root, 'webapps') do
119
- task 'cleaning portlets', 'done', 'failed' do
120
- portlets_to_remove = %w(chat-portlet knowledge-base-portlet mail-portlet opensocial-portlet sevencogs-hook sevencogs-theme wsrp-portlet)
121
-
122
- portlets_to_remove.each do |portlet|
123
- portlet_path = File.join(Dir.pwd, portlet)
124
- if Dir.exist? portlet_path
125
- $log.info "removing #{portlet}"
126
- FileUtils.rm_rf portlet_path
127
- end
128
- end
129
- end
130
- end
131
- end
132
-
133
- def init_liferay_archive
134
- unless File.exist? @liferay_archive_path
135
- $log.info 'Downloading liferay ...'
136
- write_out = open(@liferay_archive_path, "wb")
137
- write_out.write(open(@url).read)
138
- write_out.close
139
- end
140
-
141
- unless File.exist? @liferay_archive_path
142
- $log.error "cannot neither find #{@liferay_archive_path} nor download liferay zip from #{@url}."
143
- exit 1
144
- end
145
- end
146
-
147
- def environment
148
- $rays_config.environments['local']
149
- end
150
- end