MuranoCLI 3.0.0 → 3.0.1
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +50 -27
- data/.trustme.vim +12 -8
- data/bin/murano +23 -8
- data/docs/basic_example.rst +1 -1
- data/docs/completions/murano_completion-bash +88 -0
- data/lib/MrMurano/Account.rb +3 -3
- data/lib/MrMurano/Business.rb +6 -6
- data/lib/MrMurano/Config-Migrate.rb +1 -3
- data/lib/MrMurano/Config.rb +16 -8
- data/lib/MrMurano/Content.rb +56 -45
- data/lib/MrMurano/Gateway.rb +62 -21
- data/lib/MrMurano/Mock.rb +27 -19
- data/lib/MrMurano/Passwords.rb +7 -7
- data/lib/MrMurano/ReCommander.rb +171 -28
- data/lib/MrMurano/Setting.rb +38 -40
- data/lib/MrMurano/Solution-ServiceConfig.rb +2 -1
- data/lib/MrMurano/Solution-Services.rb +196 -61
- data/lib/MrMurano/Solution-Users.rb +7 -7
- data/lib/MrMurano/Solution.rb +22 -8
- data/lib/MrMurano/SolutionId.rb +10 -4
- data/lib/MrMurano/SubCmdGroupContext.rb +14 -5
- data/lib/MrMurano/SyncAllowed.rb +42 -0
- data/lib/MrMurano/SyncUpDown.rb +122 -65
- data/lib/MrMurano/Webservice-Cors.rb +9 -3
- data/lib/MrMurano/Webservice-Endpoint.rb +39 -33
- data/lib/MrMurano/Webservice-File.rb +35 -24
- data/lib/MrMurano/commands/business.rb +18 -18
- data/lib/MrMurano/commands/content.rb +3 -2
- data/lib/MrMurano/commands/devices.rb +137 -22
- data/lib/MrMurano/commands/globals.rb +8 -2
- data/lib/MrMurano/commands/keystore.rb +3 -2
- data/lib/MrMurano/commands/link.rb +13 -13
- data/lib/MrMurano/commands/login.rb +3 -2
- data/lib/MrMurano/commands/mock.rb +4 -3
- data/lib/MrMurano/commands/password.rb +4 -2
- data/lib/MrMurano/commands/postgresql.rb +5 -3
- data/lib/MrMurano/commands/settings.rb +78 -62
- data/lib/MrMurano/commands/show.rb +79 -74
- data/lib/MrMurano/commands/solution.rb +6 -4
- data/lib/MrMurano/commands/solution_picker.rb +5 -4
- data/lib/MrMurano/commands/status.rb +15 -4
- data/lib/MrMurano/commands/timeseries.rb +3 -2
- data/lib/MrMurano/commands/tsdb.rb +3 -2
- data/lib/MrMurano/hash.rb +6 -6
- data/lib/MrMurano/http.rb +66 -67
- data/lib/MrMurano/makePretty.rb +18 -12
- data/lib/MrMurano/progress.rb +9 -2
- data/lib/MrMurano/verbosing.rb +14 -2
- data/lib/MrMurano/version.rb +2 -2
- data/spec/GatewayDevice_spec.rb +190 -149
- data/spec/Mock_spec.rb +3 -3
- data/spec/Solution-ServiceEventHandler_spec.rb +170 -137
- data/spec/SyncUpDown_spec.rb +205 -191
- metadata +3 -2
data/spec/SyncUpDown_spec.rb
CHANGED
@@ -64,46 +64,51 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
64
64
|
t = TSUD.new
|
65
65
|
expect(t).to receive(:warning).once.with(/Skipping missing location.*/)
|
66
66
|
ret = t.status
|
67
|
-
expect(ret).to eq(
|
67
|
+
expect(ret).to eq(
|
68
|
+
{ toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: [] }
|
69
|
+
)
|
68
70
|
end
|
69
71
|
|
70
72
|
it "finds nothing in empty directory" do
|
71
73
|
FileUtils.mkpath(@project_dir + '/tsud')
|
72
74
|
t = TSUD.new
|
73
75
|
ret = t.status
|
74
|
-
expect(ret).to eq(
|
76
|
+
expect(ret).to eq(
|
77
|
+
{ toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: [] }
|
78
|
+
)
|
75
79
|
end
|
76
80
|
|
77
81
|
it "finds things there but not here" do
|
78
82
|
FileUtils.mkpath(@project_dir + '/tsud')
|
79
83
|
t = TSUD.new
|
80
84
|
expect(t).to receive(:list).once.and_return([
|
81
|
-
{:
|
82
|
-
{:
|
83
|
-
{:
|
85
|
+
{name: 1},
|
86
|
+
{name: 2},
|
87
|
+
{name: 3},
|
84
88
|
])
|
85
89
|
ret = t.status
|
86
90
|
expect(ret).to eq({
|
87
|
-
:
|
88
|
-
:
|
91
|
+
toadd: [],
|
92
|
+
todel: [
|
89
93
|
{
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
94
|
+
name: 1,
|
95
|
+
synckey: 1,
|
96
|
+
synctype: TSUD.description,
|
93
97
|
},
|
94
98
|
{
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
99
|
+
name: 2,
|
100
|
+
synckey: 2,
|
101
|
+
synctype: TSUD.description,
|
98
102
|
},
|
99
103
|
{
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
104
|
+
name: 3,
|
105
|
+
synckey: 3,
|
106
|
+
synctype: TSUD.description,
|
103
107
|
}],
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
108
|
+
tomod: [],
|
109
|
+
unchg: [],
|
110
|
+
skipd: [],
|
111
|
+
clash: [],
|
107
112
|
})
|
108
113
|
end
|
109
114
|
|
@@ -111,11 +116,11 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
111
116
|
FileUtils.mkpath(@project_dir + '/tsud')
|
112
117
|
t = TSUD.new
|
113
118
|
expect(t).to receive(:list).once.and_return([
|
114
|
-
{:
|
115
|
-
{:
|
116
|
-
{:
|
119
|
+
{name: 1},
|
120
|
+
{name: 2},
|
121
|
+
{name: 3},
|
117
122
|
])
|
118
|
-
ret = t.status({:
|
123
|
+
ret = t.status({asdown: true})
|
119
124
|
expect(ret).to eq({
|
120
125
|
todel: [],
|
121
126
|
toadd: [
|
@@ -126,6 +131,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
126
131
|
tomod: [],
|
127
132
|
unchg: [],
|
128
133
|
skipd: [],
|
134
|
+
clash: [],
|
129
135
|
})
|
130
136
|
end
|
131
137
|
|
@@ -135,8 +141,8 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
135
141
|
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
136
142
|
t = TSUD.new
|
137
143
|
expect(t).to receive(:to_remote_item).and_return(
|
138
|
-
{:
|
139
|
-
{:
|
144
|
+
{name: 'one.lua'},
|
145
|
+
{name: 'two.lua'},
|
140
146
|
)
|
141
147
|
ret = t.status
|
142
148
|
expect(ret).to match({
|
@@ -158,6 +164,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
158
164
|
tomod: [],
|
159
165
|
unchg: [],
|
160
166
|
skipd: [],
|
167
|
+
clash: [],
|
161
168
|
})
|
162
169
|
end
|
163
170
|
|
@@ -167,12 +174,12 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
167
174
|
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
168
175
|
t = TSUD.new
|
169
176
|
expect(t).to receive(:list).once.and_return([
|
170
|
-
{:
|
171
|
-
{:
|
177
|
+
{name: 'one.lua'},
|
178
|
+
{name: 'two.lua'},
|
172
179
|
])
|
173
180
|
expect(t).to receive(:to_remote_item).and_return(
|
174
|
-
{:
|
175
|
-
{:
|
181
|
+
{name: 'one.lua'},
|
182
|
+
{name: 'two.lua'},
|
176
183
|
)
|
177
184
|
ret = t.status
|
178
185
|
expect(ret).to match({
|
@@ -194,6 +201,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
194
201
|
toadd: [],
|
195
202
|
unchg: [],
|
196
203
|
skipd: [],
|
204
|
+
clash: [],
|
197
205
|
})
|
198
206
|
end
|
199
207
|
it "finds things here and there; but they're the same" do
|
@@ -202,12 +210,12 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
202
210
|
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
203
211
|
t = TSUD.new
|
204
212
|
expect(t).to receive(:list).once.and_return([
|
205
|
-
{:
|
206
|
-
{:
|
213
|
+
{name: 'one.lua'},
|
214
|
+
{name: 'two.lua'},
|
207
215
|
])
|
208
216
|
expect(t).to receive(:to_remote_item).and_return(
|
209
|
-
{:
|
210
|
-
{:
|
217
|
+
{name: 'one.lua'},
|
218
|
+
{name: 'two.lua'},
|
211
219
|
)
|
212
220
|
expect(t).to receive(:docmp).twice.and_return(false)
|
213
221
|
ret = t.status
|
@@ -230,6 +238,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
230
238
|
toadd: [],
|
231
239
|
tomod: [],
|
232
240
|
skipd: [],
|
241
|
+
clash: [],
|
233
242
|
})
|
234
243
|
end
|
235
244
|
|
@@ -238,13 +247,13 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
238
247
|
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
239
248
|
t = TSUD.new
|
240
249
|
expect(t).to receive(:list).once.and_return([
|
241
|
-
{:
|
250
|
+
{name: 'one.lua'}
|
242
251
|
])
|
243
252
|
expect(t).to receive(:to_remote_item).and_return(
|
244
|
-
{:
|
253
|
+
{name: 'one.lua'}
|
245
254
|
)
|
246
255
|
expect(t).to receive(:dodiff).once.and_return("diffed output")
|
247
|
-
ret = t.status({:
|
256
|
+
ret = t.status({diff: true})
|
248
257
|
expect(ret).to match({
|
249
258
|
tomod: [
|
250
259
|
{
|
@@ -259,6 +268,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
259
268
|
toadd: [],
|
260
269
|
unchg: [],
|
261
270
|
skipd: [],
|
271
|
+
clash: [],
|
262
272
|
})
|
263
273
|
end
|
264
274
|
|
@@ -274,209 +284,213 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
274
284
|
FileUtils.touch(@project_dir + '/tsud/ga/six.lua') # toadd
|
275
285
|
@t = TSUD.new
|
276
286
|
expect(@t).to receive(:list).once.and_return([
|
277
|
-
MrMurano::SyncUpDown::Item.new({:
|
278
|
-
MrMurano::SyncUpDown::Item.new({:
|
279
|
-
MrMurano::SyncUpDown::Item.new({:
|
280
|
-
MrMurano::SyncUpDown::Item.new({:
|
281
|
-
MrMurano::SyncUpDown::Item.new({:
|
282
|
-
MrMurano::SyncUpDown::Item.new({:
|
287
|
+
MrMurano::SyncUpDown::Item.new({name: 'eight.lua', updated_at: ITEM_UPDATED_AT}), # todel
|
288
|
+
MrMurano::SyncUpDown::Item.new({name: 'four.lua', updated_at: ITEM_UPDATED_AT}), # unchg
|
289
|
+
MrMurano::SyncUpDown::Item.new({name: 'one.lua', updated_at: ITEM_UPDATED_AT}), # tomod
|
290
|
+
MrMurano::SyncUpDown::Item.new({name: 'seven.lua', updated_at: ITEM_UPDATED_AT}), # todel
|
291
|
+
MrMurano::SyncUpDown::Item.new({name: 'three.lua', updated_at: ITEM_UPDATED_AT}), # unchg
|
292
|
+
MrMurano::SyncUpDown::Item.new({name: 'two.lua', updated_at: ITEM_UPDATED_AT}), # tomod
|
283
293
|
])
|
284
294
|
expect(@t).to receive(:to_remote_item).
|
285
295
|
with(anything(), pathname_globs('**/one.lua')).
|
286
|
-
and_return(MrMurano::SyncUpDown::Item.new({:
|
296
|
+
and_return(MrMurano::SyncUpDown::Item.new({name: 'one.lua', updated_at: ITEM_UPDATED_AT}))
|
287
297
|
expect(@t).to receive(:to_remote_item).
|
288
298
|
with(anything(), pathname_globs('**/two.lua')).
|
289
|
-
and_return(MrMurano::SyncUpDown::Item.new({:
|
299
|
+
and_return(MrMurano::SyncUpDown::Item.new({name: 'two.lua', updated_at: ITEM_UPDATED_AT}))
|
290
300
|
expect(@t).to receive(:to_remote_item).
|
291
301
|
with(anything(), pathname_globs('**/three.lua')).
|
292
|
-
and_return(MrMurano::SyncUpDown::Item.new({:
|
302
|
+
and_return(MrMurano::SyncUpDown::Item.new({name: 'three.lua', updated_at: ITEM_UPDATED_AT}))
|
293
303
|
expect(@t).to receive(:to_remote_item).
|
294
304
|
with(anything(), pathname_globs('**/four.lua')).
|
295
|
-
and_return(MrMurano::SyncUpDown::Item.new({:
|
305
|
+
and_return(MrMurano::SyncUpDown::Item.new({name: 'four.lua', updated_at: ITEM_UPDATED_AT}))
|
296
306
|
expect(@t).to receive(:to_remote_item).
|
297
307
|
with(anything(), pathname_globs('**/five.lua')).
|
298
|
-
and_return(MrMurano::SyncUpDown::Item.new({:
|
308
|
+
and_return(MrMurano::SyncUpDown::Item.new({name: 'five.lua', updated_at: ITEM_UPDATED_AT}))
|
299
309
|
expect(@t).to receive(:to_remote_item).
|
300
310
|
with(anything(), pathname_globs('**/six.lua')).
|
301
|
-
and_return(MrMurano::SyncUpDown::Item.new({:
|
311
|
+
and_return(MrMurano::SyncUpDown::Item.new({name: 'six.lua', updated_at: ITEM_UPDATED_AT}))
|
302
312
|
|
303
|
-
expect(@t).to receive(:docmp).with(have_attributes({:
|
304
|
-
expect(@t).to receive(:docmp).with(have_attributes({:
|
305
|
-
expect(@t).to receive(:docmp).with(have_attributes({:
|
306
|
-
expect(@t).to receive(:docmp).with(have_attributes({:
|
313
|
+
expect(@t).to receive(:docmp).with(have_attributes({name: 'one.lua'}),anything()).and_return(true)
|
314
|
+
expect(@t).to receive(:docmp).with(have_attributes({name: 'two.lua'}),anything()).and_return(true)
|
315
|
+
expect(@t).to receive(:docmp).with(have_attributes({name: 'three.lua'}),anything()).and_return(false)
|
316
|
+
expect(@t).to receive(:docmp).with(have_attributes({name: 'four.lua'}),anything()).and_return(false)
|
307
317
|
end
|
308
318
|
|
309
319
|
it "Returns all with no filter" do
|
310
320
|
ret = @t.status
|
311
321
|
expect(ret).to match({
|
312
|
-
:
|
322
|
+
unchg: [
|
313
323
|
have_attributes(
|
314
324
|
{
|
315
|
-
:
|
316
|
-
:
|
317
|
-
:
|
318
|
-
:
|
325
|
+
name: 'four.lua',
|
326
|
+
synckey: 'four.lua',
|
327
|
+
synctype: TSUD.description,
|
328
|
+
local_path: pathname_globs('**/four.lua'),
|
319
329
|
}),
|
320
330
|
have_attributes(
|
321
331
|
{
|
322
|
-
:
|
323
|
-
:
|
324
|
-
:
|
325
|
-
:
|
332
|
+
name: 'three.lua',
|
333
|
+
synckey: 'three.lua',
|
334
|
+
synctype: TSUD.description,
|
335
|
+
local_path: pathname_globs('**/three.lua'),
|
326
336
|
}),
|
327
337
|
],
|
328
|
-
:
|
338
|
+
toadd: [
|
329
339
|
have_attributes(
|
330
340
|
{
|
331
|
-
:
|
332
|
-
:
|
333
|
-
:
|
334
|
-
:
|
341
|
+
name: 'five.lua',
|
342
|
+
synckey: 'five.lua',
|
343
|
+
synctype: TSUD.description,
|
344
|
+
local_path: pathname_globs('**/five.lua'),
|
335
345
|
}),
|
336
346
|
have_attributes(
|
337
347
|
{
|
338
|
-
:
|
339
|
-
:
|
340
|
-
:
|
341
|
-
:
|
348
|
+
name: 'six.lua',
|
349
|
+
synckey: 'six.lua',
|
350
|
+
synctype: TSUD.description,
|
351
|
+
local_path: pathname_globs('**/six.lua'),
|
342
352
|
}),
|
343
353
|
],
|
344
|
-
:
|
354
|
+
todel: [
|
345
355
|
have_attributes(
|
346
356
|
{
|
347
|
-
:
|
348
|
-
:
|
349
|
-
:
|
357
|
+
name: 'eight.lua',
|
358
|
+
synckey: 'eight.lua',
|
359
|
+
synctype: TSUD.description,
|
350
360
|
}),
|
351
361
|
have_attributes(
|
352
362
|
{
|
353
|
-
:
|
354
|
-
:
|
355
|
-
:
|
363
|
+
name: 'seven.lua',
|
364
|
+
synckey: 'seven.lua',
|
365
|
+
synctype: TSUD.description,
|
356
366
|
}),
|
357
367
|
],
|
358
|
-
:
|
368
|
+
tomod: [
|
359
369
|
have_attributes(
|
360
370
|
{
|
361
|
-
:
|
362
|
-
:
|
363
|
-
:
|
364
|
-
:
|
371
|
+
name: 'one.lua',
|
372
|
+
synckey: 'one.lua',
|
373
|
+
synctype: TSUD.description,
|
374
|
+
local_path: pathname_globs('**/one.lua'),
|
365
375
|
}),
|
366
376
|
have_attributes(
|
367
377
|
{
|
368
|
-
:
|
369
|
-
:
|
370
|
-
:
|
371
|
-
:
|
378
|
+
name: 'two.lua',
|
379
|
+
synckey: 'two.lua',
|
380
|
+
synctype: TSUD.description,
|
381
|
+
local_path: pathname_globs('**/two.lua'),
|
372
382
|
}),
|
373
383
|
],
|
374
|
-
:
|
384
|
+
skipd: [],
|
385
|
+
clash: [],
|
375
386
|
})
|
376
387
|
end
|
377
388
|
|
378
389
|
it "Finds local path globs" do
|
379
390
|
ret = @t.status({}, ['**/ga/*.lua'])
|
380
391
|
expect(ret).to match({
|
381
|
-
:
|
382
|
-
:
|
392
|
+
unchg: [ ],
|
393
|
+
toadd: [
|
383
394
|
have_attributes(
|
384
|
-
:
|
385
|
-
:
|
386
|
-
:
|
387
|
-
:
|
395
|
+
name: 'six.lua',
|
396
|
+
synckey: 'six.lua',
|
397
|
+
synctype: TSUD.description,
|
398
|
+
local_path: an_instance_of(Pathname)
|
388
399
|
),
|
389
400
|
],
|
390
|
-
:
|
391
|
-
:
|
401
|
+
todel: [ ],
|
402
|
+
tomod: [
|
392
403
|
have_attributes(
|
393
|
-
:
|
394
|
-
:
|
395
|
-
:
|
396
|
-
:
|
404
|
+
name: 'two.lua',
|
405
|
+
synckey: 'two.lua',
|
406
|
+
synctype: TSUD.description,
|
407
|
+
local_path: an_instance_of(Pathname)
|
397
408
|
),
|
398
409
|
],
|
399
|
-
:
|
410
|
+
skipd: [],
|
411
|
+
clash: [],
|
400
412
|
})
|
401
413
|
end
|
402
414
|
|
403
415
|
it "Finds nothing with specific matcher" do
|
404
416
|
ret = @t.status({}, ['#foo'])
|
405
417
|
expect(ret).to match({
|
406
|
-
:
|
407
|
-
:
|
408
|
-
:
|
409
|
-
:
|
410
|
-
:
|
418
|
+
unchg: [],
|
419
|
+
toadd: [],
|
420
|
+
todel: [],
|
421
|
+
tomod: [],
|
422
|
+
skipd: [],
|
423
|
+
clash: [],
|
411
424
|
})
|
412
425
|
end
|
413
426
|
|
414
427
|
it "gets all the details" do
|
415
|
-
ret = @t.status({:
|
428
|
+
ret = @t.status({unselected: true})
|
416
429
|
expect(ret).to match({
|
417
|
-
:
|
430
|
+
unchg: [
|
418
431
|
have_attributes(
|
419
|
-
:
|
420
|
-
:
|
421
|
-
:
|
422
|
-
:
|
423
|
-
:
|
432
|
+
name: 'four.lua',
|
433
|
+
synckey: 'four.lua',
|
434
|
+
synctype: TSUD.description,
|
435
|
+
selected: true,
|
436
|
+
local_path: pathname_globs('**/four.lua')
|
424
437
|
),
|
425
438
|
have_attributes(
|
426
|
-
:
|
427
|
-
:
|
428
|
-
:
|
429
|
-
:
|
430
|
-
:
|
439
|
+
name: 'three.lua',
|
440
|
+
synckey: 'three.lua',
|
441
|
+
synctype: TSUD.description,
|
442
|
+
selected: true,
|
443
|
+
local_path: pathname_globs('**/three.lua')
|
431
444
|
),
|
432
445
|
],
|
433
|
-
:
|
446
|
+
toadd: [
|
434
447
|
have_attributes(
|
435
|
-
:
|
436
|
-
:
|
437
|
-
:
|
438
|
-
:
|
439
|
-
:
|
448
|
+
name: 'five.lua',
|
449
|
+
synckey: 'five.lua',
|
450
|
+
synctype: TSUD.description,
|
451
|
+
selected: true,
|
452
|
+
local_path: pathname_globs('**/five.lua')
|
440
453
|
),
|
441
454
|
have_attributes(
|
442
|
-
:
|
443
|
-
:
|
444
|
-
:
|
445
|
-
:
|
446
|
-
:
|
455
|
+
name: 'six.lua',
|
456
|
+
synckey: 'six.lua',
|
457
|
+
synctype: TSUD.description,
|
458
|
+
selected: true,
|
459
|
+
local_path: pathname_globs('**/six.lua')
|
447
460
|
),
|
448
461
|
],
|
449
|
-
:
|
462
|
+
todel: [
|
450
463
|
have_attributes(
|
451
|
-
:
|
452
|
-
:
|
453
|
-
:
|
454
|
-
:
|
464
|
+
name: 'eight.lua',
|
465
|
+
selected: true,
|
466
|
+
synckey: 'eight.lua',
|
467
|
+
synctype: TSUD.description,
|
455
468
|
),
|
456
469
|
have_attributes(
|
457
|
-
:
|
458
|
-
:
|
459
|
-
:
|
460
|
-
:
|
470
|
+
name: 'seven.lua',
|
471
|
+
selected: true,
|
472
|
+
synckey: 'seven.lua',
|
473
|
+
synctype: TSUD.description,
|
461
474
|
),
|
462
475
|
],
|
463
|
-
:
|
476
|
+
tomod: [
|
464
477
|
have_attributes(
|
465
|
-
:
|
466
|
-
:
|
467
|
-
:
|
468
|
-
:
|
469
|
-
:
|
478
|
+
name: 'one.lua',
|
479
|
+
synckey: 'one.lua',
|
480
|
+
synctype: TSUD.description,
|
481
|
+
selected: true,
|
482
|
+
local_path: pathname_globs('**/one.lua')
|
470
483
|
),
|
471
484
|
have_attributes(
|
472
|
-
:
|
473
|
-
:
|
474
|
-
:
|
475
|
-
:
|
476
|
-
:
|
485
|
+
name: 'two.lua',
|
486
|
+
synckey: 'two.lua',
|
487
|
+
synctype: TSUD.description,
|
488
|
+
selected: true,
|
489
|
+
local_path: pathname_globs('**/two.lua')
|
477
490
|
),
|
478
491
|
],
|
479
|
-
:
|
492
|
+
skipd: [],
|
493
|
+
clash: [],
|
480
494
|
})
|
481
495
|
end
|
482
496
|
end
|
@@ -491,18 +505,18 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
491
505
|
end
|
492
506
|
it "finds local items" do
|
493
507
|
expect(@t).to receive(:to_remote_item).and_return(
|
494
|
-
{:
|
495
|
-
{:
|
508
|
+
{name: 'one.lua'},
|
509
|
+
{name: 'two.lua'},
|
496
510
|
)
|
497
511
|
ret = @t.localitems(Pathname.new(@project_dir + '/tsud').realpath)
|
498
512
|
expect(ret).to match([
|
499
513
|
{
|
500
|
-
:
|
501
|
-
:
|
514
|
+
name: 'one.lua',
|
515
|
+
local_path: an_instance_of(Pathname)
|
502
516
|
},
|
503
517
|
{
|
504
|
-
:
|
505
|
-
:
|
518
|
+
name: 'two.lua',
|
519
|
+
local_path: an_instance_of(Pathname)
|
506
520
|
},
|
507
521
|
])
|
508
522
|
end
|
@@ -510,31 +524,31 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
510
524
|
it "takes an array from to_remote_item" do
|
511
525
|
expect(@t).to receive(:to_remote_item).and_return(
|
512
526
|
[
|
513
|
-
{:
|
514
|
-
{:
|
527
|
+
{name: 'one:1'},
|
528
|
+
{name: 'one:2'},
|
515
529
|
],
|
516
530
|
[
|
517
|
-
{:
|
518
|
-
{:
|
531
|
+
{name: 'two:1'},
|
532
|
+
{name: 'two:2'},
|
519
533
|
],
|
520
534
|
)
|
521
535
|
ret = @t.localitems(Pathname.new(@project_dir + '/tsud').realpath)
|
522
536
|
expect(ret).to match([
|
523
537
|
{
|
524
|
-
:
|
525
|
-
:
|
538
|
+
name: 'one:1',
|
539
|
+
local_path: an_instance_of(Pathname),
|
526
540
|
},
|
527
541
|
{
|
528
|
-
:
|
529
|
-
:
|
542
|
+
name: 'one:2',
|
543
|
+
local_path: an_instance_of(Pathname),
|
530
544
|
},
|
531
545
|
{
|
532
|
-
:
|
533
|
-
:
|
546
|
+
name: 'two:1',
|
547
|
+
local_path: an_instance_of(Pathname),
|
534
548
|
},
|
535
549
|
{
|
536
|
-
:
|
537
|
-
:
|
550
|
+
name: 'two:2',
|
551
|
+
local_path: an_instance_of(Pathname),
|
538
552
|
},
|
539
553
|
])
|
540
554
|
end
|
@@ -547,7 +561,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
547
561
|
lp = Pathname.new(@project_dir + '/tsud/one.lua').realpath
|
548
562
|
t = TSUD.new
|
549
563
|
expect(t).to receive(:fetch).once.with(1).and_yield("foo")
|
550
|
-
t.download(lp, {:
|
564
|
+
t.download(lp, {id: 1, updated_at: ITEM_UPDATED_AT})
|
551
565
|
end
|
552
566
|
end
|
553
567
|
|
@@ -618,12 +632,12 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
618
632
|
|
619
633
|
it "removes" do
|
620
634
|
expect(@t).to receive(:list).once.and_return([
|
621
|
-
{:
|
622
|
-
{:
|
623
|
-
{:
|
635
|
+
{name: 1},
|
636
|
+
{name: 2},
|
637
|
+
{name: 3},
|
624
638
|
])
|
625
639
|
expect(@t).to receive(:remove).exactly(3).times
|
626
|
-
@t.syncup({:
|
640
|
+
@t.syncup({delete: true})
|
627
641
|
end
|
628
642
|
|
629
643
|
it "creates" do
|
@@ -631,25 +645,25 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
631
645
|
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
632
646
|
|
633
647
|
expect(@t).to receive(:upload).twice.with(kind_of(Pathname), kind_of(MrMurano::SyncUpDown::Item), false)
|
634
|
-
@t.syncup({:
|
648
|
+
@t.syncup({create: true})
|
635
649
|
end
|
636
650
|
|
637
651
|
it "updates" do
|
638
652
|
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
639
653
|
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
640
654
|
expect(@t).to receive(:list).once.and_return([
|
641
|
-
MrMurano::SyncUpDown::Item.new({:
|
642
|
-
MrMurano::SyncUpDown::Item.new({:
|
655
|
+
MrMurano::SyncUpDown::Item.new({name: 'one.lua', updated_at: ITEM_UPDATED_AT}),
|
656
|
+
MrMurano::SyncUpDown::Item.new({name: 'two.lua', updated_at: ITEM_UPDATED_AT})
|
643
657
|
])
|
644
658
|
|
645
659
|
expect(@t).to receive(:upload).twice.with(
|
646
660
|
kind_of(Pathname), kind_of(MrMurano::SyncUpDown::Item), true
|
647
661
|
)
|
648
662
|
expect(@t).to receive(:to_remote_item).and_return(
|
649
|
-
{:
|
650
|
-
{:
|
663
|
+
{name: 'one.lua'},
|
664
|
+
{name: 'two.lua'},
|
651
665
|
)
|
652
|
-
@t.syncup({:
|
666
|
+
@t.syncup({update: true})
|
653
667
|
end
|
654
668
|
end
|
655
669
|
|
@@ -670,8 +684,8 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
670
684
|
|
671
685
|
it "creates" do
|
672
686
|
expect(@t).to receive(:list).once.and_return([
|
673
|
-
MrMurano::SyncUpDown::Item.new({:
|
674
|
-
MrMurano::SyncUpDown::Item.new({:
|
687
|
+
MrMurano::SyncUpDown::Item.new({name: 'one.lua', updated_at: ITEM_UPDATED_AT}),
|
688
|
+
MrMurano::SyncUpDown::Item.new({name: 'two.lua', updated_at: ITEM_UPDATED_AT})
|
675
689
|
])
|
676
690
|
|
677
691
|
expect(@t).to receive(:fetch).twice.and_yield("--foo\n")
|
@@ -684,14 +698,14 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
684
698
|
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
685
699
|
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
686
700
|
expect(@t).to receive(:list).once.and_return([
|
687
|
-
MrMurano::SyncUpDown::Item.new({:
|
688
|
-
MrMurano::SyncUpDown::Item.new({:
|
701
|
+
MrMurano::SyncUpDown::Item.new({name: 'one.lua', updated_at: ITEM_UPDATED_AT}),
|
702
|
+
MrMurano::SyncUpDown::Item.new({name: 'two.lua', updated_at: ITEM_UPDATED_AT})
|
689
703
|
])
|
690
704
|
|
691
705
|
expect(@t).to receive(:fetch).twice.and_yield("--foo\n")
|
692
706
|
expect(@t).to receive(:to_remote_item).and_return(
|
693
|
-
MrMurano::SyncUpDown::Item.new({:
|
694
|
-
MrMurano::SyncUpDown::Item.new({:
|
707
|
+
MrMurano::SyncUpDown::Item.new({name: 'one.lua', updated_at: ITEM_UPDATED_AT}),
|
708
|
+
MrMurano::SyncUpDown::Item.new({name: 'two.lua', updated_at: ITEM_UPDATED_AT})
|
695
709
|
)
|
696
710
|
@t.syncdown(update: true)
|
697
711
|
expect(FileTest.exist?(@project_dir + '/tsud/one.lua')).to be true
|
@@ -711,15 +725,15 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
711
725
|
# FileUtils.touch(@project_dir + '/bundles/mybun/tsud/two.lua')
|
712
726
|
#
|
713
727
|
# expect(@t).to receive(:to_remote_item).and_return(
|
714
|
-
# {:
|
728
|
+
# {name: 'two.lua'},{name: 'one.lua'}
|
715
729
|
# )
|
716
730
|
# ret = @t.locallist
|
717
731
|
# expect(ret).to match([
|
718
|
-
# {:
|
719
|
-
# :
|
720
|
-
# :
|
721
|
-
# {:
|
722
|
-
# :
|
732
|
+
# {name: 'two.lua',
|
733
|
+
# bundled: true,
|
734
|
+
# local_path: an_instance_of(Pathname)},
|
735
|
+
# {name: 'one.lua',
|
736
|
+
# local_path: an_instance_of(Pathname)},
|
723
737
|
# ])
|
724
738
|
# end
|
725
739
|
#
|
@@ -729,7 +743,7 @@ RSpec.describe MrMurano::SyncUpDown do
|
|
729
743
|
#
|
730
744
|
# expect(@t).to receive(:warning).once.with(/Not downloading into bundled item.*/)
|
731
745
|
#
|
732
|
-
# @t.download(lp, {:
|
746
|
+
# @t.download(lp, {bundled: true, name: 'one.lua'})
|
733
747
|
# end
|
734
748
|
# end
|
735
749
|
end
|