string_tools 0.15.0 → 0.16.0

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: 337a46e1015523315103711f4b61d556fc5cd71b
4
- data.tar.gz: 0e9327ad9c3387224ce1d63282691d3952b140b1
3
+ metadata.gz: '084549131263f4bead47691b27277aecbbc504d6'
4
+ data.tar.gz: d8256b2bd745db61a6e7f3a20c70c0debccb70dc
5
5
  SHA512:
6
- metadata.gz: 5650229f42d09b51761304d2e61f1706ff174d4b78da527af8376eb0a470b37ed4b578bcc678e500803496a43bcd3507adad640b63a596b8d46b3ccf7380936f
7
- data.tar.gz: '09742bdb78ef01ed2dc7b24969b18820268896b30d15c620be2c041768a11ceb69eeb3b7cdd2f37a5a7b339fa37c39c3458a15ebc81fd6d5538ede2ff465d8e9'
6
+ metadata.gz: 9409816487699de77f2d7ef3e0bdb5c33fd3cd104c5a8d8a7c2a68ba31e6f71051442fceecbca02a1ad92fd8a226c9441a9535905b5a8f7d5d536d077e82d446
7
+ data.tar.gz: 81ee9e971dcc3568c67157127634d6412eb12f7d165411dbbc201317e344cdc889590adaa9d72b718a92022b2f19a550f74a197e24533813c5ee443096988aae
data/.drone.yml CHANGED
@@ -1,32 +1,64 @@
1
- build:
2
- test:
3
- image: abakpress/dind-testing
4
- pull: true
5
- privileged: true
6
- volumes:
7
- - /home/data/drone/images:/images
8
- - /home/data/drone/gems:/bundle
9
- - /home/data/drone/key_cache:/ssh_keys
10
- environment:
11
- - COMPOSE_FILE_EXT=drone
12
- - RUBY_IMAGE_TAG=2.2-latest
13
- commands:
14
- - wrapdocker docker -v
1
+ ---
2
+ kind: pipeline
3
+ type: docker
4
+ name: build
15
5
 
16
- - fetch-images
17
- --image whilp/ssh-agent
18
- --image abakpress/ruby-app:$RUBY_IMAGE_TAG
6
+ volumes:
7
+ - name: bundle
8
+ host:
9
+ path: /home/data/drone/gems
10
+ - name: rubygems
11
+ host:
12
+ path: /home/data/drone/rubygems
19
13
 
20
- - dip ssh add -T -v /ssh_keys -k /ssh_keys/id_rsa
21
- - dip provision
22
- - dip rspec
14
+ spec_step_common: &spec_step_common
15
+ pull: if-not-exists
16
+ volumes:
17
+ - name: bundle
18
+ path: /bundle
19
+ commands:
20
+ - rm -fr Gemfile.lock gemfiles/
21
+ - bundle install -j 5
22
+ - bundle exec appraisal install
23
+ - bundle exec appraisal bundle exec rspec
23
24
 
24
- release:
25
- image: abakpress/gem-publication
26
- pull: true
27
- when:
28
- event: push
29
- volumes:
30
- - /home/data/drone/rubygems:/root/.gem
31
- commands:
32
- - release-gem --public
25
+ steps:
26
+ - name: build on ruby2.2
27
+ image: abakpress/ruby-app:2.2-latest
28
+ environment:
29
+ TEST_DB_HOST: postgres
30
+ TEST_DB_NAME: docker
31
+ TEST_DB_USERNAME: postgres
32
+ BUNDLE_PATH: /bundle/2.2
33
+ <<: *spec_step_common
34
+
35
+ - name: build on ruby2.3
36
+ image: abakpress/ruby-app:2.3-latest
37
+ environment:
38
+ TEST_DB_HOST: postgres
39
+ TEST_DB_NAME: docker
40
+ TEST_DB_USERNAME: postgres
41
+ BUNDLE_PATH: /bundle/2.3
42
+ <<: *spec_step_common
43
+
44
+ - name: build on ruby2.4
45
+ image: abakpress/ruby-app:2.4-latest
46
+ environment:
47
+ TEST_DB_HOST: postgres
48
+ TEST_DB_NAME: docker
49
+ TEST_DB_USERNAME: postgres
50
+ BUNDLE_PATH: /bundle/2.4
51
+ <<: *spec_step_common
52
+
53
+ - name: release
54
+ image: abakpress/gem-publication:latest
55
+ pull: if-not-exists
56
+ when:
57
+ event: push
58
+ branch: master
59
+ status: success
60
+ volumes:
61
+ - name: rubygems
62
+ path: /root/.gem
63
+ commands:
64
+ - release-gem --public
data/Appraisals CHANGED
@@ -1,11 +1,9 @@
1
- appraise 'rails4.0' do
2
- gem 'actionpack', '~> 4.0.0'
3
- gem 'activesupport', '~> 4.0.0'
4
- end
5
-
6
- appraise 'rails4.1' do
7
- gem 'actionpack', '~> 4.1.0'
8
- gem 'activesupport', '~> 4.1.0'
1
+ # frozen_string_literal: true
2
+ if RUBY_VERSION < '2.4'
3
+ appraise 'rails4.0' do
4
+ gem 'actionpack', '~> 4.0.0'
5
+ gem 'activesupport', '~> 4.0.0'
6
+ end
9
7
  end
10
8
 
11
9
  appraise 'rails4.2' do
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- # v0.15.0
1
+ # v0.16.0
2
+
3
+ * 2021-07-16 [8a3bf46](../../commit/8a3bf46) - __(Andrew N. Shalaev)__ Release v0.16.0
4
+ * 2021-07-16 [5784a91](../../commit/5784a91) - __(Andrew N. Shalaev)__ feature: add support for ruby v2.4
5
+ https://jira.railsc.ru/browse/BPC-19154
2
6
 
3
7
  * 2020-05-13 [19cb127](../../commit/19cb127) - __(TamarinEA)__ Release 0.15.0
4
8
  * 2020-04-03 [e63c121](../../commit/e63c121) - __(Mikhail Nelaev)__ feature: optionally turn off uri normalization
@@ -87,6 +91,11 @@ https://jira.railsc.ru/browse/PC4-16353
87
91
  # v3.0.1
88
92
 
89
93
 
94
+ # v0.15.0
95
+
96
+ * 2020-04-03 [e63c121](../../commit/e63c121) - __(Mikhail Nelaev)__ feature: optionally turn off uri normalization
97
+ https://jira.railsc.ru/browse/GOODS-2219
98
+
90
99
  # v0.14.0
91
100
 
92
101
  * 2019-09-23 [f495195](../../commit/f495195) - __(TamarinEA)__ feature: use nokogiri for strip tags
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in string_tools.gemspec
4
5
  gemspec
6
+
7
+ gem 'actionpack', '~> 4.0.13', require: false
data/Rakefile CHANGED
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  require "bundler/gem_tasks"
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'string_tools'
data/dip.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  version: '1'
2
2
 
3
3
  environment:
4
- DOCKER_RUBY_VERSION: 2.2
5
- RUBY_IMAGE_TAG: 2.2-latest
4
+ DOCKER_RUBY_VERSION: 2.3
5
+ RUBY_IMAGE_TAG: 2.3-latest
6
6
  COMPOSE_FILE_EXT: development
7
7
  RAILS_ENV: test
8
8
 
@@ -33,9 +33,10 @@ interaction:
33
33
 
34
34
  clean:
35
35
  service: app
36
- command: rm -f Gemfile.lock gemfiles/*.gemfile.*
36
+ command: rm -rf Gemfile.lock gemfiles
37
37
 
38
38
  provision:
39
39
  - docker volume create --name bundler_data
40
+ - dip clean
40
41
  - dip bundle install
41
42
  - dip appraisal install
data/lib/string_tools.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'string_tools/version'
3
4
  require 'ru_propisju'
4
5
  require 'sanitize'
@@ -186,10 +187,10 @@ module StringTools
186
187
  def call(env)
187
188
  node = env[:node]
188
189
  case node.name
189
- when 'a'.freeze
190
- normalize_link node, 'href'.freeze
191
- when 'img'.freeze
192
- normalize_link node, 'src'.freeze
190
+ when 'a'
191
+ normalize_link node, 'href'
192
+ when 'img'
193
+ normalize_link node, 'src'
193
194
  end
194
195
  end
195
196
 
@@ -229,7 +230,7 @@ module StringTools
229
230
  # Сумма в рублях прописью. Кол-во копеек выводится всегда. Первая буква заглавная
230
231
  def rublej_propisju(amount)
231
232
  kop = (amount.divmod(1)[1]*100).round
232
- result = RuPropisju.rublej(amount.to_i).capitalize
233
+ result = RuPropisju.rublej(amount.to_i).capitalize.dup
233
234
  result << " %.2d " % kop
234
235
  result << RuPropisju.choose_plural(kop, 'копейка', 'копейки', 'копеек')
235
236
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rchardet19'
2
3
  require 'addressable/uri'
3
4
  require 'active_support/core_ext/module'
@@ -154,7 +155,7 @@ class String
154
155
  end
155
156
  end
156
157
 
157
- WIN_1251_ENCODING = 'windows-1251'.freeze
158
+ WIN_1251_ENCODING = 'windows-1251'
158
159
  # shorthand
159
160
  def detect_encoding
160
161
  e = ::CharDet.detect(self)["encoding"]
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'nokogiri'
3
4
  require 'addressable/uri'
4
5
  require 'simpleidn'
@@ -44,7 +45,7 @@ module StringTools
44
45
  doc = Nokogiri::HTML::DocumentFragment.parse(html)
45
46
  scrubber = LinksRemoveScrubber.new(options)
46
47
 
47
- doc.css('a'.freeze).each { |node| scrubber.call node }
48
+ doc.css('a').each { |node| scrubber.call node }
48
49
 
49
50
  if scrubber.done_changes?
50
51
  doc.children.map { |node| node.serialize HTML_SERIALIZE_OPTIONS }.join
@@ -78,7 +79,7 @@ module StringTools
78
79
  end
79
80
 
80
81
  def whitelisted?(domain)
81
- host_parts = domain.split('.'.freeze)
82
+ host_parts = domain.split('.')
82
83
  host = host_parts[-1] # com, ru ...
83
84
  (host_parts.length - 2).downto(0) do |i|
84
85
  subdomain = host_parts[i]
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module StringTools
2
3
  class String
3
4
  TRUE_VALUES = %w(1 t T true TRUE on ON).to_set
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module StringTools
2
- VERSION = '0.15.0'.freeze
3
+ VERSION = '0.16.0'
3
4
  end
data/string_tools.gemspec CHANGED
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'string_tools/version'
@@ -19,8 +20,8 @@ Gem::Specification.new do |spec|
19
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
21
  spec.require_paths = ['lib']
21
22
 
22
- spec.add_runtime_dependency 'actionpack', '>= 3.1.12'
23
- spec.add_runtime_dependency 'activesupport', '>= 3.1.12'
23
+ spec.add_runtime_dependency 'actionpack', '>= 4.0.13'
24
+ spec.add_runtime_dependency 'activesupport', '>= 4.0.13'
24
25
  spec.add_runtime_dependency 'rchardet19', '~> 1.3.5'
25
26
  spec.add_runtime_dependency 'addressable', '>= 2.3.2'
26
27
  spec.add_runtime_dependency 'ru_propisju', '>= 2.1.4'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey D.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2021-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.12
19
+ version: 4.0.13
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.12
26
+ version: 4.0.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.12
33
+ version: 4.0.13
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.12
40
+ version: 4.0.13
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rchardet19
43
43
  requirement: !ruby/object:Gem::Requirement