285 Commits

Author SHA1 Message Date
Thibault Jouan 19b091a15c Rename Remote::Environment#{has_,}key? 2014-01-08 22:28:23 +00:00
Thibault Jouan 352fcd37f8 Modify recipe DSL API to take env on initialization 2014-01-08 22:13:14 +00:00
Thibault Jouan 1d6ae126ed Modify task DSL API to take env on initialization 2014-01-08 22:11:30 +00:00
Thibault Jouan b1010e44c5 Bump version to 0.1.9 2014-01-08 02:19:03 +00:00
Thibault Jouan 7dfbc3905b Rewrite CLI#run:
* Rename #run! to #run;
* Add #load_recipe method;
* Remove most builder/accessor/memoizable methods.
2014-01-08 02:10:18 +00:00
Thibault Jouan 4d34f66ec5 Add EX_USAGE constant in CLI class 2014-01-07 21:23:15 +00:00
Thibault Jouan 512c380517 Bump version to 0.1.9 2014-01-07 21:21:42 +00:00
Thibault Jouan f7efd9c42f Refactor CLI usage into CLI.run!:
* Add Producer::Core::CLI::ArgumentError class;
* Raise ArgumentError in CLI.new when recipe is missing;
* Remove #check_arguments! and #print_usage_and_exit, move code into
  .run! method.
2014-01-07 21:06:14 +00:00
Thibault Jouan dc9e7f1412 Improve CLI API related to standard output 2014-01-07 18:47:56 +00:00
Thibault Jouan d670d5dbdd Replace env.output interface with an IO like object 2013-12-23 23:31:15 +00:00
Thibault Jouan 012c776880 Simplify Remote::Environment with factory method:
* Implement .new_from_string factory class method;
* Rename private method #parse_from_string as class method
  .string_to_hash;
* Remove argument kind detection logic in constructor.
2013-12-21 03:08:01 +00:00
Thibault Jouan 4885483d75 Bump version to 0.1.7 2013-12-20 23:35:02 +00:00
Thibault Jouan e8be44d1f0 Implement `macro' recipe keyword 2013-12-20 23:19:16 +00:00
Thibault Jouan 43a781dc78 Remove Task::DSL.evaluate method 2013-12-20 11:43:18 +00:00
Thibault Jouan 366c682152 Remove Recipe::DSL.evaluate method 2013-12-20 11:24:30 +00:00
Thibault Jouan d83b11d07b Remove Condition::DSL.evaluate method 2013-12-20 11:24:30 +00:00
Thibault Jouan 9422705ad4 Fix coding standards in Remote (extra parentheses) 2013-12-20 11:24:30 +00:00
Thibault Jouan 9251c6af8e Improve coding standards 2013-12-20 06:46:28 +00:00
Thibault Jouan 0b68a8165d Bump version to 0.1.6 2013-12-20 06:28:03 +00:00
Thibault Jouan 892a9862fc Implement `file_write' action 2013-12-20 06:26:21 +00:00
Thibault Jouan 96daed624f Bump version to 0.1.5 2013-12-19 23:26:26 +00:00
Thibault Jouan 35621e1f5f Implement condition DSL negated test prefix (no_*)
* Allow no_* to be used for every tests in condition DSL:
  condition { no_has_env :shell, '/bin/sh' };
* Modify Test constructor to accept negated: named argument, implement
  #negated? and #pass?;
* Rename #success? to #verify in all test classes.
2013-12-19 20:22:44 +00:00
Thibault Jouan a36b30dd3c Bump version to 0.1.4 2013-10-01 19:38:09 +00:00
Thibault Jouan 85a47df547 Use SSH user name configured for a given target:
When a user is configured for the targeted host name, use it for SSH
authentification instead of the name of current user logged in.

* Modify Remote#user_name to use configured user name.
2013-09-28 20:07:36 +00:00
Thibault Jouan 768a6755de Implement Remote#config:
Load SSH configuration for targeted host name.
2013-09-26 19:22:07 +00:00
Thibault Jouan 9985fceb63 Extract logic for current target ssh user name:
Add Remote#user_name method, with code returning which user name
will be used for SSH authentication.
2013-09-26 18:34:19 +00:00
Thibault Jouan c281687bfb Bump version to 0.1.3 2013-09-26 00:30:41 +00:00
Thibault Jouan 2cbe1726f7 Implement `has_file' condition keyword 2013-09-26 00:28:40 +00:00
Thibault Jouan 3492382968 Implement Remote::FS#has_file? 2013-09-26 00:28:40 +00:00
Thibault Jouan 91f2bc3567 Implement Remote#fs 2013-09-26 00:28:40 +00:00
Thibault Jouan 99710b0df9 Implement Remote::FS#sftp 2013-09-26 00:28:40 +00:00
Thibault Jouan d240df0281 Add Remote::FS class 2013-09-26 00:28:40 +00:00
Thibault Jouan e51adbdefa Bump version to 0.1.2 2013-09-26 00:20:39 +00:00
Thibault Jouan e676eb40d6 Transform Tests class in a module 2013-09-23 21:44:50 +00:00
Thibault Jouan 8247f3a973 Bump version to 0.1.1 2013-08-20 03:53:38 +00:00
Thibault Jouan 5d3173977f Bump version to 0.1.0 2013-08-20 03:16:45 +00:00
Thibault Jouan 04afc82a29 Implement `has_env' condition keyword 2013-08-20 03:03:17 +00:00
Thibault Jouan b0ea7d876e Implement Remote#environment:
Build and return a Remote::Environment instance, with the output of
`env` command execution.
2013-08-20 03:03:07 +00:00
Thibault Jouan 513ba4eedb Implement basic Remote::Environment class:
Represent a registry for remote environment variables, will follow an
API similar to Hash except the constructor. Currently only #has_key? is
implemented.
2013-08-20 02:13:54 +00:00
Thibault Jouan ed99c191e0 Build conditions with DSL evaluated tests:
In Condition:

  * Modify constructor to accepts tests and a default return value;
  * Implement #met?;
  * Modify #! so that it return the negated value returned by #met?.

  In Condition::DSL:

  * Modify .evaluate to build the condition with tests and the value
    returned by a the evaluated condition block.

  Add a basic Test base class, with env and arguments as attributes.

  Add some spec helpers to build some easily testable kind of Test
instances (as test doubles).
2013-08-18 00:29:36 +00:00
Thibault Jouan 00a11e159f Use instance_eval in Condition::DSL#evaluate:
Use instance_eval so that the assigned block is evaluated inside the
DSL sandbox instance, giving access to all required methods and instance
variables.
2013-08-18 00:29:36 +00:00
Thibault Jouan 3a0ce82799 Improve Condition DSL framework:
Add the necessary API so that we can implement new tests easily as new
standalone classes.

  In Condition::DSL:

* Add #tests accessor;
* Modify constructor so that it accepts the env;
* Implement .define_test(keyword, class) method.
2013-08-18 00:29:36 +00:00
Thibault Jouan 639bdc1c73 Implement basic condition DSL framework for tests:
Instead of interrupting task evaluation when condition is not met,
allow the whole task to be evaluated (including condition and
evaluation) so that the interpreter will get all tasks actions (whether
condition is met or not) and be able to query the condition.

* Modify Interpreter#process_task: test if task condition is met before
  applying the actions;
* Implement condition handling in Task and Task::DSL;
* Implement Condition and Condition::DSL (useless as they are, but
  needed to implement later test keywords as part of the condition DSL.
2013-08-18 00:29:14 +00:00
Thibault Jouan b4e6fa3ef6 Fix sort order of main internal requires 2013-08-17 00:44:28 +00:00
Thibault Jouan e4a4211a7b Rename Worker class as Interpreter 2013-08-16 19:30:51 +00:00
Thibault Jouan 5a4c8c02bc Fix coding standards in Task class 2013-08-15 22:35:10 +00:00
Thibault Jouan d4d5222261 Refactor task DSL usages:
Remove most of task evaluation code from Task class, rely on
Task::DSL.evaluate to get an evaluated task.

* Task: remove #evaluate, change constructor prototype to accept actions
  instead of a block, implement .evaluate(name, env &block);
* Implement Task::DSL.evaluate method;
* Recipe::DSL: remove tasks evaluation from#evaluate, modify #task to
  use Task.evaluate to return the new task to be rigstered.
2013-08-15 22:28:16 +00:00
Thibault Jouan a675c9c910 Implement `echo' task action 2013-08-14 23:43:36 +00:00
Thibault Jouan f0e144cebd Refactor and simplify recipe DSL evaluation usages:
Remove most of recipe evaluation code in Recipe class, and rely on
Recipe::DSL to get evaluated recipes.

* Remove Recipe#evaluate call from CLI, rely on
  Recipe.evaluate_from_file to get the evaluated recipe;
* Implement Recipe.evaluate_from_file(filepath, env);
* Implement Recipe::DSL.evaluate(code, env);
* Remove code and filepath accessor on Recipe;
* Remove Recipe.from_file and Recipe#evaluate methods;
* Move task evaluations in Recipe::DSL#evaluate;
* Modify Recipe constructor so that it accepts tasks as argument.
2013-08-14 19:48:43 +00:00
Thibault Jouan 53db841b2d Remove Env#current_recipe attribute 2013-08-13 01:36:33 +00:00