MuranoCLI 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +28 -0
- data/.rspec +2 -0
- data/.travis.yml +21 -0
- data/Gemfile +27 -0
- data/LICENSE.txt +19 -0
- data/MuranoCLI.gemspec +50 -0
- data/MuranoCLI.iss +50 -0
- data/README.markdown +208 -0
- data/Rakefile +188 -0
- data/TODO.taskpaper +122 -0
- data/bin/mr +8 -0
- data/bin/murano +84 -0
- data/docs/demo.md +109 -0
- data/lib/MrMurano/Account.rb +211 -0
- data/lib/MrMurano/Config-Migrate.rb +47 -0
- data/lib/MrMurano/Config.rb +286 -0
- data/lib/MrMurano/Mock.rb +63 -0
- data/lib/MrMurano/Product-1P-Device.rb +145 -0
- data/lib/MrMurano/Product-Resources.rb +195 -0
- data/lib/MrMurano/Product.rb +358 -0
- data/lib/MrMurano/ProjectFile.rb +349 -0
- data/lib/MrMurano/Solution-Cors.rb +46 -0
- data/lib/MrMurano/Solution-Endpoint.rb +177 -0
- data/lib/MrMurano/Solution-File.rb +150 -0
- data/lib/MrMurano/Solution-ServiceConfig.rb +140 -0
- data/lib/MrMurano/Solution-Services.rb +326 -0
- data/lib/MrMurano/Solution-Users.rb +129 -0
- data/lib/MrMurano/Solution.rb +59 -0
- data/lib/MrMurano/SubCmdGroupContext.rb +49 -0
- data/lib/MrMurano/SyncUpDown.rb +565 -0
- data/lib/MrMurano/commands/assign.rb +57 -0
- data/lib/MrMurano/commands/businessList.rb +45 -0
- data/lib/MrMurano/commands/completion.rb +152 -0
- data/lib/MrMurano/commands/config.rb +67 -0
- data/lib/MrMurano/commands/content.rb +130 -0
- data/lib/MrMurano/commands/cors.rb +30 -0
- data/lib/MrMurano/commands/domain.rb +17 -0
- data/lib/MrMurano/commands/gb.rb +33 -0
- data/lib/MrMurano/commands/init.rb +138 -0
- data/lib/MrMurano/commands/keystore.rb +157 -0
- data/lib/MrMurano/commands/logs.rb +78 -0
- data/lib/MrMurano/commands/mock.rb +63 -0
- data/lib/MrMurano/commands/password.rb +88 -0
- data/lib/MrMurano/commands/postgresql.rb +41 -0
- data/lib/MrMurano/commands/product.rb +14 -0
- data/lib/MrMurano/commands/productCreate.rb +39 -0
- data/lib/MrMurano/commands/productDelete.rb +33 -0
- data/lib/MrMurano/commands/productDevice.rb +84 -0
- data/lib/MrMurano/commands/productDeviceIdCmds.rb +86 -0
- data/lib/MrMurano/commands/productList.rb +45 -0
- data/lib/MrMurano/commands/productWrite.rb +27 -0
- data/lib/MrMurano/commands/show.rb +80 -0
- data/lib/MrMurano/commands/solution.rb +14 -0
- data/lib/MrMurano/commands/solutionCreate.rb +39 -0
- data/lib/MrMurano/commands/solutionDelete.rb +34 -0
- data/lib/MrMurano/commands/solutionList.rb +45 -0
- data/lib/MrMurano/commands/status.rb +92 -0
- data/lib/MrMurano/commands/sync.rb +60 -0
- data/lib/MrMurano/commands/timeseries.rb +115 -0
- data/lib/MrMurano/commands/tsdb.rb +271 -0
- data/lib/MrMurano/commands/usage.rb +23 -0
- data/lib/MrMurano/commands/zshcomplete.erb +112 -0
- data/lib/MrMurano/commands.rb +32 -0
- data/lib/MrMurano/hash.rb +20 -0
- data/lib/MrMurano/http.rb +153 -0
- data/lib/MrMurano/makePretty.rb +75 -0
- data/lib/MrMurano/schema/pf-v1.0.0.yaml +114 -0
- data/lib/MrMurano/schema/sf-v0.2.0.yaml +77 -0
- data/lib/MrMurano/schema/sf-v0.3.0.yaml +78 -0
- data/lib/MrMurano/template/mock.erb +9 -0
- data/lib/MrMurano/template/projectFile.murano.erb +81 -0
- data/lib/MrMurano/verbosing.rb +99 -0
- data/lib/MrMurano/version.rb +4 -0
- data/lib/MrMurano.rb +20 -0
- data/spec/Account-Passwords_spec.rb +242 -0
- data/spec/Account_spec.rb +272 -0
- data/spec/ConfigFile_spec.rb +50 -0
- data/spec/ConfigMigrate_spec.rb +89 -0
- data/spec/Config_spec.rb +409 -0
- data/spec/Http_spec.rb +204 -0
- data/spec/MakePretties_spec.rb +118 -0
- data/spec/Mock_spec.rb +53 -0
- data/spec/ProductBase_spec.rb +113 -0
- data/spec/ProductContent_spec.rb +162 -0
- data/spec/ProductResources_spec.rb +329 -0
- data/spec/Product_1P_Device_spec.rb +202 -0
- data/spec/Product_1P_RPC_spec.rb +175 -0
- data/spec/Product_spec.rb +153 -0
- data/spec/ProjectFile_spec.rb +324 -0
- data/spec/Solution-Cors_spec.rb +164 -0
- data/spec/Solution-Endpoint_spec.rb +581 -0
- data/spec/Solution-File_spec.rb +212 -0
- data/spec/Solution-ServiceConfig_spec.rb +202 -0
- data/spec/Solution-ServiceDevice_spec.rb +176 -0
- data/spec/Solution-ServiceEventHandler_spec.rb +385 -0
- data/spec/Solution-ServiceModules_spec.rb +465 -0
- data/spec/Solution-UsersRoles_spec.rb +207 -0
- data/spec/Solution_spec.rb +92 -0
- data/spec/SyncRoot_spec.rb +83 -0
- data/spec/SyncUpDown_spec.rb +495 -0
- data/spec/Verbosing_spec.rb +279 -0
- data/spec/_workspace.rb +27 -0
- data/spec/cmd_assign_spec.rb +51 -0
- data/spec/cmd_business_spec.rb +59 -0
- data/spec/cmd_common.rb +72 -0
- data/spec/cmd_config_spec.rb +68 -0
- data/spec/cmd_content_spec.rb +71 -0
- data/spec/cmd_cors_spec.rb +50 -0
- data/spec/cmd_device_spec.rb +96 -0
- data/spec/cmd_domain_spec.rb +32 -0
- data/spec/cmd_init_spec.rb +30 -0
- data/spec/cmd_keystore_spec.rb +97 -0
- data/spec/cmd_password_spec.rb +62 -0
- data/spec/cmd_status_spec.rb +239 -0
- data/spec/cmd_syncdown_spec.rb +86 -0
- data/spec/cmd_syncup_spec.rb +62 -0
- data/spec/cmd_usage_spec.rb +36 -0
- data/spec/fixtures/.mrmuranorc +9 -0
- data/spec/fixtures/ProjectFiles/invalid.yaml +9 -0
- data/spec/fixtures/ProjectFiles/only_meta.yaml +24 -0
- data/spec/fixtures/ProjectFiles/with_routes.yaml +27 -0
- data/spec/fixtures/SolutionFiles/0.2.0.json +20 -0
- data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +18 -0
- data/spec/fixtures/SolutionFiles/0.2.json +21 -0
- data/spec/fixtures/SolutionFiles/0.3.0.json +20 -0
- data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +19 -0
- data/spec/fixtures/SolutionFiles/0.3.json +20 -0
- data/spec/fixtures/SolutionFiles/basic.json +20 -0
- data/spec/fixtures/SolutionFiles/secret.json +6 -0
- data/spec/fixtures/configfile +9 -0
- data/spec/fixtures/dumped_config +42 -0
- data/spec/fixtures/mrmuranorc_deleted_bob +8 -0
- data/spec/fixtures/mrmuranorc_tool_bob +3 -0
- data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +116 -0
- data/spec/fixtures/product_spec_files/example.murano.spec.yaml +14 -0
- data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +21 -0
- data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +16 -0
- data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +11 -0
- data/spec/fixtures/product_spec_files/lightbulb.yaml +14 -0
- data/spec/fixtures/roles-three.yaml +11 -0
- 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 +58 -0
- data/spec/fixtures/syncable_content/routes/manyRoutes.lua +11 -0
- data/spec/fixtures/syncable_content/routes/singleRoute.lua +5 -0
- data/spec/fixtures/syncable_content/services/devdata.lua +18 -0
- data/spec/fixtures/syncable_content/services/timers.lua +4 -0
- data/spec/spec_helper.rb +119 -0
- metadata +498 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 23b5f23df3ae26fa85d24b1350c090a7699c6b1a
|
|
4
|
+
data.tar.gz: 2d7f68e4ff2edafc2272184b1b881ed52a89a0ff
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7ab6a593fb7834cbc3ee696a1446f67ba0541812ede973f8dfd723603204375738438eff824942854d30e157eac340ed10667148a029cfa46933dfff07a55e42
|
|
7
|
+
data.tar.gz: 9c04e653b85cac4070838993e4a13603e6afcc776db2bd1a11340ba3538e6b53ae3502b80b48dc39f21f47ef9059d17509c04b1ac5004883dfa836caad56ed28
|
data/.gitignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.AppleDouble
|
|
3
|
+
.LSOverride
|
|
4
|
+
Icon
|
|
5
|
+
*.sw[a-z]
|
|
6
|
+
cookies
|
|
7
|
+
.jiramulerc
|
|
8
|
+
tags
|
|
9
|
+
mr.exe
|
|
10
|
+
|
|
11
|
+
xcuserdata
|
|
12
|
+
Pods/
|
|
13
|
+
pkg/
|
|
14
|
+
report/
|
|
15
|
+
coverage/
|
|
16
|
+
|
|
17
|
+
.murano/
|
|
18
|
+
|
|
19
|
+
_testProject/
|
|
20
|
+
|
|
21
|
+
# Thumbnails
|
|
22
|
+
._*
|
|
23
|
+
|
|
24
|
+
# Files that might appear on external disk
|
|
25
|
+
.Spotlight-V100
|
|
26
|
+
.Trashes
|
|
27
|
+
|
|
28
|
+
Gemfile.lock
|
data/.rspec
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
rvm:
|
|
3
|
+
- 2.0
|
|
4
|
+
- 2.2
|
|
5
|
+
- 2.3.3
|
|
6
|
+
- 2.4.0
|
|
7
|
+
|
|
8
|
+
before_deploy: "rake build"
|
|
9
|
+
deploy:
|
|
10
|
+
provider: releases
|
|
11
|
+
api_key:
|
|
12
|
+
secure: oB28IBHoSQVgP0PtP1uc+cRMBNhqHCCfCCV+sLNspjCGJeIjhZ4lmLcMYSy8l0+TBWxmXl6VIQd6GbyEezbB5daA4+pxY/An0OpM649t29+QuMCK8iXrD8/HXfaUzY2CP5RP47GoC/5xyCwqv3EEUjFPEGhUb5hYc74kfe3nwBmhKliHFQpZvuDE0EHWTgcEOep+kf7O+3cVf7vJVddz+Vj05t1s6VCwhBQsbUvOV4/Jv7nhHa7q0UGoY9M7sTNpwgawFeMwqvtXxl8sVbiHPLm+u6vikSbVnSdyi7wlVAoe+DSkzmnVHYzMd/t1Io7kEiLEAyDyrlJPJYS+XTMqxQ/KUDJNhf/N2IJMW2vPA+6TjpxCqcdY4QwkLNb7JfFWgQb9X4UksAEQU24W6110+zPUGmbg37eM80OrsadTWy65IQbLJ0sFFhm8vu/e2i/3LadYscw6A0Tyc1JXgGfGKd0nqyAyKGLcSBw1+dwwzkyKNHWFAaLy5hAEKv2qZdVNrTtcLhJtuxv8VUuevd3gfT6FLOIN/XAyg71mSvC2BA12vzM6KkTPNIaSmUITDgEplT5cs5h8PZ4eRghpmnT2EA3k0O3p14Ng3eeACMImJYQRKWmU/yVWVo69VVH0GRfm5SWb6xlDLFXt/Mii1MPx9ruhC232wdRACoep18w1qUY=
|
|
13
|
+
file_glob: true
|
|
14
|
+
file: "pkg/MrMurano-*.gem"
|
|
15
|
+
skip_cleanup: true
|
|
16
|
+
on:
|
|
17
|
+
repo: tadpol/MrMurano
|
|
18
|
+
tags: true
|
|
19
|
+
rvm: 2.2
|
|
20
|
+
|
|
21
|
+
# vim: set et sw=2 ts=2 :
|
data/Gemfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
#gemspec
|
|
4
|
+
|
|
5
|
+
gem 'commander', '~> 4.4.0'
|
|
6
|
+
gem 'certified', '1.0.0'
|
|
7
|
+
gem 'dotenv', '~> 2.1.1'
|
|
8
|
+
gem 'highline', '~> 1.7.8'
|
|
9
|
+
gem 'http-form_data', '~> 1.0.1'
|
|
10
|
+
gem 'inifile', '~> 3.0'
|
|
11
|
+
gem 'json-schema', '~> 2.7.0'
|
|
12
|
+
gem 'mime-types', '~> 3.1'
|
|
13
|
+
gem 'mime-types-data', '~> 3.2016.0521'
|
|
14
|
+
gem 'terminal-table', '~> 1.4.5'
|
|
15
|
+
|
|
16
|
+
group :test do
|
|
17
|
+
gem 'coderay', :require => false
|
|
18
|
+
gem 'rake', '~> 10.1.1'
|
|
19
|
+
gem 'rspec', '~> 3.5'
|
|
20
|
+
gem 'simplecov', :require => false
|
|
21
|
+
gem 'webmock', '~> 2.3.0'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
group :windows do
|
|
25
|
+
gem 'ocra', '~> 1.3.8'
|
|
26
|
+
end
|
|
27
|
+
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2016 Exosite
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
4
|
+
software and associated documentation files (the "Software"), to deal in the
|
|
5
|
+
Software without restriction, including without limitation the rights to use, copy,
|
|
6
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
|
7
|
+
and to permit persons to whom the Software is furnished to do so, subject to the
|
|
8
|
+
following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
14
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
15
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
16
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
17
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
|
18
|
+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
|
data/MuranoCLI.gemspec
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
|
3
|
+
require_relative 'lib/MrMurano/version.rb'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = 'MuranoCLI'
|
|
7
|
+
s.version = MrMurano::VERSION
|
|
8
|
+
s.authors = ['Michael Conrad Tadpol Tilstra']
|
|
9
|
+
s.email = ['miketilstra@exosite.com']
|
|
10
|
+
s.license = 'MIT'
|
|
11
|
+
s.homepage = 'https://github.com/exosite/MuranoCLI'
|
|
12
|
+
s.summary = 'Do more from the command line with Murano'
|
|
13
|
+
s.description = %{Do more from the command line with Murano
|
|
14
|
+
|
|
15
|
+
Push and pull data from Murano.
|
|
16
|
+
Get status on what things have changed.
|
|
17
|
+
See a diff of the changes before you push.
|
|
18
|
+
|
|
19
|
+
and so much more.
|
|
20
|
+
|
|
21
|
+
This gem was formerly known as MrMurano.
|
|
22
|
+
}
|
|
23
|
+
s.required_ruby_version = '~> 2.0'
|
|
24
|
+
|
|
25
|
+
s.files = `git ls-files`.split("\n")
|
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
27
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
28
|
+
s.require_paths = ['lib']
|
|
29
|
+
|
|
30
|
+
s.add_runtime_dependency('commander', '~> 4.4.0')
|
|
31
|
+
s.add_runtime_dependency('certified', '1.0.0')
|
|
32
|
+
s.add_runtime_dependency('dotenv', '~> 2.1.1')
|
|
33
|
+
s.add_runtime_dependency('highline', '~> 1.7.8')
|
|
34
|
+
s.add_runtime_dependency('http-form_data', '~> 1.0.1')
|
|
35
|
+
s.add_runtime_dependency('inifile', '~> 3.0')
|
|
36
|
+
s.add_runtime_dependency('json-schema', '~> 2.7.0')
|
|
37
|
+
s.add_runtime_dependency('mime-types', '~> 3.1')
|
|
38
|
+
s.add_runtime_dependency('mime-types-data', '~> 3.2016.0521')
|
|
39
|
+
s.add_runtime_dependency('terminal-table', '~> 1.4.5')
|
|
40
|
+
|
|
41
|
+
s.add_development_dependency('bundler', '~> 1.7.6')
|
|
42
|
+
s.add_development_dependency('ocra', '~> 1.3.8')
|
|
43
|
+
s.add_development_dependency('rake', '~> 10.1.1')
|
|
44
|
+
s.add_development_dependency('rspec', '~> 3.5')
|
|
45
|
+
s.add_development_dependency('simplecov')
|
|
46
|
+
s.add_development_dependency('webmock', '~> 2.1.0')
|
|
47
|
+
# maybe? s.add_development_dependency('vcr', '~> ???')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
data/MuranoCLI.iss
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[Setup]
|
|
2
|
+
AppName=MuranoCLI
|
|
3
|
+
AppVersion={%MRVERSION}
|
|
4
|
+
DefaultDirName={pf}\MuranoCLI
|
|
5
|
+
DefaultGroupName=MuranoCLI
|
|
6
|
+
ChangesEnvironment=yes
|
|
7
|
+
OutputBaseFileName=MuranoCLISetup
|
|
8
|
+
AppPublisher=Exosite
|
|
9
|
+
AppPublisherURL=http://exosite.com/
|
|
10
|
+
AppCopyright=Copyright (C) 2016-2017 Exosite
|
|
11
|
+
LicenseFile=LICENSE.txt
|
|
12
|
+
|
|
13
|
+
[Files]
|
|
14
|
+
Source: "murano.exe"; DestDir: "{app}\bin"
|
|
15
|
+
Source: "LICENSE.txt"; DestDir: "{app}"
|
|
16
|
+
Source: "ReadMe.txt"; DestDir: "{app}"; Flags: isreadme
|
|
17
|
+
|
|
18
|
+
; http://www.jrsoftware.org/ishelp/
|
|
19
|
+
|
|
20
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
21
|
+
; http://stackoverflow.com/questions/3304463/how-do-i-modify-the-path-environment-variable-when-running-an-inno-setup-install/3431379
|
|
22
|
+
[Registry]
|
|
23
|
+
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
|
|
24
|
+
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; \
|
|
25
|
+
Check: NeedsAddPath('{app}\bin')
|
|
26
|
+
|
|
27
|
+
;;; Not working.
|
|
28
|
+
[Code]
|
|
29
|
+
|
|
30
|
+
function NeedsAddPath(Param: string): boolean;
|
|
31
|
+
var
|
|
32
|
+
OrigPath: string;
|
|
33
|
+
ParamExpanded: string;
|
|
34
|
+
begin
|
|
35
|
+
//expand the setup constants like {app} from Param
|
|
36
|
+
ParamExpanded := ExpandConstant(Param);
|
|
37
|
+
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
|
38
|
+
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
|
39
|
+
'Path', OrigPath)
|
|
40
|
+
then begin
|
|
41
|
+
Result := True;
|
|
42
|
+
exit;
|
|
43
|
+
end;
|
|
44
|
+
// look for the path with leading and trailing semicolon and with or without \ ending
|
|
45
|
+
// Pos() returns 0 if not found
|
|
46
|
+
Result := Pos(';' + UpperCase(ParamExpanded) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
|
|
47
|
+
if Result = True then
|
|
48
|
+
Result := Pos(';' + UpperCase(ParamExpanded) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
|
|
49
|
+
end;
|
|
50
|
+
|
data/README.markdown
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# MuranoCLI
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/rb/MuranoCLI)
|
|
5
|
+
[](https://travis-ci.org/tadpol/MrMurano)
|
|
6
|
+
[](http://inch-ci.org/github/exosite/MuranoCLI)
|
|
7
|
+
|
|
8
|
+
Do more from the command line with [Murano](https://exosite.com/platform/)
|
|
9
|
+
|
|
10
|
+
MuranoCLI is the command-line tool that interacts with Murano and makes different
|
|
11
|
+
tasks easier. MuranoCLI makes it easy to deploy code to a solution, import many
|
|
12
|
+
product definitions at once, set up endpoints and APIs, and more.
|
|
13
|
+
|
|
14
|
+
MuranoCLI works around the idea of syncing, much like rsync. Files from your project
|
|
15
|
+
directory are synced up (or down) from Murano.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### To start from an existing project in Murano
|
|
21
|
+
```
|
|
22
|
+
mkdir myproject
|
|
23
|
+
cd myproject
|
|
24
|
+
murano config solution.id XXXXXX
|
|
25
|
+
murano syncdown -V
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Do stuff, see what changed: `murano status` or `murano diff`.
|
|
29
|
+
Then deploy with `murano syncup`
|
|
30
|
+
|
|
31
|
+
### To start a brand new project
|
|
32
|
+
There are a few steps and pieces to getting a solution with a product up and
|
|
33
|
+
running in Murano. Here is the list.
|
|
34
|
+
|
|
35
|
+
- Pick a business: `murano business list`
|
|
36
|
+
If this is the first time you've run `murano` it will ask for your Murano username
|
|
37
|
+
and password.
|
|
38
|
+
- Set it: `murano config business.id ZZZZZZZZZ`
|
|
39
|
+
- Create a product: `murano product create myawesomeproduct --save`
|
|
40
|
+
- Add resource aliases to specs/resources.yaml
|
|
41
|
+
- Sync the product definition up: `murano syncup -V --specs`
|
|
42
|
+
- Create a solution: `murano solution create myawesomesolution --save`
|
|
43
|
+
- Sync solution code up: `murano syncup -V`
|
|
44
|
+
- Assign the product to the solution: `murano assign set`
|
|
45
|
+
|
|
46
|
+
Do stuff, see what changed: `murano status` or `murano diff`.
|
|
47
|
+
Then deploy with `murano syncup`
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
### Gem Install (Linux and Macos)
|
|
52
|
+
|
|
53
|
+
When upgrading from a 1.\* version to a 2.0, you should uninstall the old versions
|
|
54
|
+
first.
|
|
55
|
+
```
|
|
56
|
+
> gem uninstall MuranoCLI`
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
And then install:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
> gem install MuranoCLI
|
|
63
|
+
```
|
|
64
|
+
Or
|
|
65
|
+
```
|
|
66
|
+
> gem update MuranoCLI
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
You will likely need to be root for the above commands. If you would rather not
|
|
70
|
+
install as root, you can install gems in the user directory.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
> gem install MuranoCLI --user-install
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Your `PATH` may need to be updated to find the installed `murano` command. See the
|
|
77
|
+
[Ruby Gem FAQ](http://guides.rubygems.org/faqs/#user-install). In short, you need
|
|
78
|
+
to add the output of `ruby -rubygems -e 'puts Gem.user_dir'` to your `PATH`.
|
|
79
|
+
|
|
80
|
+
### Windows Install
|
|
81
|
+
|
|
82
|
+
The MuranoCLI gem will install on Windows. There is also a single Windows binary
|
|
83
|
+
Setup installer available in [releases](https://github.com/exosite/MuranoCLI/releases)
|
|
84
|
+
|
|
85
|
+
If you do not already use Ruby on Windows, then you should use the binary
|
|
86
|
+
installer.
|
|
87
|
+
|
|
88
|
+
When upgrading, it is best to run the uninstaller for the old version before
|
|
89
|
+
installing the new version.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
### Logs
|
|
95
|
+
|
|
96
|
+
You can monitor the log messages from your solution with the `murano logs --follow`.
|
|
97
|
+
Or quickly get the last few with `murano logs`
|
|
98
|
+
|
|
99
|
+
MuranoCLI does a few things to make your log output easier to follow.
|
|
100
|
+
- Adds color to easily see where each log message starts.
|
|
101
|
+
- Reformats the timestamps to be in local time.
|
|
102
|
+
- Finds JSON blobs and pretty prints them.
|
|
103
|
+
|
|
104
|
+
All of these can be toggled with command line options.
|
|
105
|
+
|
|
106
|
+
### MURANO_CONFIGFILE environment and Dotenv
|
|
107
|
+
|
|
108
|
+
The environment variable `MURANO_CONFIGFILE` is checked for an additional config to
|
|
109
|
+
load. This in conjunction with dotenv support, allows for easily switching between
|
|
110
|
+
development, staging, and production setups.
|
|
111
|
+
|
|
112
|
+
To use this, write the three solution ids into `.murano.dev`, `.murano.stg`,
|
|
113
|
+
and `.murano.prod`. Then write the `.env` file to point at the system you're
|
|
114
|
+
currently working on.
|
|
115
|
+
|
|
116
|
+
The files for this are then:
|
|
117
|
+
```
|
|
118
|
+
cat >> .murano.dev <<EOF
|
|
119
|
+
[solution]
|
|
120
|
+
id=AAAAAAAA
|
|
121
|
+
EOF
|
|
122
|
+
|
|
123
|
+
cat >> .murano.stg <<EOF
|
|
124
|
+
[solution]
|
|
125
|
+
id=BBBBBBBB
|
|
126
|
+
EOF
|
|
127
|
+
|
|
128
|
+
cat >> .murano.prod <<EOF
|
|
129
|
+
[solution]
|
|
130
|
+
id=CCCCCCCC
|
|
131
|
+
EOF
|
|
132
|
+
|
|
133
|
+
cat > .env <<EOF
|
|
134
|
+
MURANO_CONFIGFILE=.murano.dev
|
|
135
|
+
EOF
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This also allows for keeping private things in a separate config file and having
|
|
139
|
+
the shared things checked into source control.
|
|
140
|
+
|
|
141
|
+
### Direct Service Access
|
|
142
|
+
|
|
143
|
+
To aid with debugging, MuranoCLI has direct access to some of the services in a
|
|
144
|
+
solution.
|
|
145
|
+
|
|
146
|
+
Currently these are:
|
|
147
|
+
- Keystore: `murano keystore`
|
|
148
|
+
- TSDB: `murano tsdb`
|
|
149
|
+
|
|
150
|
+
### Output Format
|
|
151
|
+
|
|
152
|
+
Many sub-commands respect the `outformat` setting. This lets you switch the output
|
|
153
|
+
between YAML, JSON, Ruby, CSV, and pretty tables. Not all formats work with all
|
|
154
|
+
commands.
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
> murano tsdb product list
|
|
158
|
+
> murano tsdb product list -c outformat=csv
|
|
159
|
+
> murano tsdb product list -c outformat=json
|
|
160
|
+
> murano tsdb product list -c outformat=yaml
|
|
161
|
+
> murano tsdb product list -c outformat=pp
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Product Content Area
|
|
165
|
+
|
|
166
|
+
MuranoCLI can manage the content area for a product. This area is a place to store
|
|
167
|
+
files for use by devices. Typically holding firmware images for Over-The-Air
|
|
168
|
+
updating. Although any kind of fleet wide data that devices may need to download
|
|
169
|
+
can be stored here.
|
|
170
|
+
|
|
171
|
+
Once the `product.id` is set, the content for that product can be accessed with the
|
|
172
|
+
following commands:
|
|
173
|
+
```
|
|
174
|
+
> murano content list
|
|
175
|
+
> murano content upload
|
|
176
|
+
> murano content info
|
|
177
|
+
> murano content delete
|
|
178
|
+
> murano content download
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Call them with `--help` for details.
|
|
182
|
+
|
|
183
|
+
## Developing
|
|
184
|
+
|
|
185
|
+
MuranoCLI uses [git flow](https://github.com/nvie/gitflow#getting-started) for
|
|
186
|
+
[managing branches](http://nvie.com/posts/a-successful-git-branching-model/).
|
|
187
|
+
|
|
188
|
+
MuranoCLI also uses [bundler](http://bundler.io).
|
|
189
|
+
|
|
190
|
+
When submitting pull requests, please do them against the develop branch.
|
|
191
|
+
|
|
192
|
+
### Tests
|
|
193
|
+
All test for MuranoCLI are done with rspec.
|
|
194
|
+
|
|
195
|
+
The tests are internal (`--tag ~cmd`) or command (`--tag cmd`). The internal tests
|
|
196
|
+
are for the objects that build up the internals. The command tests run `murano` from
|
|
197
|
+
the shell and are for testing the user facing components. A subset of the command
|
|
198
|
+
tests work with the live Murano servers (`--tag needs_password`).
|
|
199
|
+
|
|
200
|
+
To use the live tests, the following environment variables need to be set:
|
|
201
|
+
- `MURANO_USER` : User name to log into Murano with
|
|
202
|
+
- `MURNO_PASSWORD` : Password for that user
|
|
203
|
+
- `MURANO_BUSINESS` : Business id to run tests within.
|
|
204
|
+
|
|
205
|
+
A free account on Murano is sufficient for these tests.
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require 'shellwords'
|
|
3
|
+
|
|
4
|
+
task :default => [:test]
|
|
5
|
+
|
|
6
|
+
tagName = "v#{Bundler::GemHelper.gemspec.version}"
|
|
7
|
+
gemName = "MuranoCLI-#{Bundler::GemHelper.gemspec.version}.gem"
|
|
8
|
+
builtGem = "pkg/#{gemName}"
|
|
9
|
+
|
|
10
|
+
desc "Install gem in user dir"
|
|
11
|
+
task :bob do
|
|
12
|
+
sh %{gem install --user-install #{builtGem}}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc "Uninstall from user dir"
|
|
16
|
+
task :unbob do
|
|
17
|
+
sh %{gem uninstall --user-install #{builtGem}}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
task :echo do
|
|
21
|
+
puts tagName
|
|
22
|
+
puts gemName
|
|
23
|
+
puts builtGem
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc "Prints a cmd to test this in another directory"
|
|
27
|
+
task :testwith do
|
|
28
|
+
pwd=Dir.pwd.sub(Dir.home, '~')
|
|
29
|
+
puts "ruby -I#{pwd}/lib #{pwd}/bin/murano "
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
desc 'Run RSpec'
|
|
33
|
+
task :rspec do
|
|
34
|
+
Dir.mkdir("report") unless File.directory?("report")
|
|
35
|
+
rv=RUBY_VERSION.gsub(/\./,'_')
|
|
36
|
+
sh %{rspec --format html --out report/index-#{rv}.html --format progress}
|
|
37
|
+
end
|
|
38
|
+
task :test => [:test_clean_up, :rspec]
|
|
39
|
+
|
|
40
|
+
desc "Clean out junk from prior hot tests"
|
|
41
|
+
task :test_clean_up do
|
|
42
|
+
if not ENV['MURANO_USER'].nil? and
|
|
43
|
+
not ENV['MURANO_BUSINESS'].nil? and
|
|
44
|
+
not ENV['MURANO_PASSWORD'].nil? then
|
|
45
|
+
|
|
46
|
+
ids = `ruby -Ilib bin/murano product list --idonly -c "user.name=#{ENV['MURANO_USER']}" -c net.host=bizapi.hosted.exosite.io -c business.id=#{ENV['MURANO_BUSINESS']}`.chomp
|
|
47
|
+
puts "Found prodcuts #{ids}; deleteing"
|
|
48
|
+
ids.split.each do |id|
|
|
49
|
+
sh %{ruby -Ilib bin/murano product delete #{id} -c user.name=#{ENV['MURANO_USER']} -c net.host=bizapi.hosted.exosite.io -c business.id=#{ENV['MURANO_BUSINESS']}}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
ids = `ruby -Ilib bin/murano solution list --idonly -c user.name=#{ENV['MURANO_USER']} -c net.host=bizapi.hosted.exosite.io -c business.id=#{ENV['MURANO_BUSINESS']}`.chomp
|
|
53
|
+
puts "Found solutions #{ids}; deleteing"
|
|
54
|
+
ids.split.each do |id|
|
|
55
|
+
sh %{ruby -Ilib bin/murano solution delete #{id} -c user.name=#{ENV['MURANO_USER']} -c net.host=bizapi.hosted.exosite.io -c business.id=#{ENV['MURANO_BUSINESS']}}
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
###
|
|
61
|
+
# When new tags are pushed to upstream, the CI will kick-in and build the release
|
|
62
|
+
namespace :git do
|
|
63
|
+
desc "Push only develop, master, and tags to origin"
|
|
64
|
+
task :origin do
|
|
65
|
+
sh %{git push origin develop}
|
|
66
|
+
sh %{git push origin master}
|
|
67
|
+
sh %{git push origin --tags}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
desc "Push only develop, master, and tags to upstream"
|
|
71
|
+
task :upstream do
|
|
72
|
+
sh %{git push upstream develop}
|
|
73
|
+
sh %{git push upstream master}
|
|
74
|
+
sh %{git push upstream --tags}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
desc "Push to origin and upstream"
|
|
78
|
+
task :all => [:origin, :upstream]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
desc "Build, install locally, and push gem"
|
|
82
|
+
task :gemit do
|
|
83
|
+
mrt=Bundler::GemHelper.gemspec.version
|
|
84
|
+
sh %{git checkout v#{mrt}}
|
|
85
|
+
Rake::Task[:build].invoke
|
|
86
|
+
Rake::Task[:bob].invoke
|
|
87
|
+
Rake::Task['push:gem'].invoke
|
|
88
|
+
sh %{git checkout develop}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
###########################################
|
|
92
|
+
# Tasks below are largly used by CI systems
|
|
93
|
+
namespace :push do
|
|
94
|
+
desc 'Push gem up to RubyGems'
|
|
95
|
+
task :gem do
|
|
96
|
+
sh %{gem push #{builtGem}}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
namespace :github do
|
|
100
|
+
desc "Make a release in Github"
|
|
101
|
+
task :makeRelease do
|
|
102
|
+
# ENV['GITHUB_TOKEN'] set by CI.
|
|
103
|
+
# ENV['GITHUB_USER'] set by CI.
|
|
104
|
+
# ENV['GITHUB_REPO'] set by CI
|
|
105
|
+
# Create Release
|
|
106
|
+
sh %{github-release info --tag #{tagName}} do |ok, res|
|
|
107
|
+
if not ok then
|
|
108
|
+
sh %{github-release release --tag #{tagName}}
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
desc 'Push gem up to Github Releases'
|
|
114
|
+
task :gem => [:makeRelease, :build] do
|
|
115
|
+
# ENV['GITHUB_TOKEN'] set by CI.
|
|
116
|
+
# ENV['GITHUB_USER'] set by CI.
|
|
117
|
+
# ENV['GITHUB_REPO'] set by CI
|
|
118
|
+
# upload gem
|
|
119
|
+
sh %{github-release upload --tag #{tagName} --name #{gemName} --file #{builtGem}}
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
desc "Copy tag commit message into Release Notes"
|
|
123
|
+
task :copyReleaseNotes do
|
|
124
|
+
tagMsg = `git tag -l -n999 #{tagName}`.lines
|
|
125
|
+
tagMsg.shift
|
|
126
|
+
msg = tagMsg.join().shellescape
|
|
127
|
+
sh %{github-release edit --tag #{tagName} --description #{msg}}
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
file "ReadMe.txt" => ['README.markdown'] do |t|
|
|
133
|
+
File.open(t.prerequisites.first) do |rio|
|
|
134
|
+
File.open(t.name, 'w') do |wio|
|
|
135
|
+
wio << rio.read.gsub(/\n/,"\r\n")
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if Gem.win_platform? then
|
|
141
|
+
file 'murano.exe' => Dir['lib/**/*.{rb,erb,yaml}'] do
|
|
142
|
+
# Need to find all dlls, because ocra isn't finding them for some reason.
|
|
143
|
+
gemdir = `gem env gemdir`.chomp
|
|
144
|
+
gemdlls = Dir[File.join(gemdir, 'extensions', '*')]
|
|
145
|
+
dataFiles = Dir['lib/**/*.{erb,yaml}']
|
|
146
|
+
others = gemdlls + dataFiles
|
|
147
|
+
ENV['RUBYLIB'] = 'lib'
|
|
148
|
+
sh %{ocra bin/murano #{others.join(' ')}}
|
|
149
|
+
end
|
|
150
|
+
task :wexe => ['murano.exe']
|
|
151
|
+
|
|
152
|
+
desc 'Run rspec on cmd tests using murano.exe'
|
|
153
|
+
task :murano_exe_test => ['murano.exe'] do
|
|
154
|
+
Dir.mkdir("report") unless File.directory?("report")
|
|
155
|
+
ENV['CI_MR_EXE'] = '1'
|
|
156
|
+
sh %{rspec --format html --out report/murano_exe.html --format progress --tag cmd}
|
|
157
|
+
end
|
|
158
|
+
task :test => [:murano_exe_test]
|
|
159
|
+
|
|
160
|
+
installerName = "Output/MuranoCLI-#{Bundler::GemHelper.gemspec.version.to_s}-Setup.exe"
|
|
161
|
+
|
|
162
|
+
desc "Build a Windows installer for MuranoCLI"
|
|
163
|
+
task :inno => [installerName]
|
|
164
|
+
|
|
165
|
+
file "Output/MuranoCLISetup.exe" => ['murano.exe', 'ReadMe.txt'] do
|
|
166
|
+
ENV['MRVERSION'] = Bundler::GemHelper.gemspec.version.to_s
|
|
167
|
+
sh %{"C:\\Program Files (x86)\\Inno Setup 5\\iscc.exe" MuranoCLI.iss}
|
|
168
|
+
end
|
|
169
|
+
file installerName => ['Output/MuranoCLISetup.exe'] do |t|
|
|
170
|
+
FileUtils.move t.prerequisites.first, t.name, :verbose=>true
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
namespace :push do
|
|
174
|
+
namespace :github do
|
|
175
|
+
desc "Push Windows installer to Github Releases"
|
|
176
|
+
task :inno => [:makeRelease, installerName] do
|
|
177
|
+
# ENV['GITHUB_TOKEN'] set by CI.
|
|
178
|
+
# ENV['GITHUB_USER'] set by CI.
|
|
179
|
+
# ENV['GITHUB_REPO'] set by CI
|
|
180
|
+
iname = File.basename(installerName)
|
|
181
|
+
sh %{github-release upload --tag #{tagName} --name #{iname} --file #{installerName}}
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# vim: set sw=4 ts=4 :
|
|
188
|
+
|