MuranoCLI 3.0.8 → 3.1.0.beta.1

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: 3724b5391071776bfe44190b14ad244788ff94b7
4
- data.tar.gz: f7a7825838b2143194871519fd109b00701ac361
3
+ metadata.gz: 8f37048d0f8e9d3ee210166e7f27240e01a465fb
4
+ data.tar.gz: 635efd3ce5432c2d7737464c4bd1c7cef8a3e3de
5
5
  SHA512:
6
- metadata.gz: e92ac9179d3a3444d9a8a283ab94f85e576d88e5bcae6f7b947d2401b588bb8fd4ca67cd7d31817a7cdadec1488aefc6ae0b966afe45aaba944a611571f8b8d2
7
- data.tar.gz: 9fba7a0956161da7105417580bd9aa79c0372b61e3883318a184dd8a17ea01aeafc4e9c2f89e299cc4cf1f68b9c92ca89c1fd8013380a458a9e9c45dd1ee92bd
6
+ metadata.gz: 06aa8d4b6de186aeb2de85d7a68a42d733971b56db0153356c1d4b681c0bdb78708549d267db31317b20e968c6b5b6b92f9629bc66c88180852c415cb3da538b
7
+ data.tar.gz: ae8101e79d98a35c398461b7c8e0f9809c6af891e2d1181e0136b43bf54e48cb7ef0c7d62e4feb3e4b863608768b7d2391d97e2557c6f685d5276c5cf320ac9c
data/lib/MrMurano/Logs.rb CHANGED
@@ -14,6 +14,11 @@ require 'MrMurano/verbosing'
14
14
  module MrMurano
15
15
  module Logs
16
16
  class Follow
17
+ def initialize(query, limit=nil)
18
+ @query = query
19
+ @limit = limit
20
+ end
21
+
17
22
  def run_event_loop(sol, &block)
18
23
  # block_given?
19
24
  @message_handler = block
@@ -30,13 +35,16 @@ module MrMurano
30
35
  # FIXME/2017-12-12 (landonb): Which endpoint do we want?
31
36
  # /events, or /all, or /logs??
32
37
  uri = [
33
- protocol + ':/', $cfg['net.host'], 'api:1', 'log', sol.api_id, 'logs',
38
+ protocol + ':/', $cfg['net.host'], 'api:1', 'solution', sol.api_id, 'logs',
34
39
  ].join('/')
35
40
  uri += %(?token=#{sol.token})
36
- uri += %(&query={})
37
- uri += %(&projection={})
38
- # FIXME: (landonb): Would we want to add limit=?
39
- #uri += %(&limit=20)
41
+ uri += %(&query=#{@query}) unless @query.to_s.empty?
42
+ uri += %(&limit=#{@limit}) unless @limit.nil?
43
+ # MAYBE: (landonb): Add projection options? (Use for tracking exclusion.)
44
+ # uri += %(&projection={})
45
+ # MAYBE: (landonb): Add limit option? This is number
46
+ # of old log events to fetch first before streaming.
47
+ # uri += %(&limit=20)
40
48
  uri
41
49
  end
42
50
 
@@ -120,7 +120,7 @@ module MrMurano
120
120
  end
121
121
 
122
122
  def new_meta
123
- tname = $cfg['location.base'].basename.to_s.gsub(/[^A-Za-z0-9]/, '')
123
+ tname = Pathname.new($cfg['location.base']).basename.to_s.gsub(/[^A-Za-z0-9]/, '')
124
124
  PrjMeta.new(
125
125
  tname,
126
126
  "One line summary of #{tname}",
@@ -137,7 +137,7 @@ module MrMurano
137
137
  end
138
138
 
139
139
  # Get the current Project file
140
- # @return [Pathname] PAth to current project file.
140
+ # @return [Pathname] Path to current project file.
141
141
  def project_file
142
142
  @prj_file
143
143
  end
@@ -174,6 +174,9 @@ module MrMurano
174
174
  'assets.include' => 'files.searchFor',
175
175
  'assets.exclude' => 'files.ignoring',
176
176
 
177
+ # (lb): As far as I can tell, code uses $cfg['files.default_page'],
178
+ # and never accesses the $project['assets.default_page'].
179
+ # Is this a bug?
177
180
  'assets.default_page' => 'files.default_page',
178
181
 
179
182
  'modules.location' => 'location.modules',
@@ -191,8 +194,6 @@ module MrMurano
191
194
  'services.exclude' => 'eventhandler.ignoring',
192
195
 
193
196
  'resources.location' => 'location.resources',
194
- # EXPLAIN/2017-07-05: [lb] not finding either resources.include
195
- # nor product.spec used anywhere.
196
197
  'resources.include' => 'product.spec',
197
198
  'resources.exclude' => 'product.ignoring',
198
199
  }.freeze
@@ -202,63 +202,17 @@ module MrMurano
202
202
  # @param local [Pathname] Full path of where to download to
203
203
  # @param item [Item] The item to download
204
204
  def update_mtime(local, item)
205
- # FIXME/MUR-XXXX: Ideally, server should use a hash we can compare.
206
- # For now, we use the sometimes set :updated_at value.
207
- # FIXME/EXPLAIN/2017-06-23: Why is :updated_at sometimes not set?
208
- # (See more comments, below.)
209
205
  return unless item[:updated_at]
210
-
211
206
  mod_time = item[:updated_at]
212
207
  mod_time = Time.parse(mod_time) unless mod_time.is_a?(Time)
213
208
  begin
214
209
  FileUtils.touch([local.to_path], mtime: mod_time)
215
210
  rescue Errno::EACCES => err
216
- # This happens on Windows...
217
- require 'rbconfig'
218
- # Check the platform, e.g., "linux-gnu", or other.
219
- #is_windows = (
220
- # RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
221
- #)
211
+ # (lb): This is okay on Windows. (We really need a better solution.)
222
212
  unless OS.windows?
223
213
  msg = 'Unexpected: touch failed on non-Windows machine'
224
214
  warn "#{msg} / host_os: #{RbConfig::CONFIG['host_os']} / err: #{err}"
225
215
  end
226
-
227
- # 2017-07-13: Nor does ctime work.
228
- # Errno::EACCES:
229
- # Permission denied @ utime_failed -
230
- # C:/Users/ADMINI~1/AppData/Local/Temp/2/one.lua_remote_20170714-1856-by2nzk.lua
231
- #File.utime(mod_time, mod_time, local.to_path)
232
-
233
- # 2017-07-14: So this probably fails, too...
234
- #FileUtils.touch [local.to_path,], :ctime => mod_time
235
-
236
- # MAYBE/2017-07-14: How to make diff work on Windows?
237
- # Would need to store timestamp in metafile?
238
-
239
- # FIXME/EXPLAIN/2017-06-23: Why is :updated_at sometimes not set?
240
- # And why have I only triggered this from ./spec/cmd_syncdown_spec.rb ?
241
- # (Probably because nothing else makes routes or files?)
242
- # Here are the items in question:
243
- #
244
- # Happens to each of the MrMurano::Webservice::Endpoint::RouteItem's:
245
- #
246
- # <MrMurano::Webservice::Endpoint::RouteItem:0x007fe719cb6300
247
- # @id="QeRq21Cfij",
248
- # @method="delete",
249
- # @path="/api/fire/{code}",
250
- # @content_type="application/json",
251
- # @script="--#ENDPOINT delete /api/fire/{code}\nreturn 'ok'\n\n-- vim: set ai sw=2 ts=2 :\n",
252
- # @use_basic_auth=false,
253
- # @synckey="DELETE_/api/fire/{code}">
254
- #
255
- # Happens to each of the MrMurano::Webservice::File::FileItem's:
256
- #
257
- # <MrMurano::Webservice::File::FileItem:0x007fe71a44a8f0
258
- # @path="/",
259
- # @mime_type="text/html",
260
- # @checksum="da39a3ee5e6b4b0d3255bfef95601890afd80709",
261
- # @synckey="/">
262
216
  end
263
217
  end
264
218
 
@@ -92,3 +92,4 @@ global_option('--sid VALUE', %(Override application or product ID)) do |value|
92
92
  $cfg['application.id'] = value
93
93
  $cfg['product.id'] = value
94
94
  end
95
+