d1488ab646f350f0a89a52381bff2185e22ea2d0
Dev In the spirit of applicatio...

Dev authored 7 years ago

1) # Notes on tool's architecture
2) 
3) This is Rudimentary Configuration Management (RCM) tool and is super true to its name. Everything is under `RCM` module/namespace to differentiate with other gems/ruby classes on the system.
4) 
5) Things are dependent on order of execution; especially if a resource is created by another one in the run. In our case, this is experienced for managing `/var/www/html/index.html` file as it is created by installation of `apache2`.
6) 
7) ## Target system configuration
8) 
9) `apache2`, `php5`  and `libapache2-mod-php5` are installed. Then default `/var/www/html/index.html` is deleted and `/var/www/html/index.php` is dropped in its place.
10) 
Dev Adding how to install and i...

Dev authored 7 years ago

11) ## Installation and invocation
12) 
13)     wget http://src.devghai.com/rcm/tarball/master -O rcm.tar
14)     mkdir rcm
15)     tar --directory rcm -xzf rcm.tar
16)     cd rcm
17)     sudo ./bootstrap.sh
Dev Fixing a typo.

Dev authored 7 years ago

18)     sudo ./task.rb
19) 
Dev Adding how to install and i...

Dev authored 7 years ago

20) 
Dev In the spirit of applicatio...

Dev authored 7 years ago

21) ## Structure
22) 
23) The layout of the project is as simple as it can be. All objects are in `objects` folder, while all the functions that execute on those objects, or their collection are in respective file in `managers` folder. `task.rb` is the controller and also doubles up as configuration parser and validator via `whatchugot`, `parse_packages`, `parse_files` and `parse_services`. Config parsing can be moved to its own class, but it was left as it is for this task as I tend to go into a rabbit-hole... and I need to deliver a solution asap.
24) 
25) ### Configration and resources
26) 
27) YAML parser is natively available in ruby core, and was chosen over JSON for its easier markup. There are only in 3 sections in `config.yaml` - `packages`, `files` and `services` - and they are processed in that order. Files needed by the program (`hello_world.php`) are in `resources` folder. Dependencies can be specified for services, with a condition that `path` for file and `name` for package need to appear in respective section. There is no way to specify dependency for package or file at this time.
28) 
29) ### Objects
30) 
Dev Fixing a typo.

Dev authored 7 years ago

31) All objects are under `objects` folder. `rcm_file`, `rcm_package` and `rcm_service` provide abstraction of respective resource for RCM purposes. They hold everything needed to evaluate current vs desired state.