bizside 2.0.6 → 2.0.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26c26db7d3e38fd8d2a1851b5c4424ffd34c0ab10fb2e91086d070a06075a5fe
4
- data.tar.gz: 3f683257382c9c1578a177bb08899611a3b9e016c0473d92fc87523fd1dde980
3
+ metadata.gz: 0e1c1e72b09d24a208022c0b1993fe1dfdd92dace03d054e06bef412a2d5413d
4
+ data.tar.gz: e249f874f11ad00cf70c24983ea3662784c4fce63d6e06a0648421c59116fc20
5
5
  SHA512:
6
- metadata.gz: b94958b3abbafda5e3143ececc2bd370115e1a35b102c04abcaa791c9831bc9a23306c94bf36888accc1d7e98a11df9026e1842c421fa59679d9295095f7339d
7
- data.tar.gz: 9dac9f0377694abcb2d73cbc3869f1fd5923cb50ee1c6c3fa379ec8a68d3458003e3960f97125725189fd5ff9ea4c4e676f582719b74fdc9cf93d8e2dbaf5ba3
6
+ metadata.gz: e91a2b3bb6ecdaa5601776398936398073cc8586e2e47fd43e033f2c92fd77837c7f259ea2366b2784f4d07dffd41ea1cfc4a4fef3dddb2064070c9015156449
7
+ data.tar.gz: 15ff5f4fe7c04fcf668effd758c7848215bed6f23dc4fc38cd9022d8e5f4b8c0bad5619a86389236ba24f68beeba8efc183373adae14a871f3ab84109bd68fcf
@@ -121,6 +121,7 @@ module Resque
121
121
  info = {
122
122
  time: Time.now.strftime('%Y-%m-%dT%H:%M:%S.%3N%z'),
123
123
  add_on_name: Bizside.config.add_on_name,
124
+ server_address: hostname,
124
125
  class: payload['class'],
125
126
  args: payload['args'].to_s,
126
127
  queue: queue,
@@ -132,6 +133,19 @@ module Resque
132
133
  info
133
134
  end
134
135
 
136
+ # ホスト名を取得。
137
+ #
138
+ # 下記理由から hostname(1) を使用:
139
+ #
140
+ # * job 実行環境では環境変数 HOSTNAME がセットされていないケースがある
141
+ # (例: 通常の god 起動の場合。他方、container 起動の場合は
142
+ # HOSTNAME がセットされている模様)。
143
+ # * hostname(1) は Linux Standard Base 共通コマンドのため必ず存在する。
144
+ # @see https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Common/LSB-Common/rcommands.html
145
+ def hostname
146
+ @hostname ||= (`hostname`.chomp rescue '(unknown)')
147
+ end
148
+
135
149
  end
136
150
  end
137
151
  end
@@ -7,7 +7,9 @@ module Bizside
7
7
  def self.create_random_alpha_string length, case_sensitive = false
8
8
  chars = ('a'..'z').to_a
9
9
  chars += ('A'..'Z').to_a if case_sensitive
10
- chars.sample(length).join
10
+ chars_length = chars.length
11
+
12
+ Array.new(length) { chars[rand(chars_length)] }.join
11
13
  end
12
14
 
13
15
  def self.create_random_string(number)
@@ -176,7 +176,7 @@ end
176
176
 
177
177
  def self.ask_env(env_key, options = {})
178
178
  cache_file = 'tmp/cache/env'
179
- cache = File.exists?(cache_file) ? YAML.load_file(cache_file) : {}
179
+ cache = File.exist?(cache_file) ? YAML.load_file(cache_file) : {}
180
180
 
181
181
  if options.fetch(:cache, false)
182
182
  options = options.merge(default: cache.fetch(env_key, options[:default]))
@@ -190,7 +190,7 @@ def self.ask_env(env_key, options = {})
190
190
  cache[env_key] = ENV[env_key]
191
191
  File.write(cache_file, YAML.dump(cache))
192
192
  else
193
- if File.exists?(cache_file) and cache[env_key]
193
+ if File.exist?(cache_file) and cache[env_key]
194
194
  cache.delete(env_key)
195
195
  File.write(cache_file, YAML.dump(cache))
196
196
  end
@@ -203,7 +203,7 @@ def self.yes_confirmed?(yes_value, options = {})
203
203
  ret = Bizside::Yes.confirmed?(yes_value)
204
204
  if ret.nil?
205
205
  if options[:fail_on_error]
206
- fail "yes/no または true/false 形式で入力してください。answer=#{answer}"
206
+ fail "yes/no または true/false 形式で入力してください。answer=#{yes_value}"
207
207
  else
208
208
  ret = false
209
209
  end
@@ -10,7 +10,7 @@ module Bizside
10
10
  require 'carrierwave-magic'
11
11
  include CarrierWave::Magic
12
12
  process :set_magic_content_type => true
13
- rescue => e
13
+ rescue
14
14
  raise '[Bizside.gem ERROR] you need to add carrierwave-magic.gem.'
15
15
  end
16
16
  before :cache, :validate_content_type!
@@ -40,7 +40,7 @@ class ActionView::TemplateRenderer
40
40
  options[:template] = option_for_template + '.' + priority
41
41
  ret = determine_template(options)
42
42
  break
43
- rescue ActionView::MissingTemplate => e
43
+ rescue ActionView::MissingTemplate
44
44
  end
45
45
  end
46
46
  end
@@ -1,3 +1,3 @@
1
1
  module Bizside
2
- VERSION = '2.0.6'
2
+ VERSION = '2.0.9'
3
3
  end
@@ -1,28 +1,28 @@
1
- # 電話番号のバリデーション
2
- # ActiveModel::EachValidatorを継承してRailsに統合する
3
- class TelValidator < ActiveModel::EachValidator
4
-
5
- def initialize(options = {})
6
- super(options)
7
- end
8
-
9
- # レコード保存時に呼び出されるバリデーションメソッド
10
- # record ・・・ 保存対象のレコード
11
- # attribute ・・・ チェック対象の属性(DBのカラム)
12
- # value ・・・ 入力された値
13
- def validate_each(record, attribute, value)
14
- return if value.nil? or value.empty?
15
-
16
- unless validate_tel(record, value)
17
- record.errors[attribute] << I18n.t('errors.messages.invalid')
18
- end
19
- end
20
-
21
- private
22
-
23
- # 電話番号として妥当かどうかのチェック
24
- def validate_tel(record, value)
25
- # 全角・半角とわず数字とハイフンの構成であれば良しとしている
26
- value.match(/^[0-9|0-9]+[-|-]?[0-9|0-9]+[-|-]?[0-9|0-9]+$/)
27
- end
28
- end
1
+ # 電話番号のバリデーション
2
+ # ActiveModel::EachValidatorを継承してRailsに統合する
3
+ class TelValidator < ActiveModel::EachValidator
4
+
5
+ def initialize(options = {})
6
+ super(options)
7
+ end
8
+
9
+ # レコード保存時に呼び出されるバリデーションメソッド
10
+ # record ・・・ 保存対象のレコード
11
+ # attribute ・・・ チェック対象の属性(DBのカラム)
12
+ # value ・・・ 入力された値
13
+ def validate_each(record, attribute, value)
14
+ return if value.nil? or value.empty?
15
+
16
+ unless validate_tel(record, value)
17
+ record.errors[attribute] << I18n.t('errors.messages.invalid')
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ # 電話番号として妥当かどうかのチェック
24
+ def validate_tel(record, value)
25
+ # 全角・半角とわず数字とハイフンの構成であれば良しとしている
26
+ value.match(/^[0-9|0-9]+[-|-]?[0-9|0-9]+[-|-]?[0-9|0-9]+$/)
27
+ end
28
+ end
@@ -1,35 +1,35 @@
1
- class ZipValidator < ActiveModel::EachValidator
2
-
3
- def initialize(options = {})
4
- super(options)
5
- @other = options[:other]
6
- end
7
-
8
- def validate_each(record, attribute, value)
9
- zip1 = value
10
- zip2 = get_other_value(record)
11
-
12
- return if (zip1.nil? or zip1.empty?) and (zip2.nil? or zip2.empty?)
13
-
14
- unless validate_zip(zip1, zip2)
15
- record.errors[attribute] << I18n.t('errors.messages.zip')
16
- return
17
- end
18
- end
19
-
20
- private
21
-
22
- def validate_zip(zip1, zip2)
23
- return false unless zip1
24
- return false unless zip1.match(/^[0-9|0-9]{3}$/)
25
-
26
- return false unless zip2
27
- return false unless zip2.match(/^[0-9|0-9]{4}$/)
28
-
29
- true
30
- end
31
-
32
- def get_other_value(record)
33
- record.__send__(@other)
34
- end
35
- end
1
+ class ZipValidator < ActiveModel::EachValidator
2
+
3
+ def initialize(options = {})
4
+ super(options)
5
+ @other = options[:other]
6
+ end
7
+
8
+ def validate_each(record, attribute, value)
9
+ zip1 = value
10
+ zip2 = get_other_value(record)
11
+
12
+ return if (zip1.nil? or zip1.empty?) and (zip2.nil? or zip2.empty?)
13
+
14
+ unless validate_zip(zip1, zip2)
15
+ record.errors[attribute] << I18n.t('errors.messages.zip')
16
+ return
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def validate_zip(zip1, zip2)
23
+ return false unless zip1
24
+ return false unless zip1.match(/^[0-9|0-9]{3}$/)
25
+
26
+ return false unless zip2
27
+ return false unless zip2.match(/^[0-9|0-9]{4}$/)
28
+
29
+ true
30
+ end
31
+
32
+ def get_other_value(record)
33
+ record.__send__(@other)
34
+ end
35
+ end
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.6
4
+ version: 2.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - bizside-developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -160,16 +160,22 @@ dependencies:
160
160
  name: rake
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - "~>"
163
+ - - ">="
164
164
  - !ruby/object:Gem::Version
165
165
  version: '12.3'
166
+ - - "<"
167
+ - !ruby/object:Gem::Version
168
+ version: '14.0'
166
169
  type: :runtime
167
170
  prerelease: false
168
171
  version_requirements: !ruby/object:Gem::Requirement
169
172
  requirements:
170
- - - "~>"
173
+ - - ">="
171
174
  - !ruby/object:Gem::Version
172
175
  version: '12.3'
176
+ - - "<"
177
+ - !ruby/object:Gem::Version
178
+ version: '14.0'
173
179
  - !ruby/object:Gem::Dependency
174
180
  name: RedCloth
175
181
  requirement: !ruby/object:Gem::Requirement
@@ -193,7 +199,7 @@ dependencies:
193
199
  version: '3.0'
194
200
  - - "<"
195
201
  - !ruby/object:Gem::Version
196
- version: '3.2'
202
+ version: '3.36'
197
203
  type: :development
198
204
  prerelease: false
199
205
  version_requirements: !ruby/object:Gem::Requirement
@@ -203,41 +209,35 @@ dependencies:
203
209
  version: '3.0'
204
210
  - - "<"
205
211
  - !ruby/object:Gem::Version
206
- version: '3.2'
212
+ version: '3.36'
207
213
  - !ruby/object:Gem::Dependency
208
214
  name: cucumber
209
215
  requirement: !ruby/object:Gem::Requirement
210
216
  requirements:
211
- - - ">="
212
- - !ruby/object:Gem::Version
213
- version: '2.4'
214
- - - "<"
217
+ - - "~>"
215
218
  - !ruby/object:Gem::Version
216
- version: '4.0'
219
+ version: '7.1'
217
220
  type: :development
218
221
  prerelease: false
219
222
  version_requirements: !ruby/object:Gem::Requirement
220
223
  requirements:
221
- - - ">="
222
- - !ruby/object:Gem::Version
223
- version: '2.4'
224
- - - "<"
224
+ - - "~>"
225
225
  - !ruby/object:Gem::Version
226
- version: '4.0'
226
+ version: '7.1'
227
227
  - !ruby/object:Gem::Dependency
228
228
  name: cucumber-rails
229
229
  requirement: !ruby/object:Gem::Requirement
230
230
  requirements:
231
231
  - - "~>"
232
232
  - !ruby/object:Gem::Version
233
- version: '1.4'
233
+ version: '2.5'
234
234
  type: :development
235
235
  prerelease: false
236
236
  version_requirements: !ruby/object:Gem::Requirement
237
237
  requirements:
238
238
  - - "~>"
239
239
  - !ruby/object:Gem::Version
240
- version: '1.4'
240
+ version: '2.5'
241
241
  - !ruby/object:Gem::Dependency
242
242
  name: devise
243
243
  requirement: !ruby/object:Gem::Requirement
@@ -350,22 +350,22 @@ dependencies:
350
350
  name: sqlite3
351
351
  requirement: !ruby/object:Gem::Requirement
352
352
  requirements:
353
- - - "~>"
353
+ - - ">="
354
354
  - !ruby/object:Gem::Version
355
355
  version: '1.3'
356
356
  - - "<"
357
357
  - !ruby/object:Gem::Version
358
- version: 1.4.0
358
+ version: 1.5.0
359
359
  type: :development
360
360
  prerelease: false
361
361
  version_requirements: !ruby/object:Gem::Requirement
362
362
  requirements:
363
- - - "~>"
363
+ - - ">="
364
364
  - !ruby/object:Gem::Version
365
365
  version: '1.3'
366
366
  - - "<"
367
367
  - !ruby/object:Gem::Version
368
- version: 1.4.0
368
+ version: 1.5.0
369
369
  description: Bizside is an utilities to assist building web application.
370
370
  email:
371
371
  - bizside-developers@lab.acs-jp.com
@@ -479,7 +479,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
479
479
  - !ruby/object:Gem::Version
480
480
  version: '0'
481
481
  requirements: []
482
- rubygems_version: 3.2.16
482
+ rubyforge_project:
483
+ rubygems_version: 2.7.6.2
483
484
  signing_key:
484
485
  specification_version: 4
485
486
  summary: Bizside is an utilities for web application.