remote_table 1.2.4 → 1.3.0
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.
- data/README.rdoc +1 -1
- data/lib/remote_table.rb +4 -13
- data/lib/remote_table/format/delimited.rb +20 -21
- data/lib/remote_table/format/fixed_width.rb +2 -1
- data/lib/remote_table/format/mixins/processed_by_nokogiri.rb +7 -7
- data/lib/remote_table/format/mixins/processed_by_roo.rb +30 -20
- data/lib/remote_table/format/mixins/textual.rb +9 -9
- data/lib/remote_table/local_file.rb +18 -80
- data/lib/remote_table/properties.rb +52 -61
- data/lib/remote_table/transformer.rb +3 -4
- data/lib/remote_table/utils.rb +157 -0
- data/lib/remote_table/version.rb +1 -1
- data/remote_table.gemspec +1 -7
- data/test/test_big.rb +2 -2
- data/test/test_old_syntax.rb +20 -20
- data/test/test_remote_table.rb +11 -0
- metadata +28 -94
- data/lib/remote_table/executor.rb +0 -37
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
require 'escape'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'posix/spawn'
|
5
|
-
|
6
|
-
class RemoteTable
|
7
|
-
class Executor
|
8
|
-
include ::Singleton
|
9
|
-
# we should really be piping things i think
|
10
|
-
def bang(path, cmd)
|
11
|
-
srand # in case this was forked by resque
|
12
|
-
tmp_path = "#{path}.bang.#{rand}"
|
13
|
-
backtick_with_reporting "cat #{::Escape.shell_single_word path} | #{cmd} > #{::Escape.shell_single_word tmp_path}"
|
14
|
-
::FileUtils.mv tmp_path, path
|
15
|
-
end
|
16
|
-
|
17
|
-
def backtick_with_reporting(cmd, raise_on_error = false)
|
18
|
-
cmd = cmd.gsub /\n/m, ' '
|
19
|
-
if ::ENV['REMOTE_TABLE_DEBUG'] and ::ENV['REMOTE_TABLE_DEBUG'].include? 'backtick'
|
20
|
-
$stderr.puts "[remote_table] Executing #{cmd}"
|
21
|
-
end
|
22
|
-
pid = ::POSIX::Spawn.spawn({ 'PATH' => '/usr/local/bin:/usr/bin:/bin' }, cmd)
|
23
|
-
stat = ::Process::waitpid pid
|
24
|
-
if raise_on_error and not stat.success?
|
25
|
-
raise %{
|
26
|
-
From the remote_table gem...
|
27
|
-
|
28
|
-
Command failed:
|
29
|
-
#{cmd}
|
30
|
-
|
31
|
-
Exit code:
|
32
|
-
#{stat.exitstatus}
|
33
|
-
}
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|