skittlize 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: e72f8f154da84b12bf2e24cb111f1be912257e2095cf5776b6513f2270a02827
4
- data.tar.gz: 65147f1a676edafd5051a62569909cc6d2472f1368042dbc83178fe2a885372a
3
+ metadata.gz: 0b0e0ed1da3549288c7739538b5098b1dc210aa011904116be1a131ca0c625a6
4
+ data.tar.gz: a0cca47d6b3eca5a2c790c4e4f1bd97a8a20c78e15df4f1238ff9db59470e3a9
5
5
  SHA512:
6
- metadata.gz: 16a29a1731024b33f57ba4b2656630dbe2e35704686cda32d23a7aae893e46a70e5b93f351ffc2d184bd576a69d00b82488039e7662e5bee45a2f8b4363da924
7
- data.tar.gz: 1bfa3f208d1afc66017894cdfe2b3ed2b0ea68661a63b6f3d35959cd967d5b7eb26f691e1342b8e7c99716a59473200f29d442de35a17144b63b562ac78d515f
6
+ metadata.gz: a728bd5f61b70aa28cca12c6f76db86f44880c5d070a7a3b3aa2978836913405cce90486be3e90205121693a126b7b962cf2c6f37f32cef4b3c9b940197ebb03
7
+ data.tar.gz: 88de0af410e891cabd33f58c2f9664d0be12341d0865880a32bf40d32f3b869f33f787f0b388f9ae9183ece1f06a93516b29a3217fb69677e964a27dfaa4506e
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: CI
3
+
4
+ on:
5
+ push:
6
+ branches:
7
+ - master
8
+ pull_request:
9
+ branches:
10
+ - master
11
+
12
+ jobs:
13
+ ci:
14
+ name: Run checks
15
+
16
+ strategy:
17
+ matrix:
18
+ ruby_version:
19
+ - 2.4
20
+ - 2.5
21
+ - 2.6
22
+ - 2.7
23
+ - 3.0
24
+
25
+ runs-on: 'ubuntu-18.04'
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - name: Install ruby version ${{ env.ruby_version }}
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby_version }}
32
+ bundler-cache: true
33
+
34
+ - name: RSpec
35
+ run: |
36
+ bundle exec rake spec
37
+
data/.rubocop.yml ADDED
@@ -0,0 +1,21 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ CacheRootDirectory: '/tmp/skittlize-rubocop-cache'
4
+
5
+ Metrics/BlockLength:
6
+ ExcludedMethods: ['describe', 'context']
7
+
8
+ Style/Documentation:
9
+ Enabled: false
10
+
11
+ Style/SymbolArray:
12
+ Enabled: false
13
+
14
+ Style/WordArray:
15
+ Enabled: false
16
+
17
+ Style/TrailingCommaInArrayLiteral:
18
+ EnforcedStyleForMultiline: "comma"
19
+
20
+ Style/TrailingCommaInHashLiteral:
21
+ EnforcedStyleForMultiline: "comma"
data/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # Changelog
2
2
 
3
- ## [1.1.0](https://github.com/smortex/skittlize/tree/1.1.0) (2021-01-03)
3
+ ## [v1.2.0](https://github.com/smortex/skittlize/tree/v1.2.0) (2021-05-02)
4
4
 
5
- [Full Changelog](https://github.com/smortex/skittlize/compare/v1.0.0...1.1.0)
5
+ [Full Changelog](https://github.com/smortex/skittlize/compare/v1.1.0...v1.2.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add a test suite [\#4](https://github.com/smortex/skittlize/pull/4) ([smortex](https://github.com/smortex))
10
+ - Allow to skittlize parts of strings [\#3](https://github.com/smortex/skittlize/pull/3) ([smortex](https://github.com/smortex))
11
+
12
+ **Fixed bugs:**
13
+
14
+ - Fix future-version in CHANGELOG [\#2](https://github.com/smortex/skittlize/pull/2) ([smortex](https://github.com/smortex))
15
+
16
+ ## [v1.1.0](https://github.com/smortex/skittlize/tree/v1.1.0) (2021-01-04)
17
+
18
+ [Full Changelog](https://github.com/smortex/skittlize/compare/v1.0.0...v1.1.0)
6
19
 
7
20
  **Implemented enhancements:**
8
21
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in skittlize.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -8,7 +10,7 @@ require 'github_changelog_generator/task'
8
10
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
9
11
  config.user = 'smortex'
10
12
  config.project = 'skittlize'
11
- config.future_release = Skittlize::VERSION
13
+ config.future_release = "v#{Skittlize::VERSION}"
12
14
  end
13
15
 
14
16
  task default: :spec
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 'skittlize'
data/lib/skittlize.rb CHANGED
@@ -1,21 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'digest'
2
4
 
3
5
  class Array
4
- def skittlize
6
+ def skittlize(options = {})
5
7
  map do |cell|
6
8
  case cell
7
- when Array
8
- cell.skittlize
9
- when String
10
- cell.skittlize
9
+ when Array, String
10
+ cell.skittlize(options)
11
11
  else
12
12
  cell
13
13
  end
14
14
  end
15
15
  end
16
16
 
17
- def skittlize!
18
- replace(skittlize)
17
+ def skittlize!(options = {})
18
+ replace(skittlize(options))
19
19
  end
20
20
  end
21
21
 
@@ -27,11 +27,25 @@ class String
27
27
  n
28
28
  end
29
29
 
30
- def skittlize
31
- "\033[38;5;#{skittle_color}m#{self}\033[0m"
30
+ def skittlize(options = {})
31
+ check_options(options)
32
+
33
+ if options[:split]
34
+ split(options[:split]).map(&:skittlize).join(options[:join] || options[:split])
35
+ else
36
+ "\033[38;5;#{skittle_color}m#{self}\033[0m"
37
+ end
32
38
  end
33
39
 
34
- def skittlize!
35
- replace(skittlize)
40
+ def skittlize!(options = {})
41
+ replace(skittlize(options))
42
+ end
43
+
44
+ private
45
+
46
+ def check_options(options)
47
+ extra_options = options.keys - [:split, :join]
48
+
49
+ raise "Unsupported options: #{extra_options}" if extra_options.any?
36
50
  end
37
51
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Skittlize
2
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.2.0'
3
5
  end
data/skittlize.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'skittlize/version'
@@ -12,6 +14,8 @@ Gem::Specification.new do |spec|
12
14
  spec.homepage = 'https://github.com/smortex/skittlize'
13
15
  spec.license = 'MIT'
14
16
 
17
+ spec.required_ruby_version = 2.4
18
+
15
19
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
16
20
 
17
21
  spec.metadata['homepage_uri'] = spec.homepage
@@ -28,7 +32,9 @@ Gem::Specification.new do |spec|
28
32
  spec.require_paths = ['lib']
29
33
 
30
34
  spec.add_development_dependency 'bundler', '~> 2.0'
35
+ spec.add_development_dependency 'github_changelog_generator'
31
36
  spec.add_development_dependency 'rake', '~> 10.0'
32
37
  spec.add_development_dependency 'rspec', '~> 3.0'
33
- spec.add_development_dependency 'github_changelog_generator'
38
+ spec.add_development_dependency 'rubocop'
39
+ spec.add_development_dependency 'rubocop-rspec'
34
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skittlize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain Tartière
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-04 00:00:00.000000000 Z
11
+ date: 2021-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: github_changelog_generator
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +67,21 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '3.0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: github_changelog_generator
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
@@ -73,9 +101,10 @@ executables: []
73
101
  extensions: []
74
102
  extra_rdoc_files: []
75
103
  files:
104
+ - ".github/workflows/ci.yaml"
76
105
  - ".gitignore"
77
106
  - ".rspec"
78
- - ".travis.yml"
107
+ - ".rubocop.yml"
79
108
  - CHANGELOG.md
80
109
  - CODE_OF_CONDUCT.md
81
110
  - Gemfile
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.5
7
- before_install: gem install bundler -v 2.0.2