README.org in org-converge-0.0.16 vs README.org in org-converge-0.0.17
- old
+ new
@@ -45,17 +45,17 @@
Notice that the Python block has =:procs= set to 2, meaning that
it would spawn 2 processes for this.
#+begin_src sh
,#+TITLE: Sample parallel run
-
+
,#+name: infinite-worker-in-ruby
,#+begin_src ruby
$stdout.sync = true
loop { puts "working!"; sleep 1; }
,#+end_src
-
+
,#+name: infinite-worker-in-python
,#+begin_src python :procs 2
import sys
import time
@@ -90,26 +90,26 @@
~runmode=sequential~ option.
#+begin_src sh
,#+TITLE: Sample sequential run
,#+runmode: sequential
-
+
,#+name: first
,#+begin_src sh
echo "first"
,#+end_src
-
+
,#+name: second
,#+begin_src sh
echo "second"
,#+end_src
-
+
,#+name: third
,#+begin_src sh
echo "third"
,#+end_src
-
+
,#+name: fourth
,#+begin_src sh
echo "fourth"
,#+end_src
#+end_src
@@ -147,46 +147,50 @@
For example, using Org Babel tangling functionality we can spread
config files on a server by writing the following on a ~server.org~ file...
#+begin_src sh
-
+
Configuration for a component that shoul be run in multitenant mode:
-
+
,#+begin_src yaml :tangle /etc/component.yml
multitenant: false
status_port: 10004
,#+end_src
#+end_src
Then run:
: sudo org-tangle server.org
+
+ *Note:* The above tangle command is a reimplementation of the tangling functionality from Org mode using Ruby.
+ If you are interested in tangling from the command line without losing functionality and have available a local Emacs Org mode install,
+ the following project can be useful: <https://github.com/ngirard/org-noweb>
*** Idempotent runs
A run can have idempotency checks (similar to how the execute resource from [[http://docs.opscode.com/resource_execute.html][Chef]] works).
An example of this, would be when installing packages. In this example,
we want to install the =build-essential= package once, and skip it in following runs:
#+begin_src sh
,** Installing the dependencies
-
+
Need the following so that ~bundle install~ can compile
the native extensions correctly.
-
+
,#+name: build-essential-installed
,#+begin_src sh
dpkg -l | grep build-essential
,#+end_src
-
+
,#+name: build_essentials
,#+begin_src sh :unless build-essential-installed
apt-get install build-essential -y
,#+end_src
-
+
,#+name: bundle_install
,#+begin_src sh
cd project_path
bundle install
,#+end_src
@@ -195,15 +199,15 @@
Furthermore,since we are using Org mode syntax, it is possible
to reuse this setup file by including it into another Org file:
#+begin_src sh
,#+TITLE: Another setup
-
+
Include the code blocks from the server into this:
-
+
,#+include: "server.org"
-
+
,#+name: install_org_mode
,#+begin_src sh
apt-get install org-mode -y
,#+end_src
#+end_src
@@ -227,38 +231,38 @@
#+begin_src sh
,#+TITLE: Linked tasks example
,#+runmode: tasks
,#+final_task: final
-
+
,#+name: second
,#+begin_src sh :after first
for i in `seq 5 10`; do
echo $i >> out.log
done
,#+end_src
-
+
,#+name: first
,#+begin_src ruby
5.times { |n| File.open("out.log", "a") {|f| f.puts n } }
,#+end_src
-
+
,#+name: final
,#+begin_src python :after second :results output
print "Wrapping up with Python in the end"
f = open('out.log', 'a')
f.write('11')
f.close()
,#+end_src
-
+
,#+name: prologue
,#+begin_src sh :before first :results output
echo "init" > out.log
,#+end_src
#+end_src
- : org-spec chained-example.org --runmode=chained
+ : org-run chained-example.org --runmode=chained
Instead of using =--runmode= options, it is also possible to just declare in buffer
that the Org file should be run chained mode.
#+begin_src org
@@ -286,12 +290,13 @@
For any of the cases above, it is also possible to specify
whether the code blocks should be run remotely on another node.
This is done by using =:dir= in the code block header argument.
#+begin_src sh
- ,#+sshidentifyfile: vagrant/keys/vagrant
+ ,#+sshidentityfile: vagrant/keys/vagrant
,#+name: remote-bash-code-block
+
,#+begin_src sh :results output :dir /vagrant@127.0.0.1#2222:/tmp
random_number=$RANDOM
for i in `seq 1 10`; do echo "[$random_number] Running script is $0 being run from `pwd`"; done
,#+end_src
#+end_src
@@ -304,17 +309,17 @@
there is an ~org-spec~ command which can be useful to check whether there was a change
that no longer makes the results from the Org file valid. Example:
#+begin_src sh
,#+TITLE: Expected results example
-
+
,#+name: hello
,#+begin_src ruby :results output
10.times do
puts "hola"
end
,#+end_src
-
+
,#+RESULTS: hello
,#+begin_example
hola
hola
hola