MuranoCLI 3.2.1.pre.beta.6 → 3.2.1.pre.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +10 -0
- data/MuranoCLI.gemspec +37 -6
- data/Rakefile +38 -11
- data/lib/MrMurano/commands/business.rb +0 -4
- data/lib/MrMurano/version.rb +1 -1
- metadata +2 -251
- data/dockers/Dockerfile.2.2.9 +0 -40
- data/dockers/Dockerfile.2.3.6 +0 -40
- data/dockers/Dockerfile.2.4.3 +0 -40
- data/dockers/Dockerfile.2.5.0 +0 -40
- data/dockers/Dockerfile.GemRelease +0 -49
- data/dockers/Dockerfile.m4 +0 -122
- data/dockers/README.rst +0 -362
- data/dockers/RELEASE.rst +0 -135
- data/dockers/docker-test.sh +0 -163
- data/dockers/gem-release.sh +0 -4
- data/docs/basic_example.rst +0 -436
- data/docs/ci/.trustme.plugin +0 -140
- data/docs/ci/.trustme.sh +0 -516
- data/docs/ci/.trustme.vim +0 -55
- data/docs/completions/murano_completion-bash +0 -4484
- data/docs/demo.md +0 -109
- data/docs/develop.rst +0 -392
- data/docs/release.rst +0 -295
- data/spec/Account-Passwords_spec.rb +0 -245
- data/spec/Account_spec.rb +0 -256
- data/spec/Business_spec.rb +0 -307
- data/spec/ConfigFile_spec.rb +0 -55
- data/spec/ConfigMigrate_spec.rb +0 -108
- data/spec/Config_spec.rb +0 -440
- data/spec/Content_spec.rb +0 -422
- data/spec/GatewayBase_spec.rb +0 -65
- data/spec/GatewayDevice_spec.rb +0 -403
- data/spec/GatewayResource_spec.rb +0 -283
- data/spec/GatewaySettings_spec.rb +0 -130
- data/spec/HttpAuthed_spec.rb +0 -87
- data/spec/Http_spec.rb +0 -220
- data/spec/MakePretties_spec.rb +0 -127
- data/spec/Mock_spec.rb +0 -62
- data/spec/ProjectFile_spec.rb +0 -381
- data/spec/Setting_spec.rb +0 -120
- data/spec/Solution-ServiceConfig_spec.rb +0 -272
- data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
- data/spec/Solution-ServiceModules_spec.rb +0 -562
- data/spec/Solution-UsersRoles_spec.rb +0 -269
- data/spec/Solution_spec.rb +0 -140
- data/spec/SyncRoot_spec.rb +0 -111
- data/spec/SyncUpDown_spec.rb +0 -868
- data/spec/Verbosing_spec.rb +0 -332
- data/spec/Webservice-Cors_spec.rb +0 -225
- data/spec/Webservice-Endpoint_spec.rb +0 -650
- data/spec/Webservice-File_spec.rb +0 -282
- data/spec/Webservice-Setting_spec.rb +0 -105
- data/spec/_workspace.rb +0 -43
- data/spec/cmd_business_spec.rb +0 -64
- data/spec/cmd_common.rb +0 -507
- data/spec/cmd_config_spec.rb +0 -73
- data/spec/cmd_content_spec.rb +0 -109
- data/spec/cmd_cors_spec.rb +0 -54
- data/spec/cmd_device_spec.rb +0 -130
- data/spec/cmd_domain_spec.rb +0 -62
- data/spec/cmd_element_spec.rb +0 -401
- data/spec/cmd_exchange_spec.rb +0 -114
- data/spec/cmd_help_spec.rb +0 -72
- data/spec/cmd_init_spec.rb +0 -475
- data/spec/cmd_keystore_spec.rb +0 -97
- data/spec/cmd_link_spec.rb +0 -105
- data/spec/cmd_logs_spec.rb +0 -162
- data/spec/cmd_password_spec.rb +0 -64
- data/spec/cmd_setting_application_spec.rb +0 -300
- data/spec/cmd_setting_product_spec.rb +0 -246
- data/spec/cmd_status_spec.rb +0 -300
- data/spec/cmd_syncdown_application_spec.rb +0 -128
- data/spec/cmd_syncdown_both_spec.rb +0 -178
- data/spec/cmd_syncdown_unit_spec.rb +0 -861
- data/spec/cmd_syncup_spec.rb +0 -148
- data/spec/cmd_token_spec.rb +0 -53
- data/spec/cmd_usage_spec.rb +0 -79
- data/spec/dry_run_formatter.rb +0 -28
- data/spec/fixtures/.mrmuranorc +0 -9
- data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
- data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
- data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
- data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
- data/spec/fixtures/SolutionFiles/0.2.json +0 -21
- data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
- data/spec/fixtures/SolutionFiles/0.3.json +0 -20
- data/spec/fixtures/SolutionFiles/basic.json +0 -20
- data/spec/fixtures/SolutionFiles/secret.json +0 -6
- data/spec/fixtures/configfile +0 -9
- data/spec/fixtures/dumped_config +0 -57
- data/spec/fixtures/exchange_element/element-show.json +0 -1
- data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
- data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
- data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
- data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
- data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
- data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
- data/spec/fixtures/mrmuranorc_tool_bob +0 -3
- data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
- data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
- data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
- data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
- data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
- data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
- data/spec/fixtures/roles-three.yaml +0 -11
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
- data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
- data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
- data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
- data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
- data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
- data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
- data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
- data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
- data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
- data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
- data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
- data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
- data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
- data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
- data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
- data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
- data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
- data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
- data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
- data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
- data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
- data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
- data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
- data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
- data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
- data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
- data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
- data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
- data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
- data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
- data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
- data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
- data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
- data/spec/fixtures/syncable_content/assets/icon.png +0 -0
- data/spec/fixtures/syncable_content/assets/index.html +0 -0
- data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
- data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
- data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
- data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
- data/spec/fixtures/websocket/README.rst +0 -110
- data/spec/fixtures/websocket/logs_blather.rb +0 -27
- data/spec/fixtures/websocket/logs_faker.rb +0 -153
- data/spec/fixtures/websocket/simple_connection.rb +0 -45
- data/spec/fixtures/websocket/simple_options.rb +0 -77
- data/spec/fixtures/websocket/simple_server.rb +0 -69
- data/spec/fixtures/websocket/wss-echo.rb +0 -48
- data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
- data/spec/spec_helper.rb +0 -131
- data/spec/variegated_TruthyFalsey_spec.rb +0 -29
- data/spec/webmock_snapshot.rb +0 -296
data/spec/SyncUpDown_spec.rb
DELETED
@@ -1,868 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
6
|
-
# Unauthorized copying of this file is strictly prohibited.
|
7
|
-
|
8
|
-
require 'pathname'
|
9
|
-
require 'MrMurano/verbosing'
|
10
|
-
require 'MrMurano/version'
|
11
|
-
require 'MrMurano/Config'
|
12
|
-
require 'MrMurano/ProjectFile'
|
13
|
-
require 'MrMurano/SyncRoot'
|
14
|
-
require 'MrMurano/Solution-Services'
|
15
|
-
require 'MrMurano/SyncUpDown'
|
16
|
-
require 'MrMurano/SyncUpDown-Item'
|
17
|
-
require '_workspace'
|
18
|
-
|
19
|
-
class TSUD
|
20
|
-
include MrMurano::Verbose
|
21
|
-
include MrMurano::SyncUpDown
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
# 2017-07-03: See MrMurano::SolutionBase.state for the list of attrs.
|
25
|
-
@api_id = 'XYZ'
|
26
|
-
@valid_api_id = true
|
27
|
-
@uriparts = []
|
28
|
-
@solntype = 'application.id'
|
29
|
-
@itemkey = :name
|
30
|
-
@project_section = :routes
|
31
|
-
end
|
32
|
-
|
33
|
-
attr_reader :api_id
|
34
|
-
|
35
|
-
def api_id?
|
36
|
-
@valid_api_id
|
37
|
-
end
|
38
|
-
|
39
|
-
def fetch(id, _untainted=false)
|
40
|
-
# pass
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.description
|
44
|
-
%(Time Series Database)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
RSpec::Matchers.define :pathname_globs do |glob|
|
49
|
-
match do |pthnm|
|
50
|
-
pthnm.fnmatch(glob)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
ITEM_UPDATED_AT = '2017-06-24T00:45:15.564Z'
|
55
|
-
|
56
|
-
def expect_status_match_arrs(ret_arr, want_arr)
|
57
|
-
ret_arr.each_with_index do |ret_item, index|
|
58
|
-
want_item = want_arr[index]
|
59
|
-
ret_item.each_pair do |key, val|
|
60
|
-
expect(val).to match(want_item[key])
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def expect_status_match_lkup(ret, want)
|
66
|
-
# Need to tediously iterate, else Item object ID and local_path are flagged.
|
67
|
-
(ret.keys + want.keys).to_set.each do |category|
|
68
|
-
expect(ret[category].length).to eq(want[category].length)
|
69
|
-
expect_status_match_arrs(ret[category], want[category])
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
RSpec.describe MrMurano::SyncUpDown do
|
74
|
-
include_context 'WORKSPACE'
|
75
|
-
|
76
|
-
before(:example) do
|
77
|
-
$cfg = MrMurano::Config.new
|
78
|
-
$cfg.load
|
79
|
-
$project = MrMurano::ProjectFile.new
|
80
|
-
$project.load
|
81
|
-
$project['routes.location'] = 'tsud'
|
82
|
-
$project['routes.include'] = ['*.lua', '*/*.lua']
|
83
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
84
|
-
$cfg['product.id'] = 'XYZ'
|
85
|
-
$cfg['application.id'] = 'XYZ'
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'status' do
|
89
|
-
it 'warns with missing directory' do
|
90
|
-
tsud = TSUD.new
|
91
|
-
expect(tsud).to receive(:warning).once.with(/Skipping missing location.*/)
|
92
|
-
ret = tsud.status
|
93
|
-
expect(ret).to eq(
|
94
|
-
toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: []
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'finds nothing in empty directory' do
|
99
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
100
|
-
tsud = TSUD.new
|
101
|
-
ret = tsud.status
|
102
|
-
expect(ret).to eq(
|
103
|
-
toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: []
|
104
|
-
)
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'finds things there but not here' do
|
108
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
109
|
-
tsud = TSUD.new
|
110
|
-
expect(tsud).to receive(:list).once.and_return(
|
111
|
-
[
|
112
|
-
MrMurano::SyncUpDown::Item.new(name: 1),
|
113
|
-
MrMurano::SyncUpDown::Item.new(name: 2),
|
114
|
-
MrMurano::SyncUpDown::Item.new(name: 3),
|
115
|
-
]
|
116
|
-
)
|
117
|
-
want = {
|
118
|
-
toadd: [],
|
119
|
-
todel: [
|
120
|
-
MrMurano::SyncUpDown::Item.new(
|
121
|
-
name: 1,
|
122
|
-
synckey: 1,
|
123
|
-
synctype: TSUD.description,
|
124
|
-
),
|
125
|
-
MrMurano::SyncUpDown::Item.new(
|
126
|
-
name: 2,
|
127
|
-
synckey: 2,
|
128
|
-
synctype: TSUD.description,
|
129
|
-
),
|
130
|
-
MrMurano::SyncUpDown::Item.new(
|
131
|
-
name: 3,
|
132
|
-
synckey: 3,
|
133
|
-
synctype: TSUD.description,
|
134
|
-
),
|
135
|
-
],
|
136
|
-
tomod: [],
|
137
|
-
unchg: [],
|
138
|
-
skipd: [],
|
139
|
-
clash: [],
|
140
|
-
}
|
141
|
-
ret = tsud.status
|
142
|
-
expect_status_match_lkup(ret, want)
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'finds things there but not here; asdown' do
|
146
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
147
|
-
tsud = TSUD.new
|
148
|
-
expect(tsud).to receive(:list).once.and_return(
|
149
|
-
[
|
150
|
-
MrMurano::SyncUpDown::Item.new(name: 1),
|
151
|
-
MrMurano::SyncUpDown::Item.new(name: 2),
|
152
|
-
MrMurano::SyncUpDown::Item.new(name: 3),
|
153
|
-
]
|
154
|
-
)
|
155
|
-
want = {
|
156
|
-
todel: [],
|
157
|
-
toadd: [
|
158
|
-
MrMurano::SyncUpDown::Item.new(
|
159
|
-
name: 1, synckey: 1, synctype: TSUD.description,
|
160
|
-
),
|
161
|
-
MrMurano::SyncUpDown::Item.new(
|
162
|
-
name: 2, synckey: 2, synctype: TSUD.description,
|
163
|
-
),
|
164
|
-
MrMurano::SyncUpDown::Item.new(
|
165
|
-
name: 3, synckey: 3, synctype: TSUD.description,
|
166
|
-
),
|
167
|
-
],
|
168
|
-
tomod: [],
|
169
|
-
unchg: [],
|
170
|
-
skipd: [],
|
171
|
-
clash: [],
|
172
|
-
}
|
173
|
-
ret = tsud.status(asdown: true)
|
174
|
-
expect_status_match_lkup(ret, want)
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'finds things here but not there' do
|
178
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
179
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
180
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
181
|
-
tsud = TSUD.new
|
182
|
-
expect(tsud).to receive(:to_remote_items).and_return(
|
183
|
-
[MrMurano::SyncUpDown::Item.new(name: 'one.lua')],
|
184
|
-
[MrMurano::SyncUpDown::Item.new(name: 'two.lua')],
|
185
|
-
)
|
186
|
-
want = {
|
187
|
-
toadd: [
|
188
|
-
MrMurano::SyncUpDown::Item.new(
|
189
|
-
name: 'one.lua',
|
190
|
-
synckey: 'one.lua',
|
191
|
-
synctype: TSUD.description,
|
192
|
-
local_path: an_instance_of(Pathname),
|
193
|
-
),
|
194
|
-
MrMurano::SyncUpDown::Item.new(
|
195
|
-
name: 'two.lua',
|
196
|
-
synckey: 'two.lua',
|
197
|
-
synctype: TSUD.description,
|
198
|
-
local_path: an_instance_of(Pathname),
|
199
|
-
),
|
200
|
-
],
|
201
|
-
todel: [],
|
202
|
-
tomod: [],
|
203
|
-
unchg: [],
|
204
|
-
skipd: [],
|
205
|
-
clash: [],
|
206
|
-
}
|
207
|
-
ret = tsud.status
|
208
|
-
expect_status_match_lkup(ret, want)
|
209
|
-
end
|
210
|
-
|
211
|
-
it 'finds things here and there; and they are different' do
|
212
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
213
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
214
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
215
|
-
tsud = TSUD.new
|
216
|
-
expect(tsud).to receive(:list).once.and_return(
|
217
|
-
[
|
218
|
-
MrMurano::EventHandler::EventHandlerItem.new(name: 'one.lua'),
|
219
|
-
MrMurano::EventHandler::EventHandlerItem.new(name: 'two.lua'),
|
220
|
-
]
|
221
|
-
)
|
222
|
-
expect(tsud).to receive(:to_remote_items).and_return(
|
223
|
-
[MrMurano::EventHandler::EventHandlerItem.new(name: 'one.lua')],
|
224
|
-
[MrMurano::EventHandler::EventHandlerItem.new(name: 'two.lua')],
|
225
|
-
)
|
226
|
-
want = {
|
227
|
-
tomod: [
|
228
|
-
MrMurano::EventHandler::EventHandlerItem.new(
|
229
|
-
name: 'one.lua',
|
230
|
-
synckey: 'one.lua',
|
231
|
-
synctype: TSUD.description,
|
232
|
-
local_path: an_instance_of(Pathname),
|
233
|
-
),
|
234
|
-
MrMurano::EventHandler::EventHandlerItem.new(
|
235
|
-
name: 'two.lua',
|
236
|
-
synckey: 'two.lua',
|
237
|
-
synctype: TSUD.description,
|
238
|
-
local_path: an_instance_of(Pathname),
|
239
|
-
),
|
240
|
-
],
|
241
|
-
todel: [],
|
242
|
-
toadd: [],
|
243
|
-
unchg: [],
|
244
|
-
skipd: [],
|
245
|
-
clash: [],
|
246
|
-
}
|
247
|
-
ret = tsud.status
|
248
|
-
expect_status_match_lkup(ret, want)
|
249
|
-
end
|
250
|
-
|
251
|
-
it "finds things here and there; but they're the same" do
|
252
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
253
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
254
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
255
|
-
tsud = TSUD.new
|
256
|
-
expect(tsud).to receive(:list).once.and_return(
|
257
|
-
[
|
258
|
-
MrMurano::SyncUpDown::Item.new(name: 'one.lua'),
|
259
|
-
MrMurano::SyncUpDown::Item.new(name: 'two.lua'),
|
260
|
-
]
|
261
|
-
)
|
262
|
-
expect(tsud).to receive(:to_remote_items).and_return(
|
263
|
-
[MrMurano::SyncUpDown::Item.new(name: 'one.lua')],
|
264
|
-
[MrMurano::SyncUpDown::Item.new(name: 'two.lua')],
|
265
|
-
)
|
266
|
-
expect(tsud).to receive(:docmp).twice.and_return(false)
|
267
|
-
want = {
|
268
|
-
unchg: [
|
269
|
-
MrMurano::SyncUpDown::Item.new(
|
270
|
-
name: 'one.lua',
|
271
|
-
synckey: 'one.lua',
|
272
|
-
synctype: TSUD.description,
|
273
|
-
local_path: an_instance_of(Pathname),
|
274
|
-
),
|
275
|
-
MrMurano::SyncUpDown::Item.new(
|
276
|
-
name: 'two.lua',
|
277
|
-
synckey: 'two.lua',
|
278
|
-
synctype: TSUD.description,
|
279
|
-
local_path: an_instance_of(Pathname),
|
280
|
-
),
|
281
|
-
],
|
282
|
-
todel: [],
|
283
|
-
toadd: [],
|
284
|
-
tomod: [],
|
285
|
-
skipd: [],
|
286
|
-
clash: [],
|
287
|
-
}
|
288
|
-
ret = tsud.status
|
289
|
-
expect_status_match_lkup(ret, want)
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'calls diff' do
|
293
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
294
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
295
|
-
tsud = TSUD.new
|
296
|
-
expect(tsud).to receive(:list).once.and_return(
|
297
|
-
[MrMurano::SyncUpDown::Item.new(name: 'one.lua')],
|
298
|
-
)
|
299
|
-
expect(tsud).to receive(:to_remote_items).and_return(
|
300
|
-
[MrMurano::SyncUpDown::Item.new(name: 'one.lua')]
|
301
|
-
)
|
302
|
-
expect(tsud).to receive(:dodiff).once.and_return('diffed output')
|
303
|
-
want = {
|
304
|
-
tomod: [
|
305
|
-
MrMurano::SyncUpDown::Item.new(
|
306
|
-
name: 'one.lua',
|
307
|
-
synckey: 'one.lua',
|
308
|
-
synctype: TSUD.description,
|
309
|
-
local_path: an_instance_of(Pathname),
|
310
|
-
diff: 'diffed output',
|
311
|
-
),
|
312
|
-
],
|
313
|
-
todel: [],
|
314
|
-
toadd: [],
|
315
|
-
unchg: [],
|
316
|
-
skipd: [],
|
317
|
-
clash: [],
|
318
|
-
}
|
319
|
-
ret = tsud.status(diff: true)
|
320
|
-
expect_status_match_lkup(ret, want)
|
321
|
-
end
|
322
|
-
|
323
|
-
context 'Filtering' do
|
324
|
-
before(:example) do
|
325
|
-
FileUtils.mkpath(@project_dir + '/tsud/ga')
|
326
|
-
FileUtils.mkpath(@project_dir + '/tsud/gb')
|
327
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua') # tomod
|
328
|
-
FileUtils.touch(@project_dir + '/tsud/ga/two.lua') # tomod
|
329
|
-
FileUtils.touch(@project_dir + '/tsud/three.lua') # unchg
|
330
|
-
FileUtils.touch(@project_dir + '/tsud/gb/four.lua') # unchg
|
331
|
-
FileUtils.touch(@project_dir + '/tsud/five.lua') # toadd
|
332
|
-
FileUtils.touch(@project_dir + '/tsud/ga/six.lua') # toadd
|
333
|
-
@tsud = TSUD.new
|
334
|
-
expect(@tsud).to receive(:list).once.and_return(
|
335
|
-
[
|
336
|
-
MrMurano::SyncUpDown::Item.new(
|
337
|
-
name: 'eight.lua', updated_at: ITEM_UPDATED_AT
|
338
|
-
), # todel
|
339
|
-
MrMurano::SyncUpDown::Item.new(
|
340
|
-
name: 'four.lua', updated_at: ITEM_UPDATED_AT
|
341
|
-
), # unchg
|
342
|
-
MrMurano::SyncUpDown::Item.new(
|
343
|
-
name: 'one.lua', updated_at: ITEM_UPDATED_AT
|
344
|
-
), # tomod
|
345
|
-
MrMurano::SyncUpDown::Item.new(
|
346
|
-
name: 'seven.lua', updated_at: ITEM_UPDATED_AT
|
347
|
-
), # todel
|
348
|
-
MrMurano::SyncUpDown::Item.new(
|
349
|
-
name: 'three.lua', updated_at: ITEM_UPDATED_AT
|
350
|
-
), # unchg
|
351
|
-
MrMurano::SyncUpDown::Item.new(
|
352
|
-
name: 'two.lua', updated_at: ITEM_UPDATED_AT
|
353
|
-
), # tomod
|
354
|
-
]
|
355
|
-
)
|
356
|
-
|
357
|
-
expect(@tsud).to receive(:to_remote_items)
|
358
|
-
.with(anything, pathname_globs('**/one.lua'))
|
359
|
-
.and_return(
|
360
|
-
[
|
361
|
-
MrMurano::SyncUpDown::Item.new(
|
362
|
-
name: 'one.lua', updated_at: ITEM_UPDATED_AT
|
363
|
-
),
|
364
|
-
]
|
365
|
-
)
|
366
|
-
expect(@tsud).to receive(:to_remote_items)
|
367
|
-
.with(anything, pathname_globs('**/two.lua'))
|
368
|
-
.and_return(
|
369
|
-
[
|
370
|
-
MrMurano::SyncUpDown::Item.new(
|
371
|
-
name: 'two.lua', updated_at: ITEM_UPDATED_AT
|
372
|
-
),
|
373
|
-
]
|
374
|
-
)
|
375
|
-
expect(@tsud).to receive(:to_remote_items)
|
376
|
-
.with(anything, pathname_globs('**/three.lua'))
|
377
|
-
.and_return(
|
378
|
-
[
|
379
|
-
MrMurano::SyncUpDown::Item.new(
|
380
|
-
name: 'three.lua', updated_at: ITEM_UPDATED_AT
|
381
|
-
),
|
382
|
-
]
|
383
|
-
)
|
384
|
-
expect(@tsud).to receive(:to_remote_items)
|
385
|
-
.with(anything, pathname_globs('**/four.lua'))
|
386
|
-
.and_return(
|
387
|
-
[
|
388
|
-
MrMurano::SyncUpDown::Item.new(
|
389
|
-
name: 'four.lua', updated_at: ITEM_UPDATED_AT
|
390
|
-
),
|
391
|
-
]
|
392
|
-
)
|
393
|
-
expect(@tsud).to receive(:to_remote_items)
|
394
|
-
.with(anything, pathname_globs('**/five.lua'))
|
395
|
-
.and_return(
|
396
|
-
[
|
397
|
-
MrMurano::SyncUpDown::Item.new(
|
398
|
-
name: 'five.lua', updated_at: ITEM_UPDATED_AT
|
399
|
-
),
|
400
|
-
]
|
401
|
-
)
|
402
|
-
expect(@tsud).to receive(:to_remote_items)
|
403
|
-
.with(anything, pathname_globs('**/six.lua'))
|
404
|
-
.and_return(
|
405
|
-
[
|
406
|
-
MrMurano::SyncUpDown::Item.new(
|
407
|
-
name: 'six.lua', updated_at: ITEM_UPDATED_AT
|
408
|
-
),
|
409
|
-
]
|
410
|
-
)
|
411
|
-
|
412
|
-
expect(@tsud).to receive(:docmp)
|
413
|
-
.with(have_attributes(name: 'one.lua'), anything)
|
414
|
-
.and_return(true)
|
415
|
-
expect(@tsud).to receive(:docmp)
|
416
|
-
.with(have_attributes(name: 'two.lua'), anything)
|
417
|
-
.and_return(true)
|
418
|
-
expect(@tsud).to receive(:docmp)
|
419
|
-
.with(have_attributes(name: 'three.lua'), anything)
|
420
|
-
.and_return(false)
|
421
|
-
expect(@tsud).to receive(:docmp)
|
422
|
-
.with(have_attributes(name: 'four.lua'), anything)
|
423
|
-
.and_return(false)
|
424
|
-
end
|
425
|
-
|
426
|
-
it 'Returns all with no filter' do
|
427
|
-
ret = @tsud.status
|
428
|
-
expect(ret).to match(
|
429
|
-
unchg: [
|
430
|
-
have_attributes(
|
431
|
-
name: 'four.lua',
|
432
|
-
synckey: 'four.lua',
|
433
|
-
synctype: TSUD.description,
|
434
|
-
local_path: pathname_globs('**/four.lua')
|
435
|
-
),
|
436
|
-
have_attributes(
|
437
|
-
name: 'three.lua',
|
438
|
-
synckey: 'three.lua',
|
439
|
-
synctype: TSUD.description,
|
440
|
-
local_path: pathname_globs('**/three.lua')
|
441
|
-
),
|
442
|
-
],
|
443
|
-
toadd: [
|
444
|
-
have_attributes(
|
445
|
-
name: 'five.lua',
|
446
|
-
synckey: 'five.lua',
|
447
|
-
synctype: TSUD.description,
|
448
|
-
local_path: pathname_globs('**/five.lua')
|
449
|
-
),
|
450
|
-
have_attributes(
|
451
|
-
name: 'six.lua',
|
452
|
-
synckey: 'six.lua',
|
453
|
-
synctype: TSUD.description,
|
454
|
-
local_path: pathname_globs('**/six.lua')
|
455
|
-
),
|
456
|
-
],
|
457
|
-
todel: [
|
458
|
-
have_attributes(
|
459
|
-
name: 'eight.lua',
|
460
|
-
synckey: 'eight.lua',
|
461
|
-
synctype: TSUD.description
|
462
|
-
),
|
463
|
-
have_attributes(
|
464
|
-
name: 'seven.lua',
|
465
|
-
synckey: 'seven.lua',
|
466
|
-
synctype: TSUD.description
|
467
|
-
),
|
468
|
-
],
|
469
|
-
tomod: [
|
470
|
-
have_attributes(
|
471
|
-
name: 'one.lua',
|
472
|
-
synckey: 'one.lua',
|
473
|
-
synctype: TSUD.description,
|
474
|
-
local_path: pathname_globs('**/one.lua')
|
475
|
-
),
|
476
|
-
have_attributes(
|
477
|
-
name: 'two.lua',
|
478
|
-
synckey: 'two.lua',
|
479
|
-
synctype: TSUD.description,
|
480
|
-
local_path: pathname_globs('**/two.lua')
|
481
|
-
),
|
482
|
-
],
|
483
|
-
skipd: [],
|
484
|
-
clash: []
|
485
|
-
)
|
486
|
-
end
|
487
|
-
|
488
|
-
it 'Finds local path globs' do
|
489
|
-
ret = @tsud.status({}, ['**/ga/*.lua'])
|
490
|
-
expect(ret).to match(
|
491
|
-
unchg: [],
|
492
|
-
toadd: [
|
493
|
-
have_attributes(
|
494
|
-
name: 'six.lua',
|
495
|
-
synckey: 'six.lua',
|
496
|
-
synctype: TSUD.description,
|
497
|
-
local_path: an_instance_of(Pathname)
|
498
|
-
),
|
499
|
-
],
|
500
|
-
todel: [],
|
501
|
-
tomod: [
|
502
|
-
have_attributes(
|
503
|
-
name: 'two.lua',
|
504
|
-
synckey: 'two.lua',
|
505
|
-
synctype: TSUD.description,
|
506
|
-
local_path: an_instance_of(Pathname)
|
507
|
-
),
|
508
|
-
],
|
509
|
-
skipd: [],
|
510
|
-
clash: []
|
511
|
-
)
|
512
|
-
end
|
513
|
-
|
514
|
-
it 'Finds nothing with specific matcher' do
|
515
|
-
ret = @tsud.status({}, ['#foo'])
|
516
|
-
expect(ret).to match(
|
517
|
-
unchg: [],
|
518
|
-
toadd: [],
|
519
|
-
todel: [],
|
520
|
-
tomod: [],
|
521
|
-
skipd: [],
|
522
|
-
clash: []
|
523
|
-
)
|
524
|
-
end
|
525
|
-
|
526
|
-
it 'gets all the details' do
|
527
|
-
ret = @tsud.status(unselected: true)
|
528
|
-
expect(ret).to match(
|
529
|
-
unchg: [
|
530
|
-
have_attributes(
|
531
|
-
name: 'four.lua',
|
532
|
-
synckey: 'four.lua',
|
533
|
-
synctype: TSUD.description,
|
534
|
-
selected: true,
|
535
|
-
local_path: pathname_globs('**/four.lua')
|
536
|
-
),
|
537
|
-
have_attributes(
|
538
|
-
name: 'three.lua',
|
539
|
-
synckey: 'three.lua',
|
540
|
-
synctype: TSUD.description,
|
541
|
-
selected: true,
|
542
|
-
local_path: pathname_globs('**/three.lua')
|
543
|
-
),
|
544
|
-
],
|
545
|
-
toadd: [
|
546
|
-
have_attributes(
|
547
|
-
name: 'five.lua',
|
548
|
-
synckey: 'five.lua',
|
549
|
-
synctype: TSUD.description,
|
550
|
-
selected: true,
|
551
|
-
local_path: pathname_globs('**/five.lua')
|
552
|
-
),
|
553
|
-
have_attributes(
|
554
|
-
name: 'six.lua',
|
555
|
-
synckey: 'six.lua',
|
556
|
-
synctype: TSUD.description,
|
557
|
-
selected: true,
|
558
|
-
local_path: pathname_globs('**/six.lua')
|
559
|
-
),
|
560
|
-
],
|
561
|
-
todel: [
|
562
|
-
have_attributes(
|
563
|
-
name: 'eight.lua',
|
564
|
-
selected: true,
|
565
|
-
synckey: 'eight.lua',
|
566
|
-
synctype: TSUD.description,
|
567
|
-
),
|
568
|
-
have_attributes(
|
569
|
-
name: 'seven.lua',
|
570
|
-
selected: true,
|
571
|
-
synckey: 'seven.lua',
|
572
|
-
synctype: TSUD.description,
|
573
|
-
),
|
574
|
-
],
|
575
|
-
tomod: [
|
576
|
-
have_attributes(
|
577
|
-
name: 'one.lua',
|
578
|
-
synckey: 'one.lua',
|
579
|
-
synctype: TSUD.description,
|
580
|
-
selected: true,
|
581
|
-
local_path: pathname_globs('**/one.lua')
|
582
|
-
),
|
583
|
-
have_attributes(
|
584
|
-
name: 'two.lua',
|
585
|
-
synckey: 'two.lua',
|
586
|
-
synctype: TSUD.description,
|
587
|
-
selected: true,
|
588
|
-
local_path: pathname_globs('**/two.lua')
|
589
|
-
),
|
590
|
-
],
|
591
|
-
skipd: [],
|
592
|
-
clash: []
|
593
|
-
)
|
594
|
-
end
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
context 'localitems' do
|
599
|
-
before(:example) do
|
600
|
-
FileUtils.mkpath('tsud')
|
601
|
-
FileUtils.touch('tsud/one.lua')
|
602
|
-
FileUtils.touch('tsud/two.lua')
|
603
|
-
@tsud = TSUD.new
|
604
|
-
end
|
605
|
-
it 'finds local items' do
|
606
|
-
expect(@tsud).to receive(:to_remote_items).and_return(
|
607
|
-
[MrMurano::SyncUpDown::Item.new(name: 'one.lua')],
|
608
|
-
[MrMurano::SyncUpDown::Item.new(name: 'two.lua')],
|
609
|
-
)
|
610
|
-
want = [
|
611
|
-
MrMurano::SyncUpDown::Item.new(
|
612
|
-
name: 'one.lua',
|
613
|
-
local_path: an_instance_of(Pathname),
|
614
|
-
),
|
615
|
-
MrMurano::SyncUpDown::Item.new(
|
616
|
-
name: 'two.lua',
|
617
|
-
local_path: an_instance_of(Pathname),
|
618
|
-
),
|
619
|
-
]
|
620
|
-
ret = @tsud.localitems(Pathname.new(@project_dir + '/tsud').realpath)
|
621
|
-
expect_status_match_arrs(ret, want)
|
622
|
-
end
|
623
|
-
|
624
|
-
it 'takes an array from to_remote_items' do
|
625
|
-
expect(@tsud).to receive(:to_remote_items).and_return(
|
626
|
-
[
|
627
|
-
MrMurano::SyncUpDown::Item.new(name: 'one:1'),
|
628
|
-
MrMurano::SyncUpDown::Item.new(name: 'one:2'),
|
629
|
-
],
|
630
|
-
[
|
631
|
-
MrMurano::SyncUpDown::Item.new(name: 'two:1'),
|
632
|
-
MrMurano::SyncUpDown::Item.new(name: 'two:2'),
|
633
|
-
],
|
634
|
-
)
|
635
|
-
want = [
|
636
|
-
MrMurano::SyncUpDown::Item.new(
|
637
|
-
name: 'one:1',
|
638
|
-
local_path: an_instance_of(Pathname),
|
639
|
-
),
|
640
|
-
MrMurano::SyncUpDown::Item.new(
|
641
|
-
name: 'one:2',
|
642
|
-
local_path: an_instance_of(Pathname),
|
643
|
-
),
|
644
|
-
MrMurano::SyncUpDown::Item.new(
|
645
|
-
name: 'two:1',
|
646
|
-
local_path: an_instance_of(Pathname),
|
647
|
-
),
|
648
|
-
MrMurano::SyncUpDown::Item.new(
|
649
|
-
name: 'two:2',
|
650
|
-
local_path: an_instance_of(Pathname),
|
651
|
-
),
|
652
|
-
]
|
653
|
-
ret = @tsud.localitems(Pathname.new(@project_dir + '/tsud').realpath)
|
654
|
-
expect_status_match_arrs(ret, want)
|
655
|
-
end
|
656
|
-
end
|
657
|
-
|
658
|
-
context 'download' do
|
659
|
-
it 'defaults to :id if @itemkey missing' do
|
660
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
661
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
662
|
-
lp = Pathname.new(@project_dir + '/tsud/one.lua').realpath
|
663
|
-
tsud = TSUD.new
|
664
|
-
expect(tsud).to receive(:fetch).once.with(1, false).and_yield('foo')
|
665
|
-
tsud.download(lp, id: 1, updated_at: ITEM_UPDATED_AT)
|
666
|
-
end
|
667
|
-
end
|
668
|
-
|
669
|
-
context 'doing diffs' do
|
670
|
-
before(:example) do
|
671
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
672
|
-
@tsud = TSUD.new
|
673
|
-
@scpt = Pathname.new(@project_dir + '/tsud/one.lua')
|
674
|
-
@scpt.open('w') { |io| io << %(-- fake lua\nreturn 0\n) }
|
675
|
-
@scpt = @scpt.realpath
|
676
|
-
end
|
677
|
-
|
678
|
-
it 'nothing when same.' do
|
679
|
-
expect(@tsud).to receive(:fetch).and_yield(%(-- fake lua\nreturn 0\n))
|
680
|
-
ret = @tsud.dodiff(
|
681
|
-
{
|
682
|
-
name: 'one.lua',
|
683
|
-
local_path: @scpt,
|
684
|
-
updated_at: ITEM_UPDATED_AT,
|
685
|
-
},
|
686
|
-
nil
|
687
|
-
)
|
688
|
-
if Gem.win_platform?
|
689
|
-
expect(ret).to match(/FC: no differences encountered/)
|
690
|
-
else
|
691
|
-
expect(ret).to eq('')
|
692
|
-
end
|
693
|
-
end
|
694
|
-
|
695
|
-
it 'something when different.' do
|
696
|
-
expect(@tsud).to receive(:fetch).and_yield(%(-- fake lua\nreturn 2\n))
|
697
|
-
ret = @tsud.dodiff(
|
698
|
-
{
|
699
|
-
name: 'one.lua',
|
700
|
-
local_path: @scpt,
|
701
|
-
updated_at: ITEM_UPDATED_AT,
|
702
|
-
},
|
703
|
-
nil
|
704
|
-
)
|
705
|
-
expect(ret).not_to eq('')
|
706
|
-
end
|
707
|
-
|
708
|
-
it 'uses script in item' do
|
709
|
-
script = %(-- fake lua\nreturn 2\n)
|
710
|
-
expect(@tsud).to receive(:fetch).and_yield(script)
|
711
|
-
ret = @tsud.dodiff(
|
712
|
-
{
|
713
|
-
name: 'one.lua',
|
714
|
-
local_path: @scpt,
|
715
|
-
script: script,
|
716
|
-
updated_at: ITEM_UPDATED_AT,
|
717
|
-
},
|
718
|
-
nil
|
719
|
-
)
|
720
|
-
if Gem.win_platform?
|
721
|
-
expect(ret).to match(/FC: no differences encountered/)
|
722
|
-
else
|
723
|
-
expect(ret).to eq('')
|
724
|
-
end
|
725
|
-
end
|
726
|
-
end
|
727
|
-
|
728
|
-
context 'syncup' do
|
729
|
-
before(:example) do
|
730
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
731
|
-
@tsud = TSUD.new
|
732
|
-
end
|
733
|
-
|
734
|
-
it 'removes' do
|
735
|
-
expect(@tsud).to receive(:list).once.and_return(
|
736
|
-
[
|
737
|
-
MrMurano::SyncUpDown::Item.new(name: 1),
|
738
|
-
MrMurano::SyncUpDown::Item.new(name: 2),
|
739
|
-
MrMurano::SyncUpDown::Item.new(name: 3),
|
740
|
-
]
|
741
|
-
)
|
742
|
-
expect(@tsud).to receive(:remove).exactly(3).times
|
743
|
-
@tsud.syncup(delete: true)
|
744
|
-
end
|
745
|
-
|
746
|
-
it 'creates' do
|
747
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
748
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
749
|
-
|
750
|
-
expect(@tsud).to receive(
|
751
|
-
:upload
|
752
|
-
).twice.with(
|
753
|
-
kind_of(Pathname), kind_of(MrMurano::SyncUpDown::Item), false
|
754
|
-
)
|
755
|
-
@tsud.syncup(create: true)
|
756
|
-
end
|
757
|
-
|
758
|
-
it 'updates' do
|
759
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
760
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
761
|
-
expect(@tsud).to receive(:list).once.and_return(
|
762
|
-
[
|
763
|
-
MrMurano::SyncUpDown::Item.new(name: 'one.lua', updated_at: ITEM_UPDATED_AT),
|
764
|
-
MrMurano::SyncUpDown::Item.new(name: 'two.lua', updated_at: ITEM_UPDATED_AT),
|
765
|
-
]
|
766
|
-
)
|
767
|
-
|
768
|
-
expect(@tsud).to receive(:upload).twice.with(
|
769
|
-
kind_of(Pathname), kind_of(MrMurano::SyncUpDown::Item), true
|
770
|
-
)
|
771
|
-
expect(@tsud).to receive(:to_remote_items).and_return(
|
772
|
-
[MrMurano::SyncUpDown::Item.new(name: 'one.lua')],
|
773
|
-
[MrMurano::SyncUpDown::Item.new(name: 'two.lua')],
|
774
|
-
)
|
775
|
-
@tsud.syncup(update: true)
|
776
|
-
end
|
777
|
-
end
|
778
|
-
|
779
|
-
context 'syncdown' do
|
780
|
-
before(:example) do
|
781
|
-
FileUtils.mkpath(@project_dir + '/tsud')
|
782
|
-
@tsud = TSUD.new
|
783
|
-
end
|
784
|
-
|
785
|
-
it 'removes' do
|
786
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
787
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
788
|
-
|
789
|
-
@tsud.syncdown(delete: true)
|
790
|
-
expect(FileTest.exist?(@project_dir + '/tsud/one.lua')).to be false
|
791
|
-
expect(FileTest.exist?(@project_dir + '/tsud/two.lua')).to be false
|
792
|
-
end
|
793
|
-
|
794
|
-
it 'creates' do
|
795
|
-
expect(@tsud).to receive(:list).once.and_return(
|
796
|
-
[
|
797
|
-
MrMurano::SyncUpDown::Item.new(name: 'one.lua', updated_at: ITEM_UPDATED_AT),
|
798
|
-
MrMurano::SyncUpDown::Item.new(name: 'two.lua', updated_at: ITEM_UPDATED_AT),
|
799
|
-
]
|
800
|
-
)
|
801
|
-
|
802
|
-
expect(@tsud).to receive(:fetch).twice.and_yield("--foo\n")
|
803
|
-
@tsud.syncdown(create: true)
|
804
|
-
expect(FileTest.exist?(@project_dir + '/tsud/one.lua')).to be true
|
805
|
-
expect(FileTest.exist?(@project_dir + '/tsud/two.lua')).to be true
|
806
|
-
end
|
807
|
-
|
808
|
-
it 'updates' do
|
809
|
-
FileUtils.touch(@project_dir + '/tsud/one.lua')
|
810
|
-
FileUtils.touch(@project_dir + '/tsud/two.lua')
|
811
|
-
expect(@tsud).to receive(:list).once.and_return(
|
812
|
-
[
|
813
|
-
MrMurano::SyncUpDown::Item.new(name: 'one.lua', updated_at: ITEM_UPDATED_AT),
|
814
|
-
MrMurano::SyncUpDown::Item.new(name: 'two.lua', updated_at: ITEM_UPDATED_AT),
|
815
|
-
]
|
816
|
-
)
|
817
|
-
|
818
|
-
expect(@tsud).to receive(:fetch).twice.and_yield("--foo\n")
|
819
|
-
expect(@tsud).to receive(:to_remote_items).and_return(
|
820
|
-
[
|
821
|
-
MrMurano::SyncUpDown::Item.new(name: 'one.lua', updated_at: ITEM_UPDATED_AT),
|
822
|
-
],
|
823
|
-
[
|
824
|
-
MrMurano::SyncUpDown::Item.new(name: 'two.lua', updated_at: ITEM_UPDATED_AT),
|
825
|
-
],
|
826
|
-
)
|
827
|
-
@tsud.syncdown(update: true)
|
828
|
-
expect(FileTest.exist?(@project_dir + '/tsud/one.lua')).to be true
|
829
|
-
expect(FileTest.exist?(@project_dir + '/tsud/two.lua')).to be true
|
830
|
-
end
|
831
|
-
end
|
832
|
-
|
833
|
-
# context "bundles" do
|
834
|
-
# before(:example) do
|
835
|
-
# FileUtils.mkpath(@project_dir + '/tsud')
|
836
|
-
# FileUtils.mkpath(@project_dir + '/bundles/mybun/tsud')
|
837
|
-
# @tsud = TSUD.new
|
838
|
-
# end
|
839
|
-
#
|
840
|
-
# it "finds items in bundles." do
|
841
|
-
# FileUtils.touch(@project_dir + '/tsud/one.lua')
|
842
|
-
# FileUtils.touch(@project_dir + '/bundles/mybun/tsud/two.lua')
|
843
|
-
#
|
844
|
-
# expect(@tsud).to receive(:to_remote_items).and_return(
|
845
|
-
# [{name: 'two.lua'}],
|
846
|
-
# [{name: 'one.lua'}],
|
847
|
-
# )
|
848
|
-
# ret = @tsud.locallist
|
849
|
-
# expect(ret).to match([
|
850
|
-
# {name: 'two.lua',
|
851
|
-
# bundled: true,
|
852
|
-
# local_path: an_instance_of(Pathname)},
|
853
|
-
# {name: 'one.lua',
|
854
|
-
# local_path: an_instance_of(Pathname)},
|
855
|
-
# ])
|
856
|
-
# end
|
857
|
-
#
|
858
|
-
# it "Doesn't download a bundled item" do
|
859
|
-
# FileUtils.touch(@project_dir + '/tsud/one.lua')
|
860
|
-
# lp = Pathname.new(@project_dir + '/tsud/one.lua').realpath
|
861
|
-
#
|
862
|
-
# expect(@tsud).to receive(:warning).once.with(/Not downloading into bundled item.*/)
|
863
|
-
#
|
864
|
-
# @tsud.download(lp, {bundled: true, name: 'one.lua'})
|
865
|
-
# end
|
866
|
-
# end
|
867
|
-
end
|
868
|
-
|