org-converge 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/TODO +42 -2
- data/lib/org-converge/babel_output_buffer.rb +16 -15
- data/lib/org-converge/command.rb +31 -16
- data/lib/org-converge/engine.rb +90 -10
- data/lib/org-converge/version.rb +1 -1
- data/spec/converge_examples/basic_run_example/setup.org +2 -2
- data/spec/converge_examples/block_modifiers/run.org +29 -0
- data/spec/converge_examples/expected_results/spec.org +4 -1
- data/spec/converge_examples/expected_results/spec2.org +1 -1
- data/spec/converge_examples/runlist_example/setup.org +1 -1
- data/spec/converge_examples/shebang/run.org +24 -0
- data/spec/converge_spec.rb +15 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e89091fab09c57f8564f168764b393111f5138
|
4
|
+
data.tar.gz: c7a7d29b0c0a86e11d95271d117a685cbab41793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43e71d209d7ea8bf2ada721adc05cda93734d3c85c1d9d3dcd01f8ee056258d1276aa7d4528672251a377af134cf3ed23507e3af430d7590bde9a7c75932a5b8
|
7
|
+
data.tar.gz: 6b95cf0b6c050102f52740400aa1d305f47369aec5655772717009b61597b31913250ac3f8c2b1b4704eddcee7aafaa6f7557b34aea2fd84d03f67a1c3802740
|
data/TODO
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#+TODO: TODO | DONE CANCELED
|
3
3
|
#+startup: showeverything
|
4
4
|
|
5
|
-
* [0/
|
5
|
+
* [0/10] 0.1.0 version
|
6
6
|
|
7
7
|
- [ ] Macros can be loaded and applied to the configuration
|
8
8
|
- [ ] Actually support converging and idempotency (~--runmode=idempotent~)
|
@@ -17,8 +17,48 @@
|
|
17
17
|
- [ ] Can use ~:dir~ for running a process relative to that directory
|
18
18
|
- [ ] Bugfix for when results blocks have only inline examples or images
|
19
19
|
- [ ] Bugfix for when the result from a ~org-spec~ run has non-zero exit status
|
20
|
+
- [ ] Bugfixes for spec run
|
20
21
|
|
21
|
-
* [
|
22
|
+
* [0/5] 0.0.14
|
23
|
+
|
24
|
+
- [ ] Distributed run helpers for the header arguments
|
25
|
+
: ssh
|
26
|
+
- [ ] =:waits:=
|
27
|
+
Wait for other processes to start before starting.
|
28
|
+
The process does not start until the alive signal to the following
|
29
|
+
list of processes succeeds.
|
30
|
+
- [ ] =:awaits:=
|
31
|
+
Wait for other processes to finish before starting.
|
32
|
+
- [ ] =:onerror=
|
33
|
+
aborteverything, restart, runhandler
|
34
|
+
- [ ] =:assertedby=
|
35
|
+
|
36
|
+
* [2/2] 0.0.13
|
37
|
+
|
38
|
+
- [X] =:waitsfor=, =:waitfor=, =:sleep:=
|
39
|
+
The process starts after this delay
|
40
|
+
- [X] =:timeoutin=, =:timeout=
|
41
|
+
|
42
|
+
The process stops running after this time
|
43
|
+
|
44
|
+
* [1/1] 0.0.12
|
45
|
+
|
46
|
+
- [X] Use the shebang for the binary
|
47
|
+
|
48
|
+
#+begin_src ruby :results output
|
49
|
+
cmd = "#!/bin/bash".gsub('#!', '')
|
50
|
+
|
51
|
+
puts cmd
|
52
|
+
#+end_src
|
53
|
+
|
54
|
+
#+RESULTS:
|
55
|
+
: /bin/bash
|
56
|
+
|
57
|
+
* [1/1] 0.0.11
|
58
|
+
|
59
|
+
- [X] Normalize the binaries used for some languages (bash, node)
|
60
|
+
|
61
|
+
* [1/1] 0.0.10
|
22
62
|
|
23
63
|
- [X] Add ~:procs~ to code blocks to identify how many times it should run
|
24
64
|
|
@@ -45,13 +45,20 @@ module Orgmode
|
|
45
45
|
def insert(line)
|
46
46
|
# We try to get the lang from #+BEGIN_SRC and #+BEGIN_EXAMPLE blocks
|
47
47
|
if line.begin_block?
|
48
|
+
block_header_arguments = { }
|
49
|
+
line.block_header_arguments.each_pair do |k, v|
|
50
|
+
if k.class == Symbol
|
51
|
+
block_header_arguments[k] = v
|
52
|
+
else
|
53
|
+
new_key = k.gsub(':', '').to_sym
|
54
|
+
block_header_arguments[new_key] = v
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
48
58
|
case
|
49
|
-
when
|
50
|
-
@current_tangle =
|
51
|
-
@tangle[@current_tangle][:header] =
|
52
|
-
:shebang => line.block_header_arguments[':shebang'],
|
53
|
-
:mkdirp => line.block_header_arguments[':mkdirp']
|
54
|
-
}
|
59
|
+
when block_header_arguments[:tangle]
|
60
|
+
@current_tangle = block_header_arguments[:tangle]
|
61
|
+
@tangle[@current_tangle][:header] = block_header_arguments
|
55
62
|
@tangle[@current_tangle][:lang] = line.block_lang
|
56
63
|
when line.properties['block_name']
|
57
64
|
# unnamed blocks are not run
|
@@ -59,16 +66,10 @@ module Orgmode
|
|
59
66
|
@buffer = ''
|
60
67
|
|
61
68
|
# Need to keep track of the options from a block before running it
|
62
|
-
@scripts[@scripts_counter][:header] =
|
63
|
-
|
64
|
-
:mkdirp => line.block_header_arguments[':mkdirp'],
|
65
|
-
:name => line.properties['block_name'],
|
66
|
-
:before => line.block_header_arguments[':before'],
|
67
|
-
:after => line.block_header_arguments[':after'],
|
68
|
-
:procs => line.block_header_arguments[':procs'],
|
69
|
-
}
|
69
|
+
@scripts[@scripts_counter][:header] = block_header_arguments
|
70
|
+
@scripts[@scripts_counter][:header][:name] = line.properties['block_name']
|
70
71
|
@scripts[@scripts_counter][:lang] = normalize_lang(line.block_lang)
|
71
|
-
|
72
|
+
|
72
73
|
# TODO: have a way to specify which are the default binaries to be used per language
|
73
74
|
# when binary_detected?(@block_lang)
|
74
75
|
else
|
data/lib/org-converge/command.rb
CHANGED
@@ -42,6 +42,7 @@ module OrgConverge
|
|
42
42
|
true
|
43
43
|
rescue => e
|
44
44
|
@logger.error e
|
45
|
+
@logger.error e.backtrace.join("\n")
|
45
46
|
false
|
46
47
|
end
|
47
48
|
|
@@ -81,7 +82,7 @@ module OrgConverge
|
|
81
82
|
logger.error "Cannot converge because there were errors during tangle step".fg 'red'
|
82
83
|
end
|
83
84
|
|
84
|
-
def run_blocks_chain!
|
85
|
+
def run_blocks_chain!
|
85
86
|
# Chain the blocks by defining them as Rake::Tasks dynamically
|
86
87
|
tasks = { }
|
87
88
|
|
@@ -93,8 +94,9 @@ module OrgConverge
|
|
93
94
|
task = Rake::Task.define_task task_name do
|
94
95
|
with_running_engine do |engine|
|
95
96
|
file = File.expand_path("#{@run_dir}/#{key}")
|
96
|
-
|
97
|
-
|
97
|
+
bin = determine_lang_bin(script)
|
98
|
+
cmd = "#{bin} #{file}"
|
99
|
+
run_procs(script, cmd, engine)
|
98
100
|
end
|
99
101
|
end
|
100
102
|
tasks[task_name] = {
|
@@ -146,8 +148,9 @@ module OrgConverge
|
|
146
148
|
display_name = script[:header][:name]
|
147
149
|
with_running_engine do |engine|
|
148
150
|
file = File.expand_path("#{@run_dir}/#{key}")
|
149
|
-
|
150
|
-
|
151
|
+
bin = determine_lang_bin(script)
|
152
|
+
cmd = "#{bin} #{file}"
|
153
|
+
run_procs(script, cmd)
|
151
154
|
end
|
152
155
|
end
|
153
156
|
logger.info "Run has completed successfully.".fg 'green'
|
@@ -157,12 +160,12 @@ module OrgConverge
|
|
157
160
|
@engine = OrgConverge::Engine.new(:logger => @logger, :babel => @babel)
|
158
161
|
babel.tangle_runnable_blocks!(@run_dir)
|
159
162
|
babel.ob.scripts.each do |key, script|
|
160
|
-
file = File.expand_path("#{@run_dir}/#{key}")
|
161
|
-
cmd = "#{script[:lang]} #{file}"
|
162
|
-
|
163
163
|
# Decision: Only run blocks which have a name
|
164
164
|
next unless script[:header][:name]
|
165
165
|
|
166
|
+
file = File.expand_path("#{@run_dir}/#{key}")
|
167
|
+
bin = determine_lang_bin(script)
|
168
|
+
cmd = "#{bin} #{file}"
|
166
169
|
run_procs(script, cmd)
|
167
170
|
end
|
168
171
|
logger.info "Running code blocks now! (#{babel.ob.scripts.count} runnable blocks found in total)"
|
@@ -176,7 +179,8 @@ module OrgConverge
|
|
176
179
|
scripts = babel.ob.scripts.select {|k, h| h[:header][:name] =~ Regexp.new(@options['--name']) }
|
177
180
|
scripts.each do |key, script|
|
178
181
|
file = File.expand_path("#{@run_dir}/#{key}")
|
179
|
-
|
182
|
+
bin = determine_lang_bin(script)
|
183
|
+
cmd = "#{bin} #{file}"
|
180
184
|
run_procs(script, cmd)
|
181
185
|
end
|
182
186
|
|
@@ -203,7 +207,8 @@ module OrgConverge
|
|
203
207
|
display_name = script[:header][:name]
|
204
208
|
with_running_engine do |engine|
|
205
209
|
file = File.expand_path("#{@run_dir}/#{key}")
|
206
|
-
|
210
|
+
bin = determine_lang_bin(script)
|
211
|
+
cmd = "#{bin} #{file}"
|
207
212
|
engine.register display_name, cmd, { :cwd => @root_dir, :logger => logger }
|
208
213
|
end
|
209
214
|
end
|
@@ -238,7 +243,8 @@ module OrgConverge
|
|
238
243
|
display_name = script[:header][:name]
|
239
244
|
script_file = File.expand_path("#{@run_dir}/#{key}")
|
240
245
|
results_file = File.expand_path("#{@results_dir}/#{key}")
|
241
|
-
|
246
|
+
bin = determine_lang_bin(script)
|
247
|
+
cmd = "#{bin} #{script_file}"
|
242
248
|
|
243
249
|
with_running_engine(:runmode => 'spec', :results_dir => @results_dir) \
|
244
250
|
do |engine|
|
@@ -335,16 +341,25 @@ module OrgConverge
|
|
335
341
|
end
|
336
342
|
end
|
337
343
|
|
338
|
-
def run_procs(script, cmd)
|
344
|
+
def run_procs(script, cmd, engine=nil)
|
345
|
+
engine ||= @engine
|
339
346
|
display_name = script[:header][:name]
|
340
347
|
if script[:header][:procs]
|
341
348
|
procs = script[:header][:procs].to_i
|
342
|
-
procs
|
343
|
-
proc_name = "#{display_name}
|
344
|
-
|
349
|
+
1.upto(procs) do |i|
|
350
|
+
proc_name = "#{display_name}:#{i}"
|
351
|
+
engine.register proc_name, cmd, { :cwd => @root_dir, :logger => logger, :header => script[:header] }
|
345
352
|
end
|
346
353
|
else
|
347
|
-
|
354
|
+
engine.register display_name, cmd, { :cwd => @root_dir, :logger => logger, :header => script[:header] }
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def determine_lang_bin(script)
|
359
|
+
if script[:header][:shebang]
|
360
|
+
script[:header][:shebang].gsub('#!', '')
|
361
|
+
else
|
362
|
+
script[:lang]
|
348
363
|
end
|
349
364
|
end
|
350
365
|
end
|
data/lib/org-converge/engine.rb
CHANGED
@@ -19,6 +19,10 @@ module OrgConverge
|
|
19
19
|
@logger = options[:logger] || Logger.new(STDOUT)
|
20
20
|
@babel = options[:babel]
|
21
21
|
@runmode = options[:runmode]
|
22
|
+
|
23
|
+
# Code blocks whose start invocation is manipulated run inside a thread
|
24
|
+
@threads = []
|
25
|
+
@running_threads = { }
|
22
26
|
end
|
23
27
|
|
24
28
|
# We allow other processes to exit with 0 status
|
@@ -29,28 +33,45 @@ module OrgConverge
|
|
29
33
|
watch_for_output
|
30
34
|
sleep 0.1
|
31
35
|
begin
|
32
|
-
status = watch_for_termination
|
33
|
-
|
36
|
+
status = watch_for_termination do
|
37
|
+
@threads.each do |t|
|
38
|
+
unless t.alive?
|
39
|
+
t.exit
|
40
|
+
@running_threads.delete(t.__id__)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end while (@running.count > 0 or @running_threads.count > 0)
|
34
45
|
end
|
35
46
|
|
36
47
|
# Overriden: we do not consider process formations
|
37
48
|
def spawn_processes
|
38
49
|
@processes.each do |process|
|
39
50
|
reader, writer = create_pipe
|
51
|
+
pid = nil
|
52
|
+
thread = nil
|
40
53
|
begin
|
41
54
|
# In case of spec mode, we need to redirect the output to a results file instead
|
42
55
|
writer = File.open(process.options[:results], 'a') if @runmode == 'spec'
|
43
|
-
pid = process.run(:output => writer)
|
44
|
-
@names[process] = "#{@names[process]}.#{pid}"
|
56
|
+
pid, thread = process.run(:output => writer, :header => process.options[:header])
|
57
|
+
@names[process] = "#{@names[process]}.#{pid || thread.__id__}"
|
45
58
|
|
46
59
|
# NOTE: In spec mode we need to be more strict on what is flushed by the engine
|
47
60
|
# because we will be comparing the output
|
48
|
-
|
61
|
+
unless @runmode == 'spec'
|
62
|
+
writer.puts "started with pid #{pid}" if pid
|
63
|
+
writer.puts "started thread with tid #{thread.__id__}" if thread
|
64
|
+
end
|
49
65
|
rescue Errno::ENOENT
|
50
66
|
writer.puts "unknown command: #{process.command}" unless @runmode == 'spec'
|
51
67
|
end
|
52
|
-
|
53
|
-
@
|
68
|
+
|
69
|
+
@running[pid] = [process] if pid
|
70
|
+
@readers[pid || thread.__id__] = reader
|
71
|
+
if thread
|
72
|
+
@threads << thread
|
73
|
+
@running_threads[thread.__id__] = [process]
|
74
|
+
end
|
54
75
|
end
|
55
76
|
end
|
56
77
|
|
@@ -65,12 +86,13 @@ module OrgConverge
|
|
65
86
|
def output(name, data)
|
66
87
|
data.to_s.lines.map(&:chomp).each do |message|
|
67
88
|
# FIXME: In case the process has finished before its lines where flushed
|
89
|
+
output = "#{name} -- #{message}"
|
68
90
|
ps, pid = name.empty? ? '<defunct>' : name.split('.')
|
69
|
-
output = "#{pad_process_name(ps)}
|
91
|
+
output = "#{pad_process_name(ps)}".fg get_color_for_pid(pid.to_i)
|
70
92
|
output += " -- "
|
71
93
|
output += message
|
72
94
|
|
73
|
-
# FIXME: When the process has stopped already, the name of the process does not appear
|
95
|
+
# FIXME: When the process has stopped already, the name of the process/thread does not appear
|
74
96
|
# (which means that this approach is wrong from the beginning probably)
|
75
97
|
logger.info output
|
76
98
|
end
|
@@ -81,7 +103,7 @@ module OrgConverge
|
|
81
103
|
private
|
82
104
|
def name_padding
|
83
105
|
@name_padding ||= begin
|
84
|
-
name_padding = @names.values.map { |n| n.length }.sort.last
|
106
|
+
name_padding = @names.values.map { |n| n.split('.').first.length }.sort.last
|
85
107
|
[ 9, name_padding ].max
|
86
108
|
end
|
87
109
|
end
|
@@ -102,12 +124,70 @@ module OrgConverge
|
|
102
124
|
pid
|
103
125
|
rescue Errno::ECHILD
|
104
126
|
end
|
127
|
+
|
128
|
+
def name_for(pid)
|
129
|
+
process = nil
|
130
|
+
index = nil
|
131
|
+
if @running[pid]
|
132
|
+
process, index = @running[pid]
|
133
|
+
elsif @running_threads[pid]
|
134
|
+
process, index = @running_threads[pid]
|
135
|
+
end
|
136
|
+
name_for_index(process, index)
|
137
|
+
end
|
138
|
+
|
139
|
+
def name_for_index(process, index)
|
140
|
+
[ @names[process], index.to_s ].compact.join(".")
|
141
|
+
end
|
105
142
|
end
|
106
143
|
|
107
144
|
# Need to expose the options to make the process be aware
|
108
145
|
# of the possible running mode (specially spec mode)
|
109
146
|
# and where to put the results output
|
147
|
+
require 'timeout'
|
110
148
|
class CodeBlockProcess < Foreman::Process
|
111
149
|
attr_reader :options
|
150
|
+
|
151
|
+
def run(options={})
|
152
|
+
env = @options[:env].merge(options[:env] || {})
|
153
|
+
output = options[:output] || $stdout
|
154
|
+
runner = "#{Foreman.runner}".shellescape
|
155
|
+
|
156
|
+
# whitelist the modifiers which manipulate how to the block is started
|
157
|
+
block_modifiers = { }
|
158
|
+
if options[:header]
|
159
|
+
block_modifiers[:waitfor] = options[:header][:waitsfor] || options[:header][:waitfor] || options[:header][:sleep]
|
160
|
+
block_modifiers[:timeout] = options[:header][:timeoutin] || options[:header][:timeout] || options[:header][:timeoutafter]
|
161
|
+
end
|
162
|
+
|
163
|
+
pid = nil
|
164
|
+
thread = nil
|
165
|
+
process = nil
|
166
|
+
|
167
|
+
if block_modifiers and (block_modifiers[:waitfor] || block_modifiers[:timeout])
|
168
|
+
thread = Thread.new do
|
169
|
+
waitfor = block_modifiers[:waitfor].to_i
|
170
|
+
timeout = block_modifiers[:timeout].to_i
|
171
|
+
process = proc do
|
172
|
+
sleep waitfor if waitfor > 0
|
173
|
+
wrapped_command = "exec #{runner} -d '#{cwd}' -p -- #{command}"
|
174
|
+
pid = Process.spawn env, wrapped_command, :out => output, :err => output
|
175
|
+
end
|
176
|
+
timeout > 0 ? Timeout::timeout(timeout, &process) : process.call
|
177
|
+
end
|
178
|
+
else
|
179
|
+
if Foreman.windows?
|
180
|
+
Dir.chdir(cwd) do
|
181
|
+
pid = Process.spawn env, expanded_command(env), :out => output, :err => output
|
182
|
+
end
|
183
|
+
else
|
184
|
+
wrapped_command = "exec #{runner} -d '#{cwd}' -p -- #{command}"
|
185
|
+
pid = Process.spawn env, wrapped_command, :out => output, :err => output
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
# In case of thread, pid will be nil
|
190
|
+
return pid, thread
|
191
|
+
end
|
112
192
|
end
|
113
193
|
end
|
data/lib/org-converge/version.rb
CHANGED
@@ -6,7 +6,7 @@ with all output being flushed to the screen.
|
|
6
6
|
- Count some numbers with bash
|
7
7
|
|
8
8
|
#+name: bash_counter
|
9
|
-
#+begin_src sh
|
9
|
+
#+begin_src sh
|
10
10
|
echo '' > out.log
|
11
11
|
for i in `seq 1 5`; do
|
12
12
|
echo "Writing! $i"
|
@@ -18,7 +18,7 @@ done
|
|
18
18
|
- Count some numbers with ruby
|
19
19
|
|
20
20
|
#+name: ruby_counter
|
21
|
-
#+begin_src ruby
|
21
|
+
#+begin_src ruby
|
22
22
|
$stdout.sync = true
|
23
23
|
sleep 0.2
|
24
24
|
10.times do |n|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#+TITLE: Code block modifiers
|
2
|
+
|
3
|
+
We have the following process, but it will take 5 seconds to start...
|
4
|
+
|
5
|
+
#+name: waits-5-seconds
|
6
|
+
#+begin_src sh :sleep 2
|
7
|
+
echo "Wait..."
|
8
|
+
for i in `seq 1 4`;
|
9
|
+
do
|
10
|
+
echo $i >> out.log
|
11
|
+
sleep 1
|
12
|
+
done
|
13
|
+
echo "Now done!"
|
14
|
+
#+end_src
|
15
|
+
|
16
|
+
This one on the other hand starts as soon as possible:
|
17
|
+
|
18
|
+
#+name: does-not-wait
|
19
|
+
#+begin_src sh
|
20
|
+
echo "whoosh" > out.log
|
21
|
+
#+end_src
|
22
|
+
|
23
|
+
#+name: timeout-in-3-seconds
|
24
|
+
#+begin_src sh :timeout 3
|
25
|
+
while true; do
|
26
|
+
echo "Eventually will timeout..."
|
27
|
+
sleep 1
|
28
|
+
done
|
29
|
+
#+end_src
|
@@ -7,12 +7,14 @@ results, we can try checking whether the contents from the code block
|
|
7
7
|
are evaling into what is being documented in the results block.
|
8
8
|
|
9
9
|
#+name: hello
|
10
|
-
#+begin_src
|
10
|
+
#+begin_src sh :results output code :exports both
|
11
11
|
for i in `seq 20`; do
|
12
12
|
echo "hello"
|
13
13
|
done
|
14
14
|
#+end_src
|
15
15
|
|
16
|
+
.........
|
17
|
+
|
16
18
|
#+RESULTS: hello
|
17
19
|
#+BEGIN_SRC sh
|
18
20
|
hello
|
@@ -60,3 +62,4 @@ hola
|
|
60
62
|
hola
|
61
63
|
#+END_SRC
|
62
64
|
|
65
|
+
.........
|
@@ -26,7 +26,7 @@ This one would fail near christmas, outside of Japan,
|
|
26
26
|
when the site is down, or there is a change in the rss.xml being provided.
|
27
27
|
|
28
28
|
#+name: christmas_check
|
29
|
-
#+begin_src
|
29
|
+
#+begin_src sh :results output
|
30
30
|
curl https://isitchristmas.com/rss.xml 2> /dev/null | grep title
|
31
31
|
# curl isitchristmastyet.com 2> /dev/null
|
32
32
|
#+end_src
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#+title: Free style shebang usage
|
2
|
+
#+runmode :sequential
|
3
|
+
|
4
|
+
#+name: ruby20
|
5
|
+
#+begin_src ruby :shebang #!~/.rvm/rubies/ruby-2.0.0-p353/bin/ruby :results output code
|
6
|
+
puts RUBY_VERSION
|
7
|
+
#+end_src
|
8
|
+
|
9
|
+
#+RESULTS: ruby20
|
10
|
+
#+BEGIN_SRC ruby
|
11
|
+
2.0.0
|
12
|
+
#+END_SRC
|
13
|
+
|
14
|
+
#+name: ruby193
|
15
|
+
#+begin_src ruby :shebang #!~/.rvm/rubies/ruby-1.9.3-p0/bin/ruby :results output code
|
16
|
+
puts RUBY_VERSION
|
17
|
+
#+end_src
|
18
|
+
|
19
|
+
#+RESULTS: ruby193
|
20
|
+
#+BEGIN_SRC ruby
|
21
|
+
1.9.3
|
22
|
+
#+END_SRC
|
23
|
+
|
24
|
+
.
|
data/spec/converge_spec.rb
CHANGED
@@ -106,7 +106,7 @@ describe OrgConverge::Command do
|
|
106
106
|
File.read(File.join(example_dir, 'out.log')).should == expected_contents
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
pending "should run 'expected_results' with src blocks" do
|
110
110
|
example_dir = File.join(EXAMPLES_DIR, 'expected_results')
|
111
111
|
setup_file = File.join(example_dir, 'spec.org')
|
112
112
|
|
@@ -145,4 +145,18 @@ describe OrgConverge::Command do
|
|
145
145
|
largest = File.open("#{example_dir}/result").read
|
146
146
|
largest.should == "906609\n"
|
147
147
|
end
|
148
|
+
|
149
|
+
it "should support 'block_modifiers'" do
|
150
|
+
example_dir = File.join(EXAMPLES_DIR, 'block_modifiers')
|
151
|
+
setup_file = File.join(example_dir, 'run.org')
|
152
|
+
|
153
|
+
o = OrgConverge::Command.new({
|
154
|
+
'<org_file>' => setup_file,
|
155
|
+
'--root-dir' => example_dir
|
156
|
+
})
|
157
|
+
success = o.execute!
|
158
|
+
success.should == true
|
159
|
+
result = File.open("#{example_dir}/out.log").read
|
160
|
+
result.should == "whoosh\n1\n2\n3\n4\n"
|
161
|
+
end
|
148
162
|
end
|
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.
|
4
|
+
version: 0.0.12
|
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-
|
11
|
+
date: 2014-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -130,12 +130,14 @@ files:
|
|
130
130
|
- spec/converge_examples/basic_run_example/setup.org
|
131
131
|
- spec/converge_examples/basic_tangle/conf.yml.expected
|
132
132
|
- spec/converge_examples/basic_tangle/setup.org
|
133
|
+
- spec/converge_examples/block_modifiers/run.org
|
133
134
|
- spec/converge_examples/commented_block/run.org
|
134
135
|
- spec/converge_examples/expected_results/spec.org
|
135
136
|
- spec/converge_examples/expected_results/spec2.org
|
136
137
|
- spec/converge_examples/linked_tasks/tasks.org
|
137
138
|
- spec/converge_examples/multi_proc/run.org
|
138
139
|
- spec/converge_examples/runlist_example/setup.org
|
140
|
+
- spec/converge_examples/shebang/run.org
|
139
141
|
- spec/converge_examples/specified_block/run.org
|
140
142
|
- spec/converge_spec.rb
|
141
143
|
- spec/spec_helper.rb
|
@@ -167,12 +169,14 @@ test_files:
|
|
167
169
|
- spec/converge_examples/basic_run_example/setup.org
|
168
170
|
- spec/converge_examples/basic_tangle/conf.yml.expected
|
169
171
|
- spec/converge_examples/basic_tangle/setup.org
|
172
|
+
- spec/converge_examples/block_modifiers/run.org
|
170
173
|
- spec/converge_examples/commented_block/run.org
|
171
174
|
- spec/converge_examples/expected_results/spec.org
|
172
175
|
- spec/converge_examples/expected_results/spec2.org
|
173
176
|
- spec/converge_examples/linked_tasks/tasks.org
|
174
177
|
- spec/converge_examples/multi_proc/run.org
|
175
178
|
- spec/converge_examples/runlist_example/setup.org
|
179
|
+
- spec/converge_examples/shebang/run.org
|
176
180
|
- spec/converge_examples/specified_block/run.org
|
177
181
|
- spec/converge_spec.rb
|
178
182
|
- spec/spec_helper.rb
|