leangem 2.1.4 → 2.1.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fileupload.rb +11 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 931d177128e7ea2f58dd7ecb6b7e5b012c1862a3
4
- data.tar.gz: 55fd188c6b20a9d8ed1565d03c56ae1bfe487c8f
3
+ metadata.gz: 3bcf4bf14cf2fd42ef26a9fb305c000045eb5854
4
+ data.tar.gz: 25ace4ef9f12b8c680d88574907e9614b4505943
5
5
  SHA512:
6
- metadata.gz: a3c6d5c19e4c4439a143a83b8a2f9233c874ad28aeab6bbad0a80dbe02820ac5b16b75d164439a8516d034bb9c97b05c5eac9d6c062b4675497527764258c3b6
7
- data.tar.gz: 817f4a726d79a5663ce698c900900c8693d3d43f09d6ec24631bfbbea2031e1f439e0bbf160b7feb712a733168bc9e88401e18aa9cf86d1378a523114b13cf9c
6
+ metadata.gz: 80053532beb034406eea4c95e5e0e56536f6374423da5cb445d61258242c189b973d68c6c196b2edfaf634a8dbb55b1652769002e0cf9cb2f14d8883bc6fe59f
7
+ data.tar.gz: 82d3916200e5f576dbbfde927663775bf7f0a75d1642953654f8cc9c056189a2bfb5366bd13ef625b72165a7798c3a3c6546d7d9c429236cbb57ef540e784143
@@ -8,15 +8,17 @@ class Fileupload
8
8
  sname = Fileupload.getname(file, filepath)
9
9
  begin
10
10
  unless Dir::exist?(filepath)
11
- Dir.mkdir(filepath)
12
- end
11
+ unless system("mkdir #{filepath}")
12
+ return {state: false, result: "目录创建失败,请于管理员联系"}
13
+ end
14
+ end
13
15
  File.open(filepath+sname, "wb") do |f|
14
16
  f.write(file.read)
15
17
  end
18
+ return {state: true, result: sname}
16
19
  rescue
17
20
  return {state: false, result: "写入文件失败:#{$!}"}
18
21
  end
19
- return {state: true, result: sname}
20
22
  else
21
23
  return {state: false, result: result[:message]}
22
24
  end
@@ -73,16 +75,18 @@ class Fileupload
73
75
  sname = Fileupload.getname(imgfile, filepath)
74
76
  begin
75
77
  unless Dir::exist?(filepath)
76
- Dir.mkdir(filepath)
77
- end
78
+ unless system("mkdir #{filepath}")
79
+ return {state: false, result: "目录创建失败,请于管理员联系"}
80
+ end
81
+ end
78
82
  File.open(filepath+sname, "wb") do |f|
79
83
  f.write(imgfile.read)
80
84
  end
85
+ Fileupload.resize(filepath + sname, w, h)
86
+ return {state: true, result: sname}
81
87
  rescue
82
88
  return {state: false, result: "写入图片失败:#{$!}"}
83
89
  end
84
- Fileupload.resize(filepath + sname, w, h)
85
- return {state: true, result: sname}
86
90
  else
87
91
  return {state: false, result: result[:message]}
88
92
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leangem
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lean