MrMurano 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/MrMurano.rb +12 -14
- data/lib/MrMurano/Account.rb +53 -2
- data/lib/MrMurano/Product.rb +0 -2
- data/lib/MrMurano/Solution-Endpoint.rb +0 -1
- data/lib/MrMurano/Solution-File.rb +0 -1
- data/lib/MrMurano/Solution-ServiceConfig.rb +52 -1
- data/lib/MrMurano/Solution-Services.rb +0 -1
- data/lib/MrMurano/Solution-Users.rb +0 -1
- data/lib/MrMurano/Solution.rb +0 -3
- data/lib/MrMurano/{Config.rb → configFile.rb} +0 -0
- data/lib/MrMurano/exportImport.rb +13 -30
- data/lib/MrMurano/timeseries.rb +1 -1
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account-Passwords_spec.rb +11 -2
- data/spec/ProductBase_spec.rb +3 -0
- data/spec/ProductContent_spec.rb +3 -0
- data/spec/Product_spec.rb +3 -0
- metadata +3 -5
- data/lib/MrMurano/accountCommand.rb +0 -54
- data/lib/MrMurano/assignCommand.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0271003380ad3597a7b8522db408a955f9e0678f
|
4
|
+
data.tar.gz: e36306d65362a9c67bca0b504713aecfa9f16a1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b032e0e3f04e2c9f2b6be2cc01584bd8b93484027a6509b0bd2657b25dda5d6e13fe3bbd8f0e6ffbc6860765c4b0386201c8625f986775196cbc4141f707b24f
|
7
|
+
data.tar.gz: c666e9604c69f2385d5ddea60232027a05714605b5ffa0900783c9f53b7a601fc617e2b4f788ed8af91b3f8fac06c92dae1a85b083c21b9f7f6aad434ed3e92b
|
data/lib/MrMurano.rb
CHANGED
@@ -1,26 +1,24 @@
|
|
1
1
|
require 'MrMurano/version'
|
2
2
|
require 'MrMurano/verbosing'
|
3
|
-
require 'MrMurano/hash'
|
3
|
+
require 'MrMurano/hash.rb'
|
4
4
|
require 'MrMurano/http'
|
5
|
-
require 'MrMurano/
|
5
|
+
require 'MrMurano/configFile'
|
6
6
|
require 'MrMurano/Account'
|
7
7
|
require 'MrMurano/Solution'
|
8
|
-
require 'MrMurano/Solution-Endpoint'
|
9
|
-
require 'MrMurano/Solution-File'
|
10
|
-
require 'MrMurano/Solution-Services'
|
11
|
-
require 'MrMurano/Solution-Users'
|
12
|
-
require 'MrMurano/Solution-ServiceConfig'
|
8
|
+
require 'MrMurano/Solution-Endpoint.rb'
|
9
|
+
require 'MrMurano/Solution-File.rb'
|
10
|
+
require 'MrMurano/Solution-Services.rb'
|
11
|
+
require 'MrMurano/Solution-Users.rb'
|
12
|
+
require 'MrMurano/Solution-ServiceConfig.rb'
|
13
13
|
require 'MrMurano/Product'
|
14
14
|
|
15
|
-
require 'MrMurano/accountCommand'
|
16
|
-
require 'MrMurano/assignCommand'
|
17
15
|
require 'MrMurano/configCommand'
|
18
16
|
require 'MrMurano/contentCommand'
|
19
17
|
require 'MrMurano/cors'
|
20
18
|
require 'MrMurano/exportImport'
|
21
|
-
require 'MrMurano/keystore'
|
22
|
-
require 'MrMurano/logs'
|
23
|
-
require 'MrMurano/
|
24
|
-
require 'MrMurano/
|
25
|
-
require 'MrMurano/timeseries'
|
19
|
+
require 'MrMurano/keystore.rb'
|
20
|
+
require 'MrMurano/logs.rb'
|
21
|
+
require 'MrMurano/sync.rb'
|
22
|
+
require 'MrMurano/status.rb'
|
23
|
+
require 'MrMurano/timeseries.rb'
|
26
24
|
#require 'MrMurano/shelledCommand'
|
data/lib/MrMurano/Account.rb
CHANGED
@@ -2,10 +2,10 @@ require 'uri'
|
|
2
2
|
require 'net/http'
|
3
3
|
require 'json'
|
4
4
|
require 'date'
|
5
|
+
require 'pp'
|
6
|
+
require 'terminal-table'
|
5
7
|
require 'pathname'
|
6
8
|
require 'yaml'
|
7
|
-
require 'MrMurano/Config'
|
8
|
-
require 'MrMurano/http'
|
9
9
|
|
10
10
|
module MrMurano
|
11
11
|
class Passwords
|
@@ -125,4 +125,55 @@ module MrMurano
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
+
command :account do |c|
|
129
|
+
c.syntax = %{mr account [options]}
|
130
|
+
c.description = %{Show things about your account.}
|
131
|
+
c.option '--businesses', 'Get businesses for user'
|
132
|
+
c.option '--products', 'Get products for user (needs a business)'
|
133
|
+
c.option '--solutions', 'Get solutions for user (needs a business)'
|
134
|
+
c.option '--idonly', 'Only return the ids'
|
135
|
+
|
136
|
+
c.example %{List all businesses}, 'mr account --businesses'
|
137
|
+
c.example %{List solutions}, 'mr account --solutions -c business.id=XXXXXXXX'
|
138
|
+
|
139
|
+
c.action do |args, options|
|
140
|
+
|
141
|
+
acc = MrMurano::Account.new
|
142
|
+
|
143
|
+
if options.businesses then
|
144
|
+
data = acc.businesses
|
145
|
+
if options.idonly then
|
146
|
+
say data.map{|row| row[:bizid]}.join(' ')
|
147
|
+
else
|
148
|
+
busy = data.map{|row| [row[:bizid], row[:role], row[:name]]}
|
149
|
+
table = Terminal::Table.new :rows => busy, :headings => ['Biz ID', 'Role', 'Name']
|
150
|
+
say table
|
151
|
+
end
|
152
|
+
|
153
|
+
elsif options.products then
|
154
|
+
data = acc.products
|
155
|
+
if options.idonly then
|
156
|
+
say data.map{|row| row[:pid]}.join(' ')
|
157
|
+
else
|
158
|
+
busy = data.map{|r| [r[:label], r[:type], r[:pid], r[:modelId]]}
|
159
|
+
table = Terminal::Table.new :rows => busy, :headings => ['Label', 'Type', 'PID', 'ModelID']
|
160
|
+
say table
|
161
|
+
end
|
162
|
+
|
163
|
+
elsif options.solutions then
|
164
|
+
data = acc.solutions
|
165
|
+
if options.idonly then
|
166
|
+
say data.map{|row| row[:apiId]}.join(' ')
|
167
|
+
else
|
168
|
+
busy = data.map{|r| [r[:apiId], r[:domain], r[:type], r[:sid]]}
|
169
|
+
table = Terminal::Table.new :rows => busy, :headings => ['API ID', 'Domain', 'Type', 'SID']
|
170
|
+
say table
|
171
|
+
end
|
172
|
+
|
173
|
+
else
|
174
|
+
say acc.token
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
end
|
128
179
|
# vim: set ai et sw=2 ts=2 :
|
data/lib/MrMurano/Product.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'terminal-table'
|
2
2
|
|
3
3
|
module MrMurano
|
4
4
|
# …/serviceconfig
|
@@ -51,4 +51,55 @@ module MrMurano
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
command 'assign list' do |c|
|
55
|
+
c.syntax = 'mr assign list [options]'
|
56
|
+
c.description = 'List the products that are assigned'
|
57
|
+
c.option '--idonly', 'Only return the ids'
|
58
|
+
c.action do |args, options|
|
59
|
+
sol = MrMurano::SC_Device.new
|
60
|
+
|
61
|
+
trigs = sol.showTriggers()
|
62
|
+
if options.idonly or $cfg['business.id'].nil? then
|
63
|
+
say trigs.join(' ')
|
64
|
+
else
|
65
|
+
acc = MrMurano::Account.new
|
66
|
+
products = acc.products
|
67
|
+
products.select!{|p| trigs.include? p[:modelId] }
|
68
|
+
if products.empty? then
|
69
|
+
say trigs.join(' ')
|
70
|
+
else
|
71
|
+
busy = products.map{|r| [r[:label], r[:type], r[:pid], r[:modelId]]}
|
72
|
+
table = Terminal::Table.new :rows => busy, :headings => ['Label', 'Type', 'PID', 'ModelID']
|
73
|
+
say table
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
alias_command :assign, 'assign list'
|
79
|
+
|
80
|
+
command 'assign set' do |c|
|
81
|
+
c.syntax = 'mr assign set [product]'
|
82
|
+
c.description = 'Assign a product to a eventhandler'
|
83
|
+
|
84
|
+
c.action do |args, options|
|
85
|
+
sol = MrMurano::SC_Device.new
|
86
|
+
|
87
|
+
prname = args.shift
|
88
|
+
if prname.nil? then
|
89
|
+
prid = $cfg['product.id']
|
90
|
+
else
|
91
|
+
acc = MrMurano::Account.new
|
92
|
+
products = acc.products
|
93
|
+
products.select!{|p|
|
94
|
+
p[:label] == prname or p[:modelId] == prname or p[:pid] == prname
|
95
|
+
}
|
96
|
+
prid = products.map{|p| p[:modelId]}
|
97
|
+
end
|
98
|
+
raise "No product ID!" if prid.nil?
|
99
|
+
say "Assigning #{prid} to solution" if $cfg['tool.verbose']
|
100
|
+
sol.assignTriggers(prid) unless $cfg['tool.dry']
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
54
105
|
# vim: set ai et sw=2 ts=2 :
|
data/lib/MrMurano/Solution.rb
CHANGED
File without changes
|
@@ -4,21 +4,11 @@ require 'fileutils'
|
|
4
4
|
|
5
5
|
command 'config export' do |c|
|
6
6
|
c.syntax = %{mr config export}
|
7
|
-
c.summary = %{Export data to
|
8
|
-
c.description = %{Export data to Solutionfiles
|
9
|
-
|
10
|
-
This will write to the Solutionfile.json and .Solutionfile.secret used by the
|
11
|
-
exosite-cil tool.
|
12
|
-
|
13
|
-
This also will merge all of the endpoints into a single 'routes.lua' file.
|
14
|
-
}
|
7
|
+
c.summary = %{Export data to a Solutionfile.json and .Solutionfile.secret}
|
15
8
|
|
16
9
|
c.option '--force', "Overwrite existing files."
|
17
|
-
c.option '--[no-]merge', "Merge endpoints into a single routes.lua file"
|
18
10
|
|
19
11
|
c.action do |args, options|
|
20
|
-
options.defaults :merge => true
|
21
|
-
|
22
12
|
solfile = Pathname.new($cfg['location.base'] + 'Solutionfile.json')
|
23
13
|
solsecret = Pathname.new($cfg['location.base'] + '.Solutionfile.secret')
|
24
14
|
|
@@ -27,26 +17,24 @@ command 'config export' do |c|
|
|
27
17
|
say "Use --force to overwrite"
|
28
18
|
end
|
29
19
|
|
20
|
+
epf = 'routes.lua'
|
21
|
+
File.open(epf, 'w') do |dst|
|
22
|
+
MrMurano::Endpoint.new.locallist.each do |ed|
|
23
|
+
ed[:local_path].open do |fin|
|
24
|
+
FileUtils.copy_stream(fin, dst)
|
25
|
+
end
|
26
|
+
dst << "\n\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
30
|
solf = {
|
31
|
+
:routes => 'epf',
|
31
32
|
:assets => $cfg['location.files'],
|
32
33
|
:default_page => $cfg['files.default_page'],
|
33
34
|
:services => {},
|
34
35
|
:modules => {}
|
35
36
|
}
|
36
37
|
|
37
|
-
if options.merge then
|
38
|
-
epf = 'routes.lua'
|
39
|
-
File.open(epf, 'w') do |dst|
|
40
|
-
MrMurano::Endpoint.new.locallist.each do |ed|
|
41
|
-
ed[:local_path].open do |fin|
|
42
|
-
FileUtils.copy_stream(fin, dst)
|
43
|
-
end
|
44
|
-
dst << "\n\n"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
solf[:routes] = epf
|
48
|
-
end
|
49
|
-
|
50
38
|
dpwd = Pathname.new(Dir.pwd)
|
51
39
|
MrMurano::EventHandler.new.locallist.each do |ev|
|
52
40
|
rp = ev[:local_path].relative_path_from(dpwd).to_s
|
@@ -83,12 +71,7 @@ end
|
|
83
71
|
|
84
72
|
command 'config import' do |c|
|
85
73
|
c.syntax = %{mr config import}
|
86
|
-
c.summary = %{Import data from
|
87
|
-
c.description = %{Import data from Solutionfiles
|
88
|
-
|
89
|
-
This imports from the Solutionfile.json and .Solutionfile.secret that are created
|
90
|
-
by the exosite-cli tool.
|
91
|
-
}
|
74
|
+
c.summary = %{Import data from a Solutionfile.json and .Solutionfile.secret}
|
92
75
|
|
93
76
|
c.action do |args, options|
|
94
77
|
solfile = ($cfg['location.base'] + 'Solutionfile.json')
|
data/lib/MrMurano/timeseries.rb
CHANGED
data/lib/MrMurano/version.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'commander/import'
|
3
|
+
require 'MrMurano'
|
3
4
|
require 'tempfile'
|
4
5
|
|
6
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
7
|
+
# Some kludgery to work around commander. Likely a better way to do this.
|
8
|
+
program :version, MrMurano::VERSION
|
9
|
+
program :description, %{Manage a Solution in Exosite's Murano}
|
10
|
+
command(:nop){ |c| c.action {|a,o|} }
|
11
|
+
default_command :nop
|
12
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
13
|
+
|
5
14
|
RSpec.describe MrMurano::Passwords, "#pwd" do
|
6
15
|
it "Creates a file " do
|
7
16
|
tmpfile = Dir.tmpdir + '/pwtest' # This way because Tempfile.new creates.
|
data/spec/ProductBase_spec.rb
CHANGED
data/spec/ProductContent_spec.rb
CHANGED
data/spec/Product_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MrMurano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Conrad Tadpol Tilstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -185,7 +185,6 @@ files:
|
|
185
185
|
- bin/mr
|
186
186
|
- lib/MrMurano.rb
|
187
187
|
- lib/MrMurano/Account.rb
|
188
|
-
- lib/MrMurano/Config.rb
|
189
188
|
- lib/MrMurano/Product.rb
|
190
189
|
- lib/MrMurano/Solution-Endpoint.rb
|
191
190
|
- lib/MrMurano/Solution-File.rb
|
@@ -193,9 +192,8 @@ files:
|
|
193
192
|
- lib/MrMurano/Solution-Services.rb
|
194
193
|
- lib/MrMurano/Solution-Users.rb
|
195
194
|
- lib/MrMurano/Solution.rb
|
196
|
-
- lib/MrMurano/accountCommand.rb
|
197
|
-
- lib/MrMurano/assignCommand.rb
|
198
195
|
- lib/MrMurano/configCommand.rb
|
196
|
+
- lib/MrMurano/configFile.rb
|
199
197
|
- lib/MrMurano/contentCommand.rb
|
200
198
|
- lib/MrMurano/cors.rb
|
201
199
|
- lib/MrMurano/exportImport.rb
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'terminal-table'
|
2
|
-
|
3
|
-
command :account do |c|
|
4
|
-
c.syntax = %{mr account [options]}
|
5
|
-
c.description = %{Show things about your account.}
|
6
|
-
c.option '--businesses', 'Get businesses for user'
|
7
|
-
c.option '--products', 'Get products for user (needs a business)'
|
8
|
-
c.option '--solutions', 'Get solutions for user (needs a business)'
|
9
|
-
c.option '--idonly', 'Only return the ids'
|
10
|
-
|
11
|
-
c.example %{List all businesses}, 'mr account --businesses'
|
12
|
-
c.example %{List solutions}, 'mr account --solutions -c business.id=XXXXXXXX'
|
13
|
-
|
14
|
-
c.action do |args, options|
|
15
|
-
|
16
|
-
acc = MrMurano::Account.new
|
17
|
-
|
18
|
-
if options.businesses then
|
19
|
-
data = acc.businesses
|
20
|
-
if options.idonly then
|
21
|
-
say data.map{|row| row[:bizid]}.join(' ')
|
22
|
-
else
|
23
|
-
busy = data.map{|row| [row[:bizid], row[:role], row[:name]]}
|
24
|
-
table = Terminal::Table.new :rows => busy, :headings => ['Biz ID', 'Role', 'Name']
|
25
|
-
say table
|
26
|
-
end
|
27
|
-
|
28
|
-
elsif options.products then
|
29
|
-
data = acc.products
|
30
|
-
if options.idonly then
|
31
|
-
say data.map{|row| row[:pid]}.join(' ')
|
32
|
-
else
|
33
|
-
busy = data.map{|r| [r[:label], r[:type], r[:pid], r[:modelId]]}
|
34
|
-
table = Terminal::Table.new :rows => busy, :headings => ['Label', 'Type', 'PID', 'ModelID']
|
35
|
-
say table
|
36
|
-
end
|
37
|
-
|
38
|
-
elsif options.solutions then
|
39
|
-
data = acc.solutions
|
40
|
-
if options.idonly then
|
41
|
-
say data.map{|row| row[:apiId]}.join(' ')
|
42
|
-
else
|
43
|
-
busy = data.map{|r| [r[:apiId], r[:domain], r[:type], r[:sid]]}
|
44
|
-
table = Terminal::Table.new :rows => busy, :headings => ['API ID', 'Domain', 'Type', 'SID']
|
45
|
-
say table
|
46
|
-
end
|
47
|
-
|
48
|
-
else
|
49
|
-
say acc.token
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
54
|
-
# vim: set ai et sw=2 ts=2 :
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'terminal-table'
|
2
|
-
|
3
|
-
command 'assign list' do |c|
|
4
|
-
c.syntax = 'mr assign list [options]'
|
5
|
-
c.description = 'List the products that are assigned'
|
6
|
-
c.option '--idonly', 'Only return the ids'
|
7
|
-
c.action do |args, options|
|
8
|
-
sol = MrMurano::SC_Device.new
|
9
|
-
|
10
|
-
trigs = sol.showTriggers()
|
11
|
-
if options.idonly or $cfg['business.id'].nil? then
|
12
|
-
say trigs.join(' ')
|
13
|
-
else
|
14
|
-
acc = MrMurano::Account.new
|
15
|
-
products = acc.products
|
16
|
-
products.select!{|p| trigs.include? p[:modelId] }
|
17
|
-
if products.empty? then
|
18
|
-
say trigs.join(' ')
|
19
|
-
else
|
20
|
-
busy = products.map{|r| [r[:label], r[:type], r[:pid], r[:modelId]]}
|
21
|
-
table = Terminal::Table.new :rows => busy, :headings => ['Label', 'Type', 'PID', 'ModelID']
|
22
|
-
say table
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
alias_command :assign, 'assign list'
|
28
|
-
|
29
|
-
command 'assign set' do |c|
|
30
|
-
c.syntax = 'mr assign set [product]'
|
31
|
-
c.description = 'Assign a product to a eventhandler'
|
32
|
-
|
33
|
-
c.action do |args, options|
|
34
|
-
sol = MrMurano::SC_Device.new
|
35
|
-
|
36
|
-
prname = args.shift
|
37
|
-
if prname.nil? then
|
38
|
-
prid = $cfg['product.id']
|
39
|
-
else
|
40
|
-
acc = MrMurano::Account.new
|
41
|
-
products = acc.products
|
42
|
-
products.select!{|p|
|
43
|
-
p[:label] == prname or p[:modelId] == prname or p[:pid] == prname
|
44
|
-
}
|
45
|
-
prid = products.map{|p| p[:modelId]}
|
46
|
-
end
|
47
|
-
raise "No product ID!" if prid.nil?
|
48
|
-
say "Assigning #{prid} to solution" if $cfg['tool.verbose']
|
49
|
-
sol.assignTriggers(prid) unless $cfg['tool.dry']
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
# vim: set ai et sw=2 ts=2 :
|