ow-nuxeo 0.2.3 → 0.3.0
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/ow-nuxeo +134 -86
- metadata +2 -2
data/bin/ow-nuxeo
CHANGED
@@ -4,86 +4,136 @@
|
|
4
4
|
|
5
5
|
require 'fileutils'
|
6
6
|
|
7
|
+
# Help screen
|
8
|
+
# ===========
|
9
|
+
|
10
|
+
def displayHelp()
|
11
|
+
putHeader '"ow-nuxeo" Help'
|
12
|
+
puts
|
13
|
+
puts '* EXAMPLES'
|
14
|
+
puts 'ow-nuxeo init'
|
15
|
+
puts 'ow-nuxeo build'
|
16
|
+
puts 'ow-nuxeo fastbuild deploy run'
|
17
|
+
puts 'ow-nuxeo setversion 1.0.0'
|
18
|
+
puts 'ow-nuxeo release'
|
19
|
+
puts ''
|
20
|
+
puts '* AVAILABLE GOALS > MAVEN BUILD'
|
21
|
+
puts 'build : Full build'
|
22
|
+
puts 'fastbuild : Full build, but skip the tests'
|
23
|
+
puts 'fastestbuild : Build only the changed code, skip the tests, run offline (note: it won\'t fetch the latest Nuxeo Studio plugin version)'
|
24
|
+
puts 'test : Run the Maven tests only, in debug mode'
|
25
|
+
puts 'release : Full build with the "release" flag enabled, to enable the use of the tagged Nuxeo Studio plugin'
|
26
|
+
puts ''
|
27
|
+
puts '* AVAILABLE GOALS > OTHER MAVEN-RELATED GOALS'
|
28
|
+
puts 'init : Starts a wizard to create a new Nuxeo project.'
|
29
|
+
puts 'getversion : Returns the current version of your project.'
|
30
|
+
puts 'setversion [V] : Updates the project version (will be reflected on all modules of the root POM). Parameter [V] is the new version number.'
|
31
|
+
puts ''
|
32
|
+
puts '* AVAILABLE GOALS > SERVER CONTROL'
|
33
|
+
puts 'deploy : Deploy the marketplace package to your instance'
|
34
|
+
puts 'run : Run Nuxeo in console mode'
|
35
|
+
puts 'reset : Resets the data of your Derby/H2 server (if you\'re using an external database, it will only purge the binaries)'
|
36
|
+
puts ''
|
37
|
+
puts '* AVAILABLE GOALS > MISC'
|
38
|
+
puts 'version : Displays ow-nuxeo version'
|
39
|
+
puts 'help : Displays this screen'
|
40
|
+
puts ''
|
41
|
+
end
|
42
|
+
|
43
|
+
# Utility functions
|
44
|
+
# =================
|
45
|
+
|
46
|
+
def nuxeoctlPath()
|
47
|
+
if defined? NUXEO_PATH
|
48
|
+
path = Dir[NUXEO_PATH + 'bin/nuxeoctl'][0]
|
49
|
+
end
|
50
|
+
if path == nil
|
51
|
+
putHeader "ERROR: Is the Nuxeo path (in 'nuxeo-config.rb') defined correctly? Aborting."
|
52
|
+
exit -1
|
53
|
+
else
|
54
|
+
return path
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
$firstHeader = true
|
59
|
+
def putHeader(title)
|
60
|
+
title = ' ' + title + ' '
|
61
|
+
if $firstHeader
|
62
|
+
$firstHeader = false
|
63
|
+
else
|
64
|
+
puts
|
65
|
+
end
|
66
|
+
puts '=' * title.length
|
67
|
+
puts title
|
68
|
+
puts '=' * title.length
|
69
|
+
end
|
70
|
+
|
71
|
+
def runCommand(title, command)
|
72
|
+
putHeader 'Running: ' + title + ''
|
73
|
+
puts '> ' + command
|
74
|
+
puts
|
75
|
+
if !system(command)
|
76
|
+
putHeader 'ERROR: A command failed. Aborting.'
|
77
|
+
exit -1
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check ow-nuxeo requirements
|
82
|
+
# ===========================
|
83
|
+
|
7
84
|
if ARGV[0] != 'init' && ARGV[0] != 'version'
|
8
85
|
begin
|
9
86
|
require './nuxeo-config.rb'
|
10
87
|
rescue LoadError
|
11
|
-
|
88
|
+
putHeader "WARNING: 'nuxeo-config.rb' is missing. Using default config."
|
12
89
|
begin
|
13
90
|
require './nuxeo-config.default.rb'
|
14
91
|
rescue LoadError
|
15
|
-
|
92
|
+
putHeader "ERROR: Neither 'nuxeo-config.rb' nor './nuxeo-config.default.rb' was found. Aborting."
|
16
93
|
puts "Please create them by using the example below. Alternately, you can use 'ow-nuxeo init' to create a new project from scratch."
|
17
94
|
puts ""
|
18
|
-
puts "
|
95
|
+
puts "----------------------"
|
19
96
|
puts "# Nuxeo location"
|
20
97
|
puts "#NUXEO_PATH = '/home/username/nuxeo-cap-5.6.0-tomcat/'"
|
21
98
|
puts ""
|
22
99
|
puts "# Distrib config"
|
23
100
|
puts "MARKETPLACE_PACKAGE_NAME = 'my-project'"
|
24
101
|
puts "MARKETPLACE_PROJECT_PATH = './my-project-distribution'"
|
25
|
-
puts "
|
26
|
-
|
27
|
-
exit 0
|
102
|
+
puts "----------------------"
|
103
|
+
exit -1
|
28
104
|
end
|
29
105
|
end
|
30
106
|
end
|
31
107
|
|
32
|
-
|
33
|
-
|
34
|
-
path = Dir[NUXEO_PATH + 'bin/nuxeoctl'][0]
|
35
|
-
end
|
36
|
-
if path == nil
|
37
|
-
puts "ERROR, is the Nuxeo path (in 'nuxeo-config.rb') defined correctly?"
|
38
|
-
exit 0
|
39
|
-
else
|
40
|
-
return path
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def displayHelp()
|
45
|
-
puts '> EXAMPLES'
|
46
|
-
puts 'ow-nuxeo init'
|
47
|
-
puts 'ow-nuxeo build'
|
48
|
-
puts 'ow-nuxeo fastbuild deploy run'
|
49
|
-
puts 'ow-nuxeo setversion 1.0.0'
|
50
|
-
puts 'ow-nuxeo release'
|
51
|
-
puts ''
|
52
|
-
puts '> AVAILABLE GOALS / BUILD'
|
53
|
-
puts 'build : Full build'
|
54
|
-
puts 'fastbuild : Build, but skip the tests'
|
55
|
-
puts 'fastestbuild : Build, but skip the tests and run offline (note: won\'t update any SNAPSHOT from remote repos, like Nuxeo Studio plugins)'
|
56
|
-
puts 'test : Run the Maven tests only, in debug mode'
|
57
|
-
puts 'release : Full build with the "release" flag enabled, to enable the use of the tagged NxStudio plugin'
|
58
|
-
puts ''
|
59
|
-
puts '> AVAILABLE GOALS / SERVER CONTROL'
|
60
|
-
puts 'deploy : Deploy the marketplace package to your instance'
|
61
|
-
puts 'run : Run Nuxeo in console mode'
|
62
|
-
puts 'reset : Resets the data of your Derby/H2 server (will only purge the binaries if you\'re using an external database)'
|
63
|
-
puts ''
|
64
|
-
puts '> AVAILABLE GOALS / TOOLS'
|
65
|
-
puts 'init : Starts a wizard to create a new Nuxeo project.'
|
66
|
-
puts 'getversion : Returns the current version of your project.'
|
67
|
-
puts 'setversion [V] : Updates the project version (will be reflected on all modules of the root POM). Parameter [V] is the new version number.'
|
68
|
-
puts 'version : Displays ow-nuxeo version'
|
69
|
-
puts ''
|
70
|
-
end
|
108
|
+
# Command loop
|
109
|
+
# ============
|
71
110
|
|
72
111
|
ARGV.each do |arg|
|
73
|
-
|
74
112
|
case arg
|
75
113
|
|
114
|
+
# General commands
|
115
|
+
# ================
|
116
|
+
|
117
|
+
when 'help'
|
118
|
+
displayHelp()
|
119
|
+
|
120
|
+
when 'version'
|
121
|
+
puts Gem.loaded_specs['ow-nuxeo'].full_name
|
122
|
+
|
123
|
+
# Maven commands
|
124
|
+
# ==============
|
125
|
+
|
76
126
|
when 'test'
|
77
|
-
|
127
|
+
runCommand('Maven tests', 'mvnDebug -DforkMode=never test')
|
78
128
|
|
79
129
|
when 'build'
|
80
|
-
|
130
|
+
runCommand('Full Maven build', 'mvn clean install')
|
81
131
|
|
82
132
|
when 'fastbuild'
|
83
|
-
|
133
|
+
runCommand('Maven build without tests', 'mvn clean install -DskipTests=true')
|
84
134
|
|
85
135
|
when 'fastestbuild'
|
86
|
-
|
136
|
+
runCommand('Offline Maven build without tests', 'mvn install -DskipTests=true -o')
|
87
137
|
|
88
138
|
when 'getversion'
|
89
139
|
File.open(MARKETPLACE_PROJECT_PATH + '/pom.xml') do |f|
|
@@ -97,29 +147,36 @@ ARGV.each do |arg|
|
|
97
147
|
|
98
148
|
when 'setversion'
|
99
149
|
if !ARGV[1].nil?
|
100
|
-
|
150
|
+
runCommand('Projects version update', 'mvn versions:set -DnewVersion=' + ARGV[1])
|
101
151
|
break
|
102
152
|
else
|
103
153
|
puts "Usage: ow-nuxeo setversion [VERSION]"
|
104
154
|
end
|
105
155
|
|
106
156
|
when 'release'
|
107
|
-
|
157
|
+
runCommand('Maven build using matching Studio tag', 'mvn clean install -Drelease')
|
158
|
+
|
159
|
+
# Nuxeo commands
|
160
|
+
# ==============
|
108
161
|
|
109
162
|
when 'deploy'
|
110
|
-
nuxeoctlPath =
|
163
|
+
nuxeoctlPath = nuxeoctlPath()
|
111
164
|
system('chmod +x ' + nuxeoctlPath)
|
112
165
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
system(nuxeoctlPath + ' --accept=true mp-install ' + Dir[MARKETPLACE_PROJECT_PATH + '/target/' + MARKETPLACE_PROJECT_PATH.split('/').last + '-*.zip'][0])
|
166
|
+
runCommand('Uninstall package "' + MARKETPLACE_PACKAGE_NAME + '"',
|
167
|
+
nuxeoctlPath + ' --accept=true --nodeps mp-remove ' + MARKETPLACE_PACKAGE_NAME)
|
168
|
+
runCommand('Install new marketplace package',
|
169
|
+
nuxeoctlPath + ' --accept=true --nodeps mp-install ' + Dir[MARKETPLACE_PROJECT_PATH + '/target/' + MARKETPLACE_PROJECT_PATH.split('/').last + '-*.zip'][0])
|
118
170
|
|
119
171
|
when 'run'
|
120
|
-
|
172
|
+
command = nuxeoctlPath() + ' console'
|
173
|
+
putHeader 'Launching Nuxeo in console mode'
|
174
|
+
puts '> ' + command
|
175
|
+
puts
|
176
|
+
system(command)
|
121
177
|
|
122
178
|
when 'reset'
|
179
|
+
putHeader 'Nuxeo data reset'
|
123
180
|
print "Delete all Nuxeo data ? (y/n, default is 'n') >> "
|
124
181
|
case STDIN.gets.strip.downcase
|
125
182
|
when 'y'
|
@@ -138,21 +195,23 @@ ARGV.each do |arg|
|
|
138
195
|
puts "Aborted."
|
139
196
|
end
|
140
197
|
|
141
|
-
|
142
|
-
|
143
|
-
|
198
|
+
# Project generation
|
199
|
+
# ==================
|
200
|
+
|
144
201
|
when 'init'
|
145
|
-
|
202
|
+
putHeader "Archetype build"
|
146
203
|
archetype_path = File.expand_path(File.dirname(__FILE__) + "/../archetype")
|
147
204
|
FileUtils.cp_r archetype_path, "tmp_archetype"
|
148
205
|
system("mvn clean install -f ./tmp_archetype/pom.xml")
|
149
206
|
FileUtils.rm_r "tmp_archetype"
|
150
207
|
|
151
|
-
|
208
|
+
putHeader "Project information"
|
152
209
|
projectInfo = {}
|
153
210
|
|
211
|
+
puts "To instanciate the project, you are being asked a series of questions. You will be able to correct any mistake at the end."
|
212
|
+
puts
|
154
213
|
puts "[1/3] MAVEN INFORMATION"
|
155
|
-
puts "
|
214
|
+
puts "-----------------------"
|
156
215
|
while projectInfo['groupId'].to_s == ''
|
157
216
|
print "Maven group ID (example: 'fr.openwide') >> "
|
158
217
|
projectInfo['groupId'] = STDIN.gets.strip
|
@@ -167,7 +226,7 @@ ARGV.each do |arg|
|
|
167
226
|
end
|
168
227
|
|
169
228
|
puts "\n[2/3] NUXEO INFORMATION"
|
170
|
-
puts "
|
229
|
+
puts "-------------------------"
|
171
230
|
while projectInfo['nuxeoVersion'].to_s == ''
|
172
231
|
print "Target Nuxeo version (example: '5.6') >> "
|
173
232
|
projectInfo['nuxeoVersion'] = STDIN.gets.strip
|
@@ -215,8 +274,8 @@ ARGV.each do |arg|
|
|
215
274
|
projectInfo['nuxeoConnectPassword'] = '';
|
216
275
|
end
|
217
276
|
|
218
|
-
puts "\n\n[3/3] OPEN
|
219
|
-
puts "
|
277
|
+
puts "\n\n[3/3] OPEN WIDE INFORMATION"
|
278
|
+
puts "-------------------------------"
|
220
279
|
print "Is this an Open Wide project? (y/n, default is 'n') >> "
|
221
280
|
projectInfo['isOpenwideProject'] = STDIN.gets.strip.downcase
|
222
281
|
projectInfo['isOpenwideProject'] = (projectInfo['isOpenwideProject'] == 'y') ? 'true' : 'false'
|
@@ -228,18 +287,11 @@ ARGV.each do |arg|
|
|
228
287
|
print "[OPTIONAL] Open Wide Maven password >> "
|
229
288
|
projectInfo['openwideRepoPassword'] = STDIN.gets.strip
|
230
289
|
end
|
231
|
-
else
|
232
|
-
projectInfo['openwideRepoUsername'] = '';
|
233
|
-
projectInfo['openwideRepoPassword'] = '';
|
234
|
-
puts "\nWARNING: The generated projects will references some 'openwide-nuxeo-commons' libraries, which are not published in Maven central yet."
|
235
|
-
puts "You will have to download and build them from https://github.com/Open-Wide/openwide-nuxeo-commons."
|
236
|
-
print "(press ENTER) >> "
|
237
|
-
STDIN.gets
|
238
290
|
end
|
239
291
|
|
240
|
-
|
241
|
-
puts "======="
|
292
|
+
putHeader "Summary"
|
242
293
|
puts "Is everything correct? Press ENTER to continue, or type 'variable_name new_value' to change any value (eg. 'name my-project').\n"
|
294
|
+
puts
|
243
295
|
begin
|
244
296
|
puts "------------"
|
245
297
|
for key, value in projectInfo.each
|
@@ -259,23 +311,19 @@ ARGV.each do |arg|
|
|
259
311
|
end
|
260
312
|
end while confirm.to_s != ''
|
261
313
|
|
262
|
-
puts "\n> Generating project...\n\n"
|
263
|
-
|
264
314
|
generationCommand = "mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=fr.openwide.nuxeo -DarchetypeArtifactId=openwide-nuxeo-archetype -DarchetypeVersion=1.0.0-SNAPSHOT"
|
265
315
|
for key, value in projectInfo.each
|
266
316
|
generationCommand += " -D" + key + "=\"" + value.to_s + "\""
|
267
317
|
end
|
268
318
|
|
269
|
-
|
319
|
+
runCommand('Project generation', generationCommand);
|
270
320
|
|
271
|
-
|
272
|
-
|
273
|
-
puts "
|
274
|
-
puts "========="
|
275
|
-
puts "Please edit the Nuxeo path in 'nuxeo-config.rb', then you're ready to go."
|
321
|
+
putHeader "COMPLETED!"
|
322
|
+
puts "The project has been generated in './" + projectInfo['artifactId'].to_s + "'."
|
323
|
+
puts "Please edit the Nuxeo path in './" + projectInfo['artifactId'].to_s + "/nuxeo-config.rb', then you're ready to go."
|
276
324
|
|
277
325
|
else
|
278
|
-
|
326
|
+
putHeader("Unknown goal '" + arg + "'.")
|
279
327
|
|
280
328
|
end
|
281
329
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ow-nuxeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Eases common tasks for Nuxeo integrators, from creating a project from
|
15
15
|
scratch to building and launching it.
|