17 Commits

Author SHA1 Message Date
Erik Erikson
553e6cf0da Provide Consistent Service Path
Fix #5242

Do this by first supplying the `servicePath` in `~/lib/plugins/lib/validate.js` and `~/lib/plugins/print.js` in a consistent manner with the code in `~/lib/classes/PluginManager.js`.  Then, provide a default of `process.cwd()` for `servicePath` in `getCacheFilePath` and `getServerlessConfigFile`.
2018-09-19 17:03:29 -07:00
Ron Korving
0fd4235aeb Add print options to allow digging, filtering and formatting 2018-06-18 15:14:02 +09:00
Erik Erikson
dc3a4aa6af Fix print, clean pre-population, fix cyclic bug
Fix `print`
The print command is highly linked to the `Variables` and `Service` codebases, keep those in sync and leave reminders about the link.  Made these explicit and separately implemented to avoid complexity.
Additionally, the print command re-populates an object with the *very similar* content as the previously pre-populated service (just not augmented as just mentioned).  This can lead to cross contamination between the two.  As such, all caches must be cleared per unique invocation of service/object/property population.
Add tests for some expected but previously unverified behaviors.

Clean pre-population
The previous implementation worked okay but was unnecessary and would have been a maintenance problem.  Instead, just knock out the population of variables depending on those config dependent services and use the standard means of resolution.

Fix cyclic bug (resulting from running print against a self-referencing serverless.yml)
The caching of values could lead to a cyclic object remaining in the caches for variable population.  This causes crashes and pain.  Solved by the cache cleaning logic.
2018-02-22 16:30:04 -08:00
Erik Erikson
13ae54cacc Fix Cycles Crash (#4556)
Replace the existing service and clear the cache (which references the ammended service)
Remove cycles in that service using json-cycle.
Dump the decycled object as YAML to console.
2017-12-13 16:39:06 -08:00
Rafal Wilinski
cf8e15778d Fix linter issue 2017-10-12 00:55:20 +02:00
Alex DeBrie
fb2fb3d14d Expand refs in YAML 2017-10-04 18:53:06 +00:00
Alex DeBrie
45c8ade73c Show custom variableSyntax in output 2017-09-27 15:56:23 +00:00
Alex DeBrie
00d05244cc And now the linter works! 2017-09-22 20:50:41 +00:00
Alex DeBrie
c8b6de516f The tests are passing!!! 2017-09-22 20:23:28 +00:00
Alex DeBrie
059d690cdc Continued work on print tests 2017-09-22 15:50:01 +00:00
Alex DeBrie
e4be10f48f Begin better tests for print command 2017-09-21 15:29:14 +00:00
Alex DeBrie
c419c5b451 Handle user-provided variableSyntax 2017-09-20 18:40:19 +00:00
Alex DeBrie
ee958d891c Add test for print 2017-09-01 20:35:33 +00:00
Eslam A. Hefnawy
ba2728fbd1 added use strict to print plugin 2017-09-01 21:45:45 +07:00
Alex DeBrie
abe818f5c3 Set options before populating config object 2017-08-31 13:15:15 +00:00
Alex DeBrie
6f256404c5 Fix lint issues 2017-08-29 13:01:04 +00:00
Alex DeBrie
d95e192cde Add print command 2017-08-29 12:45:29 +00:00