Improve telemetry for run env command

This commit is contained in:
Ivan Kravets
2014-11-30 17:00:30 +02:00
parent 22297b9cfd
commit 6b9cbde8eb
2 changed files with 6 additions and 6 deletions

View File

@ -39,8 +39,6 @@ def cli(environment, target, upload_port):
echo("Processing %s environment:" % style(envname, fg="cyan"))
telemetry.on_run_environment(envname, config.items(section))
variables = ["PIOENV=" + envname]
if upload_port:
variables.append("UPLOAD_PORT=%s" % upload_port)
@ -59,6 +57,8 @@ def cli(environment, target, upload_port):
if not config.has_option(section, "platform"):
raise UndefinedEnvPlatform(envname)
telemetry.on_run_environment(config.items(section), envtargets)
p = PlatformFactory().newPlatform(config.get(section, "platform"))
result = p.run(variables, envtargets)
secho(result['out'], fg="green")

View File

@ -134,10 +134,10 @@ def on_command(ctx): # pylint: disable=W0613
resend_backuped_reports()
def on_run_environment(name, options): # pylint: disable=W0613
# on_event("RunEnv", "Name", name)
for opt, value in options:
on_event("RunEnv", opt.title(), value)
def on_run_environment(options, targets):
opts = ["%s=%s" % (opt, value) for opt, value in sorted(options)]
targets = [t.title() for t in targets or ["run"]]
on_event("Env", " ".join(targets), " ".join(opts))
def on_event(category, action, label=None, value=None, screen_name=None):