MrMurano 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d80701051b1837ecfe462e1487ec2cc238e54b9
4
- data.tar.gz: 40e4cca578b534b259092f496d161697969e5bf6
3
+ metadata.gz: 08043fd1cb5602fd295ab448b40143d91cfbf6c2
4
+ data.tar.gz: 5446486ffce9f83d28f0ccb3172e882d480fbce2
5
5
  SHA512:
6
- metadata.gz: e24973636dfb33ec1343886be2196d03338ea377a49f7b7a6598fe456c9b426c0064a89f9dc99e8199a18c226287a63ab1fe2deb958a44434f2103b925e18a1f
7
- data.tar.gz: 53bed541a095ba1ecf0ba52003e3f13c0a5f2c563737a9e6bcd51634c3aebee02dbc1107f9a4bbb96e0ac2f5babb619a40c2fa4c6f347d9aac4371c5e62f675f
6
+ metadata.gz: 6037888fc38ad48dbdb315da51e2410aba14ffa6302b7286bcbe401a0c97a37e281f7ec48c5196132ebb3aa27f02f1cff14e697840feb80615089eca88e103bf
7
+ data.tar.gz: 65045aed6de179a7eb526f40361f0e8f4844ff396e7277408fa665fa8177c17b60d1c0a26b5bb0b28703859e1fe5cd0cae4ccecc3a4eefcae22e98591dd3e6d5
data/TODO.taskpaper CHANGED
@@ -1,9 +1,11 @@
1
1
 
2
2
  Commands:
3
+ - Status will show things have changes when they don’t.
4
+ - Default for most commands should be -same @done(2016-08-02)
3
5
  - Add Diff Command @done(2016-07-27)
4
6
 
5
7
  Endpoints:
6
- - Add support for multiple endpoints in one file
8
+ - Add support for multiple endpoints in one file (maybe)
7
9
  - Add directory support like in modules @done(2016-07-26)
8
10
 
9
11
  Files:
@@ -22,6 +24,7 @@ Product:
22
24
 
23
25
  Config:
24
26
  - Think about adding dev,staging,prod system; how would that work?
27
+ Would it work ok to just use the --configfile option?
25
28
 
26
29
  SolutionBase:
27
30
  - All network traffic is serialized. Make some parallel.
@@ -126,15 +126,17 @@ module MrMurano
126
126
  end
127
127
  end
128
128
 
129
- # This is largely for testing.
130
129
  command :account do |c|
131
- c.syntax = %{mr account ...}
130
+ c.syntax = %{mr account [options]}
132
131
  c.description = %{Show things about your account.}
133
132
  c.option '--businesses', 'Get businesses for user'
134
133
  c.option '--products', 'Get products for user (needs a business)'
135
134
  c.option '--solutions', 'Get solutions for user (needs a business)'
136
135
  c.option '--idonly', 'Only return the ids'
137
136
 
137
+ c.example %{List all businesses}, 'mr account --businesses'
138
+ c.example %{List solutions}, 'mr account --solutions -c business.id=XXXXXXXX'
139
+
138
140
  c.action do |args, options|
139
141
 
140
142
  acc = MrMurano::Account.new
@@ -32,6 +32,7 @@ module MrMurano
32
32
  say_error ":: #{response.body}"
33
33
  end
34
34
  end
35
+ remote.reject!{|k,v| k==:synckey}
35
36
  post('/', remote)
36
37
  end
37
38
 
@@ -46,7 +47,7 @@ module MrMurano
46
47
  here.delete_if do |i|
47
48
  Hash.transform_keys_to_symbols(i)[@itemkey] == item[@itemkey]
48
49
  end
49
- here << item
50
+ here << item.reject{|k,v| k==:synckey}
50
51
  local.open('wb') do |io|
51
52
  io.write here.map{|i| Hash.transform_keys_to_strings(i)}.to_yaml
52
53
  end
@@ -231,6 +231,7 @@ module MrMurano
231
231
  end
232
232
  end
233
233
  if options.create then
234
+ pp toadd
234
235
  toadd.each do |item|
235
236
  verbose "Adding item #{item[:synckey]}"
236
237
  unless $cfg['tool.dry'] then
@@ -296,8 +297,8 @@ module MrMurano
296
297
  tomod = []
297
298
  unchg = []
298
299
  if options.asdown then
299
- todel = (herebox.keys - therebox.keys).map{|key| therebox[key] }
300
- toadd = (therebox.keys - herebox.keys).map{|key| herebox[key] }
300
+ todel = (herebox.keys - therebox.keys).map{|key| herebox[key] }
301
+ toadd = (therebox.keys - herebox.keys).map{|key| therebox[key] }
301
302
  else
302
303
  toadd = (herebox.keys - therebox.keys).map{|key| herebox[key] }
303
304
  todel = (therebox.keys - herebox.keys).map{|key| therebox[key] }
@@ -156,22 +156,48 @@ module MrMurano
156
156
  end
157
157
 
158
158
  end
159
+
160
+ ##
161
+ # IF none of -same, then -same; else just the ones listed.
162
+ def self.checkSAME(opt)
163
+ unless opt.files or opt.endpoints or opt.modules or
164
+ opt.eventhandlers or opt.roles or opt.users then
165
+ opt.files = true
166
+ opt.endpoints = true
167
+ opt.modules = true
168
+ opt.eventhandlers = true
169
+ end
170
+ if opt.all then
171
+ opt.files = true
172
+ opt.endpoints = true
173
+ opt.modules = true
174
+ opt.eventhandlers = true
175
+ opt.roles = true
176
+ opt.users = true
177
+ end
178
+ end
159
179
  end
160
180
 
161
181
  command :config do |c|
162
182
  c.syntax = %{mr config [options] <key> [<new value>]}
163
183
  c.summary = %{Get and set options}
164
184
  c.description = %{
165
- You can get, set, or query config options with this command. All config options
166
- are in a 'section.key' format. There is also a layer of scopes that the keys can
167
- be saved in.
168
-
185
+ You can get, set, or query config options with this command. All config
186
+ options are in a 'section.key' format. There is also a layer of scopes
187
+ that the keys can be saved in.
169
188
  }
170
189
 
171
190
  c.example %{See what the current combined config is}, 'mr config --dump'
191
+ c.example %{Query a value}, 'mr config solution.id'
192
+ c.example %{Set a new value; writing to the project config file}, 'mr config solution.id XXXXXXXX'
193
+ c.example %{Set a new value; writing to the private config file}, 'mr config --private solution.id XXXXXXXX'
194
+ c.example %{Set a new value; writing to the user config file}, 'mr config --user user.name my@email.address'
195
+ c.example %{Unset a value in a configfile. (lower scopes will become visible if set)},
196
+ 'mr config diff.cmd --unset'
197
+
172
198
 
173
- c.option '--system', 'Use only the system config file'
174
- c.option '--user', 'Use only the config file in $HOME'
199
+ c.option '--system', 'Use only the system config file. (/etc/mrmuranorc)'
200
+ c.option '--user', 'Use only the config file in $HOME (.mrmuranorc)'
175
201
  c.option '--project', 'Use only the config file in the project (.mrmuranorc)'
176
202
  c.option '--private', 'Use only the private config file in the project (.mrmuranorc.private)'
177
203
  c.option '--specified', 'Use only the config file from the --config option.'
@@ -196,7 +222,7 @@ command :config do |c|
196
222
  scopes << :project if options.project
197
223
  scopes << :private if options.private
198
224
  scopes << :specified if options.specified
199
- scopes = MrMurano::Config.CFG_SCOPES if scopes.empty?
225
+ scopes = MrMurano::Config::CFG_SCOPES if scopes.empty?
200
226
 
201
227
  say $cfg.get(args[0], scopes)
202
228
  else
@@ -3,12 +3,12 @@ command :status do |c|
3
3
  c.syntax = %{mr status [options]}
4
4
  c.description = %{Get the status of files}
5
5
  c.option '--all', 'Check everything'
6
- c.option '-s','--files', %{Static Files}
7
- c.option '-a','--endpoints', %{Endpoints}
8
- c.option '-m','--modules', %{Modules}
9
- c.option '-e','--eventhandlers', %{Event Handlers}
10
- c.option '--roles', %{Roles}
11
- c.option '--users', %{Users}
6
+ c.option '-s','--[no-]files', %{Static Files}
7
+ c.option '-a','--[no-]endpoints', %{Endpoints}
8
+ c.option '-m','--[no-]modules', %{Modules}
9
+ c.option '-e','--[no-]eventhandlers', %{Event Handlers}
10
+ c.option '--[no-]roles', %{Roles}
11
+ c.option '--[no-]users', %{Users}
12
12
 
13
13
  c.option '--[no-]asdown', %{Report as if syncdown instead of syncup}
14
14
  c.option '--[no-]diff', %{For modified items, show a diff}
@@ -16,16 +16,10 @@ command :status do |c|
16
16
  c.option '--[no-]showall', %{List unchanged as well}
17
17
 
18
18
  c.action do |args,options|
19
- options.default :delete=>true, :create=>true, :update=>true, :diff=>false, :grouped => true
19
+ options.default :delete=>true, :create=>true, :update=>true, :diff=>false,
20
+ :grouped => true
20
21
 
21
- if options.all then
22
- options.files = true
23
- options.endpoints = true
24
- options.modules = true
25
- options.roles = true
26
- options.users = true
27
- options.eventhandlers = true
28
- end
22
+ MrMurano.checkSAME(options)
29
23
 
30
24
  def fmtr(item)
31
25
  if item.has_key? :local_path then
@@ -64,37 +58,37 @@ command :status do |c|
64
58
  if options.endpoints then
65
59
  sol = MrMurano::Endpoint.new
66
60
  ret = sol.status($cfg['location.base'] + $cfg['location.endpoints'], options)
67
- gmerge(ret, ' EP ', options)
61
+ gmerge(ret, 'A', options)
68
62
  end
69
63
 
70
64
  if options.modules then
71
65
  sol = MrMurano::Library.new
72
66
  ret = sol.status( $cfg['location.base'] + $cfg['location.modules'], options)
73
- gmerge(ret, 'MOD ', options)
67
+ gmerge(ret, 'M', options)
74
68
  end
75
69
 
76
70
  if options.eventhandlers then
77
71
  sol = MrMurano::EventHandler.new
78
72
  ret = sol.status( $cfg['location.base'] + $cfg['location.eventhandlers'], options)
79
- gmerge(ret, ' EH ', options)
73
+ gmerge(ret, 'E', options)
80
74
  end
81
75
 
82
76
  if options.roles then
83
77
  sol = MrMurano::Role.new
84
78
  ret = sol.status( $cfg['location.base'] + $cfg['location.roles'], options)
85
- gmerge(ret, 'ROLE', options)
79
+ gmerge(ret, 'R', options)
86
80
  end
87
81
 
88
82
  if options.users then
89
83
  sol = MrMurano::User.new
90
84
  ret = sol.status( $cfg['location.base'] + $cfg['location.users'], options)
91
- gmerge(ret, 'USER', options)
85
+ gmerge(ret, 'U', options)
92
86
  end
93
87
 
94
88
  if options.files then
95
89
  sol = MrMurano::File.new
96
90
  ret = sol.status( $cfg['location.base'] + $cfg['location.files'], options)
97
- gmerge(ret, 'FILE', options)
91
+ gmerge(ret, 'S', options)
98
92
  end
99
93
 
100
94
  pretty(@grouped, options) if options.grouped
data/lib/MrMurano/sync.rb CHANGED
@@ -3,10 +3,10 @@ command :syncdown do |c|
3
3
  c.syntax = %{mr syncdown [options]}
4
4
  c.description = %{Sync project down from Murano}
5
5
  c.option '--all', 'Sync everything'
6
- c.option '-s','--files', %{Sync Static Files}
7
- c.option '-a','--endpoints', %{Sync Endpoints}
8
- c.option '-m','--modules', %{Sync Modules}
9
- c.option '-e','--eventhandlers', %{Sync Event Handlers}
6
+ c.option '-s','--[no-]files', %{Sync Static Files}
7
+ c.option '-a','--[no-]endpoints', %{Sync Endpoints}
8
+ c.option '-m','--[no-]modules', %{Sync Modules}
9
+ c.option '-e','--[no-]eventhandlers', %{Sync Event Handlers}
10
10
  c.option '--roles', %{Sync Roles}
11
11
  c.option '--users', %{Sync Users}
12
12
 
@@ -20,15 +20,7 @@ command :syncdown do |c|
20
20
 
21
21
  c.action do |args,options|
22
22
  options.default :delete=>true, :create=>true, :update=>true
23
-
24
- if options.all then
25
- options.files = true
26
- options.endpoints = true
27
- options.modules = true
28
- options.roles = true
29
- options.users = true
30
- options.eventhandlers = true
31
- end
23
+ MrMurano.checkSAME(options)
32
24
 
33
25
  if options.endpoints then
34
26
  sol = MrMurano::Endpoint.new
@@ -68,10 +60,10 @@ command :syncup do |c|
68
60
  c.syntax = %{mr syncup [options]}
69
61
  c.description = %{Sync project up into Murano}
70
62
  c.option '--all', 'Sync everything'
71
- c.option '-s','--files', %{Sync Static Files}
72
- c.option '-a','--endpoints', %{Sync Endpoints}
73
- c.option '-m','--modules', %{Sync Modules}
74
- c.option '-e','--eventhandlers', %{Sync Event Handlers}
63
+ c.option '-s','--[no-]files', %{Sync Static Files}
64
+ c.option '-a','--[no-]endpoints', %{Sync Endpoints}
65
+ c.option '-m','--[no-]modules', %{Sync Modules}
66
+ c.option '-e','--[no-]eventhandlers', %{Sync Event Handlers}
75
67
  c.option '--roles', %{Sync Roles}
76
68
  c.option '--users', %{Sync Users}
77
69
 
@@ -85,15 +77,7 @@ command :syncup do |c|
85
77
 
86
78
  c.action do |args,options|
87
79
  options.default :delete=>true, :create=>true, :update=>true
88
-
89
- if options.all then
90
- options.files = true
91
- options.endpoints = true
92
- options.modules = true
93
- options.roles = true
94
- options.users = true
95
- options.eventhandlers = true
96
- end
80
+ MrMurano.checkSAME(options)
97
81
 
98
82
  if options.endpoints then
99
83
  sol = MrMurano::Endpoint.new
@@ -1,4 +1,4 @@
1
1
  module MrMurano
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.0.3'.freeze
3
3
  end
4
4
 
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.0.2
4
+ version: 1.0.3
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-08-02 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander