bizside 2.0.1 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bizside/config.rb +5 -3
- data/lib/bizside/coverage/launch.rb +20 -12
- data/lib/bizside/file_converter.rb +1 -2
- data/lib/bizside/file_uploader.rb +18 -8
- data/lib/bizside/railtie.rb +1 -0
- data/lib/bizside/test_help.rb +1 -0
- data/lib/bizside/version.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad2622c94f4492dce9352aade7512d20cf24e0f37d279b489c83de842de0d04
|
4
|
+
data.tar.gz: 0e2d37c1cd091f298f9324edbeae13f6942514bd93fcfc49c9fa8422e5679953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ed6d011a95dd34ba5d9d670d2c5b8101e650677f8869e7382f5813c2f19e735a026ecafce3298363e47a6e50ae457d8c95b8aa324eba915937ff79cf8e92c2
|
7
|
+
data.tar.gz: bebfdb0888313e89e1ea1d50b3b3da11900cebf0ae717d57eb22578ba86ab76f716a4ae073f20f5e35a03e1bdd60c36b1bb20dea70bdb815e236821dce2341c6
|
data/lib/bizside/config.rb
CHANGED
@@ -25,7 +25,7 @@ module Bizside
|
|
25
25
|
|
26
26
|
ret
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def []=(key, value)
|
30
30
|
value = self.class.new(value) if value.is_a?(Hash)
|
31
31
|
@hash[key.to_s] = value
|
@@ -52,8 +52,10 @@ module Bizside
|
|
52
52
|
def method_missing(name, *args)
|
53
53
|
ret = self[name]
|
54
54
|
|
55
|
-
if ret.is_a?(Hash)
|
56
|
-
|
55
|
+
if ret.is_a?(Hash) || ret.is_a?(::Bizside::Config)
|
56
|
+
unless args[0].nil?
|
57
|
+
ret = self[name] = args[0]
|
58
|
+
end
|
57
59
|
end
|
58
60
|
|
59
61
|
ret
|
@@ -1,5 +1,24 @@
|
|
1
1
|
module Bizside
|
2
2
|
class CoverageLaunch
|
3
|
+
|
4
|
+
def self.load
|
5
|
+
if ENV["COVERAGE"].to_s.downcase == 'true' and ENV['ACCEPTANCE_TEST'].to_s.downcase == 'true'
|
6
|
+
setup()
|
7
|
+
|
8
|
+
SimpleCov.start 'rails' do
|
9
|
+
SimpleCov.command_name(ENV['COMMAND_NAME']) if ENV['COMMAND_NAME']
|
10
|
+
SimpleCov.merge_timeout(7200)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.load_from_test_helper
|
16
|
+
if ENV["COVERAGE"] == 'true'
|
17
|
+
setup()
|
18
|
+
SimpleCov.start 'rails'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
3
22
|
def self.setup
|
4
23
|
require 'simplecov'
|
5
24
|
require 'simplecov-rcov'
|
@@ -9,17 +28,6 @@ module Bizside
|
|
9
28
|
Coverage::RcovFormatter
|
10
29
|
])
|
11
30
|
end
|
31
|
+
private_class_method :setup
|
12
32
|
end
|
13
33
|
end
|
14
|
-
|
15
|
-
if ENV["COVERAGE"].to_s.downcase == 'true' and ENV['ACCEPTANCE_TEST'].to_s.downcase == 'true'
|
16
|
-
Bizside::CoverageLaunch.setup()
|
17
|
-
|
18
|
-
SimpleCov.start 'rails' do
|
19
|
-
SimpleCov.command_name(ENV['COMMAND_NAME']) if ENV['COMMAND_NAME']
|
20
|
-
SimpleCov.merge_timeout(7200)
|
21
|
-
end
|
22
|
-
elsif ENV["COVERAGE"]
|
23
|
-
Bizside::CoverageLaunch.setup()
|
24
|
-
SimpleCov.start 'rails'
|
25
|
-
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'rmagick'
|
2
|
-
|
3
1
|
module Bizside
|
4
2
|
module FileConverter
|
5
3
|
EXT_IMAGE = ['.gif', '.jpg', '.jpeg', '.png']
|
@@ -26,6 +24,7 @@ module Bizside
|
|
26
24
|
end
|
27
25
|
|
28
26
|
def self.convert_to_image(file)
|
27
|
+
require 'rmagick'
|
29
28
|
|
30
29
|
case File.extname(file.path)
|
31
30
|
when *EXT_IMAGE
|
@@ -4,12 +4,7 @@ require_relative 'carrierwave'
|
|
4
4
|
require_relative 'uploader/extension_whitelist'
|
5
5
|
require_relative 'uploader/filename_validator'
|
6
6
|
require_relative 'uploader/content_type_validator'
|
7
|
-
|
8
|
-
if defined?(Rails) && Rails.application.class.parent_name.eql?('BizsideTestApp')
|
9
|
-
# not require 'uploader/exif'
|
10
|
-
else
|
11
|
-
require_relative 'uploader/exif'
|
12
|
-
end
|
7
|
+
require_relative 'uploader/exif'
|
13
8
|
|
14
9
|
module Bizside
|
15
10
|
# === storage.yml
|
@@ -45,6 +40,21 @@ module Bizside
|
|
45
40
|
Bizside.config.storage.fog? ? downloaded_file_from_fog(file.path) : file.path
|
46
41
|
end
|
47
42
|
|
43
|
+
# ファイル名の長さチェックが可能なように
|
44
|
+
def cache!(new_file = sanitized_file)
|
45
|
+
begin
|
46
|
+
super
|
47
|
+
rescue Errno::ENAMETOOLONG => e
|
48
|
+
if Bizside.config.file_uploader.ignore_long_filename_error?
|
49
|
+
if self.model.respond_to?(:original_filename)
|
50
|
+
self.model.original_filename = filename
|
51
|
+
end
|
52
|
+
else
|
53
|
+
raise e
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
48
58
|
private
|
49
59
|
|
50
60
|
def downloaded_file_from_fog(path)
|
@@ -53,7 +63,7 @@ module Bizside
|
|
53
63
|
|
54
64
|
def download_file_from_fog(path)
|
55
65
|
tmp_path = "/tmp/#{Bizside.config.add_on_name}-#{Bizside::StringUtils.current_time_string}-#{File.basename(path)}"
|
56
|
-
system("curl '#{file.url}' -o '#{tmp_path}'")
|
66
|
+
raise "File download failed.(curl '#{file.url}' -o '#{tmp_path}')" unless system("curl '#{file.url}' -o '#{tmp_path}'")
|
57
67
|
tmp_path
|
58
68
|
end
|
59
69
|
|
@@ -62,7 +72,7 @@ module Bizside
|
|
62
72
|
unless File.exist?(cache_path)
|
63
73
|
FileUtils.mkdir_p(File.dirname(cache_path))
|
64
74
|
tmp_path = download_file_from_fog(path)
|
65
|
-
system("mv '#{tmp_path}' '#{cache_path}'")
|
75
|
+
raise "Failed to move file.(mv '#{tmp_path}' '#{cache_path}')" unless system("mv '#{tmp_path}' '#{cache_path}'")
|
66
76
|
end
|
67
77
|
cache_path
|
68
78
|
end
|
data/lib/bizside/railtie.rb
CHANGED
data/lib/bizside/test_help.rb
CHANGED
data/lib/bizside/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bizside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bizside-developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -326,6 +326,26 @@ dependencies:
|
|
326
326
|
- - "<"
|
327
327
|
- !ruby/object:Gem::Version
|
328
328
|
version: 3.0.0
|
329
|
+
- !ruby/object:Gem::Dependency
|
330
|
+
name: rmagick
|
331
|
+
requirement: !ruby/object:Gem::Requirement
|
332
|
+
requirements:
|
333
|
+
- - ">="
|
334
|
+
- !ruby/object:Gem::Version
|
335
|
+
version: 4.2.3
|
336
|
+
- - "<"
|
337
|
+
- !ruby/object:Gem::Version
|
338
|
+
version: 5.0.0
|
339
|
+
type: :development
|
340
|
+
prerelease: false
|
341
|
+
version_requirements: !ruby/object:Gem::Requirement
|
342
|
+
requirements:
|
343
|
+
- - ">="
|
344
|
+
- !ruby/object:Gem::Version
|
345
|
+
version: 4.2.3
|
346
|
+
- - "<"
|
347
|
+
- !ruby/object:Gem::Version
|
348
|
+
version: 5.0.0
|
329
349
|
- !ruby/object:Gem::Dependency
|
330
350
|
name: sqlite3
|
331
351
|
requirement: !ruby/object:Gem::Requirement
|