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/ConfigFile_spec.rb
DELETED
@@ -1,55 +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 'MrMurano/version'
|
9
|
-
require 'MrMurano/Config'
|
10
|
-
require 'tempfile'
|
11
|
-
|
12
|
-
RSpec.describe MrMurano::Config::ConfigFile do
|
13
|
-
it 'Creates a file' do
|
14
|
-
tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
|
15
|
-
begin
|
16
|
-
cf = MrMurano::Config::ConfigFile.new(:user, tmpfile)
|
17
|
-
cf.write
|
18
|
-
|
19
|
-
expect(FileTest.exist?(tmpfile))
|
20
|
-
unless Gem.win_platform?
|
21
|
-
expect(FileTest.world_readable?(tmpfile)).to be(nil)
|
22
|
-
expect(FileTest.world_writable?(tmpfile)).to be(nil)
|
23
|
-
end
|
24
|
-
ensure
|
25
|
-
File.unlink(tmpfile) unless tmpfile.nil?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it ':internal does not write a file' do
|
30
|
-
tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
|
31
|
-
begin
|
32
|
-
MrMurano::Config::ConfigFile.new(:internal, tmpfile)
|
33
|
-
expect(FileTest.exist?(tmpfile)).to be(false)
|
34
|
-
ensure
|
35
|
-
File.unlink(tmpfile) if FileTest.exist?(tmpfile)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
it ':defaults does not write a file' do
|
39
|
-
tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
|
40
|
-
begin
|
41
|
-
MrMurano::Config::ConfigFile.new(:defaults, tmpfile)
|
42
|
-
expect(FileTest.exist?(tmpfile)).to be(false)
|
43
|
-
ensure
|
44
|
-
File.unlink(tmpfile) if FileTest.exist?(tmpfile)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'loads a file' do
|
49
|
-
cf = MrMurano::Config::ConfigFile.new(:project, 'spec/fixtures/configfile')
|
50
|
-
cf.load
|
51
|
-
|
52
|
-
expect(cf[:data]['solution']['id']).to eq('XXXXXXXXXX')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
data/spec/ConfigMigrate_spec.rb
DELETED
@@ -1,108 +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 'erb'
|
9
|
-
require 'highline/import'
|
10
|
-
require 'pathname'
|
11
|
-
#require 'tempfile'
|
12
|
-
require 'MrMurano/version'
|
13
|
-
require 'MrMurano/Config-Migrate'
|
14
|
-
require 'MrMurano/ProjectFile'
|
15
|
-
require '_workspace'
|
16
|
-
|
17
|
-
RSpec.describe MrMurano::ConfigMigrate do
|
18
|
-
include_context 'WORKSPACE'
|
19
|
-
before(:example) do
|
20
|
-
@saved_pwd = ENV['MURANO_PASSWORD']
|
21
|
-
ENV['MURANO_PASSWORD'] = nil
|
22
|
-
@saved_cfg = ENV['MURANO_CONFIGFILE']
|
23
|
-
ENV['MURANO_CONFIGFILE'] = nil
|
24
|
-
|
25
|
-
$cfg = MrMurano::Config.new
|
26
|
-
$cfg.load
|
27
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
28
|
-
|
29
|
-
$project = MrMurano::ProjectFile.new
|
30
|
-
$project.load
|
31
|
-
|
32
|
-
@lry = Pathname.new(@project_dir) + '.Solutionfile.secret'
|
33
|
-
FileUtils.copy(
|
34
|
-
File.join(@testdir, 'spec/fixtures/SolutionFiles/secret.json'), @lry.to_path
|
35
|
-
)
|
36
|
-
|
37
|
-
@mrt = MrMurano::ConfigMigrate.new
|
38
|
-
|
39
|
-
@stdsaved = [$stdout, $stderr]
|
40
|
-
$stdout = StringIO.new
|
41
|
-
$stderr = StringIO.new
|
42
|
-
end
|
43
|
-
|
44
|
-
after(:example) do
|
45
|
-
$stdout, $stderr = @stdsaved
|
46
|
-
ENV['MURANO_PASSWORD'] = @saved_pwd
|
47
|
-
ENV['MURANO_CONFIGFILE'] = @saved_cfg
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'imports all' do
|
51
|
-
@mrt.import_secret
|
52
|
-
|
53
|
-
expect($cfg['application.id']).to eq('ABCDEFG')
|
54
|
-
expect($cfg['product.id']).to eq('HIJKLMNOP')
|
55
|
-
expect($cfg['user.name']).to eq('test@user.account')
|
56
|
-
pff = $cfg.file_at('passwords', :user)
|
57
|
-
pwd = MrMurano::Passwords.new(pff)
|
58
|
-
pwd.load
|
59
|
-
expect(pwd.get($cfg['net.host'], $cfg['user.name'])).to eq('gibblygook')
|
60
|
-
expect($stdout.string).to eq('')
|
61
|
-
expect($stderr.string).to eq('')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'imports over' do
|
65
|
-
$cfg['application.id'] = '12'
|
66
|
-
$cfg['product.id'] = 'awdfvs'
|
67
|
-
$cfg['user.name'] = '3qrarvsa'
|
68
|
-
$cfg = MrMurano::Config.new
|
69
|
-
$cfg.load
|
70
|
-
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
71
|
-
|
72
|
-
@mrt.import_secret
|
73
|
-
|
74
|
-
expect($cfg['application.id']).to eq('ABCDEFG')
|
75
|
-
expect($cfg['product.id']).to eq('HIJKLMNOP')
|
76
|
-
expect($cfg['user.name']).to eq('test@user.account')
|
77
|
-
pff = $cfg.file_at('passwords', :user)
|
78
|
-
pwd = MrMurano::Passwords.new(pff)
|
79
|
-
pwd.load
|
80
|
-
expect(pwd.get($cfg['net.host'], $cfg['user.name'])).to eq('gibblygook')
|
81
|
-
expect($stdout.string).to eq('')
|
82
|
-
expect($stderr.string).to eq('')
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'Asks about password differences' do
|
86
|
-
pff = $cfg.file_at('passwords', :user)
|
87
|
-
pwd = MrMurano::Passwords.new(pff)
|
88
|
-
pwd.set($cfg['net.host'], 'test@user.account', 'bob')
|
89
|
-
pwd.save
|
90
|
-
|
91
|
-
expect($terminal).to receive(:ask).with(
|
92
|
-
'A different password for this account already exists. Overwrite? N/y'
|
93
|
-
).and_return('y')
|
94
|
-
|
95
|
-
@mrt.import_secret
|
96
|
-
|
97
|
-
expect($cfg['application.id']).to eq('ABCDEFG')
|
98
|
-
expect($cfg['product.id']).to eq('HIJKLMNOP')
|
99
|
-
expect($cfg['user.name']).to eq('test@user.account')
|
100
|
-
pff = $cfg.file_at('passwords', :user)
|
101
|
-
pwd = MrMurano::Passwords.new(pff)
|
102
|
-
pwd.load
|
103
|
-
expect(pwd.get($cfg['net.host'], $cfg['user.name'])).to eq('gibblygook')
|
104
|
-
expect($stdout.string).to eq('')
|
105
|
-
expect($stderr.string).to eq('')
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
data/spec/Config_spec.rb
DELETED
@@ -1,440 +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 'erb'
|
9
|
-
require 'pathname'
|
10
|
-
require 'tempfile'
|
11
|
-
require 'MrMurano/version'
|
12
|
-
require 'MrMurano/Config'
|
13
|
-
require '_workspace'
|
14
|
-
|
15
|
-
RSpec.describe MrMurano::Config do
|
16
|
-
context 'Basics' do
|
17
|
-
include_context 'WORKSPACE'
|
18
|
-
it 'Sets defaults' do
|
19
|
-
cfg = MrMurano::Config.new
|
20
|
-
cfg.load
|
21
|
-
# Don't check for all of them, just a few.
|
22
|
-
expect(cfg['files.default_page']).to eq('index.html')
|
23
|
-
expect(cfg.get('files.default_page', :defaults)).to eq('index.html')
|
24
|
-
expect(cfg['tool.debug']).to eq(false)
|
25
|
-
expect(cfg.get('tool.debug', :defaults)).to eq(false)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'Sets internal values' do
|
29
|
-
cfg = MrMurano::Config.new
|
30
|
-
cfg.load
|
31
|
-
|
32
|
-
cfg['bob.test'] = 'twelve'
|
33
|
-
|
34
|
-
expect(cfg['bob.test']).to eq('twelve')
|
35
|
-
expect(cfg.get('bob.test', :internal)).to eq('twelve')
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'Sets tool values' do
|
39
|
-
cfg = MrMurano::Config.new
|
40
|
-
cfg.load
|
41
|
-
|
42
|
-
cfg['test'] = 'twelve'
|
43
|
-
|
44
|
-
expect(cfg['tool.test']).to eq('twelve')
|
45
|
-
expect(cfg.get('tool.test', :internal)).to eq('twelve')
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'Sets project values' do # This should write
|
49
|
-
cfg = MrMurano::Config.new
|
50
|
-
cfg.load
|
51
|
-
|
52
|
-
cfg.set('bob.test', 'twelve', :project)
|
53
|
-
|
54
|
-
expect(cfg['bob.test']).to eq('twelve')
|
55
|
-
expect(cfg.get('bob.test', :project)).to eq('twelve')
|
56
|
-
|
57
|
-
expect(FileTest.exist?(@project_dir + '.murano/config'))
|
58
|
-
|
59
|
-
#reload
|
60
|
-
cfg = MrMurano::Config.new
|
61
|
-
cfg.load
|
62
|
-
expect(cfg.get('bob.test', :project)).to eq('twelve')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'Sets a user value' do
|
66
|
-
cfg = MrMurano::Config.new
|
67
|
-
cfg.load
|
68
|
-
|
69
|
-
cfg.set('bob.test', 'twelve', :user)
|
70
|
-
|
71
|
-
expect(cfg['bob.test']).to eq('twelve')
|
72
|
-
expect(cfg.get('bob.test', :user)).to eq('twelve')
|
73
|
-
|
74
|
-
expect(FileTest.exist?(ENV['HOME'] + '.murano/config'))
|
75
|
-
|
76
|
-
#reload
|
77
|
-
cfg = MrMurano::Config.new
|
78
|
-
cfg.load
|
79
|
-
expect(cfg.get('bob.test', :user)).to eq('twelve')
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'loads from a specific file' do
|
83
|
-
File.open(@project_dir + '/foo.cfg', 'w') do |io|
|
84
|
-
io << %([test]
|
85
|
-
bob = test
|
86
|
-
).gsub(/^\s\+/, '')
|
87
|
-
end
|
88
|
-
|
89
|
-
cfg = MrMurano::Config.new
|
90
|
-
cfg.load
|
91
|
-
cfg.load_specific(@project_dir + '/foo.cfg')
|
92
|
-
|
93
|
-
expect(cfg['test.bob']).to eq('test')
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'returns a path to a file in' do
|
97
|
-
it 'project mrmurano dir' do
|
98
|
-
cfg = MrMurano::Config.new
|
99
|
-
cfg.load
|
100
|
-
path = cfg.file_at('testfile').realdirpath
|
101
|
-
want = Pathname.new(@project_dir + '/.murano/testfile').realdirpath
|
102
|
-
|
103
|
-
expect(path).to eq(want)
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'user mrmurano dir' do
|
107
|
-
cfg = MrMurano::Config.new
|
108
|
-
cfg.load
|
109
|
-
path = cfg.file_at('testfile', :user).realdirpath
|
110
|
-
want = Pathname.new(Dir.home + '/.murano/testfile').realdirpath
|
111
|
-
|
112
|
-
expect(path).to eq(want)
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'internal' do
|
116
|
-
cfg = MrMurano::Config.new
|
117
|
-
cfg.load
|
118
|
-
path = cfg.file_at('testfile', :internal)
|
119
|
-
|
120
|
-
expect(path).to eq(nil)
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'specified' do
|
124
|
-
cfg = MrMurano::Config.new
|
125
|
-
cfg.load
|
126
|
-
path = cfg.file_at('testfile', :specified)
|
127
|
-
|
128
|
-
expect(path).to eq(nil)
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'defaults' do
|
132
|
-
cfg = MrMurano::Config.new
|
133
|
-
cfg.load
|
134
|
-
path = cfg.file_at('testfile', :defaults)
|
135
|
-
|
136
|
-
expect(path).to eq(nil)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
context "ENV['MURANO_CONFIGFILE']" do
|
141
|
-
before(:example) do
|
142
|
-
@saved_cfg = ENV['MURANO_CONFIGFILE']
|
143
|
-
end
|
144
|
-
after(:example) do
|
145
|
-
ENV['MURANO_CONFIGFILE'] = @saved_cfg
|
146
|
-
ENV['MR_CONFIGFILE'] = nil
|
147
|
-
end
|
148
|
-
|
149
|
-
it 'loads file in env' do
|
150
|
-
ENV['MURANO_CONFIGFILE'] = @tmpdir + '/home/test.config'
|
151
|
-
File.open(@tmpdir + '/home/test.config', 'w') do |io|
|
152
|
-
io << %([test]
|
153
|
-
bob = test
|
154
|
-
).gsub(/^\s\+/, '')
|
155
|
-
end
|
156
|
-
|
157
|
-
cfg = MrMurano::Config.new
|
158
|
-
cfg.load
|
159
|
-
expect(cfg['test.bob']).to eq('test')
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'will create file at env' do
|
163
|
-
ENV['MURANO_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
164
|
-
cfg = MrMurano::Config.new
|
165
|
-
cfg.load
|
166
|
-
cfg.set('coffee.hot', 'yes', :env)
|
167
|
-
|
168
|
-
expect(FileTest.exist?(ENV['MURANO_CONFIGFILE']))
|
169
|
-
|
170
|
-
#reload
|
171
|
-
cfg = MrMurano::Config.new
|
172
|
-
cfg.load
|
173
|
-
expect(cfg['coffee.hot']).to eq('yes')
|
174
|
-
expect(cfg.get('coffee.hot', :env)).to eq('yes')
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'warns about migrating old ENV name' do
|
178
|
-
ENV['MURANO_CONFIGFILE'] = nil
|
179
|
-
ENV['MR_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
180
|
-
expect_any_instance_of(MrMurano::Config).to receive(:warning).once
|
181
|
-
MrMurano::Config.new
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'errors if both are defined' do
|
185
|
-
ENV['MURANO_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
186
|
-
ENV['MR_CONFIGFILE'] = @tmpdir + '/home/testcreate.config'
|
187
|
-
# 2 warnings:
|
188
|
-
# ENV "MR_CONFIGFILE" is no longer supported. Rename it to "MURANO_CONFIGFILE"
|
189
|
-
# Both "MURANO_CONFIGFILE" and "MR_CONFIGFILE" defined,
|
190
|
-
# please remove "MR_CONFIGFILE".
|
191
|
-
expect_any_instance_of(MrMurano::Config).to receive(:warning).twice
|
192
|
-
#expect_any_instance_of(MrMurano::Config).to receive(:error).once
|
193
|
-
MrMurano::Config.new
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
it 'dumps' do
|
198
|
-
@saved_cfg = ENV['MURANO_CONFIGFILE']
|
199
|
-
ENV['MURANO_CONFIGFILE'] = nil
|
200
|
-
cfg = MrMurano::Config.new
|
201
|
-
cfg.load
|
202
|
-
cfg['sync.bydefault'] = 'files'
|
203
|
-
ret = cfg.dump
|
204
|
-
|
205
|
-
rawwant = IO.read(File.join(@testdir.to_path, 'spec', 'fixtures', 'dumped_config'))
|
206
|
-
template = ERB.new(rawwant)
|
207
|
-
want = template.result(binding)
|
208
|
-
|
209
|
-
expect(ret).to eq(want)
|
210
|
-
ENV['MURANO_CONFIGFILE'] = @saved_cfg
|
211
|
-
end
|
212
|
-
|
213
|
-
context 'fixing permissions' do
|
214
|
-
it 'fixes a directory' do
|
215
|
-
Dir.mkdir('test')
|
216
|
-
cfg = MrMurano::Config.new
|
217
|
-
cfg.fix_modes(Pathname.new('test'))
|
218
|
-
if Gem.win_platform?
|
219
|
-
expect(FileTest.world_readable?('test')).to eq(493)
|
220
|
-
else
|
221
|
-
expect(FileTest.world_readable?('test')).to be_nil
|
222
|
-
end
|
223
|
-
expect(FileTest.world_writable?('test')).to be_nil
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'fixes a file' do
|
227
|
-
FileUtils.touch('test')
|
228
|
-
cfg = MrMurano::Config.new
|
229
|
-
cfg.fix_modes(Pathname.new('test'))
|
230
|
-
if Gem.win_platform?
|
231
|
-
expect(FileTest.world_readable?('test')).to eq(420)
|
232
|
-
else
|
233
|
-
expect(FileTest.world_readable?('test')).to be_nil
|
234
|
-
end
|
235
|
-
expect(FileTest.world_writable?('test')).to be_nil
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
context 'Can find the project directory by .murano/config' do
|
241
|
-
before(:example) do
|
242
|
-
@tmpdir = Dir.tmpdir
|
243
|
-
path = '/home/work/project/some/where'
|
244
|
-
@project_dir = @tmpdir + '/home/work/project'
|
245
|
-
FileUtils.mkpath(@tmpdir + path)
|
246
|
-
FileUtils.mkpath(@project_dir + '/.murano')
|
247
|
-
FileUtils.touch(@project_dir + '/.murano/config')
|
248
|
-
|
249
|
-
# Set ENV to override output of Dir.home
|
250
|
-
@saved_home = Dir.home
|
251
|
-
ENV['HOME'] = @tmpdir + '/home'
|
252
|
-
end
|
253
|
-
|
254
|
-
after(:example) do
|
255
|
-
FileUtils.remove_dir(@tmpdir + '/home', true) if FileTest.exist? @tmpdir
|
256
|
-
ENV['HOME'] = @saved_home
|
257
|
-
end
|
258
|
-
|
259
|
-
it 'when in project directory' do
|
260
|
-
Dir.chdir(@project_dir) do
|
261
|
-
cfg = MrMurano::Config.new
|
262
|
-
cfg.load
|
263
|
-
# Follow symlinks to get the paths comparable.
|
264
|
-
locbase = cfg.get('location.base', :defaults).realdirpath
|
265
|
-
wkd = Pathname.new(@project_dir).realdirpath
|
266
|
-
expect(locbase).to eq(wkd)
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
it 'when in sub directory' do
|
271
|
-
Dir.chdir(@project_dir + '/some/where') do
|
272
|
-
cfg = MrMurano::Config.new
|
273
|
-
cfg.load
|
274
|
-
# Follow symlinks to get the paths comparable.
|
275
|
-
locbase = cfg.get('location.base', :defaults).realdirpath
|
276
|
-
wkd = Pathname.new(@project_dir).realdirpath
|
277
|
-
expect(locbase).to eq(wkd)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
it 'when .murano is in both PWD and parent dir' do
|
282
|
-
Dir.chdir(@project_dir + '/some') do
|
283
|
-
FileUtils.mkpath('.murano')
|
284
|
-
FileUtils.touch('.murano/config')
|
285
|
-
cfg = MrMurano::Config.new
|
286
|
-
cfg.load
|
287
|
-
# Follow symlinks to get the paths comparable.
|
288
|
-
locbase = cfg.get('location.base', :defaults).realdirpath
|
289
|
-
wkd = (Pathname.new(@project_dir) + 'some').realdirpath
|
290
|
-
expect(locbase).to eq(wkd)
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
|
-
context 'Can find the project directory by .murano/' do
|
296
|
-
before(:example) do
|
297
|
-
@tmpdir = Dir.tmpdir
|
298
|
-
path = '/home/work/project/some/where'
|
299
|
-
@project_dir = @tmpdir + '/home/work/project'
|
300
|
-
FileUtils.mkpath(@tmpdir + path)
|
301
|
-
FileUtils.mkpath(@project_dir + '/.murano')
|
302
|
-
|
303
|
-
# Set ENV to override output of Dir.home
|
304
|
-
@saved_home = Dir.home
|
305
|
-
ENV['HOME'] = @tmpdir + '/home'
|
306
|
-
end
|
307
|
-
|
308
|
-
after(:example) do
|
309
|
-
FileUtils.remove_dir(@tmpdir + '/home', true) if FileTest.exist? @tmpdir
|
310
|
-
ENV['HOME'] = @saved_home
|
311
|
-
end
|
312
|
-
|
313
|
-
it 'when in project directory' do
|
314
|
-
Dir.chdir(@project_dir) do
|
315
|
-
cfg = MrMurano::Config.new
|
316
|
-
cfg.load
|
317
|
-
# Follow symlinks to get the paths comparable.
|
318
|
-
locbase = cfg.get('location.base', :defaults).realdirpath
|
319
|
-
wkd = Pathname.new(@project_dir).realdirpath
|
320
|
-
expect(locbase).to eq(wkd)
|
321
|
-
end
|
322
|
-
end
|
323
|
-
|
324
|
-
it 'when in sub directory' do
|
325
|
-
Dir.chdir(@project_dir + '/some/where') do
|
326
|
-
cfg = MrMurano::Config.new
|
327
|
-
cfg.load
|
328
|
-
# Follow symlinks to get the paths comparable.
|
329
|
-
locbase = cfg.get('location.base', :defaults).realdirpath
|
330
|
-
wkd = Pathname.new(@project_dir).realdirpath
|
331
|
-
expect(locbase).to eq(wkd)
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
it 'when .murano is in both PWD and parent dir' do
|
336
|
-
Dir.chdir(@project_dir + '/some') do
|
337
|
-
FileUtils.mkpath('.murano')
|
338
|
-
cfg = MrMurano::Config.new
|
339
|
-
cfg.load
|
340
|
-
# Follow symlinks to get the paths comparable.
|
341
|
-
locbase = cfg.get('location.base', :defaults).realdirpath
|
342
|
-
wkd = (Pathname.new(@project_dir) + 'some').realdirpath
|
343
|
-
expect(locbase).to eq(wkd)
|
344
|
-
end
|
345
|
-
end
|
346
|
-
end
|
347
|
-
|
348
|
-
context 'When pwd is $HOME:' do
|
349
|
-
before(:example) do
|
350
|
-
@tmpdir = Dir.tmpdir
|
351
|
-
@project_dir = @tmpdir + '/home/work/project'
|
352
|
-
FileUtils.mkpath(@project_dir)
|
353
|
-
# Set ENV to override output of Dir.home
|
354
|
-
@saved_home = Dir.home
|
355
|
-
ENV['HOME'] = @tmpdir + '/home'
|
356
|
-
end
|
357
|
-
|
358
|
-
after(:example) do
|
359
|
-
FileUtils.remove_dir(@tmpdir + '/home', true) if FileTest.exist? @tmpdir
|
360
|
-
ENV['HOME'] = @saved_home
|
361
|
-
end
|
362
|
-
|
363
|
-
it 'Sets a user value' do
|
364
|
-
Dir.chdir(ENV['HOME']) do
|
365
|
-
cfg = MrMurano::Config.new
|
366
|
-
cfg.load
|
367
|
-
|
368
|
-
cfg.set('bob.test', 'twelve', :user)
|
369
|
-
|
370
|
-
expect(cfg['bob.test']).to eq('twelve')
|
371
|
-
expect(cfg.get('bob.test', :user)).to eq('twelve')
|
372
|
-
|
373
|
-
expect(FileTest.exist?(ENV['HOME'] + '/.murano/config')).to be true
|
374
|
-
|
375
|
-
#reload
|
376
|
-
cfg = MrMurano::Config.new
|
377
|
-
cfg.load
|
378
|
-
expect(cfg.get('bob.test', :user)).to eq('twelve')
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
|
-
it 'Sets project values' do # This should write
|
383
|
-
Dir.chdir(ENV['HOME']) do
|
384
|
-
cfg = MrMurano::Config.new
|
385
|
-
cfg.load
|
386
|
-
|
387
|
-
cfg.set('bob.test', 'twelve', :project)
|
388
|
-
|
389
|
-
expect(cfg['bob.test']).to eq('twelve')
|
390
|
-
expect(cfg.get('bob.test', :project)).to eq('twelve')
|
391
|
-
|
392
|
-
expect(FileTest.exist?(ENV['HOME'] + '/.murano/config')).to be true
|
393
|
-
|
394
|
-
#reload
|
395
|
-
cfg = MrMurano::Config.new
|
396
|
-
cfg.load
|
397
|
-
expect(cfg.get('bob.test', :project)).to eq('twelve')
|
398
|
-
end
|
399
|
-
end
|
400
|
-
|
401
|
-
it 'write a project value and reads it as a user value' do
|
402
|
-
Dir.chdir(ENV['HOME']) do
|
403
|
-
cfg = MrMurano::Config.new
|
404
|
-
cfg.load
|
405
|
-
|
406
|
-
cfg.set('bob.test', 'twelve', :project)
|
407
|
-
|
408
|
-
expect(cfg['bob.test']).to eq('twelve')
|
409
|
-
# :user won't have the new value until it is loaded again
|
410
|
-
expect(cfg.get('bob.test', :project)).to eq('twelve')
|
411
|
-
|
412
|
-
expect(FileTest.exist?(ENV['HOME'] + '/.murano/config')).to be true
|
413
|
-
|
414
|
-
#reload
|
415
|
-
cfg = MrMurano::Config.new
|
416
|
-
cfg.load
|
417
|
-
expect(cfg.get('bob.test', :user)).to eq('twelve')
|
418
|
-
end
|
419
|
-
end
|
420
|
-
end
|
421
|
-
|
422
|
-
context 'Warns about migrating old' do
|
423
|
-
include_context 'WORKSPACE'
|
424
|
-
|
425
|
-
it 'config file name' do
|
426
|
-
FileUtils.touch(@project_dir + '/.mrmuranorc')
|
427
|
-
expect_any_instance_of(MrMurano::Config).to receive(:warning).once
|
428
|
-
cfg = MrMurano::Config.new
|
429
|
-
cfg.validate_cmd
|
430
|
-
end
|
431
|
-
|
432
|
-
it 'config directory name' do
|
433
|
-
FileUtils.mkpath(@project_dir + '/.mrmurano')
|
434
|
-
expect_any_instance_of(MrMurano::Config).to receive(:warning).once
|
435
|
-
cfg = MrMurano::Config.new
|
436
|
-
cfg.validate_cmd
|
437
|
-
end
|
438
|
-
end
|
439
|
-
end
|
440
|
-
|