cachivache 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f0d05fd61763ddfbaf45081cd997a8044464e9be
4
+ data.tar.gz: 1b212da0f93c9300540e85b025d85d80d645385b
5
+ SHA512:
6
+ metadata.gz: 2a5e7ce917810238715143a5103d5c01287f20550de257930d83139a79526403e6cd6bc6c2de24b695f72c3f323e16631b68c2b0a4d9ce1079597e1b59d60df2
7
+ data.tar.gz: b5b95f01aefc1c9826570a1c97098cc3e2a7d658a1d0cce38cee3a4830ea0c72d2bae0ac15ba8bfc7e26c2ac605cad41593c36822a30be097dce4663092cf628
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cachivache.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Martin Rubi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,324 @@
1
+ # CabezaDeTermo::Cachivache
2
+
3
+ ## Installation
4
+
5
+ - `gem install cachivache`
6
+
7
+ ## Description
8
+
9
+ Cachivache is a provisioner for Vagrant machines with Ubuntu images.
10
+
11
+ You can provision a Vagrant VM using shell scripts, or more sophisticated tools like [Puppet](https://puppetlabs.com/), [Chef](https://www.chef.io/chef/), [salt](https://docs.saltstack.com/en/latest/), [Ansible](http://www.ansible.com/) and by the time you are reading this probably a few more.
12
+
13
+ If you are a developer, most of the time you just want to quickly provision you Vagrant with some bash script that installs some services and libraries, replace some parameter files in your application and probably run a few custom bash commands and that's pretty much it.
14
+ The good thing about provisioning with bash scripts is that it is fast and very easy to implement (just google how to install something and toss the bash script into the provision script and that's it).
15
+ On the other hand, the problems with shell provisions are that
16
+
17
+ - bash is unreadable. That's not a problem most of the times, but when the a task becomes a little more complex than c&p the apt-get instructions to install something, it becomes one (even some super simple tasks like replacing parameters in a file)
18
+
19
+ - it's very difficult to factorize and reuse
20
+
21
+ - even if you factorize it into little bash scripts, you can't easyly declare dependencies between these scripts
22
+
23
+ The provisioning tools like Puppet and Chef resolve these problems, and a lot more. Actually, they resolve so much more problems that is overkill to only use them to provision a Vagrant machine for developing.
24
+ All of these tools define their own DSL and high level concepts and metaphors, they require you configure them, you must search for the correct recipes to install what you want, etc.
25
+ These tools are a must to manage the provisioning of different environments, but for a single developer machine they are way too much.
26
+
27
+ Cachivache is a middle ground between bash scripts and these tools.
28
+ Instead of reinventing the wheel with a brand new DSL and new metaphors, Cachivache uses a wheel that we have had for ages: [Rake](https://github.com/ruby/rake).
29
+
30
+ ## Usage
31
+
32
+ Once you installed the `cachivache` gem, setup cachivache for your project:
33
+
34
+ - Go to the root of your project
35
+ - `cachivache init`
36
+ - `cd cachivache`
37
+
38
+ write some stuffs in your `stuff` folder and set what stuff to install and your git email and user:
39
+
40
+ - `cachivache config`
41
+
42
+ and that's it, you can now start Vagrant with:
43
+
44
+ - `vagrant up`
45
+ - `vagrant ssh`
46
+ - `cd src`
47
+
48
+ and you have your project running in a Vagrant machine.
49
+
50
+ If you want to commit from Vagrant, add the `:'projects-setup'` as a dependency of your project in the stuff you created, it will set your git credentials.
51
+
52
+ The idea behind Cachivache is to put little bash scripts in Rake tasks, and then run those tasks from within the Vagrant VM. As the Ubuntu images already come with a Ruby installation, there's not much to do at all.
53
+
54
+ So, Cachivache has very few concepts:
55
+
56
+ - Bash scripts, which you put in Rake tasks
57
+
58
+ - Rake tasks (also called stuffs in this framework), that can depend on other Rake tasks
59
+
60
+ - Ruby string interpolation, which allows you to easily parametrize stuff in the bash scripts
61
+
62
+ - And the secret ingredient: stuff
63
+
64
+ What is stuff? Stuff is a folder with .rb files. That's it. Cachivache believes in giving power to the people, so instead of defining how, where and when you must organize your scripts, it will let you organize things in any way you want in a couple of folders: `stuff-library` and `stuff`. No recipes, playbooks, roles, bags, configurations, minions, masters, slaves, facts, etc. Just put stuff in a folder.
65
+ [`stuff-library`](https://github.com/cabeza-de-termo/stuff-library) folder holds some existing stuff you can use to install things, and in `stuff` you can toss your own stuff for your project.
66
+
67
+ ## So, what does a stuff look like?
68
+
69
+ Well, here's an example stuff that setups all the necessary things to work on a php library:
70
+
71
+ ```ruby
72
+ dependencies = [
73
+ :'projects-setup',
74
+ :graphviz,
75
+ :xdebug,
76
+ :'php-cli',
77
+ :composer,
78
+ ]
79
+
80
+ stuff :'php-json-spec' => dependencies do
81
+ shell %{
82
+ cd #{PhpJsonSpec.project_folder}
83
+
84
+ composer install
85
+
86
+ # Run the test coverage report
87
+ php vendor/bin/phpunit -c phpunit-with-coverage.xml
88
+
89
+ # Generate the documentation
90
+ php vendor/bin/phpdoc
91
+ }
92
+ end
93
+
94
+ configure PhpJsonSpec do
95
+ let(:project_folder) { Cachivache.src_folder }
96
+ end
97
+ ```
98
+ ## How do I tell Cachivache what to install?
99
+
100
+ Edit the file `cachivache.rb` and define the stuffs to install in the section
101
+
102
+ ```ruby
103
+ ####################################
104
+ # Define what stuff to install
105
+ ####################################
106
+
107
+ let(:stuff_to_install) {
108
+ [
109
+ 'ruby-json-spec',
110
+ 'some-other-stuff',
111
+ 'a-namespace:and-another-one:more-stuff',
112
+ 'mysql-server', # You can install any stuff as long as it is defined
113
+ ]
114
+ }
115
+ ```
116
+
117
+ Note that if you set the dependencies of each stuff correctly, you will only have to tell Cachivache to install the top most stuff, and Rake will do the rest for you. Thanks Rake!
118
+
119
+ ## What other awesome features has Cachivache?
120
+
121
+ As I said before, all the work is done by Rake, so pretty much none.
122
+
123
+ There is some sintactic sugar you can use to perform some common task though. But please note that using any of these shorcuts is not mandatory at all, you can just stick to plain old shell scripts.
124
+
125
+ If you haven't see any ruby code before, here are some tips to use in Cachivache stuffs:
126
+
127
+ ### You can define strings in several ways:
128
+
129
+ ```ruby
130
+ stuff :'do-stuff' do
131
+ shell %Q{
132
+ echo "stuff"
133
+ }
134
+ end
135
+
136
+ # or
137
+
138
+ stuff :'do-stuff' do
139
+ shell %Q[
140
+ echo "stuff"
141
+ ]
142
+ end
143
+
144
+ # or
145
+
146
+ stuff :'do-stuff' do
147
+ shell %(
148
+ echo "stuff"
149
+ )
150
+ end
151
+
152
+ # or in a single line
153
+
154
+ stuff :'do-stuff' do
155
+ shell %Q{echo "stuff"}
156
+ end
157
+
158
+ # or with ""
159
+
160
+ stuff :'do-stuff' do
161
+ shell "echo \"stuff\""
162
+ end
163
+ ```
164
+
165
+ You see in the last example that if we define strings using "" we need to scape internals \", so the simpliest is to use `%Q{}`.
166
+
167
+ ### You can call as many `sh` blocks within a task as you like. You can also :invoke and :execute other tasks:
168
+
169
+ ```ruby
170
+ stuff :'do-stuff' do
171
+ shell %Q{
172
+ echo "stuff"
173
+ }
174
+
175
+ invoke 'install-apache'
176
+
177
+ shell %Q{
178
+ echo "even more stuff"
179
+ }
180
+
181
+ execute 'restart-apache'
182
+
183
+ shell! %Q{
184
+ echo "You would normally not need to use :shell! (note the exclamation mark) but you can"
185
+ }
186
+ end
187
+ ```
188
+
189
+ The difference between :invoke and :execute is that :execute will perform the task every time it's called, whilst :invoke will only run the task once during the provision. So, to install and configure stuff use :invoke, but to turn things on and off use :execute.
190
+ Or if your tasks are idempotent, always use :execute to make things simplier. It's up to you.
191
+
192
+ ### Instead of using bash `if ! ...; then; .... fi`, you can use these Cachivache helpers:
193
+
194
+ ```ruby
195
+ stuff :'do-stuff' do
196
+ shell_unless file_exists: '/bla.conf' do
197
+ shell %Q{
198
+ ls -la
199
+ rm -rf bla
200
+ }
201
+ end
202
+ end
203
+ ```
204
+
205
+ ```ruby
206
+ stuff :'do-stuff' do
207
+ shell_unless folder_exists: '/bla' do
208
+ shell %Q{
209
+ ls -la
210
+ rm -rf bla
211
+ }
212
+ end
213
+ end
214
+ ```
215
+
216
+ ```ruby
217
+ stuff :'do-stuff' do
218
+ shell_unless file: '/bla', contains: 'some regex' do
219
+ shell %Q{
220
+ ls -la
221
+ rm -rf bla
222
+ }
223
+ end
224
+ end
225
+ ```
226
+
227
+ ```ruby
228
+ stuff :'do-stuff' do
229
+ shell_unless command: 'java -version', contains: 'java 1.8' do
230
+ shell %Q{
231
+ ls -la
232
+ rm -rf bla
233
+ }
234
+ end
235
+ end
236
+ ```
237
+
238
+ - To append and replace text in a file, you can use this Cachivache helper:
239
+
240
+ ```ruby
241
+ stuff :'do-stuff' do
242
+ in_file "/etc/bla.conf" do
243
+ shell replace pattern: "%user%", with: "admin"
244
+
245
+ shell append "[cachivache]"
246
+ shell append "path='/bla'"
247
+ shell append :new_line
248
+ end
249
+ end
250
+ ```
251
+
252
+ ### You can use variables instead of hardcoding values in the scripts:
253
+
254
+ ```ruby
255
+ stuff :'do-stuff' do
256
+ shell %Q{
257
+ mkdir #{DoStuff.some_folder}
258
+
259
+ mkdir #{SomethingDefinedElsewhereWorksToo.some_folder}
260
+ }
261
+ end
262
+
263
+ configure DoStuff do
264
+ let(:some_folder) { '/home/vagrant/some-folder' }
265
+ end
266
+ ```
267
+
268
+ ### If you want to remind the user of something after the provision is done, in any task use :remind_to
269
+
270
+ ```ruby
271
+ stuff :'do-stuff' do
272
+ shell %Q{
273
+ ls -la
274
+ }
275
+
276
+ remind_to "Please don't forget to add '#{Cachivache.vagrant_ip_address} cachivache.com' to your /etc/hosts file"
277
+ end
278
+ ```
279
+ ## What if I want to use my own [`stuff-library`](https://github.com/cabeza-de-termo/stuff-library)?
280
+
281
+ No prob! Go to your `cachivache` folder and:
282
+
283
+ - `cachivache add-stuff-library git@github.com:someuser/my-very-own-stuff-library.git`
284
+
285
+ Cachivache will load any .rb file in the cachivache folder, so your library stuff will be loaded too.
286
+
287
+ To update some stuff library from git do:
288
+
289
+ - `cachivache update-stuff-libraries my-very-own-stuff-library`
290
+
291
+ To update all the stuff libraries do:
292
+
293
+ - `cachivache update-stuff-libraries`
294
+
295
+ To remove a stuff library do:
296
+
297
+ - `cachivache remove-stuff-libraries stuff-library`
298
+
299
+ ## Debugging
300
+
301
+ During the building of the stuff, it's useful to be able to see what the provision
302
+ what would do instead of running it.
303
+
304
+ To debug the provision do
305
+
306
+ - Go to the root of your project
307
+ - `cd cachivache`
308
+ - `vagrant ssh`
309
+ - `cd src/cachivache` (now you are in Vagrant)
310
+ - `bundle install`
311
+ - `rake explain` will output the complete shell script without running it
312
+ - `rake some-stuff` will execute only some-stuff and its dependencies
313
+
314
+ ## Running the tests
315
+
316
+ Not a single test was written this day :(
317
+
318
+ ## Contributing
319
+
320
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cabeza-de-termo/cachivache.
321
+
322
+ ## License
323
+
324
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/cachivache ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cachivache'
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ .vagrant
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'colorize'
@@ -0,0 +1,324 @@
1
+ # CabezaDeTermo::Cachivache
2
+
3
+ ## Installation
4
+
5
+ - `gem install cachivache`
6
+
7
+ ## Description
8
+
9
+ Cachivache is a provisioner for Vagrant machines with Ubuntu images.
10
+
11
+ You can provision a Vagrant VM using shell scripts, or more sophisticated tools like [Puppet](https://puppetlabs.com/), [Chef](https://www.chef.io/chef/), [salt](https://docs.saltstack.com/en/latest/), [Ansible](http://www.ansible.com/) and by the time you are reading this probably a few more.
12
+
13
+ If you are a developer, most of the time you just want to quickly provision you Vagrant with some bash script that installs some services and libraries, replace some parameter files in your application and probably run a few custom bash commands and that's pretty much it.
14
+ The good thing about provisioning with bash scripts is that it is fast and very easy to implement (just google how to install something and toss the bash script into the provision script and that's it).
15
+ On the other hand, the problems with shell provisions are that
16
+
17
+ - bash is unreadable. That's not a problem most of the times, but when the a task becomes a little more complex than c&p the apt-get instructions to install something, it becomes one (even some super simple tasks like replacing parameters in a file)
18
+
19
+ - it's very difficult to factorize and reuse
20
+
21
+ - even if you factorize it into little bash scripts, you can't easyly declare dependencies between these scripts
22
+
23
+ The provisioning tools like Puppet and Chef resolve these problems, and a lot more. Actually, they resolve so much more problems that is overkill to only use them to provision a Vagrant machine for developing.
24
+ All of these tools define their own DSL and high level concepts and metaphors, they require you configure them, you must search for the correct recipes to install what you want, etc.
25
+ These tools are a must to manage the provisioning of different environments, but for a single developer machine they are way too much.
26
+
27
+ Cachivache is a middle ground between bash scripts and these tools.
28
+ Instead of reinventing the wheel with a brand new DSL and new metaphors, Cachivache uses a wheel that we have had for ages: [Rake](https://github.com/ruby/rake).
29
+
30
+ ## Usage
31
+
32
+ Once you installed the `cachivache` gem, setup cachivache for your project:
33
+
34
+ - Go to the root of your project
35
+ - `cachivache init`
36
+ - `cd cachivache`
37
+
38
+ write some stuffs in your `stuff` folder and set what stuff to install and your git email and user:
39
+
40
+ - `cachivache config`
41
+
42
+ and that's it, you can now start Vagrant with:
43
+
44
+ - `vagrant up`
45
+ - `vagrant ssh`
46
+ - `cd src`
47
+
48
+ and you have your project running in a Vagrant machine.
49
+
50
+ If you want to commit from Vagrant, add the `:'projects-setup'` as a dependency of your project in the stuff you created, it will set your git credentials.
51
+
52
+ The idea behind Cachivache is to put little bash scripts in Rake tasks, and then run those tasks from within the Vagrant VM. As the Ubuntu images already come with a Ruby installation, there's not much to do at all.
53
+
54
+ So, Cachivache has very few concepts:
55
+
56
+ - Bash scripts, which you put in Rake tasks
57
+
58
+ - Rake tasks (also called stuffs in this framework), that can depend on other Rake tasks
59
+
60
+ - Ruby string interpolation, which allows you to easily parametrize stuff in the bash scripts
61
+
62
+ - And the secret ingredient: stuff
63
+
64
+ What is stuff? Stuff is a folder with .rb files. That's it. Cachivache believes in giving power to the people, so instead of defining how, where and when you must organize your scripts, it will let you organize things in any way you want in a couple of folders: `stuff-library` and `stuff`. No recipes, playbooks, roles, bags, configurations, minions, masters, slaves, facts, etc. Just put stuff in a folder.
65
+ [`stuff-library`](https://github.com/cabeza-de-termo/stuff-library) folder holds some existing stuff you can use to install things, and in `stuff` you can toss your own stuff for your project.
66
+
67
+ ## So, what does a stuff look like?
68
+
69
+ Well, here's an example stuff that setups all the necessary things to work on a php library:
70
+
71
+ ```ruby
72
+ dependencies = [
73
+ :'projects-setup',
74
+ :graphviz,
75
+ :xdebug,
76
+ :'php-cli',
77
+ :composer,
78
+ ]
79
+
80
+ stuff :'php-json-spec' => dependencies do
81
+ shell %{
82
+ cd #{PhpJsonSpec.project_folder}
83
+
84
+ composer install
85
+
86
+ # Run the test coverage report
87
+ php vendor/bin/phpunit -c phpunit-with-coverage.xml
88
+
89
+ # Generate the documentation
90
+ php vendor/bin/phpdoc
91
+ }
92
+ end
93
+
94
+ configure PhpJsonSpec do
95
+ let(:project_folder) { Cachivache.src_folder }
96
+ end
97
+ ```
98
+ ## How do I tell Cachivache what to install?
99
+
100
+ Edit the file `cachivache.rb` and define the stuffs to install in the section
101
+
102
+ ```ruby
103
+ ####################################
104
+ # Define what stuff to install
105
+ ####################################
106
+
107
+ let(:stuff_to_install) {
108
+ [
109
+ 'ruby-json-spec',
110
+ 'some-other-stuff',
111
+ 'a-namespace:and-another-one:more-stuff',
112
+ 'mysql-server', # You can install any stuff as long as it is defined
113
+ ]
114
+ }
115
+ ```
116
+
117
+ Note that if you set the dependencies of each stuff correctly, you will only have to tell Cachivache to install the top most stuff, and Rake will do the rest for you. Thanks Rake!
118
+
119
+ ## What other awesome features has Cachivache?
120
+
121
+ As I said before, all the work is done by Rake, so pretty much none.
122
+
123
+ There is some sintactic sugar you can use to perform some common task though. But please note that using any of these shorcuts is not mandatory at all, you can just stick to plain old shell scripts.
124
+
125
+ If you haven't see any ruby code before, here are some tips to use in Cachivache stuffs:
126
+
127
+ ### You can define strings in several ways:
128
+
129
+ ```ruby
130
+ stuff :'do-stuff' do
131
+ shell %Q{
132
+ echo "stuff"
133
+ }
134
+ end
135
+
136
+ # or
137
+
138
+ stuff :'do-stuff' do
139
+ shell %Q[
140
+ echo "stuff"
141
+ ]
142
+ end
143
+
144
+ # or
145
+
146
+ stuff :'do-stuff' do
147
+ shell %(
148
+ echo "stuff"
149
+ )
150
+ end
151
+
152
+ # or in a single line
153
+
154
+ stuff :'do-stuff' do
155
+ shell %Q{echo "stuff"}
156
+ end
157
+
158
+ # or with ""
159
+
160
+ stuff :'do-stuff' do
161
+ shell "echo \"stuff\""
162
+ end
163
+ ```
164
+
165
+ You see in the last example that if we define strings using "" we need to scape internals \", so the simpliest is to use `%Q{}`.
166
+
167
+ ### You can call as many `sh` blocks within a task as you like. You can also :invoke and :execute other tasks:
168
+
169
+ ```ruby
170
+ stuff :'do-stuff' do
171
+ shell %Q{
172
+ echo "stuff"
173
+ }
174
+
175
+ invoke 'install-apache'
176
+
177
+ shell %Q{
178
+ echo "even more stuff"
179
+ }
180
+
181
+ execute 'restart-apache'
182
+
183
+ shell! %Q{
184
+ echo "You would normally not need to use :shell! (note the exclamation mark) but you can"
185
+ }
186
+ end
187
+ ```
188
+
189
+ The difference between :invoke and :execute is that :execute will perform the task every time it's called, whilst :invoke will only run the task once during the provision. So, to install and configure stuff use :invoke, but to turn things on and off use :execute.
190
+ Or if your tasks are idempotent, always use :execute to make things simplier. It's up to you.
191
+
192
+ ### Instead of using bash `if ! ...; then; .... fi`, you can use these Cachivache helpers:
193
+
194
+ ```ruby
195
+ stuff :'do-stuff' do
196
+ shell_unless file_exists: '/bla.conf' do
197
+ shell %Q{
198
+ ls -la
199
+ rm -rf bla
200
+ }
201
+ end
202
+ end
203
+ ```
204
+
205
+ ```ruby
206
+ stuff :'do-stuff' do
207
+ shell_unless folder_exists: '/bla' do
208
+ shell %Q{
209
+ ls -la
210
+ rm -rf bla
211
+ }
212
+ end
213
+ end
214
+ ```
215
+
216
+ ```ruby
217
+ stuff :'do-stuff' do
218
+ shell_unless file: '/bla', contains: 'some regex' do
219
+ shell %Q{
220
+ ls -la
221
+ rm -rf bla
222
+ }
223
+ end
224
+ end
225
+ ```
226
+
227
+ ```ruby
228
+ stuff :'do-stuff' do
229
+ shell_unless command: 'java -version', contains: 'java 1.8' do
230
+ shell %Q{
231
+ ls -la
232
+ rm -rf bla
233
+ }
234
+ end
235
+ end
236
+ ```
237
+
238
+ - To append and replace text in a file, you can use this Cachivache helper:
239
+
240
+ ```ruby
241
+ stuff :'do-stuff' do
242
+ in_file "/etc/bla.conf" do
243
+ shell replace pattern: "%user%", with: "admin"
244
+
245
+ shell append "[cachivache]"
246
+ shell append "path='/bla'"
247
+ shell append :new_line
248
+ end
249
+ end
250
+ ```
251
+
252
+ ### You can use variables instead of hardcoding values in the scripts:
253
+
254
+ ```ruby
255
+ stuff :'do-stuff' do
256
+ shell %Q{
257
+ mkdir #{DoStuff.some_folder}
258
+
259
+ mkdir #{SomethingDefinedElsewhereWorksToo.some_folder}
260
+ }
261
+ end
262
+
263
+ configure DoStuff do
264
+ let(:some_folder) { '/home/vagrant/some-folder' }
265
+ end
266
+ ```
267
+
268
+ ### If you want to remind the user of something after the provision is done, in any task use :remind_to
269
+
270
+ ```ruby
271
+ stuff :'do-stuff' do
272
+ shell %Q{
273
+ ls -la
274
+ }
275
+
276
+ remind_to "Please don't forget to add '#{Cachivache.vagrant_ip_address} cachivache.com' to your /etc/hosts file"
277
+ end
278
+ ```
279
+ ## What if I want to use my own [`stuff-library`](https://github.com/cabeza-de-termo/stuff-library)?
280
+
281
+ No prob! Go to your `cachivache` folder and:
282
+
283
+ - `cachivache add-stuff-library git@github.com:someuser/my-very-own-stuff-library.git`
284
+
285
+ Cachivache will load any .rb file in the cachivache folder, so your library stuff will be loaded too.
286
+
287
+ To update some stuff library from git do:
288
+
289
+ - `cachivache update-stuff-libraries my-very-own-stuff-library`
290
+
291
+ To update all the stuff libraries do:
292
+
293
+ - `cachivache update-stuff-libraries`
294
+
295
+ To remove a stuff library do:
296
+
297
+ - `cachivache remove-stuff-libraries stuff-library`
298
+
299
+ ## Debugging
300
+
301
+ During the building of the stuff, it's useful to be able to see what the provision
302
+ what would do instead of running it.
303
+
304
+ To debug the provision do
305
+
306
+ - Go to the root of your project
307
+ - `cd cachivache`
308
+ - `vagrant ssh`
309
+ - `cd src/cachivache` (now you are in Vagrant)
310
+ - `bundle install`
311
+ - `rake explain` will output the complete shell script without running it
312
+ - `rake some-stuff` will execute only some-stuff and its dependencies
313
+
314
+ ## Running the tests
315
+
316
+ Not a single test was written this day :(
317
+
318
+ ## Contributing
319
+
320
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cabeza-de-termo/cachivache.
321
+
322
+ ## License
323
+
324
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).