MuranoCLI 3.2.0.beta.1 → 3.2.0.beta.5

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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -1
  3. data/.trustme.plugin +137 -0
  4. data/.trustme.sh +217 -117
  5. data/.trustme.vim +9 -3
  6. data/Gemfile +9 -3
  7. data/MuranoCLI.gemspec +8 -5
  8. data/Rakefile +1 -0
  9. data/dockers/Dockerfile.2.2.9 +6 -3
  10. data/dockers/Dockerfile.2.3.6 +6 -3
  11. data/dockers/Dockerfile.2.4.3 +6 -3
  12. data/dockers/Dockerfile.2.5.0 +6 -3
  13. data/dockers/Dockerfile.GemRelease +10 -8
  14. data/dockers/Dockerfile.m4 +23 -5
  15. data/dockers/docker-test.sh +65 -28
  16. data/docs/completions/murano_completion-bash +751 -57
  17. data/docs/develop.rst +10 -9
  18. data/lib/MrMurano/AccountBase.rb +95 -6
  19. data/lib/MrMurano/Commander-Entry.rb +9 -4
  20. data/lib/MrMurano/Config-Migrate.rb +2 -0
  21. data/lib/MrMurano/Config.rb +94 -26
  22. data/lib/MrMurano/Content.rb +1 -1
  23. data/lib/MrMurano/Exchange.rb +77 -42
  24. data/lib/MrMurano/Gateway.rb +1 -1
  25. data/lib/MrMurano/HttpAuthed.rb +20 -7
  26. data/lib/MrMurano/Logs.rb +10 -1
  27. data/lib/MrMurano/ProjectFile.rb +1 -1
  28. data/lib/MrMurano/ReCommander.rb +129 -73
  29. data/lib/MrMurano/Solution-ServiceConfig.rb +18 -11
  30. data/lib/MrMurano/Solution-Services.rb +78 -50
  31. data/lib/MrMurano/Solution-Users.rb +1 -1
  32. data/lib/MrMurano/Solution.rb +13 -63
  33. data/lib/MrMurano/SyncUpDown-Core.rb +185 -77
  34. data/lib/MrMurano/SyncUpDown-Item.rb +29 -4
  35. data/lib/MrMurano/SyncUpDown.rb +11 -11
  36. data/lib/MrMurano/Webservice-Cors.rb +1 -1
  37. data/lib/MrMurano/Webservice-Endpoint.rb +28 -17
  38. data/lib/MrMurano/Webservice-File.rb +103 -43
  39. data/lib/MrMurano/commands/domain.rb +1 -0
  40. data/lib/MrMurano/commands/element.rb +585 -0
  41. data/lib/MrMurano/commands/exchange.rb +211 -204
  42. data/lib/MrMurano/commands/gb.rb +1 -0
  43. data/lib/MrMurano/commands/globals.rb +17 -7
  44. data/lib/MrMurano/commands/init.rb +115 -101
  45. data/lib/MrMurano/commands/keystore.rb +1 -1
  46. data/lib/MrMurano/commands/logs.rb +2 -1
  47. data/lib/MrMurano/commands/postgresql.rb +17 -7
  48. data/lib/MrMurano/commands/service.rb +572 -0
  49. data/lib/MrMurano/commands/show.rb +7 -3
  50. data/lib/MrMurano/commands/solution.rb +2 -1
  51. data/lib/MrMurano/commands/solution_picker.rb +31 -15
  52. data/lib/MrMurano/commands/status.rb +205 -169
  53. data/lib/MrMurano/commands/sync.rb +70 -38
  54. data/lib/MrMurano/commands/token.rb +59 -14
  55. data/lib/MrMurano/commands/usage.rb +1 -0
  56. data/lib/MrMurano/commands.rb +2 -0
  57. data/lib/MrMurano/hash.rb +91 -0
  58. data/lib/MrMurano/http.rb +55 -6
  59. data/lib/MrMurano/makePretty.rb +47 -0
  60. data/lib/MrMurano/optparse.rb +60 -45
  61. data/lib/MrMurano/variegated/TruthyFalsey.rb +48 -0
  62. data/lib/MrMurano/variegated/ruby_dig.rb +64 -0
  63. data/lib/MrMurano/verbosing.rb +113 -3
  64. data/lib/MrMurano/version.rb +1 -1
  65. data/spec/Account_spec.rb +34 -20
  66. data/spec/Business_spec.rb +12 -9
  67. data/spec/Config_spec.rb +7 -1
  68. data/spec/Content_spec.rb +17 -1
  69. data/spec/GatewayBase_spec.rb +5 -2
  70. data/spec/GatewayDevice_spec.rb +4 -2
  71. data/spec/GatewayResource_spec.rb +4 -1
  72. data/spec/GatewaySettings_spec.rb +4 -1
  73. data/spec/HttpAuthed_spec.rb +73 -0
  74. data/spec/Http_spec.rb +32 -35
  75. data/spec/ProjectFile_spec.rb +1 -1
  76. data/spec/Solution-ServiceConfig_spec.rb +4 -1
  77. data/spec/Solution-ServiceEventHandler_spec.rb +6 -3
  78. data/spec/Solution-ServiceModules_spec.rb +4 -1
  79. data/spec/Solution-UsersRoles_spec.rb +4 -1
  80. data/spec/Solution_spec.rb +4 -1
  81. data/spec/SyncUpDown_spec.rb +1 -1
  82. data/spec/Webservice-Cors_spec.rb +4 -1
  83. data/spec/Webservice-Endpoint_spec.rb +9 -6
  84. data/spec/Webservice-File_spec.rb +17 -4
  85. data/spec/Webservice-Setting_spec.rb +6 -2
  86. data/spec/_workspace.rb +2 -0
  87. data/spec/cmd_common.rb +42 -13
  88. data/spec/cmd_content_spec.rb +17 -7
  89. data/spec/cmd_device_spec.rb +1 -1
  90. data/spec/cmd_domain_spec.rb +2 -2
  91. data/spec/cmd_element_spec.rb +400 -0
  92. data/spec/cmd_exchange_spec.rb +2 -2
  93. data/spec/cmd_init_spec.rb +59 -25
  94. data/spec/cmd_keystore_spec.rb +6 -3
  95. data/spec/cmd_link_spec.rb +10 -5
  96. data/spec/cmd_logs_spec.rb +1 -1
  97. data/spec/cmd_setting_application_spec.rb +18 -15
  98. data/spec/cmd_setting_product_spec.rb +7 -7
  99. data/spec/cmd_status_spec.rb +27 -17
  100. data/spec/cmd_syncdown_application_spec.rb +30 -3
  101. data/spec/cmd_syncdown_both_spec.rb +72 -18
  102. data/spec/cmd_syncup_spec.rb +71 -5
  103. data/spec/cmd_token_spec.rb +2 -2
  104. data/spec/cmd_usage_spec.rb +2 -2
  105. data/spec/dry_run_formatter.rb +27 -0
  106. data/spec/fixtures/dumped_config +8 -0
  107. data/spec/fixtures/exchange_element/element-show.json +1 -0
  108. data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +282 -0
  109. data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +588 -0
  110. data/spec/variegated_TruthyFalsey_spec.rb +29 -0
  111. metadata +51 -25
@@ -9,6 +9,7 @@ require 'inflecto'
9
9
  require 'pathname'
10
10
  require 'MrMurano/verbosing'
11
11
  require 'MrMurano/SyncRoot'
12
+ require 'MrMurano/commands/solution_picker'
12
13
 
13
14
  # Load options to control which things to sync
14
15
  def cmd_option_syncable_pickers(cmd)
@@ -44,212 +45,247 @@ def cmd_defaults_syncable_pickers(options)
44
45
  end
45
46
  end
46
47
 
47
- command :status do |c|
48
- c.syntax = %(murano status [--options] [filters])
49
- c.summary = %(Get the status of files)
50
- c.description = %(
51
- Get the status of files.
48
+ class StatusCmd
49
+ include MrMurano::Verbose
52
50
 
53
- Compares the local project against what is up in Murano, showing a summary
54
- of what things are new or changed.
51
+ STATUS_CMD_DESCRIPTION = %(
52
+ The status command tells you the status of files
53
+ ================================================
55
54
 
56
- When --diff is passed, for items that have changes, the remote item and
57
- local item are passed to a diff tool and that output is included.
55
+ Compares the local project against what is up in Murano,
56
+ showing a summary of what things are new or changed.
58
57
 
59
- The diff tool and options to it can be set with the config key 'diff.cmd'.
58
+ With the --diff option, if an item has changes, the remote item and
59
+ local item are passed to a diff tool and that output is displayed.
60
+
61
+ - The diff tool and options to it can be set with the config key 'diff.cmd'.
60
62
 
61
63
  Filters allow for selecting a subset of items to check based on patterns.
62
64
 
63
- File glob filters can be used to select local files. The glob is compared
64
- with the full file path.
65
+ - File glob filters can be used to select local files.
66
+ The glob is compared with the full file path.
65
67
 
66
68
  Each item type also supports specific filters. These always start with #.
67
- Endpoints can be selected with a "#<method>#<path glob>" pattern.
68
- ).gsub(/^ +/, '').strip
69
-
70
- # Add flag: --type [application|product|all].
71
- cmd_add_solntype_pickers(c)
72
-
73
- c.option '--all', 'Check everything'
74
- c.option '--[no-]asdown', %(Report as if syncdown instead of syncup)
75
- c.option '--[no-]asup', %(Report as if syncup instead of syncdown (default: true))
76
- c.option '--[no-]diff', %(For modified items, show a diff)
77
- c.option '--[no-]grouped', %(Group all adds, deletes, and mods together)
78
- c.option '--[no-]show-all', %(List unchanged as well)
79
- c.option '--[no-]show-type', %(Include type of item)
80
- cmd_option_syncable_pickers(c)
81
-
82
- c.action do |args, options|
83
- # SKIP: c.verify_arg_count!(args)
84
- options.default(
85
- all: nil,
86
- asdown: nil,
87
- asup: nil,
88
- diff: false,
89
- grouped: true,
90
- show_all: false,
91
- show_type: false,
92
- # delete/create/update are not options the user can specify
93
- # for status or diff commands; but the SyncUpDown class expects
94
- # them.
95
- delete: true,
96
- create: true,
97
- update: true,
98
- )
99
- cmd_defaults_solntype_pickers(options)
100
- cmd_defaults_syncable_pickers(options)
101
-
102
- def fmtr(item, options)
103
- if item.key?(:local_path)
104
- desc = item[:local_path].relative_path_from(Pathname.pwd).to_s
105
- desc = "#{desc}:#{item[:line]}" if item.key?(:line) && item[:line] > 0
106
- else
107
- desc = item[:synckey]
108
- end
109
- return desc unless options.show_type
110
- unless item[:pp_desc].to_s.empty? || item[:pp_desc] == item[:synckey]
111
- desc += " (#{item[:pp_desc]})"
112
- end
113
- # NOTE: This path is the endpoint path.
114
- desc += " [#{item[:method]} #{item[:path]}]" if item[:method] && item[:path]
115
- desc
116
- end
117
-
118
- def interject(msg)
119
- MrMurano::Verbose.whirly_interject { say msg }
120
- end
121
69
 
122
- def pretty(ret, options)
123
- pretty_group_header(
124
- ret[:toadd], 'Only on local machine', 'new locally', options.grouped
70
+ - E.g, Endpoints can be selected with a "#<method>#<path glob>" pattern.
71
+ ).strip
72
+
73
+ def command_status(cmd)
74
+ cmd.syntax = %(murano status [--options] [filters])
75
+ cmd.summary = %(Get the status of files)
76
+ cmd.description = STATUS_CMD_DESCRIPTION
77
+
78
+ # Add flag: --type [application|product|all].
79
+ cmd_add_solntype_pickers(cmd)
80
+
81
+ cmd.option '--all', 'Check everything'
82
+ cmd.option '--[no-]asdown', %(Report as if syncdown instead of syncup)
83
+ cmd.option '--[no-]asup', %(Report as if syncup instead of syncdown (default: true))
84
+ cmd.option '--[no-]diff', %(For modified items, show a diff)
85
+ cmd.option '--[no-]grouped', %(Group all adds, deletes, and mods together)
86
+ cmd.option '--[no-]show-all', %(List unchanged as well)
87
+ cmd.option '--[no-]show-type', %(Include type of item)
88
+ cmd_option_syncable_pickers(cmd)
89
+
90
+ cmd.example %(Show item statuses for dirty items:
91
+ #
92
+ # - Items that exist locally by not on the remote;
93
+ # - Items that exist remotely by not on the local;
94
+ # - Items that have differences between the local and remote sources
95
+ ), %(murano status)
96
+
97
+ cmd.example %(Show differences between local Services (event handlers)
98
+ # and those configured on the platform
99
+ ), %(murano diff -S)
100
+
101
+ cmd.example %(Show differences between local Endpoints and those configured
102
+ # on the platform but only files starting with "example",
103
+ # e.g., "endpoints/example1.lua", "endpoints/example-foo.lua", etc.
104
+ #
105
+ # NOTE: Use single quotes to prevent shell interpolation of the '*'.
106
+ ), %(murano diff -E 'endpoints/example*')
107
+
108
+ cmd.example %(Show status of specific files
109
+ ), %(murano status services/user.lua endpoints/example.lua)
110
+
111
+ cmd.action do |args, options|
112
+ # SKIP: cmd.verify_arg_count!(args)
113
+ options.default(
114
+ all: nil,
115
+ asdown: nil,
116
+ asup: nil,
117
+ diff: false,
118
+ grouped: true,
119
+ show_all: false,
120
+ show_type: false,
121
+ # delete/create/update are not options the user can specify
122
+ # for status or diff commands; but the SyncUpDown class expects
123
+ # them.
124
+ delete: true,
125
+ create: true,
126
+ update: true,
125
127
  )
126
- ret[:toadd].each do |item|
127
- interject " + #{item[:pp_type]} #{highlight_chg(fmtr(item, options))}"
128
- pretty_diff(item, options)
129
- end
130
-
131
- pretty_group_header(
132
- ret[:todel], 'Only on remote server', 'new remotely', options.grouped
133
- )
134
- ret[:todel].each do |item|
135
- interject " - #{item[:pp_type]} #{highlight_del(fmtr(item, options))}"
136
- pretty_diff(item, options)
137
- end
138
-
139
- pretty_group_header(
140
- ret[:tomod], 'Items that differ', 'that differs', options.grouped
141
- )
142
- ret[:tomod].each do |item|
143
- interject " M #{item[:pp_type]} #{highlight_chg(fmtr(item, options))}"
144
- interject item[:diff] if options.diff
145
- end
146
-
147
- unless ret[:skipd].empty?
148
- pretty_group_header(
149
- ret[:skipd], 'Items without a solution', 'without a solution', options.grouped
150
- )
151
- ret[:skipd].each do |item|
152
- interject " - #{item[:pp_type]} #{highlight_del(fmtr(item, options))}"
128
+ cmd_defaults_solntype_pickers(options)
129
+ cmd_defaults_syncable_pickers(options)
130
+
131
+ @grouped = { toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: [] }
132
+
133
+ # Check that user doesn't try to asdown and asup, or no-asdown and no-asup.
134
+ if options.asdown.nil? && options.asup.nil?
135
+ options.asdown = false
136
+ options.asup = true
137
+ elsif !options.asdown.nil? && !options.asup.nil?
138
+ unless options.asdown ^ options.asup
139
+ error('Please specify either --asdown or --asup, but not both!')
140
+ exit 1
153
141
  end
142
+ elsif options.asdown.nil?
143
+ options.asdown = !options.asup
144
+ elsif options.asup.nil?
145
+ options.asup = !options.asdown
146
+ else
147
+ raise('Unexpected code path.')
154
148
  end
155
149
 
156
- unless ret[:clash].empty?
157
- pretty_group_header(
158
- ret[:clash], 'Conflicting items', 'in conflict', options.grouped
159
- )
160
- ret[:clash].each do |item|
161
- abbrev = $cfg['tool.ascii'] && 'x' || '✗'
162
- interject " #{abbrev} #{item[:pp_type]} #{highlight_del(fmtr(item, options))}"
150
+ MrMurano::SyncRoot.instance.each_filtered(options.__hash__) do |_name, type, klass, desc|
151
+ MrMurano::Verbose.whirly_msg "Fetching #{Inflecto.pluralize(desc)}..."
152
+ begin
153
+ syncable = klass.new
154
+ rescue MrMurano::ConfigError => err
155
+ MrMurano::Verbose.error "Could not fetch status for #{desc}: #{err}"
156
+ rescue StandardError => _err
157
+ raise
158
+ else
159
+ ret = syncable.status(options, args)
160
+ gmerge(ret, type, desc, options)
163
161
  end
164
162
  end
163
+ MrMurano::Verbose.whirly_stop
165
164
 
166
- return unless options.show_all
167
- interject 'Unchanged:' if options.grouped
168
- ret[:unchg].each { |item| interject " #{item[:pp_type]} #{fmtr(item, options)}" }
165
+ pretty(@grouped, options) if options.grouped
169
166
  end
167
+ end
170
168
 
171
- def pretty_group_header(group, header_any, header_empty, grouped)
172
- return unless grouped
173
- if !group.empty?
174
- interject "#{header_any}:"
175
- else
176
- interject "Nothing #{header_empty}"
177
- end
178
- end
169
+ def interject(msg)
170
+ MrMurano::Verbose.whirly_interject { say msg }
171
+ end
179
172
 
180
- def pretty_diff(item, options)
181
- return unless options.diff && $cfg['tool.verbose'] && !item[:diff].empty?
182
- interject item[:diff]
173
+ def pretty(ret, options)
174
+ pretty_group_header(
175
+ ret[:toadd], 'Only on local machine', 'new locally', options.grouped
176
+ )
177
+ ret[:toadd].each do |item|
178
+ interject " + #{item[:pp_type]} #{highlight_chg(item[:locus])}"
179
+ pretty_diff(item, options)
183
180
  end
184
181
 
185
- def highlight_chg(msg)
186
- Rainbow(msg).green.bright
182
+ pretty_group_header(
183
+ ret[:todel], 'Only on remote server', 'new remotely', options.grouped
184
+ )
185
+ ret[:todel].each do |item|
186
+ interject " - #{item[:pp_type]} #{highlight_del(item[:locus])}"
187
+ pretty_diff(item, options)
187
188
  end
188
189
 
189
- def highlight_del(msg)
190
- Rainbow(msg).red.bright
190
+ pretty_group_header(
191
+ ret[:tomod], 'Items that differ', 'that differs', options.grouped
192
+ )
193
+ ret[:tomod].each do |item|
194
+ interject " M #{item[:pp_type]} #{highlight_chg(item[:locus])}"
195
+ interject item[:diff] if options.diff
191
196
  end
192
197
 
193
- @grouped = { toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: [] }
194
- def gmerge(ret, type, desc, options)
195
- if options.grouped
196
- out = @grouped
197
- else
198
- out = { toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: [] }
198
+ # 2018-04-24: (lb): If one or the other solutions is not setup (app or prod)
199
+ # don't care, and don't indicate to user that missing soln's items are dirty.
200
+ # MAYBE: (lb): We can probably delete this comment. Keeping until more confident.
201
+ #unless ret[:skipd].empty?
202
+ # pretty_group_header(
203
+ # ret[:skipd], 'Items without a solution', 'without a solution', options.grouped
204
+ # )
205
+ # ret[:skipd].each do |item|
206
+ # interject " - #{item[:pp_type]} #{highlight_del(item[:locus])}"
207
+ # end
208
+ #end
209
+
210
+ unless ret[:clash].empty?
211
+ pretty_group_header(
212
+ ret[:clash], 'Conflicting items', 'in conflict', options.grouped
213
+ )
214
+ ret[:clash].each do |item|
215
+ abbrev = $cfg['tool.ascii'] && 'x' || '✗'
216
+ interject " #{abbrev} #{item[:pp_type]} #{highlight_del(item[:locus])}"
199
217
  end
218
+ end
200
219
 
201
- %i[toadd todel tomod unchg skipd clash].each do |kind|
202
- ret[kind].each do |item|
203
- item = item.to_h
204
- item[:pp_type] = type
205
- item[:pp_desc] = desc
206
- out[kind] << item
207
- end
208
- end
220
+ return unless options.show_all
221
+ interject 'Unchanged:' if options.grouped
222
+ ret[:unchg].each { |item| interject " #{item[:pp_type]} #{item[:locus]}" }
223
+ end
209
224
 
210
- pretty(out, options) unless options.grouped
225
+ def pretty_group_header(group, header_any, header_empty, grouped)
226
+ return unless grouped
227
+ if !group.empty?
228
+ interject "#{header_any}:"
229
+ else
230
+ interject "Nothing #{header_empty}"
211
231
  end
232
+ end
212
233
 
213
- # *** Method code starts here ***
234
+ def pretty_diff(item, options)
235
+ return unless options.diff && $cfg['tool.verbose']
236
+ return unless !item[:diff].nil? && !item[:diff].empty?
237
+ interject item[:diff]
238
+ end
214
239
 
215
- # Check that user doesn't try to asdown and asup, or no-asdown and no-asup.
216
- if options.asdown.nil? && options.asup.nil?
217
- options.asdown = false
218
- options.asup = true
219
- elsif !options.asdown.nil? && !options.asup.nil?
220
- unless options.asdown ^ options.asup
221
- error('Please specify either --asdown or --asup, but not both!')
222
- exit 1
223
- end
224
- elsif options.asdown.nil?
225
- options.asdown = !options.asup
226
- elsif options.asup.nil?
227
- options.asup = !options.asdown
240
+ def highlight_chg(msg)
241
+ Rainbow(msg).green.bright
242
+ end
243
+
244
+ def highlight_del(msg)
245
+ Rainbow(msg).red.bright
246
+ end
247
+
248
+ def gmerge(ret, type, desc, options)
249
+ if options.grouped
250
+ out = @grouped
228
251
  else
229
- raise('Unexpected code path.')
252
+ out = { toadd: [], todel: [], tomod: [], unchg: [], skipd: [], clash: [] }
230
253
  end
231
254
 
232
- MrMurano::SyncRoot.instance.each_filtered(options.__hash__) do |_name, type, klass, desc|
233
- MrMurano::Verbose.whirly_msg "Fetching #{Inflecto.pluralize(desc)}..."
234
- begin
235
- syncable = klass.new
236
- rescue MrMurano::ConfigError => err
237
- MrMurano::Verbose.error "Could not fetch status for #{desc}: #{err}"
238
- rescue StandardError => _err
239
- raise
240
- else
241
- ret = syncable.status(options, args)
242
- gmerge(ret, type, desc, options)
255
+ %i[toadd todel tomod unchg skipd clash].each do |kind|
256
+ ret[kind].each do |item|
257
+ hitem = item.to_h
258
+ hitem[:pp_type] = type
259
+ hitem[:pp_desc] = desc
260
+ hitem[:locus] = item.location_friendly(show_type: options.show_type)
261
+ out[kind] << hitem
243
262
  end
244
263
  end
245
- MrMurano::Verbose.whirly_stop
246
264
 
247
- pretty(@grouped, options) if options.grouped
265
+ pretty(out, options) unless options.grouped
248
266
  end
267
+ end # StatusCmd
268
+
269
+ def wire_cmd_status
270
+ status_cmd = StatusCmd.new
271
+
272
+ command(:status) { |cmd| status_cmd.command_status(cmd) }
273
+ alias_command(
274
+ 'diff', 'status', '--diff', '--no-grouped',
275
+ )
276
+ alias_command(
277
+ 'diff application', 'status', '--diff', '--no-grouped', '--type', 'application',
278
+ )
279
+ alias_command(
280
+ 'diff product', 'status', '--diff', '--no-grouped', '--type', 'product',
281
+ )
282
+ alias_command(
283
+ 'application diff', 'status', '--diff', '--no-grouped', '--type', 'application',
284
+ )
285
+ alias_command(
286
+ 'product diff', 'status', '--diff', '--no-grouped', '--type', 'product',
287
+ )
249
288
  end
250
- alias_command 'diff', 'status', '--diff', '--no-grouped'
251
- alias_command 'diff application', 'status', '--diff', '--no-grouped', '--type', 'application'
252
- alias_command 'diff product', 'status', '--diff', '--no-grouped', '--type', 'product'
253
- alias_command 'application diff', 'status', '--diff', '--no-grouped', '--type', 'application'
254
- alias_command 'product diff', 'status', '--diff', '--no-grouped', '--type', 'product'
289
+
290
+ wire_cmd_status
255
291
 
@@ -7,13 +7,14 @@
7
7
 
8
8
  require 'MrMurano/verbosing'
9
9
  require 'MrMurano/SyncRoot'
10
+ require 'MrMurano/commands/solution_picker'
10
11
  require 'MrMurano/commands/status'
11
12
 
12
- def sync_add_options(c, locale)
13
- c.option '--[no-]delete', %(Don't delete things from #{locale})
14
- c.option '--[no-]create', %(Don't create things on #{locale})
15
- c.option '--[no-]update', %(Don't update things on #{locale})
16
- c.option '--ignore-errors', %(Don't die on sync errors)
13
+ def sync_add_options(cmd, locale)
14
+ cmd.option '--[no-]delete', %(Don't delete things from #{locale})
15
+ cmd.option '--[no-]create', %(Don't create things on #{locale})
16
+ cmd.option '--[no-]update', %(Don't update things on #{locale})
17
+ cmd.option '--ignore-errors', %(Don't die on sync errors)
17
18
  end
18
19
 
19
20
  def syncdown_files(options, args=nil)
@@ -28,26 +29,40 @@ def syncdown_files(options, args=nil)
28
29
  num_synced
29
30
  end
30
31
 
31
- command :syncdown do |c|
32
- c.syntax = %(murano syncdown [--options] [filters])
33
- c.summary = %(Sync project down from Murano)
34
- c.description = %(
32
+ command :syncdown do |cmd|
33
+ cmd.syntax = %(murano syncdown [--options] [filters])
34
+ cmd.summary = %(Sync project down from Murano)
35
+ cmd.description = %(
35
36
  Sync project down from Murano.
36
37
  ).strip
37
38
 
38
39
  # Add flag: --type [application|product|all].
39
- cmd_add_solntype_pickers(c)
40
+ cmd_add_solntype_pickers(cmd)
40
41
 
41
- c.option '--all', 'Sync everything'
42
- cmd_option_syncable_pickers(c)
43
- sync_add_options(c, 'local machine')
42
+ cmd.option '--all', 'Sync everything'
43
+ cmd_option_syncable_pickers(cmd)
44
+ sync_add_options(cmd, 'local machine')
44
45
 
45
- c.example %(Make local be like what is on the server), %(murano syncdown --all)
46
- c.example %(Pull down new things, but don't delete or modify anything), %(murano syncdown --all --no-delete --no-update)
47
- c.example %(Only Pull new static files), %(murano syncdown --files --no-delete --no-update)
46
+ cmd.example %(Make local be like what is on the server
47
+ ), %(murano syncdown --all)
48
48
 
49
- c.action do |args, options|
50
- # SKIP: c.verify_arg_count!(args)
49
+ cmd.example %(Pull down new things, but don't delete or modify anything
50
+ ), %(murano syncdown --all --no-delete --no-update)
51
+
52
+ cmd.example %(Only pull down new static files
53
+ ), %(murano syncdown --assets --no-delete --no-update)
54
+
55
+ cmd.example %(Only pull down Endpoints whose filename starts with "example",
56
+ # e.g., "endpoints/example1.lua", "endpoints/example-foo.lua", etc.
57
+ #
58
+ # NOTE: Use single quotes to prevent shell interpolation of the '*'.
59
+ ), %(murano syncdown -E 'endpoints/example*')
60
+
61
+ cmd.example %(Only pull down specific files
62
+ ), %(murano syncdown services/user.lua endpoints/example.lua)
63
+
64
+ cmd.action do |args, options|
65
+ # SKIP: cmd.verify_arg_count!(args)
51
66
  options.default(delete: true, create: true, update: true)
52
67
  cmd_defaults_solntype_pickers(options)
53
68
  cmd_defaults_syncable_pickers(options)
@@ -60,36 +75,53 @@ alias_command 'pull product', 'syncdown', '--no-delete', '--type', 'product'
60
75
  alias_command 'application pull', 'syncdown', '--no-delete', '--type', 'application'
61
76
  alias_command 'product pull', 'syncdown', '--no-delete', '--type', 'product'
62
77
 
63
- command :syncup do |c|
64
- c.syntax = %(murano syncup [--options] [filters])
65
- c.summary = %(Sync project up into Murano)
66
- c.description = %(
78
+ def syncup_files(options, args=nil)
79
+ MrMurano::SyncRoot.instance.each_filtered(options) do |_name, _type, klass, desc|
80
+ MrMurano::Verbose.whirly_msg "Syncing #{Inflecto.pluralize(desc)}..."
81
+ sol = klass.new
82
+ sol.syncup(options, args)
83
+ end
84
+ MrMurano::Verbose.whirly_stop
85
+ end
86
+
87
+ command :syncup do |cmd|
88
+ cmd.syntax = %(murano syncup [--options] [filters])
89
+ cmd.summary = %(Sync project up into Murano)
90
+ cmd.description = %(
67
91
  Sync project up into Murano.
68
92
  ).strip
69
93
 
70
94
  # Add flag: --type [application|product|all].
71
- cmd_add_solntype_pickers(c)
95
+ cmd_add_solntype_pickers(cmd)
96
+
97
+ cmd.option '--all', 'Sync everything'
98
+ cmd_option_syncable_pickers(cmd)
99
+ sync_add_options(cmd, 'server')
100
+
101
+ cmd.example %(Deploy project to server
102
+ ), %(murano syncup --all)
103
+
104
+ cmd.example %(Update static files
105
+ ), %(murano syncup --assets)
106
+
107
+ cmd.example %(Only add or modify static files
108
+ ), %(murano syncup --assets --no-delete)
72
109
 
73
- c.option '--all', 'Sync everything'
74
- cmd_option_syncable_pickers(c)
75
- sync_add_options(c, 'server')
110
+ cmd.example %(Only update Endpoints whose filename starts with "example",
111
+ # e.g., "endpoints/example1.lua", "endpoints/example-foo.lua", etc.
112
+ #
113
+ # NOTE: Use single quotes to prevent shell interpolation of the '*'.
114
+ ), %(murano syncup -E 'endpoints/example*')
76
115
 
77
- c.example %(Deploy project to server), %(murano syncup --all)
78
- c.example %(Update static files), %(murano syncup --files)
79
- c.example %(Only add or modify static files), %(murano syncup --files --no-delete)
116
+ cmd.example %(Only update specific files
117
+ ), %(murano syncup services/user.lua endpoints/example.lua)
80
118
 
81
- c.action do |args, options|
82
- # SKIP: c.verify_arg_count!(args)
119
+ cmd.action do |args, options|
120
+ # SKIP: cmd.verify_arg_count!(args)
83
121
  options.default(delete: true, create: true, update: true)
84
122
  cmd_defaults_solntype_pickers(options)
85
123
  cmd_defaults_syncable_pickers(options)
86
- #MrMurano::Verbose.whirly_start "Syncing solutions..."
87
- MrMurano::SyncRoot.instance.each_filtered(options.__hash__) do |_name, _type, klass, desc|
88
- MrMurano::Verbose.whirly_msg "Syncing #{Inflecto.pluralize(desc)}..."
89
- sol = klass.new
90
- sol.syncup(options, args)
91
- end
92
- MrMurano::Verbose.whirly_stop
124
+ syncup_files(options.__hash__, args)
93
125
  end
94
126
  end
95
127
  alias_command 'push', 'syncup', '--no-delete'