Removed posix-spawn dependency, used open3 instead (core funciontality), JRuby compatible (#24)

This commit is contained in:
Johanderson Mogollon 2016-05-25 04:07:34 +02:00 committed by Jason Lee
parent 7f51c67f13
commit e4daa11309
4 changed files with 12 additions and 9 deletions

3
.gitignore vendored
View File

@ -10,6 +10,9 @@
/tmp/
.DS_Store
## RubyMine Ide files
.idea/
## Specific to RubyMotion:
.dat*
.repl_history

View File

@ -2,7 +2,6 @@ PATH
remote: .
specs:
rucaptcha (0.4.4)
posix-spawn (>= 0.3.0)
GEM
remote: https://rubygems.org/
@ -45,12 +44,14 @@ GEM
arel (6.0.3)
builder (3.2.2)
concurrent-ruby (1.0.2)
concurrent-ruby (1.0.2-java)
diff-lcs (1.2.5)
erubis (2.7.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
i18n (0.7.0)
json (1.8.3)
json (1.8.3-java)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
@ -63,7 +64,7 @@ GEM
minitest (5.9.0)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
posix-spawn (0.3.11)
nokogiri (1.6.7.2-java)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
@ -114,10 +115,12 @@ GEM
sprockets (>= 3.0.0)
thor (0.19.1)
thread_safe (0.3.5)
thread_safe (0.3.5-java)
tzinfo (1.2.2)
thread_safe (~> 0.1)
PLATFORMS
java
ruby
DEPENDENCIES
@ -128,4 +131,4 @@ DEPENDENCIES
rucaptcha!
BUNDLED WITH
1.11.2
1.12.4

View File

@ -1,4 +1,4 @@
require 'posix-spawn'
require 'open3'
module RuCaptcha
class Captcha
@ -77,11 +77,9 @@ module RuCaptcha
png_file_path
else
command.strip!
pid, _, stdout, stderr = POSIX::Spawn.popen4(command)
Process.waitpid(pid)
err = stderr.read
out, err, st = Open3.capture3(command)
raise "RuCaptcha: #{err.strip}" if err.present?
stdout.read
out
end
end
end

View File

@ -13,7 +13,6 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']
s.summary = 'This is a Captcha gem for Rails Application. It run ImageMagick command to draw Captcha image.'
s.add_dependency 'posix-spawn', '>= 0.3.0'
s.add_development_dependency 'rake'
s.add_development_dependency 'rails'