org-converge 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f820b2bd05b18d9597ca859f80704b1375b8e78b
4
- data.tar.gz: 150113c16bad5a6aa993e2dd6ab20aad39e78620
3
+ metadata.gz: 6cf889f8ef7be8359861d16b9c6ce2a686de0044
4
+ data.tar.gz: 6cda1842ca4d7862c7f8365c307c3e529e64e206
5
5
  SHA512:
6
- metadata.gz: f9d49510cbafe950e8e846ef3bc4113c5cacc647ed26e0c2dff5f1d8183b79ebe1eef613a79cb7906230d276a91db15e9d6d5b5a50803b49b5a727106800d9b2
7
- data.tar.gz: df152bb016b5438a2fc8cd919fc4b7cbb9647c9f5791b0ff060caa0dce9728103df833db07825ea143b16ecc2b9fd01be400dca825c719c7229fe9177db16bbf
6
+ metadata.gz: c7148d17f782828501fe134b62eef994acec46de820d4de785ca9365831d9f28156e21cdf4e24c30b7bf148f6957b7a834dcce82cca1f6a3263708174f940397
7
+ data.tar.gz: 322e52f96e1283746958de21cd84e4db78e069cd2eb9bfd8bbf727516f9ee0bbaeed0107af04497ec9dae103a33d6041a39df41cfe8c11614f754e38bf88bb01
data/README.org CHANGED
@@ -47,13 +47,13 @@
47
47
 
48
48
  #+begin_src sh
49
49
  ,#+TITLE: Sample parallel run
50
-
50
+  
51
51
  ,#+name: infinite-worker-in-ruby
52
52
  ,#+begin_src ruby
53
53
  $stdout.sync = true
54
54
  loop { puts "working!"; sleep 1; }
55
55
  ,#+end_src
56
-
56
+  
57
57
  ,#+name: infinite-worker-in-python
58
58
  ,#+begin_src python :procs 2
59
59
  import sys
@@ -92,22 +92,22 @@
92
92
  #+begin_src sh
93
93
  ,#+TITLE: Sample sequential run
94
94
  ,#+runmode: sequential
95
-
95
+  
96
96
  ,#+name: first
97
97
  ,#+begin_src sh
98
98
  echo "first"
99
99
  ,#+end_src
100
-
100
+  
101
101
  ,#+name: second
102
102
  ,#+begin_src sh
103
103
  echo "second"
104
104
  ,#+end_src
105
-
105
+  
106
106
  ,#+name: third
107
107
  ,#+begin_src sh
108
108
  echo "third"
109
109
  ,#+end_src
110
-
110
+  
111
111
  ,#+name: fourth
112
112
  ,#+begin_src sh
113
113
  echo "fourth"
@@ -149,9 +149,9 @@
149
149
  config files on a server by writing the following on a ~server.org~ file...
150
150
 
151
151
  #+begin_src sh
152
-
152
+  
153
153
  Configuration for a component that shoul be run in multitenant mode:
154
-
154
+  
155
155
  ,#+begin_src yaml :tangle /etc/component.yml
156
156
  multitenant: false
157
157
  status_port: 10004
@@ -161,6 +161,10 @@ status_port: 10004
161
161
  Then run:
162
162
 
163
163
  : sudo org-tangle server.org
164
+
165
+ *Note:* The above tangle command is a reimplementation of the tangling functionality from Org mode using Ruby.
166
+ If you are interested in tangling from the command line without losing functionality and have available a local Emacs Org mode install,
167
+ the following project can be useful: <https://github.com/ngirard/org-noweb>
164
168
 
165
169
  *** Idempotent runs
166
170
 
@@ -171,20 +175,20 @@ status_port: 10004
171
175
 
172
176
  #+begin_src sh
173
177
  ,** Installing the dependencies
174
-
178
+  
175
179
  Need the following so that ~bundle install~ can compile
176
180
  the native extensions correctly.
177
-  
181
+   
178
182
  ,#+name: build-essential-installed
179
183
  ,#+begin_src sh
180
184
  dpkg -l | grep build-essential
181
185
  ,#+end_src
182
-  
186
+    
183
187
  ,#+name: build_essentials
184
188
  ,#+begin_src sh :unless build-essential-installed
185
189
  apt-get install build-essential -y
186
190
  ,#+end_src
187
-
191
+   
188
192
  ,#+name: bundle_install
189
193
  ,#+begin_src sh
190
194
  cd project_path
@@ -197,11 +201,11 @@ status_port: 10004
197
201
 
198
202
  #+begin_src sh
199
203
  ,#+TITLE: Another setup
200
-
204
+  
201
205
  Include the code blocks from the server into this:
202
-  
206
+   
203
207
  ,#+include: "server.org"
204
-
208
+  
205
209
  ,#+name: install_org_mode
206
210
  ,#+begin_src sh
207
211
  apt-get install org-mode -y
@@ -229,19 +233,19 @@ it would be run sequentially with idempotency checks applied:
229
233
  ,#+TITLE: Linked tasks example
230
234
  ,#+runmode: tasks
231
235
  ,#+final_task: final
232
-
236
+  
233
237
  ,#+name: second
234
238
  ,#+begin_src sh :after first
235
239
  for i in `seq 5 10`; do
236
240
  echo $i >> out.log
237
241
  done
238
242
  ,#+end_src
239
-
243
+  
240
244
  ,#+name: first
241
245
  ,#+begin_src ruby
242
246
  5.times { |n| File.open("out.log", "a") {|f| f.puts n } }
243
247
  ,#+end_src
244
-
248
+  
245
249
  ,#+name: final
246
250
  ,#+begin_src python :after second :results output
247
251
  print "Wrapping up with Python in the end"
@@ -249,14 +253,14 @@ it would be run sequentially with idempotency checks applied:
249
253
  f.write('11')
250
254
  f.close()
251
255
  ,#+end_src
252
-
256
+  
253
257
  ,#+name: prologue
254
258
  ,#+begin_src sh :before first :results output
255
259
  echo "init" > out.log
256
260
  ,#+end_src
257
261
  #+end_src
258
262
 
259
- : org-spec chained-example.org --runmode=chained
263
+ : org-run chained-example.org --runmode=chained
260
264
 
261
265
  Instead of using =--runmode= options, it is also possible to just declare in buffer
262
266
  that the Org file should be run chained mode.
@@ -288,8 +292,9 @@ it would be run sequentially with idempotency checks applied:
288
292
  This is done by using =:dir= in the code block header argument.
289
293
 
290
294
  #+begin_src sh
291
- ,#+sshidentifyfile: vagrant/keys/vagrant
295
+ ,#+sshidentityfile: vagrant/keys/vagrant
292
296
  ,#+name: remote-bash-code-block
297
+  
293
298
  ,#+begin_src sh :results output :dir /vagrant@127.0.0.1#2222:/tmp
294
299
  random_number=$RANDOM
295
300
  for i in `seq 1 10`; do echo "[$random_number] Running script is $0 being run from `pwd`"; done
@@ -306,14 +311,14 @@ it would be run sequentially with idempotency checks applied:
306
311
 
307
312
  #+begin_src sh
308
313
  ,#+TITLE: Expected results example
309
-  
314
+   
310
315
  ,#+name: hello
311
316
  ,#+begin_src ruby :results output
312
317
  10.times do
313
318
  puts "hola"
314
319
  end
315
320
  ,#+end_src
316
-  
321
+   
317
322
  ,#+RESULTS: hello
318
323
  ,#+begin_example
319
324
  hola
data/TODO CHANGED
@@ -35,6 +35,12 @@ Some of these need further work on the Org Ruby parser.
35
35
  - [ ] =:cache true=
36
36
  Also part of the idempotency checks.
37
37
  - [ ] =:env= and =#+envfile:=
38
+ - [ ] Create pools for running processes
39
+
40
+ * [2/2] 0.0.17
41
+
42
+ - [X] Typos
43
+ - [X] Override the =:dir= for remote processes
38
44
 
39
45
  * [1/1] 0.0.16
40
46
 
@@ -8,7 +8,7 @@ doc = <<OPTIONS
8
8
  org-converge: Run with idempotency checks.
9
9
 
10
10
  Usage:
11
- org-converge <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>]
11
+ org-converge <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>] [--dir=<dir>]
12
12
 
13
13
  Options:
14
14
 
@@ -8,7 +8,7 @@ doc = <<OPTIONS
8
8
  org-run: Run code blocks in parallel by default.
9
9
 
10
10
  Usage:
11
- org-run <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>] [--runmode=<runmode>] [--name=<block_name>]
11
+ org-run <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>] [--runmode=<runmode>] [--name=<block_name>] [--dir=<dir>]
12
12
 
13
13
  Options:
14
14
 
@@ -11,6 +11,7 @@ module OrgConverge
11
11
  @options = options
12
12
  @dotorg = options['<org_file>']
13
13
  @root_dir = options['--root-dir']
14
+ @dir = options['--dir']
14
15
  @run_dir = if @root_dir
15
16
  File.expand_path(File.join(@root_dir, 'run'))
16
17
  else
@@ -368,6 +369,7 @@ module OrgConverge
368
369
  end
369
370
  end
370
371
 
372
+ script[:header][:dir] = @dir if @dir
371
373
  if script[:header][:procs]
372
374
  procs = script[:header][:procs].to_i
373
375
  1.upto(procs) do |i|
@@ -222,7 +222,7 @@ module OrgConverge
222
222
  ssh_options = { }
223
223
  ssh_options[:port] = block_modifiers[:ssh][:port]
224
224
  ssh_options[:password] = block_modifiers[:ssh][:password] if block_modifiers[:ssh][:password]
225
- ssh_options[:keys] = @babel.ob.in_buffer_settings['SSHIDENTIFYFILE'] if @babel.ob.in_buffer_settings['SSHIDENTIFYFILE']
225
+ ssh_options[:keys] = @babel.ob.in_buffer_settings['SSHIDENTITYFILE'] if @babel.ob.in_buffer_settings['SSHIDENTITYFILE']
226
226
  begin
227
227
  # SCP the script to run remotely and the binary used to run it
228
228
  binary, script = command.split(' ')
@@ -1,3 +1,3 @@
1
1
  module OrgConverge
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  #+TITLE: Remote runs
2
- #+sshidentifyfile: vagrant/keys/vagrant
2
+ #+sshidentityfile: vagrant/keys/vagrant
3
3
  #+sshpassword: vagrant
4
4
  #+startup: showeverything
5
5
 
@@ -174,6 +174,21 @@ describe OrgConverge::Command do
174
174
  result.should == "within subdir\n"
175
175
  end
176
176
 
177
+ it "should be able to override chdir the process directory" do
178
+ example_dir = File.join(EXAMPLES_DIR, 'chdir')
179
+ setup_file = File.join(example_dir, 'override-dir.org')
180
+
181
+ o = OrgConverge::Command.new({
182
+ '<org_file>' => setup_file,
183
+ '--root-dir' => example_dir,
184
+ '--dir' => "subdir"
185
+ })
186
+ success = o.execute!
187
+ success.should == true
188
+ result = File.open("#{example_dir}/subdir/out.log").read
189
+ result.should == "within subdir\n"
190
+ end
191
+
177
192
  it "should support idempotency checks via :if and :unless conditional clauses" do
178
193
  example_dir = File.join(EXAMPLES_DIR, 'idempotency')
179
194
  setup_file = File.join(example_dir, 'conditions.org')
@@ -52,7 +52,7 @@ end
52
52
 
53
53
  #+name: vagrant-running
54
54
  #+begin_src sh
55
- vagrant status
55
+ vagrant status | grep poweron
56
56
  #+end_src
57
57
 
58
58
  #+name: start_vagrant
@@ -80,9 +80,10 @@ fi
80
80
  #+begin_src sh :dir /vagrant@localhost#2222:/ :if running-in-ubuntu
81
81
  sudo apt-get update
82
82
  sudo apt-get install build-essentials emacs24-nox org-mode -y
83
+ sudo apt-get install docker.io -y
83
84
  #+end_src
84
85
 
85
- **** Vagrantfile :: Docker provider
86
+ **** COMMENT Vagrantfile :: Docker provider
86
87
 
87
88
  #+begin_src ruby :tangle docker/Vagrantfile :mkdirp true
88
89
  Vagrant.configure("2") do |config|
@@ -95,7 +96,7 @@ end
95
96
  #+begin_src conf :tangle docker/Dockerfile
96
97
  FROM ubuntu
97
98
  RUN apt-get -y update
98
- RUN apt-get -y install emacs24-nox org-mode
99
+ RUN apt-get -y install emacs24-nox
99
100
  #+end_src
100
101
 
101
102
  #+name: vagrant-docker-provider
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: org-converge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Waldemar Quevedo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-07 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt