Commit Graph

99 Commits

Author SHA1 Message Date
Sergio Díaz 26b33fbf00
Added tests to all CLI commands. (#28)
* Moved the spinner initialization to the base class.

* Got rid of the base class, it complicated testing.

Now it lives on as a utils file. Should make it easier to test the CLI.

* Added a spec file for the ListCommand.

* Added tests for all CLI commands.

* Update some old tests.

Added missing cases and tests.

Most of these are kind useless but I hope I won't have to touch them
again.
2018-05-22 21:42:52 -06:00
Sergio Díaz 23064040df
Stopped iterating over keys and started assigning instead. (#27)
I don't actually remember why I did it this way. I probably wanted to be
a lot more strict with the keys originally which seems silly in
retrospective.
2018-05-22 12:55:58 -06:00
Sergio Díaz dbc7addb39
Added flags for quiet and as-json output. (#26)
--as-json outputs the response as json, this allows you to use tools
like jq on the output which is nice.

--quiet makes it so no output is printed. I added this in case you are
looping Beau and don't want to see the output of every single request.
Example: `seq 10 | xargs -I{} beau request hi --quiet`.
2018-05-22 12:08:32 -06:00
David Diaz 293dde59c4 0.9.3 2018-05-17 10:54:15 -06:00
Sergio Díaz a9ba5b0bb7
: is valid as a variable when talking about hosts. (#25) 2018-05-17 10:52:35 -06:00
David Diaz c0923dcce5 0.9.2 2018-05-17 10:02:16 -06:00
Sergio Díaz 29940d2a24
This fixes an issue where / and \ and : where considered valid names for (#24)
replacements.
2018-05-17 10:01:02 -06:00
Sergio Díaz aba33e7fc3
Fix: Env variables (#23)
I am making a couple of small changes to how external environment
variables are used. From now own everything comming from the outside,
namely the .env file and the params flag are assigned to the '_'
variable within the internal environment. This is mostly to namespace
things and make it clear where they are coming from.
2018-05-17 09:58:44 -06:00
David Diaz d2eabfb19e 0.9.1 2018-05-16 23:13:42 -06:00
Sergio Díaz 0677497074
Making improvements to the plugins system. (#22)
This is mostly some clean up. Now plugins are checked for existence
before being required. The regex for dynamic values was improved a
little in an attemp to make it more reliable. Plugins are only required
once now.

The CLI's CWD is set to that of the config file. This makes relative
paths mentioned in the file more reliable.
2018-05-16 18:24:52 -06:00
David Diaz 9ba3027017 Added swp to gitignore. 2018-05-07 17:18:03 +00:00
David Diaz 0e5b427d24 0.9.0 2018-05-06 19:05:58 -06:00
Sergio Díaz 248f4a9223
Added params as a flag to request. (#20)
This allows the use to inject arbitrary values to Beau's environment.
2018-05-06 18:26:19 -06:00
Sergio Díaz 56d536a509
Re-indented some files I was missing. (#19)
I think that's it.
2018-05-04 22:00:54 -06:00
Sergio Díaz 4bf7a60e9c
Added beau-std as an auto-loaded plugin. (#18)
This means that beau-std will automatically be loaded if available in
the same space as Beau. beau-std is a set of commonly used plugins,
these map directly to nodejs features that are commonly needed within
Beau.
2018-05-04 13:08:55 -06:00
Sergio Díaz 59f85fac8c
Reindenting. (#17)
I normally prefer tabs for everything, it's nice to have the ability to
set to whatever your preferred width is. Since this project uses a lot
of yaml stuff I've had to indent those tests with spaces, for
consistency's sake I've decided to use spaces everywhere.
2018-05-04 11:47:28 -06:00
David Diaz 64de56d51c Added a .prettierrc config file. 2018-05-04 11:22:02 -06:00
David Diaz 3212403962 Changed the description on the package.json 2018-05-04 05:08:58 +00:00
Sergio Díaz 90761acaa4
Added a schema validator. (#13)
* Added a schema validator.

This allows you to check if the given beau config is valid. Will be used
to improve the CLI and remove schema validation-type errors from the
actual code.

* Added a validate command to the CLI.

This command is a way to test the config file. Eventually it'll probably
be removed and the schema validation will run on every other command. I
have to determine how useful this is and how performance might be
affected.
2018-05-01 22:20:14 -06:00
Sergio Díaz 4fba235bad
Migrating Beau's CLI from commander to OCLIF. (#14)
* Migrating Beau's CLI from commander to OCLIF.

* Cleaning up flags.
2018-04-30 20:27:51 -06:00
Sergio Díaz 91d35459aa
Merge pull request #15 from Seich/next-dynamic-values
Allow dynamic values to replace values internally.
2018-04-30 14:42:51 -06:00
David Diaz 185333cb20 Copy objects instead of properties on modifiers. 2018-04-30 14:21:20 -06:00
David Diaz dd2842c097 Allow dynamic values to replace values internally.
If the only thing passed as a value is a dynamic value whatever it
returns will become the new value internally. This means that they are
no longer required to be strings. This also allows plugins to use native
objects and types internally to do more advance things.
2018-04-30 11:39:44 -06:00
Sergio Díaz 92142c148b
Merge pull request #12 from Seich/next-refactor-config-loading
Refactored the Request's constructor.
2018-04-26 18:38:37 -06:00
David Diaz 358da930e8 Refactored the Request's constructor.
I didn't like how verbose it was, this is somewhat better.
2018-04-26 18:35:33 -06:00
Sergio Díaz 17971a3cca
Merge pull request #11 from Seich/next-cookies
Added basic cookies support.
2018-04-26 17:53:55 -06:00
David Diaz d3b78bc27d Added basic cookies support.
You can now let Beau know you expect cookies to be passed around by
setting COOKIEJAR to true. I'd eventually like to add support for file
storage or something similar.
2018-04-26 17:50:09 -06:00
Sergio Díaz 979f93ddbb
Merge pull request #10 from Seich/next-forms
Added support for forms.
2018-04-26 15:00:22 -06:00
David Diaz 9d10db3243 Added support for forms.
You can now pass a form key to the request and it'll set the header and
payload automatically.
2018-04-26 14:52:06 -06:00
David Diaz 3df90600ac Updated dependencies. 2018-04-26 10:56:42 -06:00
Sergio Díaz 6c552cb7a2
Merge pull request #9 from Seich/next-plugin-improvements
Modifiers can now edit request settings.
2018-04-20 18:57:38 -06:00
David Diaz d15564a9e3 Modifiers can now edit request settings.
This gives a lot more flexibility when it comes to what a modifier can
do. They can now use any valid request option to change how the response
behaves.
2018-04-20 18:29:19 -06:00
Sergio Díaz d154f73232
Merge pull request #8 from Seich/next
Allow Escaping the $
2018-04-20 17:57:26 -06:00
David Diaz f13cbda84a Allow the escaping of variables.
This results in two important changes:

- Made changes so that we actually use the replacement regex groups.
This was supposed to happen from the start but I guess I didn't notice.
By fixing this the code for finding dependencies and the cache#parse is
now a bit more reliable.

- This also changes how we store variables in the cache (which I've been
meaning to do for a while.) removing the dollar sign that usually
preceeded all cached requests in Beau. It's all more sensible now.

There's more refactoring left to do.
2018-04-13 10:12:03 -06:00
David Diaz e9c07cbbf9 0.8.0 2018-04-08 13:56:11 -06:00
Sergio Díaz 490bc85174
Merge pull request #7 from Seich/next-plugins
Refactored Beau's Plugin System
2018-04-08 13:41:34 -06:00
David Diaz 1fb45da5de Refactored Beau's Plugin System
It now uses a plugin registry. Plugins are loaded when the configuration
file is first parsed. When a request is made it is passed over to the
available modifiers before and after it's execution and applies
whichever changes are made. It now passes a copy instead of a reference
to provide a nicer interface.

Dynamic values have been added as a plugin type. These plugins are
javascript functions that can be called from within the beau file and
whose results are used as a replacement.

These are added along with variables to the runtime execution flow. The
current order for their execution is:

Request composition -> Dynamic Values -> Pre-Request Modifiers ->
Post-Request Modifiers.
2018-04-08 13:33:43 -06:00
David Diaz 293c3883e9 0.7.3 2018-03-01 16:03:45 -06:00
David Diaz 7e25f9fd29 Added update-notifier.
I like being notified of updates so I figured everyone else does. /s
2018-03-01 16:02:54 -06:00
David Diaz 070ffc3106 0.7.2 2018-03-01 11:44:15 -06:00
David Diaz 2f33442072 Added support for dotenv.
If a .env file is present it's values will be added to beau's
environment variables.
2018-03-01 11:42:41 -06:00
David Diaz 228d2de7f3 0.7.1 2018-03-01 11:02:51 -06:00
David Diaz 124d55d1ae Fixed issue where an empty payload was changed to an empty object. 2018-03-01 10:58:30 -06:00
David Diaz e140778393 0.7.0 2018-01-21 15:40:20 -06:00
Sergio Díaz 59acbd59b5
Merge pull request #6 from Seich/hosts
Added support for multiple hosts.
2018-01-21 15:37:56 -06:00
David Diaz fe401c1391 Added support for multiple hosts.
This introduces a top level key: `hosts`. It's an array where you can
configure multiple hosts with their own requests, they share defaults
and environment with the global scope.

This allows you to  have multiple paths being the same with different
endpoints and settings.
2018-01-19 18:10:00 -06:00
David Diaz 5f0f1821e4 0.6.1 2018-01-17 01:58:13 -06:00
David Diaz 8926f4d2da Updated package.json 2018-01-17 01:57:52 -06:00
David Diaz 2dbeb0d230 0.6.0 2018-01-11 17:30:22 -06:00
David Diaz 8ab1636e13 Updated README 2018-01-11 01:01:57 -06:00