rucaptcha 0.3.2 → 0.3.2.1

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: 426e52c0e7d7b9691d077e57707d49893b8b8298
4
- data.tar.gz: 1facb980237b56228e4f24758c63ac120b92895a
3
+ metadata.gz: 7ddf04eddc583be35415502ee00f014a113122b2
4
+ data.tar.gz: c8bbe3e0d1637cd3f56e98ade1067972df9e5dbc
5
5
  SHA512:
6
- metadata.gz: 0365c36e90ed6ec817b2154161cd01d014bf29ab57ef27f54f04b7a9dda0ed0676cb9e4f7d1c452d7fff7ba688a2a8907fb80c32ac9f6c175e3635e05ab3ec69
7
- data.tar.gz: d29fde1ca29dc61a041dc54891b0badd73e52add5a7e484dc42b66adc3363b07f06e2026d7d9d851d1b0cd892ab51787d4c83a4160305405fccc7163345d65ff
6
+ metadata.gz: 78c9f3d52cf0123a7568402b378ec050b45c19015d59c789f31020e8179ea2591ea6e6f1e23d0baf62a7a98b4c6385a5e003f1e25d7ebdcc58044a25fd298a68
7
+ data.tar.gz: 581c4bb3660c6ac96ef2da1a06be97103e99c0324722744332fef13f85189db099140bbcd314e8ba66a76cfe9f03879e6881af1919be32159d676279bc812b74
@@ -1,3 +1,8 @@
1
+ 0.3.2.1
2
+ -------
3
+
4
+ - Add Windows development env support.
5
+
1
6
  0.3.2
2
7
  -----
3
8
 
@@ -4,7 +4,11 @@ module RuCaptcha
4
4
  headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
5
5
  headers['Pragma'] = 'no-cache'
6
6
 
7
- send_data generate_rucaptcha, disposition: 'inline', type: 'image/png'
7
+ if Gem.win_platform?
8
+ send_file generate_rucaptcha, disposition: 'inline', type: 'image/png'
9
+ else
10
+ send_data generate_rucaptcha, disposition: 'inline', type: 'image/png'
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -60,12 +60,21 @@ module RuCaptcha
60
60
  -implode #{RuCaptcha.config.implode} -trim label:- png:-
61
61
  CODE
62
62
 
63
- command.strip!
64
- pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)
65
- Process.waitpid(pid)
66
- err = stderr.read
67
- raise "RuCaptcha: #{err.strip}" if err != nil && err.length > 0
68
- stdout.read
63
+ if Gem.win_platform?
64
+ png_file_path = Rails.root.join('tmp', 'cache', "#{code}.png")
65
+ command = "convert -size #{size} xc:White -gravity Center -weight 12 -pointsize 20 -annotate 0 \"#{code}\" -trim #{png_file_path}"
66
+ require 'open3'
67
+ _stdout_str, stderr_str = Open3.capture3(command)
68
+ raise "RuCaptcha: #{stderr_str.strip}" if stderr_str != nil && stderr_str.length > 0
69
+ png_file_path
70
+ else
71
+ command.strip!
72
+ pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)
73
+ Process.waitpid(pid)
74
+ err = stderr.read
75
+ raise "RuCaptcha: #{err.strip}" if err != nil && err.length > 0
76
+ stdout.read
77
+ end
69
78
  end
70
79
  end
71
80
  end
@@ -1,3 +1,3 @@
1
1
  module RuCaptcha
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-24 00:00:00.000000000 Z
11
+ date: 2016-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: posix-spawn
@@ -107,10 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.4.8
110
+ rubygems_version: 2.5.1
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: This is a Captcha gem for Rails Application. It run ImageMagick command to
114
114
  draw Captcha image.
115
115
  test_files: []
116
- has_rdoc: