MuranoCLI 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/Gemfile +3 -2
- data/MuranoCLI.gemspec +2 -2
- data/README.markdown +107 -10
- data/lib/MrMurano/Product-Resources.rb +10 -0
- data/lib/MrMurano/ProjectFile.rb +7 -0
- data/lib/MrMurano/Solution-Endpoint.rb +24 -12
- data/lib/MrMurano/Solution-File.rb +17 -5
- data/lib/MrMurano/Solution-ServiceConfig.rb +7 -5
- data/lib/MrMurano/Solution-Services.rb +61 -31
- data/lib/MrMurano/SyncUpDown.rb +200 -49
- data/lib/MrMurano/commands/gb.rb +4 -3
- data/lib/MrMurano/commands/init.rb +55 -3
- data/lib/MrMurano/commands/login.rb +20 -0
- data/lib/MrMurano/commands/password.rb +12 -9
- data/lib/MrMurano/commands/status.rb +5 -1
- data/lib/MrMurano/commands.rb +1 -1
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +8 -0
- data/spec/ConfigMigrate_spec.rb +3 -0
- data/spec/Config_spec.rb +16 -1
- data/spec/Solution-Endpoint_spec.rb +28 -20
- data/spec/Solution-ServiceEventHandler_spec.rb +27 -21
- data/spec/Solution-ServiceModules_spec.rb +42 -43
- data/spec/SyncUpDown_spec.rb +75 -68
- data/spec/cmd_init_spec.rb +303 -9
- data/spec/cmd_status_spec.rb +14 -12
- data/spec/spec_helper.rb +4 -1
- metadata +7 -6
@@ -142,11 +142,13 @@ RSpec.describe MrMurano::Library do
|
|
142
142
|
}
|
143
143
|
tio.close
|
144
144
|
|
145
|
-
ret = @srv.upload(tio.path,
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
ret = @srv.upload(tio.path,
|
146
|
+
MrMurano::Library::LibraryItem.new(
|
147
|
+
:id=>"9K0",
|
148
|
+
:name=>"debug",
|
149
|
+
:alias=>"XYZ_debug",
|
150
|
+
:solution_id=>"XYZ",
|
151
|
+
))
|
150
152
|
expect(ret)
|
151
153
|
end
|
152
154
|
end
|
@@ -169,11 +171,14 @@ RSpec.describe MrMurano::Library do
|
|
169
171
|
}
|
170
172
|
tio.close
|
171
173
|
|
172
|
-
ret = @srv.upload(
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
174
|
+
ret = @srv.upload(
|
175
|
+
tio.path,
|
176
|
+
MrMurano::Library::LibraryItem.new(
|
177
|
+
:id=>"9K0",
|
178
|
+
:name=>"debug",
|
179
|
+
:alias=>"XYZ_debug",
|
180
|
+
:solution_id=>"XYZ",
|
181
|
+
))
|
177
182
|
expect(ret)
|
178
183
|
end
|
179
184
|
end
|
@@ -193,11 +198,13 @@ RSpec.describe MrMurano::Library do
|
|
193
198
|
tio.close
|
194
199
|
|
195
200
|
expect(@srv).to receive(:error).and_return(nil)
|
196
|
-
ret = @srv.upload(tio.path,
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
+
ret = @srv.upload(tio.path,
|
202
|
+
MrMurano::Library::LibraryItem.new(
|
203
|
+
:id=>"9K0",
|
204
|
+
:name=>"debug",
|
205
|
+
:alias=>"XYZ_debug",
|
206
|
+
:solution_id=>"XYZ",
|
207
|
+
))
|
201
208
|
expect(ret)
|
202
209
|
end
|
203
210
|
end
|
@@ -218,11 +225,13 @@ RSpec.describe MrMurano::Library do
|
|
218
225
|
|
219
226
|
cacheFile = $cfg.file_at(@srv.cacheFileName)
|
220
227
|
FileUtils.touch(cacheFile.to_path)
|
221
|
-
ret = @srv.upload(tio.path,
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
228
|
+
ret = @srv.upload(tio.path,
|
229
|
+
MrMurano::Library::LibraryItem.new(
|
230
|
+
:id=>"9K0",
|
231
|
+
:name=>"debug",
|
232
|
+
:alias=>"XYZ_debug",
|
233
|
+
:solution_id=>"XYZ",
|
234
|
+
))
|
226
235
|
expect(ret)
|
227
236
|
end
|
228
237
|
end
|
@@ -247,11 +256,13 @@ RSpec.describe MrMurano::Library do
|
|
247
256
|
:updated_at=>Time.now.getutc.to_datetime.iso8601(3)}
|
248
257
|
}.to_yaml
|
249
258
|
end
|
250
|
-
ret = @srv.upload(tio.path,
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
259
|
+
ret = @srv.upload(tio.path,
|
260
|
+
MrMurano::Library::LibraryItem.new(
|
261
|
+
:id=>"9K0",
|
262
|
+
:name=>"debug",
|
263
|
+
:alias=>"XYZ_debug",
|
264
|
+
:solution_id=>"XYZ",
|
265
|
+
))
|
255
266
|
expect(ret)
|
256
267
|
end
|
257
268
|
end
|
@@ -429,28 +440,16 @@ RSpec.describe MrMurano::Library do
|
|
429
440
|
expect(ret).to eq(["a", "b", "c/**/d/*.bob"])
|
430
441
|
end
|
431
442
|
|
432
|
-
it "raises on alias without
|
433
|
-
expect {
|
434
|
-
@srv.mkname( {:event=>'bob'} )
|
435
|
-
}.to raise_error %{Missing parts! {"event":"bob"}}
|
436
|
-
end
|
437
|
-
|
438
|
-
it "raises on alias without event" do
|
439
|
-
expect {
|
440
|
-
@srv.mkalias( {:service=>'bob'} )
|
441
|
-
}.to raise_error %{Missing parts! {"service":"bob"}}
|
442
|
-
end
|
443
|
-
|
444
|
-
it "raises on name without service" do
|
443
|
+
it "raises on alias without name" do
|
445
444
|
expect {
|
446
|
-
@srv.
|
447
|
-
}.to raise_error
|
445
|
+
@srv.mkname( MrMurano::Library::EventHandlerItem.new() )
|
446
|
+
}.to raise_error(NameError)
|
448
447
|
end
|
449
448
|
|
450
|
-
it "raises on name without
|
449
|
+
it "raises on name without name" do
|
451
450
|
expect {
|
452
|
-
@srv.
|
453
|
-
}.to raise_error
|
451
|
+
@srv.mkalias( MrMurano::Library::EventHandlerItem.new() )
|
452
|
+
}.to raise_error(NameError)
|
454
453
|
end
|
455
454
|
end
|
456
455
|
|
data/spec/SyncUpDown_spec.rb
CHANGED
@@ -182,59 +182,62 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
182
182
|
FileUtils.touch(@projectDir + '/tsud/ga/six.lua') # toadd
|
183
183
|
@t = TSUD.new
|
184
184
|
expect(@t).to receive(:list).once.and_return([
|
185
|
-
{:name=>'one.lua'},
|
186
|
-
|
187
|
-
|
185
|
+
MrMurano::SyncUpDown::Item.new({:name=>'one.lua'}), # tomod
|
186
|
+
MrMurano::SyncUpDown::Item.new({:name=>'two.lua'}), # tomod
|
187
|
+
MrMurano::SyncUpDown::Item.new({:name=>'three.lua'}), # unchg
|
188
|
+
MrMurano::SyncUpDown::Item.new({:name=>'four.lua'}), # unchg
|
189
|
+
MrMurano::SyncUpDown::Item.new({:name=>'seven.lua'}), # todel
|
190
|
+
MrMurano::SyncUpDown::Item.new({:name=>'eight.lua'}), # todel
|
188
191
|
])
|
189
192
|
expect(@t).to receive(:toRemoteItem).
|
190
193
|
with(anything(), pathname_globs('**/one.lua')).
|
191
|
-
and_return({:name=>'one.lua'})
|
194
|
+
and_return(MrMurano::SyncUpDown::Item.new({:name=>'one.lua'}))
|
192
195
|
expect(@t).to receive(:toRemoteItem).
|
193
196
|
with(anything(), pathname_globs('**/two.lua')).
|
194
|
-
and_return({:name=>'two.lua'})
|
197
|
+
and_return(MrMurano::SyncUpDown::Item.new({:name=>'two.lua'}))
|
195
198
|
expect(@t).to receive(:toRemoteItem).
|
196
199
|
with(anything(), pathname_globs('**/three.lua')).
|
197
|
-
and_return({:name=>'three.lua'})
|
200
|
+
and_return(MrMurano::SyncUpDown::Item.new({:name=>'three.lua'}))
|
198
201
|
expect(@t).to receive(:toRemoteItem).
|
199
202
|
with(anything(), pathname_globs('**/four.lua')).
|
200
|
-
and_return({:name=>'four.lua'})
|
203
|
+
and_return(MrMurano::SyncUpDown::Item.new({:name=>'four.lua'}))
|
201
204
|
expect(@t).to receive(:toRemoteItem).
|
202
205
|
with(anything(), pathname_globs('**/five.lua')).
|
203
|
-
and_return({:name=>'five.lua'})
|
206
|
+
and_return(MrMurano::SyncUpDown::Item.new({:name=>'five.lua'}))
|
204
207
|
expect(@t).to receive(:toRemoteItem).
|
205
208
|
with(anything(), pathname_globs('**/six.lua')).
|
206
|
-
and_return({:name=>'six.lua'})
|
209
|
+
and_return(MrMurano::SyncUpDown::Item.new({:name=>'six.lua'}))
|
207
210
|
|
208
|
-
expect(@t).to receive(:docmp).with(
|
209
|
-
expect(@t).to receive(:docmp).with(
|
210
|
-
expect(@t).to receive(:docmp).with(
|
211
|
-
expect(@t).to receive(:docmp).with(
|
211
|
+
expect(@t).to receive(:docmp).with(have_attributes({:name=>'one.lua'}),anything()).and_return(true)
|
212
|
+
expect(@t).to receive(:docmp).with(have_attributes({:name=>'two.lua'}),anything()).and_return(true)
|
213
|
+
expect(@t).to receive(:docmp).with(have_attributes({:name=>'three.lua'}),anything()).and_return(false)
|
214
|
+
expect(@t).to receive(:docmp).with(have_attributes({:name=>'four.lua'}),anything()).and_return(false)
|
212
215
|
end
|
213
216
|
|
214
217
|
it "Returns all with no filter" do
|
215
218
|
ret = @t.status
|
216
219
|
expect(ret).to match({
|
217
220
|
:unchg=>[
|
218
|
-
{:name=>'three.lua', :synckey=>'three.lua',
|
219
|
-
:local_path=> pathname_globs('**/three.lua')},
|
220
|
-
{:name=>'four.lua', :synckey=>'four.lua',
|
221
|
-
:local_path=>pathname_globs('**/four.lua')},
|
221
|
+
have_attributes({:name=>'three.lua', :synckey=>'three.lua',
|
222
|
+
:local_path=> pathname_globs('**/three.lua')}),
|
223
|
+
have_attributes({:name=>'four.lua', :synckey=>'four.lua',
|
224
|
+
:local_path=>pathname_globs('**/four.lua')}),
|
222
225
|
],
|
223
226
|
:toadd=>[
|
224
|
-
{:name=>'five.lua', :synckey=>'five.lua',
|
225
|
-
:local_path=>pathname_globs('**/five.lua')},
|
226
|
-
{:name=>'six.lua', :synckey=>'six.lua',
|
227
|
-
:local_path=>pathname_globs('**/six.lua')},
|
227
|
+
have_attributes({:name=>'five.lua', :synckey=>'five.lua',
|
228
|
+
:local_path=>pathname_globs('**/five.lua')}),
|
229
|
+
have_attributes({:name=>'six.lua', :synckey=>'six.lua',
|
230
|
+
:local_path=>pathname_globs('**/six.lua')}),
|
228
231
|
],
|
229
232
|
:todel=>[
|
230
|
-
{:name=>'seven.lua', :synckey=>'seven.lua'},
|
231
|
-
{:name=>'eight.lua', :synckey=>'eight.lua'},
|
233
|
+
have_attributes({:name=>'seven.lua', :synckey=>'seven.lua'}),
|
234
|
+
have_attributes({:name=>'eight.lua', :synckey=>'eight.lua'}),
|
232
235
|
],
|
233
236
|
:tomod=>[
|
234
|
-
{:name=>'one.lua', :synckey=>'one.lua',
|
235
|
-
:local_path=>pathname_globs('**/one.lua')},
|
236
|
-
{:name=>'two.lua', :synckey=>'two.lua',
|
237
|
-
:local_path=>pathname_globs('**/two.lua')},
|
237
|
+
have_attributes({:name=>'one.lua', :synckey=>'one.lua',
|
238
|
+
:local_path=>pathname_globs('**/one.lua')}),
|
239
|
+
have_attributes({:name=>'two.lua', :synckey=>'two.lua',
|
240
|
+
:local_path=>pathname_globs('**/two.lua')}),
|
238
241
|
]})
|
239
242
|
end
|
240
243
|
|
@@ -243,13 +246,13 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
243
246
|
expect(ret).to match({
|
244
247
|
:unchg=>[ ],
|
245
248
|
:toadd=>[
|
246
|
-
|
247
|
-
:local_path=>an_instance_of(Pathname)
|
249
|
+
have_attributes(:name=>'six.lua', :synckey=>'six.lua',
|
250
|
+
:local_path=>an_instance_of(Pathname)),
|
248
251
|
],
|
249
252
|
:todel=>[ ],
|
250
253
|
:tomod=>[
|
251
|
-
|
252
|
-
:local_path=>an_instance_of(Pathname)
|
254
|
+
have_attributes(:name=>'two.lua', :synckey=>'two.lua',
|
255
|
+
:local_path=>an_instance_of(Pathname)),
|
253
256
|
]})
|
254
257
|
end
|
255
258
|
|
@@ -266,26 +269,26 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
266
269
|
ret = @t.status({:unselected=>true})
|
267
270
|
expect(ret).to match({
|
268
271
|
:unchg=>[
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
272
|
+
have_attributes(:name=>'three.lua', :synckey=>'three.lua', :selected=>true,
|
273
|
+
:local_path=> pathname_globs('**/three.lua')),
|
274
|
+
have_attributes(:name=>'four.lua', :synckey=>'four.lua', :selected=>true,
|
275
|
+
:local_path=>pathname_globs('**/four.lua')),
|
273
276
|
],
|
274
277
|
:toadd=>[
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
278
|
+
have_attributes(:name=>'five.lua', :synckey=>'five.lua', :selected=>true,
|
279
|
+
:local_path=>pathname_globs('**/five.lua')),
|
280
|
+
have_attributes(:name=>'six.lua', :synckey=>'six.lua', :selected=>true,
|
281
|
+
:local_path=>pathname_globs('**/six.lua')),
|
279
282
|
],
|
280
283
|
:todel=>[
|
281
|
-
|
282
|
-
|
284
|
+
have_attributes(:name=>'seven.lua', :selected=>true, :synckey=>'seven.lua'),
|
285
|
+
have_attributes(:name=>'eight.lua', :selected=>true, :synckey=>'eight.lua'),
|
283
286
|
],
|
284
287
|
:tomod=>[
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
288
|
+
have_attributes(:name=>'one.lua', :synckey=>'one.lua', :selected=>true,
|
289
|
+
:local_path=>pathname_globs('**/one.lua')),
|
290
|
+
have_attributes(:name=>'two.lua', :synckey=>'two.lua', :selected=>true,
|
291
|
+
:local_path=>pathname_globs('**/two.lua')),
|
289
292
|
]})
|
290
293
|
end
|
291
294
|
end
|
@@ -396,7 +399,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
396
399
|
FileUtils.touch(@projectDir + '/tsud/one.lua')
|
397
400
|
FileUtils.touch(@projectDir + '/tsud/two.lua')
|
398
401
|
|
399
|
-
expect(@t).to receive(:upload).twice.with(kind_of(Pathname), kind_of(
|
402
|
+
expect(@t).to receive(:upload).twice.with(kind_of(Pathname), kind_of(MrMurano::SyncUpDown::Item), false)
|
400
403
|
@t.syncup({:create=>true})
|
401
404
|
end
|
402
405
|
|
@@ -404,10 +407,11 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
404
407
|
FileUtils.touch(@projectDir + '/tsud/one.lua')
|
405
408
|
FileUtils.touch(@projectDir + '/tsud/two.lua')
|
406
409
|
expect(@t).to receive(:list).once.and_return([
|
407
|
-
{:name=>'one.lua'},
|
410
|
+
MrMurano::SyncUpDown::Item.new({:name=>'one.lua'}),
|
411
|
+
MrMurano::SyncUpDown::Item.new({:name=>'two.lua'})
|
408
412
|
])
|
409
413
|
|
410
|
-
expect(@t).to receive(:upload).twice.with(kind_of(Pathname), kind_of(
|
414
|
+
expect(@t).to receive(:upload).twice.with(kind_of(Pathname), kind_of(MrMurano::SyncUpDown::Item), true)
|
411
415
|
expect(@t).to receive(:toRemoteItem).and_return(
|
412
416
|
{:name=>'one.lua'},{:name=>'two.lua'}
|
413
417
|
)
|
@@ -432,7 +436,8 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
432
436
|
|
433
437
|
it "creates" do
|
434
438
|
expect(@t).to receive(:list).once.and_return([
|
435
|
-
{:name=>'one.lua'},
|
439
|
+
MrMurano::SyncUpDown::Item.new({:name=>'one.lua'}),
|
440
|
+
MrMurano::SyncUpDown::Item.new({:name=>'two.lua'})
|
436
441
|
])
|
437
442
|
|
438
443
|
expect(@t).to receive(:fetch).twice.and_yield("--foo\n")
|
@@ -445,12 +450,14 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
445
450
|
FileUtils.touch(@projectDir + '/tsud/one.lua')
|
446
451
|
FileUtils.touch(@projectDir + '/tsud/two.lua')
|
447
452
|
expect(@t).to receive(:list).once.and_return([
|
448
|
-
{:name=>'one.lua'},
|
453
|
+
MrMurano::SyncUpDown::Item.new({:name=>'one.lua'}),
|
454
|
+
MrMurano::SyncUpDown::Item.new({:name=>'two.lua'})
|
449
455
|
])
|
450
456
|
|
451
457
|
expect(@t).to receive(:fetch).twice.and_yield("--foo\n")
|
452
458
|
expect(@t).to receive(:toRemoteItem).and_return(
|
453
|
-
{:name=>'one.lua'},
|
459
|
+
MrMurano::SyncUpDown::Item.new({:name=>'one.lua'}),
|
460
|
+
MrMurano::SyncUpDown::Item.new({:name=>'two.lua'})
|
454
461
|
)
|
455
462
|
@t.syncdown({:update=>true})
|
456
463
|
expect(FileTest.exist?(@projectDir + '/tsud/one.lua')).to be true
|
@@ -458,13 +465,13 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
458
465
|
end
|
459
466
|
end
|
460
467
|
|
461
|
-
context "bundles" do
|
462
|
-
before(:example) do
|
463
|
-
FileUtils.mkpath(@projectDir + '/tsud')
|
464
|
-
FileUtils.mkpath(@projectDir + '/bundles/mybun/tsud')
|
465
|
-
@t = TSUD.new
|
466
|
-
end
|
467
|
-
|
468
|
+
# context "bundles" do
|
469
|
+
# before(:example) do
|
470
|
+
# FileUtils.mkpath(@projectDir + '/tsud')
|
471
|
+
# FileUtils.mkpath(@projectDir + '/bundles/mybun/tsud')
|
472
|
+
# @t = TSUD.new
|
473
|
+
# end
|
474
|
+
#
|
468
475
|
# it "finds items in bundles." do
|
469
476
|
# FileUtils.touch(@projectDir + '/tsud/one.lua')
|
470
477
|
# FileUtils.touch(@projectDir + '/bundles/mybun/tsud/two.lua')
|
@@ -481,15 +488,15 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
481
488
|
# :local_path=>an_instance_of(Pathname)},
|
482
489
|
# ])
|
483
490
|
# end
|
484
|
-
|
485
|
-
it "Doesn't download a bundled item" do
|
486
|
-
FileUtils.touch(@projectDir + '/tsud/one.lua')
|
487
|
-
lp = Pathname.new(@projectDir + '/tsud/one.lua').realpath
|
488
|
-
|
489
|
-
expect(@t).to receive(:warning).once.with(/Not downloading into bundled item.*/)
|
490
|
-
|
491
|
-
@t.download(lp, {:bundled=>true, :name=>'one.lua'})
|
492
|
-
end
|
493
|
-
end
|
491
|
+
#
|
492
|
+
# it "Doesn't download a bundled item" do
|
493
|
+
# FileUtils.touch(@projectDir + '/tsud/one.lua')
|
494
|
+
# lp = Pathname.new(@projectDir + '/tsud/one.lua').realpath
|
495
|
+
#
|
496
|
+
# expect(@t).to receive(:warning).once.with(/Not downloading into bundled item.*/)
|
497
|
+
#
|
498
|
+
# @t.download(lp, {:bundled=>true, :name=>'one.lua'})
|
499
|
+
# end
|
500
|
+
# end
|
494
501
|
end
|
495
502
|
# vim: set ai et sw=2 ts=2 :
|
data/spec/cmd_init_spec.rb
CHANGED
@@ -16,15 +16,309 @@ RSpec.describe 'mr init', :cmd do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
context "in empty directory", :needs_password do
|
20
|
+
context "with" do
|
21
|
+
# Setup a solution and product to use.
|
22
|
+
# Doing this in a context with before&after so that after runs even when test
|
23
|
+
# fails.
|
24
|
+
before(:example) do
|
25
|
+
@project_name = rname('initEmpty')
|
26
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'create', @project_name, '--save'))
|
27
|
+
expect(err).to eq('')
|
28
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
29
|
+
expect(status.exitstatus).to eq(0)
|
30
|
+
|
31
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @project_name, '--save'))
|
32
|
+
expect(err).to eq('')
|
33
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
34
|
+
expect(status.exitstatus).to eq(0)
|
35
|
+
|
36
|
+
# delete all of this so it is a empty directory.
|
37
|
+
FileUtils.remove_entry('.murano')
|
38
|
+
end
|
39
|
+
after(:example) do
|
40
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name))
|
41
|
+
expect(out).to eq('')
|
42
|
+
expect(err).to eq('')
|
43
|
+
expect(status.exitstatus).to eq(0)
|
44
|
+
|
45
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'delete', @project_name))
|
46
|
+
expect(out).to eq('')
|
47
|
+
expect(err).to eq('')
|
48
|
+
expect(status.exitstatus).to eq(0)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "existing solution and product" do
|
52
|
+
# The test account will have one business, one product, and one solution.
|
53
|
+
# So it won't ask any questions.
|
54
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'))
|
55
|
+
expect(out.lines).to match_array([
|
56
|
+
"\n",
|
57
|
+
a_string_starting_with('Found project base directory at '),
|
58
|
+
"\n",
|
59
|
+
a_string_starting_with('Using account '),
|
60
|
+
a_string_starting_with('Using Business ID already set to '),
|
61
|
+
"\n",
|
62
|
+
a_string_starting_with('You only have one solution; using '),
|
63
|
+
"\n",
|
64
|
+
a_string_starting_with('You only have one product; using '),
|
65
|
+
"\n",
|
66
|
+
a_string_matching(%r{Ok, In business ID: \w+ using Solution ID: \w+ with Product ID: \w+}),
|
67
|
+
"Writing an initial Project file: project.murano\n",
|
68
|
+
"Default directories created\n",
|
69
|
+
])
|
70
|
+
expect(err).to eq("")
|
71
|
+
expect(status.exitstatus).to eq(0)
|
72
|
+
|
73
|
+
expect(File.directory?(".murano")).to be true
|
74
|
+
expect(File.exist?(".murano/config")).to be true
|
75
|
+
expect(File.directory?("routes")).to be true
|
76
|
+
expect(File.directory?("services")).to be true
|
77
|
+
expect(File.directory?("files")).to be true
|
78
|
+
expect(File.directory?("modules")).to be true
|
79
|
+
expect(File.directory?("specs")).to be true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "without", :needs_password do
|
84
|
+
before(:example) do
|
85
|
+
@project_name = rname('initCreating')
|
86
|
+
end
|
87
|
+
after(:example) do
|
88
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name))
|
89
|
+
expect(out).to eq('')
|
90
|
+
expect(err).to eq('')
|
91
|
+
expect(status.exitstatus).to eq(0)
|
92
|
+
|
93
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'delete', @project_name))
|
94
|
+
expect(out).to eq('')
|
95
|
+
expect(err).to eq('')
|
96
|
+
expect(status.exitstatus).to eq(0)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "existing solution and product" do
|
100
|
+
# The test account will have one business.
|
101
|
+
# It will ask to create a solution and product.
|
102
|
+
# !!!! the 8 is hardcoded indention here !!!!
|
103
|
+
data = <<-EOT.gsub(/^ {8}/, '')
|
104
|
+
#{@project_name}
|
105
|
+
#{@project_name}
|
106
|
+
EOT
|
107
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'), :stdin_data=>data)
|
108
|
+
expect(out.lines).to match_array([
|
109
|
+
"\n",
|
110
|
+
a_string_starting_with('Found project base directory at '),
|
111
|
+
"\n",
|
112
|
+
a_string_starting_with('Using account '),
|
113
|
+
a_string_starting_with('Using Business ID already set to '),
|
114
|
+
"\n",
|
115
|
+
"You don't have any solutions; lets create one\n",
|
116
|
+
"Solution Name? \n",
|
117
|
+
"You don't have any products; lets create one\n",
|
118
|
+
"Product Name? \n",
|
119
|
+
a_string_matching(%r{Ok, In business ID: \w+ using Solution ID: \w+ with Product ID: \w+}),
|
120
|
+
"Writing an initial Project file: project.murano\n",
|
121
|
+
"Default directories created\n",
|
122
|
+
])
|
123
|
+
expect(err).to eq("")
|
124
|
+
expect(status.exitstatus).to eq(0)
|
125
|
+
|
126
|
+
expect(File.directory?(".murano")).to be true
|
127
|
+
expect(File.exist?(".murano/config")).to be true
|
128
|
+
expect(File.directory?("routes")).to be true
|
129
|
+
expect(File.directory?("services")).to be true
|
130
|
+
expect(File.directory?("files")).to be true
|
131
|
+
expect(File.directory?("modules")).to be true
|
132
|
+
expect(File.directory?("specs")).to be true
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context "in existing project directory", :needs_password do
|
138
|
+
before(:example) do
|
139
|
+
FileUtils.cp_r(File.join(@testdir, 'spec/fixtures/syncable_content/.'), '.')
|
140
|
+
FileUtils.move('assets','files')
|
141
|
+
|
142
|
+
@project_name = rname('initEmpty')
|
143
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'create', @project_name, '--save'))
|
144
|
+
expect(err).to eq('')
|
145
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
146
|
+
expect(status.exitstatus).to eq(0)
|
147
|
+
|
148
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'create', @project_name, '--save'))
|
149
|
+
expect(err).to eq('')
|
150
|
+
expect(out.chomp).to match(/^[a-zA-Z0-9]+$/)
|
151
|
+
expect(status.exitstatus).to eq(0)
|
152
|
+
end
|
153
|
+
after(:example) do
|
154
|
+
Dir.chdir(ENV['HOME']) do
|
155
|
+
out, err, status = Open3.capture3(capcmd('murano', 'solution', 'delete', @project_name))
|
156
|
+
expect(out).to eq('')
|
157
|
+
expect(err).to eq('')
|
158
|
+
expect(status.exitstatus).to eq(0)
|
159
|
+
|
160
|
+
out, err, status = Open3.capture3(capcmd('murano', 'product', 'delete', @project_name))
|
161
|
+
expect(out).to eq('')
|
162
|
+
expect(err).to eq('')
|
163
|
+
expect(status.exitstatus).to eq(0)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
it "without ProjectFile" do
|
168
|
+
# The test account will have one business, one product, and one solution.
|
169
|
+
# So it won't ask any questions.
|
170
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'))
|
171
|
+
expect(out.lines).to match_array([
|
172
|
+
"\n",
|
173
|
+
a_string_starting_with('Found project base directory at '),
|
174
|
+
"\n",
|
175
|
+
a_string_starting_with('Using account '),
|
176
|
+
a_string_starting_with('Using Business ID already set to '),
|
177
|
+
"\n",
|
178
|
+
a_string_starting_with('Using Solution ID already set to '),
|
179
|
+
"\n",
|
180
|
+
a_string_starting_with('Using Product ID already set to '),
|
181
|
+
"\n",
|
182
|
+
a_string_matching(%r{Ok, In business ID: \w+ using Solution ID: \w+ with Product ID: \w+}),
|
183
|
+
"Writing an initial Project file: project.murano\n",
|
184
|
+
"Default directories created\n",
|
185
|
+
])
|
186
|
+
expect(err).to eq("")
|
187
|
+
expect(status.exitstatus).to eq(0)
|
188
|
+
|
189
|
+
expect(File.directory?(".murano")).to be true
|
190
|
+
expect(File.exist?(".murano/config")).to be true
|
191
|
+
expect(File.directory?("routes")).to be true
|
192
|
+
expect(File.directory?("services")).to be true
|
193
|
+
expect(File.directory?("files")).to be true
|
194
|
+
expect(File.directory?("modules")).to be true
|
195
|
+
expect(File.directory?("specs")).to be true
|
196
|
+
end
|
197
|
+
|
198
|
+
it "with ProjectFile" do
|
199
|
+
FileUtils.copy(File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml'), 'test.murano')
|
200
|
+
# The test account will have one business, one product, and one solution.
|
201
|
+
# So it won't ask any questions.
|
202
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'))
|
203
|
+
expect(out.lines).to match_array([
|
204
|
+
"\n",
|
205
|
+
a_string_starting_with('Found project base directory at '),
|
206
|
+
"\n",
|
207
|
+
a_string_starting_with('Using account '),
|
208
|
+
a_string_starting_with('Using Business ID already set to '),
|
209
|
+
"\n",
|
210
|
+
a_string_starting_with('Using Solution ID already set to '),
|
211
|
+
"\n",
|
212
|
+
a_string_starting_with('Using Product ID already set to '),
|
213
|
+
"\n",
|
214
|
+
a_string_matching(%r{Ok, In business ID: \w+ using Solution ID: \w+ with Product ID: \w+}),
|
215
|
+
"Default directories created\n",
|
216
|
+
])
|
217
|
+
expect(err).to eq("")
|
218
|
+
expect(status.exitstatus).to eq(0)
|
219
|
+
|
220
|
+
expect(File.directory?(".murano")).to be true
|
221
|
+
expect(File.exist?(".murano/config")).to be true
|
222
|
+
expect(File.directory?("routes")).to be true
|
223
|
+
expect(File.directory?("services")).to be true
|
224
|
+
expect(File.directory?("files")).to be true
|
225
|
+
expect(File.directory?("modules")).to be true
|
226
|
+
expect(File.directory?("specs")).to be true
|
227
|
+
end
|
228
|
+
|
229
|
+
it "with SolutionFile 0.2.0" do
|
230
|
+
File.open('Solutionfile.json', 'wb') do |io|
|
231
|
+
io << {
|
232
|
+
:default_page => 'index.html',
|
233
|
+
:file_dir => 'files',
|
234
|
+
:custom_api => 'routes/manyRoutes.lua',
|
235
|
+
:modules => {
|
236
|
+
:table_util => 'modules/table_util.lua'
|
237
|
+
},
|
238
|
+
:event_handler => {
|
239
|
+
:device => {
|
240
|
+
:datapoint => 'services/devdata.lua'
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}.to_json
|
244
|
+
end
|
245
|
+
# The test account will have one business, one product, and one solution.
|
246
|
+
# So it won't ask any questions.
|
247
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'))
|
248
|
+
expect(out.lines).to match_array([
|
249
|
+
"\n",
|
250
|
+
a_string_starting_with('Found project base directory at '),
|
251
|
+
"\n",
|
252
|
+
a_string_starting_with('Using account '),
|
253
|
+
a_string_starting_with('Using Business ID already set to '),
|
254
|
+
"\n",
|
255
|
+
a_string_starting_with('Using Solution ID already set to '),
|
256
|
+
"\n",
|
257
|
+
a_string_starting_with('Using Product ID already set to '),
|
258
|
+
"\n",
|
259
|
+
a_string_matching(%r{Ok, In business ID: \w+ using Solution ID: \w+ with Product ID: \w+}),
|
260
|
+
"Writing an initial Project file: project.murano\n",
|
261
|
+
"Default directories created\n",
|
262
|
+
])
|
263
|
+
expect(err).to eq("")
|
264
|
+
expect(status.exitstatus).to eq(0)
|
265
|
+
|
266
|
+
expect(File.directory?(".murano")).to be true
|
267
|
+
expect(File.exist?(".murano/config")).to be true
|
268
|
+
expect(File.directory?("routes")).to be true
|
269
|
+
expect(File.directory?("services")).to be true
|
270
|
+
expect(File.directory?("files")).to be true
|
271
|
+
expect(File.directory?("modules")).to be true
|
272
|
+
expect(File.directory?("specs")).to be true
|
273
|
+
end
|
274
|
+
|
275
|
+
it "with SolutionFile 0.3.0" do
|
276
|
+
File.open('Solutionfile.json', 'wb') do |io|
|
277
|
+
io << {
|
278
|
+
:default_page => 'index.html',
|
279
|
+
:assets => 'files',
|
280
|
+
:routes => 'routes/manyRoutes.lua',
|
281
|
+
:modules => {
|
282
|
+
:table_util => 'modules/table_util.lua'
|
283
|
+
},
|
284
|
+
:services => {
|
285
|
+
:device => {
|
286
|
+
:datapoint => 'services/devdata.lua'
|
287
|
+
}
|
288
|
+
},
|
289
|
+
:version => '0.3.0',
|
290
|
+
}.to_json
|
291
|
+
end
|
292
|
+
# The test account will have one business, one product, and one solution.
|
293
|
+
# So it won't ask any questions.
|
294
|
+
out, err, status = Open3.capture3(capcmd('murano', 'init'))
|
295
|
+
expect(out.lines).to match_array([
|
296
|
+
"\n",
|
297
|
+
a_string_starting_with('Found project base directory at '),
|
298
|
+
"\n",
|
299
|
+
a_string_starting_with('Using account '),
|
300
|
+
a_string_starting_with('Using Business ID already set to '),
|
301
|
+
"\n",
|
302
|
+
a_string_starting_with('Using Solution ID already set to '),
|
303
|
+
"\n",
|
304
|
+
a_string_starting_with('Using Product ID already set to '),
|
305
|
+
"\n",
|
306
|
+
a_string_matching(%r{Ok, In business ID: \w+ using Solution ID: \w+ with Product ID: \w+}),
|
307
|
+
"Writing an initial Project file: project.murano\n",
|
308
|
+
"Default directories created\n",
|
309
|
+
])
|
310
|
+
expect(err).to eq("")
|
311
|
+
expect(status.exitstatus).to eq(0)
|
312
|
+
|
313
|
+
expect(File.directory?(".murano")).to be true
|
314
|
+
expect(File.exist?(".murano/config")).to be true
|
315
|
+
expect(File.directory?("routes")).to be true
|
316
|
+
expect(File.directory?("services")).to be true
|
317
|
+
expect(File.directory?("files")).to be true
|
318
|
+
expect(File.directory?("modules")).to be true
|
319
|
+
expect(File.directory?("specs")).to be true
|
320
|
+
end
|
321
|
+
end
|
28
322
|
|
29
323
|
end
|
30
324
|
# vim: set ai et sw=2 ts=2 :
|