org-converge 0.0.14 → 0.0.15

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: b8f7e90bad105cff350dbb911fe70a553646caa6
4
- data.tar.gz: da367c09faae2f51ad7b0efd34c57f5a27ab8057
3
+ metadata.gz: 0d79849925c29871f3955a60256beec94327117a
4
+ data.tar.gz: c15b7b0962388cb85bc8ac2344b7ff21326b37f7
5
5
  SHA512:
6
- metadata.gz: 2b099f71b36b2504a9ae922ea1956d2a23eb224478c332fc230a747079105db9214b604d397ab43f0fa8dfd8d29b2349384a00ca4dfcf7f9e2fd72809e0885b8
7
- data.tar.gz: 8768bddc3b3273d54164c7325e2f1f5e22b1364ed91ceaecf31f6edd1ee426274500ebd45eec6ed8329e1a048a4041de85f9614a9e443086d5fe83a52f5ef466
6
+ metadata.gz: 951731210970f8ea7b3274c39309545cdab786b8743e8b6757e703e6cc2cf0f8e399d51846aef7f39e303b3e72d231b438dad853e84411661f3be47b0cffcf85
7
+ data.tar.gz: 555a85dd9f830ef9303670f527f7c560408314be273e4d58bc14fd6e2fca11d57c31e8eda652c1075e0390c7b238e297e94ddfe6662cee28ce836427c14e270f
data/TODO CHANGED
@@ -2,23 +2,23 @@
2
2
  #+TODO: TODO | DONE CANCELED
3
3
  #+startup: showeverything
4
4
 
5
- * [0/16] 0.1.0 version
5
+ * [0/15] 1.0.0 version
6
+
7
+ Some of these need further work on the Org Ruby parser.
6
8
 
7
9
  - [ ] Macros can be loaded and applied to the configuration
8
- - [ ] Actually support converging and idempotency (~--runmode=idempotent~)
9
- + Do not do an operation unless it is required
10
- + Abort in case there was a failure in executing the script.
11
- + This would work by using the ~:cache true~ to a block header argument
12
10
  - [ ] Support for ~#+SETUPFILE~
11
+ To load the macros
12
+ - [ ] Support converging and idempotency (~--runmode=idempotent~)
13
+ + Do not do an operation unless it is required
14
+ + Abort in case there was a failure in executing one of the scripts.
13
15
  - [ ] Heuristics for determining which binary to use for running the script
14
16
  - [ ] Display how the run would look like without making changes
15
17
  : org-converge setupfile.org --dry-run
16
- - [ ] Use =:eval= for evaling blocks (off by default)
17
18
  - [ ] Bugfix for when results blocks have only inline examples or images
18
- - [ ] Bugfix for when the result from a ~org-spec~ run has non-zero exit status
19
- - [ ] Bugfixes for spec run
20
- - [ ] Distributed run helpers for the header arguments
21
- Like remote =:dir= for example.
19
+ - [ ] Bugfix for when the result from a ~org-spec~ run has non-zero exit status
20
+ - [ ] =:eval=
21
+ For evaling blocks (off by default)
22
22
  - [ ] =:onerror=
23
23
  aborteverything, restart, runhandler
24
24
  - [ ] =:asserts=
@@ -29,9 +29,16 @@
29
29
  - [ ] =:awaits:=
30
30
  Wait for other processes to finish before starting.
31
31
  - [ ] =:file=
32
- For storing the output from the evaluation (already done in spec mode)a
33
- - [ ] Can use =:dir= for running a process remotely via ssh
34
- This needs the credentials to be readily available
32
+ For storing the output from the evaluation (already done in spec
33
+ mode)
34
+ - [ ] =:cache true=
35
+ Also part of the idempotency checks.
36
+ - [ ] =:env= and =#+envfile:=
37
+
38
+ * [1/1] 0.0.15
39
+
40
+ - [X] Can use =:dir= for running a process remotely via ssh.
41
+ This needs the remote credentials to be available.
35
42
 
36
43
  * [2/2] 0.0.14
37
44
 
@@ -121,8 +128,8 @@ Need some basic functionality of what Org babel offers first.
121
128
  - [X] ~--tangle~ flag
122
129
  - [X] Support a root dir for when not running relative to the directory
123
130
 
124
- * [6/21] Ideas
125
- ** TODO Chaining resources with ~#+NAME:~ directives and ~:notify~ argument
131
+ * [9/20] Ideas
132
+ ** TODO Chaining resources with =#+name:= directives and =:notify= argument
126
133
 
127
134
  One idea is to be able to notify resources by naming the code blocks.
128
135
 
@@ -143,26 +150,18 @@ sudo /etc/register-to-balancer
143
150
  - Support for ~:before all~ and ~:after all~ added
144
151
  ** TODO Add namespace dynamically to the tasks using an in buffer setting
145
152
 
146
- When including files there can be some potential scoping issues.
153
+ There can be some potential scoping issues when using =#+include:=
147
154
 
148
- ** TODO Inject macros within the environment variables from a runnable process
149
155
  ** TODO Clarify which ones of the header arguments to implement
150
156
 
151
157
  http://orgmode.org/manual/Specific-header-arguments.html#Specific-header-arguments
152
-
153
- ** TODO Use sshkit for running remote processes
154
- ** TODO By default, it should use current dir for tangling
155
- ** TODO Converging: Only do an operation when it didn't finish
156
-
157
- Hence the name of the project
158
-
159
158
  ** TODO For now we keep the indentation of the code blocks
160
159
 
161
160
  The indentatin of the ~#+begin_src~ should always
162
161
  be at the beginning of the file, not at the indentation
163
162
  level from when the file was written in Org mode.
164
163
 
165
- ** TODO We should have a whitelist of languages that can be executed and ignore everything
164
+ ** TODO We should have a whitelist of languages that can be executed and ignore everything else
166
165
 
167
166
  Under which heuristics or configuration should we decide which will be the
168
167
  binary that should be used to execute the block? Specify with shebang?
@@ -183,9 +182,14 @@ It should be possible to tangle the files this way:
183
182
 
184
183
  It seems that there is support for a ~#+SETUPFILE~
185
184
 
186
- ** TODO Something more flexible than macros:
185
+ ** TODO Something more flexible than macros for templating
187
186
 
188
- One example of syntax that we could use instead of macros:
187
+ One example of syntax that we could use instead of macros.
188
+ One idea is to use the =:session= argument and different drivers
189
+ for languages that are commonly used for the configuration.
190
+ This would inject the settings into a =@macros= hash from where
191
+ the values can be picked up to be applied at runtime, sort
192
+ of like the overrride attributes feature from Chef.
189
193
 
190
194
  #+begin_src yaml :session
191
195
  fluentd:
@@ -193,13 +197,34 @@ fluentd:
193
197
  path: here.log
194
198
  #+end_src
195
199
 
196
- But need to
200
+ Or also json could be used:
197
201
 
198
- ** TODO Choosing a templating language: default for now is mustache
202
+ #+begin_src js :session
203
+ {
204
+ "fluentd": {
205
+ "port": 4224,
206
+ "path": "here.log"
207
+ }
208
+ }
209
+ #+end_src
210
+
211
+ Or even just plain Ruby?
212
+
213
+ #+begin_src ruby :session
214
+ session = {
215
+ "fluentd" => {
216
+ "port" => 4224,
217
+ "path" => "here.log"
218
+ }
219
+ }
220
+ #+end_src
221
+
222
+ ** TODO Choosing a templating language
199
223
 
200
224
  We could implement the macro systems, but it seems that it may not be
201
225
  strong enough for providing with all the cases we may run into.
202
- ** TODO Support caching?
226
+
227
+ ** TODO Support =:cache=?
203
228
 
204
229
  #+begin_src emacs-lisp :cache yes :exports results
205
230
  (random)
@@ -208,11 +233,15 @@ strong enough for providing with all the cases we may run into.
208
233
  #+RESULTS[db54597aed193d861d01bf92110e10f28f8f40d4]:
209
234
  : 842438499349743708
210
235
 
211
- ** TODO Support :eval ?
236
+ ** TODO Support =:eval=?
212
237
 
213
238
  #+begin_src sh :eval (print "Really doing this...")
214
239
  echo "Going ahead with operation X!"
215
240
  #+end_src
241
+ ** DONE By default, it should use current dir for tangling
242
+ ** DONE Converging: Only do an operation when it didn't finish
243
+
244
+ Hence the name of the project
216
245
 
217
246
  ** DONE ~#+NAME:~ could be used in the logger for identifying the process
218
247
  ** DONE Managing dependencies: could be handled with ~#+include~ directives
@@ -246,6 +275,8 @@ would create the necessary directories behind the scenes.
246
275
  ,mkdir -p etc/fluentd/config
247
276
  ,#+end_src
248
277
  #+end_src
278
+
279
+ ** CANCELED Use sshkit for running remote processes
249
280
  ** CANCELED How to set the permissions from the directory from the file that is being tangled when it does not exists?
250
281
 
251
282
  By default, this would be 0644, but we also need to specify the
data/bin/org-converge CHANGED
@@ -5,10 +5,10 @@ require 'org-converge'
5
5
 
6
6
  doc = <<OPTIONS
7
7
 
8
- org-converge: A light configuration management tool for Org mode
8
+ org-converge: Run with idempotency checks.
9
9
 
10
10
  Usage:
11
- org-converge <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>] [--runmode=<runmode>] [--name=<block_name>]
11
+ org-converge <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>]
12
12
 
13
13
  Options:
14
14
 
data/bin/org-run CHANGED
@@ -1,5 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- mode: ruby -*-
3
+ require 'docopt'
4
+ require 'org-converge'
3
5
 
4
- # alias for org-converge
5
- load File.expand_path('../org-converge', __FILE__)
6
+ doc = <<OPTIONS
7
+
8
+ org-run: Run code blocks in parallel by default.
9
+
10
+ Usage:
11
+ org-run <org_file> [--showfiles] [--log=<logfile>] [--root-dir=<root_dir>] [--runmode=<runmode>] [--name=<block_name>]
12
+
13
+ Options:
14
+
15
+ -h --help Show this screen.
16
+
17
+ OPTIONS
18
+
19
+ begin
20
+ require "pp"
21
+ cmd = Docopt::docopt(doc)
22
+ rescue Docopt::Exit => e
23
+ puts e.message
24
+ end
25
+
26
+ exit 1 unless cmd
27
+
28
+ o = OrgConverge::Command.new(cmd)
29
+ o.execute!
data/lib/org-converge.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'org-ruby'
2
2
  require 'org-converge/babel_output_buffer'
3
3
  require 'org-converge/babel'
4
+ require 'org-converge/helpers'
4
5
  require 'org-converge/command'
5
6
  require 'org-converge/engine'
6
7
  require 'org-converge/version'
@@ -1,5 +1,6 @@
1
1
  module OrgConverge
2
2
  class Command
3
+ include Helpers
3
4
  attr_reader :dotorg
4
5
  attr_reader :logger
5
6
  attr_reader :ob
@@ -321,7 +322,7 @@ module OrgConverge
321
322
  end
322
323
 
323
324
  def with_running_engine(opts={})
324
- default_options = { :logger => @logger, :babel => @babel }
325
+ default_options = { :logger => @logger, :babel => babel }
325
326
  options = default_options.merge!(opts)
326
327
  engine = OrgConverge::Engine.new(options)
327
328
  yield engine
@@ -377,13 +378,5 @@ module OrgConverge
377
378
  engine.register display_name, cmd, { :cwd => @root_dir, :logger => logger, :header => script[:header] }
378
379
  end
379
380
  end
380
-
381
- def determine_lang_bin(script)
382
- if script[:header][:shebang]
383
- script[:header][:shebang].gsub('#!', '')
384
- else
385
- script[:lang]
386
- end
387
- end
388
381
  end
389
382
  end
@@ -6,6 +6,8 @@ require 'foreman/engine'
6
6
  require 'foreman/process'
7
7
  require 'tco'
8
8
  require 'fileutils'
9
+ require 'net/ssh'
10
+ require 'net/scp'
9
11
 
10
12
  module OrgConverge
11
13
  class Engine < Foreman::Engine
@@ -85,6 +87,7 @@ module OrgConverge
85
87
  def register(name, command, options={})
86
88
  options[:env] ||= env
87
89
  options[:cwd] ||= File.dirname(command.split(" ").first)
90
+ options[:babel] ||= @babel
88
91
 
89
92
  process = OrgConverge::CodeBlockProcess.new(command, options)
90
93
  @names[process] = name
@@ -131,6 +134,7 @@ module OrgConverge
131
134
  yield if block_given?
132
135
  pid
133
136
  rescue Errno::ECHILD
137
+ yield if block_given?
134
138
  end
135
139
 
136
140
  def termination_message_for(status)
@@ -167,12 +171,15 @@ module OrgConverge
167
171
  # of the possible running mode (specially spec mode)
168
172
  # and where to put the results output
169
173
  class CodeBlockProcess < Foreman::Process
174
+ include OrgConverge::Helpers
170
175
  attr_reader :options
171
176
 
172
177
  def run(options={})
173
178
  env = @options[:env].merge(options[:env] || {})
179
+ logger = @options[:logger]
174
180
  output = options[:output] || $stdout
175
181
  runner = "#{Foreman.runner}".shellescape
182
+ @babel = @options[:babel]
176
183
 
177
184
  # whitelist the modifiers which manipulate how to the block is started
178
185
  block_modifiers = { }
@@ -180,7 +187,12 @@ module OrgConverge
180
187
  block_modifiers[:waitfor] = options[:header][:waitsfor] || options[:header][:waitfor] || options[:header][:sleep]
181
188
  block_modifiers[:timeout] = options[:header][:timeoutin] || options[:header][:timeout] || options[:header][:timeoutafter]
182
189
  if options[:header][:dir]
183
- block_modifiers[:cwd] = File.expand_path(File.join(self.options[:cwd], options[:header][:dir]))
190
+ ssh_params = determine_ssh_params(options[:header][:dir])
191
+ if ssh_params[:host]
192
+ block_modifiers[:ssh] = ssh_params
193
+ else
194
+ block_modifiers[:cwd] = File.expand_path(File.join(self.options[:cwd], options[:header][:dir]))
195
+ end
184
196
  end
185
197
  end
186
198
 
@@ -204,15 +216,67 @@ module OrgConverge
204
216
  pid = Process.spawn env, wrapped_command, opts
205
217
  end
206
218
 
219
+ ssh_process = nil
220
+ if block_modifiers[:ssh]
221
+ ssh_process = proc do
222
+ ssh_options = { }
223
+ ssh_options[:port] = block_modifiers[:ssh][:port]
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']
226
+ begin
227
+ # SCP the script to run remotely and the binary used to run it
228
+ binary, script = command.split(' ')
229
+ remote_file = if not block_modifiers[:ssh][:remote_dir].empty?
230
+ File.join(block_modifiers[:ssh][:remote_dir], "org-run-#{File.basename(script)}")
231
+ else
232
+ "org-run-#{File.basename(script)}"
233
+ end
234
+ scp_options = ssh_options
235
+ scp_options[:keys] = [ssh_options[:keys]] if ssh_options[:keys]
236
+
237
+ # TODO: Detect and upload the file only once
238
+ Net::SCP.upload!(block_modifiers[:ssh][:host],
239
+ block_modifiers[:ssh][:user],
240
+ script,
241
+ remote_file,
242
+ :ssh => scp_options)
243
+ Net::SSH.start(block_modifiers[:ssh][:host],
244
+ block_modifiers[:ssh][:user], ssh_options) do |ssh|
245
+ channel = ssh.open_channel do |chan|
246
+ chan.exec "#{binary} #{remote_file}" do |ch, success|
247
+ raise "could not execute command" unless success
248
+
249
+ # "on_data" is called when the process writes something to stdout
250
+ # "on_extended_data" is called when the process writes something to stderr
251
+ chan.on_data { |c, data| output.puts data }
252
+ chan.on_extended_data { |c, type, data| output.puts data }
253
+ chan.on_close { output.puts "exited from #{block_modifiers[:ssh][:host]}"}
254
+ end
255
+ chan.wait
256
+ end
257
+ ssh.loop
258
+ end
259
+ rescue Net::SCP::Error
260
+ output.puts "Error when transporting file: #{script}"
261
+ rescue => e
262
+ puts "Error during ssh session: #{e}"
263
+ end
264
+ end
265
+ end
266
+
207
267
  # In case we modify the run block, we run it in a Thread
208
268
  # otherwise we continue treating it as a forked process.
209
- if block_modifiers and (block_modifiers[:waitfor] || block_modifiers[:timeout] || block_modifiers[:dir])
269
+ if block_modifiers and (block_modifiers[:waitfor] || block_modifiers[:timeout] || block_modifiers[:dir] || block_modifiers[:ssh])
210
270
  waitfor = block_modifiers[:waitfor].to_i
211
271
  timeout = block_modifiers[:timeout].to_i
212
272
 
213
273
  thread = Thread.new do
214
274
  sleep waitfor if waitfor > 0
215
- pid = process.call
275
+ if ssh_process
276
+ ssh_process.call
277
+ else
278
+ pid = process.call
279
+ end
216
280
  if timeout > 0
217
281
  sleep timeout
218
282
  # FIXME: Kill children properly
@@ -0,0 +1,24 @@
1
+ module OrgConverge
2
+ module Helpers
3
+ def determine_lang_bin(script)
4
+ if script[:header][:shebang]
5
+ script[:header][:shebang].gsub('#!', '')
6
+ else
7
+ script[:lang]
8
+ end
9
+ end
10
+
11
+ def determine_ssh_params(dir)
12
+ ssh = { }
13
+
14
+ if dir =~ /\/(([^ @:]+)@)?([^ #:]+)?#?(\d+)?:(.*)?/
15
+ ssh[:user] = $2
16
+ ssh[:host] = $3
17
+ ssh[:port] = ($4 || 22).to_i
18
+ ssh[:remote_dir] = ($5 || '')
19
+ end
20
+
21
+ ssh
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module OrgConverge
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
data/org-converge.gemspec CHANGED
@@ -14,10 +14,13 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "org-converge"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = OrgConverge::VERSION
17
+ gem.license = 'MIT'
17
18
  gem.add_runtime_dependency('docopt', '~> 0.5')
18
19
  gem.add_runtime_dependency('org-ruby', '~> 0.9')
19
20
  gem.add_runtime_dependency('foreman', '~> 0.63')
20
21
  gem.add_runtime_dependency('tco', '~> 0.1')
21
22
  gem.add_runtime_dependency('rake', '~> 10.3')
22
- gem.add_runtime_dependency('diff-lcs', '~> 1.2')
23
+ gem.add_runtime_dependency('diff-lcs', '~> 1.2')
24
+ gem.add_runtime_dependency('net-ssh', '~> 2.8')
25
+ gem.add_runtime_dependency('net-scp', '~> 1.1')
23
26
  end
@@ -21,6 +21,8 @@ This one on the other hand starts as soon as possible:
21
21
  echo "whoosh" > out.log
22
22
  #+end_src
23
23
 
24
+ ** COMMENT Fails sometimes
25
+
24
26
  #+name: timeout-in-3-seconds
25
27
  #+begin_src sh :timeout 5
26
28
  while true; do
@@ -0,0 +1,76 @@
1
+ #+TITLE: Remote runs
2
+ #+sshidentifyfile: vagrant/keys/vagrant
3
+ #+sshpassword: vagrant
4
+ #+startup: showeverything
5
+
6
+ *Note*: This one needs a vagrant VM available for testing...
7
+
8
+ A block can be specified to be run remotely as well.
9
+ In order to do this, it is needed to specify in the =:dir= block header argument
10
+ the location of the remote node to connect to, as well as user name to use.
11
+
12
+ *** Running locally
13
+
14
+ #+name: 50-times
15
+ #+begin_src ruby
16
+ $stdout.sync = true
17
+ 50.times { puts "hello"; sleep 0.2 }
18
+ #+end_src
19
+
20
+ #+name: hello-world-block
21
+ #+begin_src sh
22
+ for i in `seq 1 30`; do
23
+ echo "$i: hello world"
24
+ sleep 0.5
25
+ done
26
+ #+end_src
27
+
28
+ *** Running remotely
29
+
30
+ #+name: remote-bash-code-block
31
+ #+begin_src sh :results output :dir /vagrant@127.0.0.1#2222:/tmp
32
+ random_number=$RANDOM
33
+ for i in `seq 1 10`; do echo "[$random_number] Running script is $0 being run from `pwd`"; done
34
+ #+end_src
35
+
36
+ #+name: remote-ruby-code-block
37
+ #+begin_src ruby :results output :dir /vagrant@127.0.0.1#2222:/tmp :shebang #!/usr/bin/ruby
38
+ $stdout.sync= true
39
+ random_number = rand(10)
40
+ 10.times do
41
+ puts "[#{random_number}] Running script is #{$0} being run from #{File.dirname(__FILE__)}"
42
+ end
43
+ #+end_src
44
+
45
+ #+name: remote-hello-from-default-path
46
+ #+begin_src sh :results output :dir /vagrant@127.0.0.1#2222:
47
+ random_number=$RANDOM
48
+ for i in `seq 1 10`; do echo "[$random_number] Running script is $0 being run from `pwd`"; done
49
+ #+end_src
50
+
51
+ *** DONE Improvement: Need to be able to set a default identity file for doing ssh.
52
+
53
+ #+sshidentityfile: vagrant/keys/vagrant
54
+
55
+ *** DONE Should the remote runs and local runs coexists? : yes
56
+
57
+ By specifying a remote dir:
58
+
59
+ - The defined script will be scp to that remote dir
60
+ - then executed using the binary in the path
61
+
62
+ *** Ideas
63
+
64
+ It would be useful to be able to define the nodes like:
65
+
66
+ #+hosts: vagrant /vagrant@127.0.0.1#2222:
67
+ #+hosts: node-1 /vagrant@127.0.0.1#2222:
68
+
69
+ So that we could call it like:
70
+
71
+ #+begin_src sh :host vagrant
72
+ echo "test" > test
73
+ #+end_src
74
+
75
+ It would be even better if this list of hosts could be discovered
76
+ by subscribing to a message bus.
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe OrgConverge::Helpers do
4
+ include OrgConverge::Helpers
5
+
6
+ tests = []
7
+ tests << {
8
+ :dir => '/vagrant@127.0.0.1#2222:/home/vagrant/',
9
+ :expected_user => "vagrant",
10
+ :expected_host => "127.0.0.1",
11
+ :expected_port => 2222,
12
+ :expected_remote_dir => "/home/vagrant/"
13
+ }
14
+ tests << {
15
+ :dir => '/vagrant@127.0.0.1:/home/vagrant/',
16
+ :expected_user => "vagrant",
17
+ :expected_host => "127.0.0.1",
18
+ :expected_port => 22,
19
+ :expected_remote_dir => '/home/vagrant/'
20
+ }
21
+ tests << {
22
+ :dir => '/vagrant@127.0.0.1:',
23
+ :expected_user => "vagrant",
24
+ :expected_host => "127.0.0.1",
25
+ :expected_port => 22,
26
+ :expected_remote_dir => ''
27
+ }
28
+ tests << {
29
+ :dir => '/127.0.0.1:',
30
+ :expected_user => nil,
31
+ :expected_host => "127.0.0.1",
32
+ :expected_port => 22,
33
+ :expected_remote_dir => ''
34
+ }
35
+ tests << {
36
+ :dir => '/var/lib/org/',
37
+ :expected_user => nil,
38
+ :expected_host => nil,
39
+ :expected_port => nil,
40
+ :expected_remote_dir => nil
41
+ }
42
+ tests << {
43
+ :dir => 'org/',
44
+ :expected_user => nil,
45
+ :expected_host => nil,
46
+ :expected_port => nil,
47
+ :expected_remote_dir => nil
48
+ }
49
+ tests.each do |t|
50
+ it "should parse ':dir #{t[:dir]}'" do
51
+ ssh = determine_ssh_params(t[:dir])
52
+ ssh[:user].should == t[:expected_user]
53
+ ssh[:host].should == t[:expected_host]
54
+ ssh[:port].should == t[:expected_port]
55
+ ssh[:remote_dir].should == t[:expected_remote_dir]
56
+ end
57
+ end
58
+ end
data/vagrant.org CHANGED
@@ -77,7 +77,7 @@ fi
77
77
  #+end_src
78
78
 
79
79
  #+name: apt-get-install
80
- #+begin_src sh :dir vagrant@localhost:2222/ :if running-in-ubuntu
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
83
  #+end_src
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.14
4
+ version: 0.0.15
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-04 00:00:00.000000000 Z
11
+ date: 2014-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: net-ssh
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '2.8'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '2.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: net-scp
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '1.1'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '1.1'
97
125
  description: A light configuration management tool for Org mode
98
126
  email:
99
127
  - waldemar.quevedo@gmail.com
@@ -125,6 +153,7 @@ files:
125
153
  - lib/org-converge/babel_output_buffer.rb
126
154
  - lib/org-converge/command.rb
127
155
  - lib/org-converge/engine.rb
156
+ - lib/org-converge/helpers.rb
128
157
  - lib/org-converge/version.rb
129
158
  - org-converge.gemspec
130
159
  - spec/converge_examples/basic_run_example/setup.org
@@ -138,14 +167,17 @@ files:
138
167
  - spec/converge_examples/idempotency/conditions.org
139
168
  - spec/converge_examples/linked_tasks/tasks.org
140
169
  - spec/converge_examples/multi_proc/run.org
170
+ - spec/converge_examples/remote_dir/remote-dir.org
141
171
  - spec/converge_examples/runlist_example/setup.org
142
172
  - spec/converge_examples/shebang/run.org
143
173
  - spec/converge_examples/specified_block/run.org
144
174
  - spec/converge_spec.rb
175
+ - spec/helpers_spec.rb
145
176
  - spec/spec_helper.rb
146
177
  - vagrant.org
147
178
  homepage: https://github.com/wallyqs/org-converge
148
- licenses: []
179
+ licenses:
180
+ - MIT
149
181
  metadata: {}
150
182
  post_install_message:
151
183
  rdoc_options: []
@@ -180,8 +212,10 @@ test_files:
180
212
  - spec/converge_examples/idempotency/conditions.org
181
213
  - spec/converge_examples/linked_tasks/tasks.org
182
214
  - spec/converge_examples/multi_proc/run.org
215
+ - spec/converge_examples/remote_dir/remote-dir.org
183
216
  - spec/converge_examples/runlist_example/setup.org
184
217
  - spec/converge_examples/shebang/run.org
185
218
  - spec/converge_examples/specified_block/run.org
186
219
  - spec/converge_spec.rb
220
+ - spec/helpers_spec.rb
187
221
  - spec/spec_helper.rb