case_transform2 1.0.0 → 1.1.1

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: 2508f1e130309a456cd3c7b57155fde46dd4bfb2da6a04d17763fa4e1b3b5625
4
- data.tar.gz: d4ce5240085406f08ee747089147fe18d538eaf09f0a3252334787b74cffdd91
3
+ metadata.gz: f91f4c7a5388436882985fd646c3020cdeaabc64f41042b68735ef1ca06742c6
4
+ data.tar.gz: a6126223e52e567b6a5ff7740071e5cf250929d6a9b204f0fccd74652bf03c5d
5
5
  SHA512:
6
- metadata.gz: 941332e0e0be855f72d31490ed0dc42a299cfaab150fde878ea6fee3c9c1b9c8145802df65b53cdc974f430bf4771c8ca46684b15cbd9cef9c44a8b16fd399bc
7
- data.tar.gz: 2e69588e55a311133b5c5c9742d2293ad29df217d5c6ff93977bf465daac6ba90bf9e74dda339736518509df5e5e3e8c03b62ab6161333c973bd78153980a1a9
6
+ metadata.gz: 2d9dfa09085f2ec2b57991bfd7c077fe663119b8a45b00074c352f4f6a376e2c01c4f4f5c9f96b91e12cd65dfd8deb35dbad92626282dffd0944c7528351a9b4
7
+ data.tar.gz: eccecfd65968097e566f252e3a58bbc5b21a8e881832f9f2cdaa0a73ed44498a29521401daae7089572b3280aaa926735b4489dae21e32d181176676816601b2
data/.codeclimate.yml CHANGED
@@ -9,31 +9,12 @@
9
9
  # For more details, see here:
10
10
  # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
11
11
 
12
- # For a list of all available engines, see here:
13
- # http://docs.codeclimate.com/article/296-engines-available-engines
14
-
15
- engines:
16
- # to turn on an engine, add it here and set enabled to `true`
17
- # to turn off an engine, set enabled to `false` or remove it
12
+ plugins:
13
+ bundler-audit:
14
+ enabled: true
18
15
  rubocop:
19
16
  enabled: true
20
- # golint:
21
- # enabled: true
22
- # gofmt:
23
- # enabled: true
24
- # eslint:
25
- # enabled: true
26
- # csslint:
27
- # enabled: true
28
-
29
- # Engines can analyze files and report issues on them, but you can separately
30
- # decide which files will receive ratings based on those issues. This is
31
- # specified by path patterns under the ratings key.
32
-
33
- # For more details see here:
34
- # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
35
-
36
- # Note: If the ratings key is not specified, this will result in a 0.0 GPA on your dashboard.
17
+ channel: rubocop-1-22-3
37
18
 
38
19
  ratings:
39
20
  paths:
@@ -0,0 +1,22 @@
1
+ name: Audit
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+ jobs:
9
+ audit:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout code
13
+ uses: actions/checkout@v2
14
+
15
+ - name: Setup Ruby and install gems
16
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
17
+ with:
18
+ ruby-version: 2.7
19
+ bundler-cache: true
20
+ - name: Run security checks
21
+ run: |
22
+ bin/bundler-audit --update
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '21 10 * * 4'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v2
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
@@ -0,0 +1,32 @@
1
+ name: Test Coverage
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ coverage:
11
+ name: coverage
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
17
+ with:
18
+ ruby-version: 2.7
19
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20
+ - name: Install cc-test-reporter and prebuild notification
21
+ run: |
22
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
23
+ chmod +x ./cc-test-reporter
24
+ ./cc-test-reporter before-build
25
+ - name: Run tests
26
+ env:
27
+ COVERAGE: 1
28
+ run: bundle exec rspec
29
+ - name: CodeClimate Post-build upload
30
+ env:
31
+ CC_TEST_REPORTER_ID: 7eaf794e2ffbbd1bbe4eccd967a5428a6318cad2a33b8fd0baf42d6335a334a0
32
+ run: ./cc-test-reporter -d -t simplecov after-build
@@ -0,0 +1,45 @@
1
+ name: Push to Rubygems
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ packages: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby 2.7
20
+ uses: actions/setup-ruby@v1
21
+ with:
22
+ ruby-version: 2.7.x
23
+
24
+ - name: Publish to GPR
25
+ run: |
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
+ gem build *.gemspec
31
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
32
+ env:
33
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GPR_TOKEN}}"
34
+ OWNER: ${{ github.repository_owner }}
35
+
36
+ - name: Publish to RubyGems
37
+ run: |
38
+ mkdir -p $HOME/.gem
39
+ touch $HOME/.gem/credentials
40
+ chmod 0600 $HOME/.gem/credentials
41
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
42
+ gem build *.gemspec
43
+ gem push *.gem
44
+ env:
45
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,22 @@
1
+ name: Test
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
21
+ - name: Run tests
22
+ run: bundle exec rspec
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in case_transform2.gemspec
6
8
  gemspec
data/Gemfile.lock CHANGED
@@ -1,21 +1,59 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- case_transform2 (1.0.0)
4
+ case_transform2 (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- coderay (1.1.1)
10
- diff-lcs (1.3)
11
- docile (1.3.0)
12
- json (2.1.0)
13
- method_source (0.8.2)
14
- pry (0.10.4)
15
- coderay (~> 1.1.0)
16
- method_source (~> 0.8.1)
17
- slop (~> 3.4)
18
- rake (11.2.2)
9
+ ast (2.4.2)
10
+ bundle-audit (0.1.0)
11
+ bundler-audit
12
+ bundler-audit (0.9.0.1)
13
+ bundler (>= 1.2.0, < 3)
14
+ thor (~> 1.0)
15
+ coderay (1.1.3)
16
+ diff-lcs (1.4.4)
17
+ docile (1.4.0)
18
+ ffi (1.15.4)
19
+ formatador (0.3.0)
20
+ guard (2.18.0)
21
+ formatador (>= 0.2.4)
22
+ listen (>= 2.7, < 4.0)
23
+ lumberjack (>= 1.0.12, < 2.0)
24
+ nenv (~> 0.1)
25
+ notiffany (~> 0.0)
26
+ pry (>= 0.13.0)
27
+ shellany (~> 0.0)
28
+ thor (>= 0.18.1)
29
+ guard-compat (1.2.1)
30
+ guard-rspec (4.7.3)
31
+ guard (~> 2.1)
32
+ guard-compat (~> 1.1)
33
+ rspec (>= 2.99.0, < 4.0)
34
+ json (2.6.1)
35
+ listen (3.7.0)
36
+ rb-fsevent (~> 0.10, >= 0.10.3)
37
+ rb-inotify (~> 0.9, >= 0.9.10)
38
+ lumberjack (1.2.8)
39
+ method_source (1.0.0)
40
+ nenv (0.3.0)
41
+ notiffany (0.1.3)
42
+ nenv (~> 0.1)
43
+ shellany (~> 0.0)
44
+ parallel (1.21.0)
45
+ parser (3.0.2.0)
46
+ ast (~> 2.4.1)
47
+ pry (0.14.1)
48
+ coderay (~> 1.1)
49
+ method_source (~> 1.0)
50
+ rainbow (3.0.0)
51
+ rake (13.0.6)
52
+ rb-fsevent (0.11.0)
53
+ rb-inotify (0.10.1)
54
+ ffi (~> 1.0)
55
+ regexp_parser (2.1.1)
56
+ rexml (3.2.5)
19
57
  rspec (3.7.0)
20
58
  rspec-core (~> 3.7.0)
21
59
  rspec-expectations (~> 3.7.0)
@@ -29,23 +67,44 @@ GEM
29
67
  diff-lcs (>= 1.2.0, < 2.0)
30
68
  rspec-support (~> 3.7.0)
31
69
  rspec-support (3.7.1)
32
- simplecov (0.16.1)
70
+ rubocop (1.22.3)
71
+ parallel (~> 1.10)
72
+ parser (>= 3.0.0.0)
73
+ rainbow (>= 2.2.2, < 4.0)
74
+ regexp_parser (>= 1.8, < 3.0)
75
+ rexml
76
+ rubocop-ast (>= 1.12.0, < 2.0)
77
+ ruby-progressbar (~> 1.7)
78
+ unicode-display_width (>= 1.4.0, < 3.0)
79
+ rubocop-ast (1.12.0)
80
+ parser (>= 3.0.1.1)
81
+ rubocop-rspec (2.5.0)
82
+ rubocop (~> 1.19)
83
+ ruby-progressbar (1.11.0)
84
+ shellany (0.0.1)
85
+ simplecov (0.17.1)
33
86
  docile (~> 1.1)
34
87
  json (>= 1.8, < 3)
35
88
  simplecov-html (~> 0.10.0)
36
89
  simplecov-html (0.10.2)
37
- slop (3.6.0)
90
+ thor (1.1.0)
91
+ unicode-display_width (2.1.0)
38
92
 
39
93
  PLATFORMS
40
94
  ruby
41
95
 
42
96
  DEPENDENCIES
43
- bundler (~> 1.16)
97
+ bundle-audit (~> 0.1.0)
98
+ bundler (>= 2.2.30)
44
99
  case_transform2!
45
- pry (~> 0.10.4)
46
- rake (~> 11.2.2)
100
+ guard (~> 2.18.0)
101
+ guard-rspec (~> 4.7.3)
102
+ pry (~> 0.14.1)
103
+ rake (>= 13.0.6)
47
104
  rspec (~> 3.7.0)
48
- simplecov (~> 0.16.1)
105
+ rubocop (~> 1.22)
106
+ rubocop-rspec (~> 2.5.0)
107
+ simplecov (~> 0.17.1)
49
108
 
50
109
  BUNDLED WITH
51
- 1.16.2
110
+ 2.2.30
data/Guardfile CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
4
6
  ## Uncomment and set this to only include directories you want to watch
5
7
  # directories %w(app lib config test spec features) \
6
- # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
8
+ # .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
9
 
8
10
  ## Note: if you are using the `directories` clause above and you are not
9
11
  ## watching the project directory ('.'), then you will want to move
@@ -15,7 +17,7 @@
15
17
  #
16
18
  # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
19
 
18
- # Note: The cmd option is now required due to the increasing number of ways
20
+ # NOTE: The cmd option is now required due to the increasing number of ways
19
21
  # rspec may be run, below are examples of the most common uses.
20
22
  # * bundler: 'bundle exec rspec'
21
23
  # * bundler binstubs: 'bin/rspec'
@@ -24,8 +26,8 @@
24
26
  # * zeus: 'zeus rspec' (requires the server to be started separately)
25
27
  # * 'just' rspec: 'rspec'
26
28
 
27
- guard :rspec, cmd: "bundle exec rspec" do
28
- require "guard/rspec/dsl"
29
+ guard :rspec, cmd: 'bundle exec rspec' do
30
+ require 'guard/rspec/dsl'
29
31
  dsl = Guard::RSpec::Dsl.new(self)
30
32
 
31
33
  # Feel free to open issues for suggestions and improvements
@@ -39,32 +41,4 @@ guard :rspec, cmd: "bundle exec rspec" do
39
41
  # Ruby files
40
42
  ruby = dsl.ruby
41
43
  dsl.watch_spec_files_for(ruby.lib_files)
42
-
43
- # Rails files
44
- rails = dsl.rails(view_extensions: %w(erb haml slim))
45
- dsl.watch_spec_files_for(rails.app_files)
46
- dsl.watch_spec_files_for(rails.views)
47
-
48
- watch(rails.controllers) do |m|
49
- [
50
- rspec.spec.call("routing/#{m[1]}_routing"),
51
- rspec.spec.call("controllers/#{m[1]}_controller"),
52
- rspec.spec.call("acceptance/#{m[1]}")
53
- ]
54
- end
55
-
56
- # Rails config changes
57
- watch(rails.spec_helper) { rspec.spec_dir }
58
- watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
- watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
-
61
- # Capybara features specs
62
- watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63
- watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64
-
65
- # Turnip features and steps
66
- watch(%r{^spec/acceptance/(.+)\.feature$})
67
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
- Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
- end
70
44
  end
data/README.md CHANGED
@@ -1,20 +1,21 @@
1
1
  <!-- vim-markdown-toc GFM -->
2
2
 
3
3
  + [case_transform2](#case_transform2)
4
- * [Why](#why)
5
- * [Install](#install)
6
- * [Warning](#warning)
7
- * [Usage](#usage)
8
- * [Transforms](#transforms)
9
- * [NOTE](#note)
4
+ * [Why](#why)
5
+ * [Install](#install)
6
+ * [Warning](#warning)
7
+ * [Usage](#usage)
8
+ * [Transforms](#transforms)
9
+ * [NOTE](#note)
10
10
 
11
11
  <!-- vim-markdown-toc -->
12
12
 
13
13
  # case_transform2
14
14
 
15
- [![Build Status](https://travis-ci.org/saiqulhaq/case_transform.svg?branch=master)](https://travis-ci.org/saiqulhaq/case_transform)
16
- [![Test Coverage](https://api.codeclimate.com/v1/badges/0050890b14e7f9165680/test_coverage)](https://codeclimate.com/github/saiqulhaq/case_transform/test_coverage)
17
15
  [![Maintainability](https://api.codeclimate.com/v1/badges/0050890b14e7f9165680/maintainability)](https://codeclimate.com/github/saiqulhaq/case_transform/maintainability)
16
+ [![Audit](https://github.com/saiqulhaq/case_transform/actions/workflows/audit.yml/badge.svg)](https://github.com/saiqulhaq/case_transform/actions/workflows/audit.yml)
17
+ [![Test](https://github.com/saiqulhaq/case_transform/actions/workflows/test.yml/badge.svg)](https://github.com/saiqulhaq/case_transform/actions/workflows/test.yml)
18
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/0050890b14e7f9165680/test_coverage)](https://codeclimate.com/github/saiqulhaq/case_transform/test_coverage)
18
19
 
19
20
 
20
21
  Transforms string letter case to camel, snake, dash and underscore without activesupport dependencies.
@@ -73,8 +74,9 @@ Any other object type will just be returned.
73
74
  | dash | dash-case |
74
75
  | underscore | under_score |
75
76
 
76
- ## NOTE
77
+ ## Ruby Version Support
77
78
 
78
- There is no `CaseTransform2.unaltered` method like the original gem has
79
+ See `.github/workflows/github-actions.yml` to find out the latest Ruby version support
80
+ The target is above 2.5 and above
79
81
 
80
82
  License: See LICENSE.txt file
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
data/bin/brakeman ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'brakeman' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('brakeman', 'brakeman')
data/bin/bundler-audit ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundler-audit' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('bundler-audit', 'bundler-audit')
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "case_transform2"
4
+ require 'bundler/setup'
5
+ require 'case_transform2'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "case_transform2"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
data/bin/setup CHANGED
File without changes
@@ -1,32 +1,39 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("lib", __dir__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "case_transform2/version"
5
+ require 'case_transform2/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "case_transform2"
8
+ s.name = 'case_transform2'
9
9
  s.version = CaseTransform2::VERSION
10
- s.license = "MIT"
11
- s.authors = ["L. Preston Sego III", "Ben Mills", "Saiqul Haq"]
12
- s.email = "saiqulhaq@gmail.com"
13
- s.homepage = "https://github.com/saiqulhaq/case_transform"
14
- s.summary = "Transforms string letter case to camel, snake, dash and underscore without activesupport dependencies"
15
- s.description = s.summary + ". Forked from https://github.com/rails-api/case_transform"
16
- s.metadata["yard.run"] = "yri"
10
+ s.license = 'MIT'
11
+ s.authors = ['L. Preston Sego III', 'Ben Mills', 'Saiqul Haq']
12
+ s.email = 'saiqulhaq@gmail.com'
13
+ s.homepage = 'https://github.com/saiqulhaq/case_transform2'
14
+ s.summary = 'Transforms string letter case to camel, snake,' \
15
+ 'dash and underscore without activesupport dependencies'
16
+ s.description = "#{s.summary}. Forked from https://github.com/rails-api/case_transform"
17
+ s.metadata['yard.run'] = 'yri'
17
18
  s.files = `git ls-files -z`.split("\x0").reject do |f|
18
19
  f.match(%r{^(test|spec|features)/})
19
20
  end
21
+ s.required_ruby_version = '>= 2.5'
20
22
 
21
- s.bindir = "exe"
23
+ s.bindir = 'exe'
22
24
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- s.require_path = ["lib"]
25
+ s.require_path = ['lib']
24
26
 
25
27
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
26
28
 
27
- s.add_development_dependency "bundler", "~> 1.16"
28
- s.add_development_dependency "pry", "~> 0.10.4"
29
- s.add_development_dependency "rake", "~> 11.2.2"
30
- s.add_development_dependency "rspec", "~> 3.7.0"
31
- s.add_development_dependency "simplecov", "~> 0.16.1"
29
+ s.add_development_dependency 'bundle-audit', '~> 0.1.0'
30
+ s.add_development_dependency 'bundler', '>= 2.2.30'
31
+ s.add_development_dependency 'guard', '~> 2.18.0'
32
+ s.add_development_dependency 'guard-rspec', '~> 4.7.3'
33
+ s.add_development_dependency 'pry', '~> 0.14.1'
34
+ s.add_development_dependency 'rake', '>= 13.0.6'
35
+ s.add_development_dependency 'rspec', '~> 3.7.0'
36
+ s.add_development_dependency 'rubocop', '~> 1.22'
37
+ s.add_development_dependency 'rubocop-rspec', '~> 2.5.0'
38
+ s.add_development_dependency 'simplecov', '~> 0.17.1'
32
39
  end
@@ -0,0 +1,9 @@
1
+ version: '2'
2
+
3
+ services:
4
+ app:
5
+ tty: true # Enables debugging capabilities when attached to this container.
6
+ image: bitnami/ruby:2.7
7
+ # command: "sh -c 'bundle install && bundle exec rspec'"
8
+ volumes:
9
+ - .:/app # docker run -it --name ruby bitnami/ruby:2.7-prod
@@ -9,10 +9,10 @@ module CaseTransform2
9
9
 
10
10
  private
11
11
 
12
- def _deep_transform_keys_in_object!(object, &block)
12
+ def _deep_transform_keys_in_object!(object, &block) # rubocop:disable Metrics/MethodLength
13
13
  case object
14
14
  when Hash
15
- object.keys.each do |key|
15
+ object.keys.each do |key| # rubocop:disable Style/HashEachMethods
16
16
  value = object.delete(key)
17
17
  object[yield(key)] = _deep_transform_keys_in_object!(value, &block)
18
18
  end
@@ -6,26 +6,28 @@ module CaseTransform2
6
6
  # @api private
7
7
  class StringExt
8
8
  def camelize(string, first_letter = :upper)
9
- raise ArgumentError, "Argument can not be nil" unless %i[upper lower].include?(first_letter)
9
+ raise ArgumentError, 'Argument can not be nil' unless %i[upper lower].include?(first_letter)
10
+
10
11
  str = string.to_s
11
12
  str = str.gsub(/^[a-z\d]*/, &:capitalize) if first_letter == :upper
12
- str.gsub(/(?:_|(\/))([a-z\d]*)/i) do
13
+ str.gsub(%r{(?:_|(/))([a-z\d]*)}i) do
13
14
  "#{Regexp.last_match(1)}#{Regexp.last_match(2).capitalize}"
14
- end.gsub("/", "::")
15
+ end.gsub('/', '::')
15
16
  end
16
17
 
17
18
  def dasherize(string)
18
- string.tr("_", "-")
19
+ string.tr('_', '-')
19
20
  end
20
21
 
21
22
  # Only support camel to underscore
22
23
  def underscore(string)
23
24
  str = string.to_s
24
25
  return str unless str =~ /[A-Z-]|::/
25
- str.gsub("::", "/")
26
+
27
+ str.gsub('::', '/')
26
28
  .gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
27
29
  .gsub(/([a-z\d])([A-Z])/, '\1_\2')
28
- .tr("-", "_")
30
+ .tr('-', '_')
29
31
  .downcase
30
32
  end
31
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CaseTransform2
4
- VERSION = "1.0.0".freeze
4
+ VERSION = '1.1.1'
5
5
  end
@@ -1,16 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "case_transform2/hash_ext"
4
- require "case_transform2/string_ext"
5
- require "case_transform2/version"
3
+ require 'case_transform2/hash_ext'
4
+ require 'case_transform2/string_ext'
5
+ require 'case_transform2/version'
6
6
 
7
+ # Lightweight version of Case Transform gem
7
8
  module CaseTransform2
8
9
  class << self
9
10
  # Transforms values to UpperCamelCase or PascalCase.
10
11
  #
11
12
  # @example
12
13
  # "some_key" => "SomeKey",
13
- def camel(value)
14
+ def camel(value) # rubocop:disable Metrics/MethodLength
14
15
  case value
15
16
  when Array
16
17
  value.map { |item| camel(item) }
@@ -29,7 +30,7 @@ module CaseTransform2
29
30
  #
30
31
  # @example
31
32
  # "some_key" => "someKey",
32
- def camel_lower(value)
33
+ def camel_lower(value) # rubocop:disable Metrics/MethodLength
33
34
  case value
34
35
  when Array
35
36
  value.map { |item| camel_lower(item) }
@@ -48,7 +49,7 @@ module CaseTransform2
48
49
  #
49
50
  # @example
50
51
  # "some_key" => "some-key",
51
- def dash(value)
52
+ def dash(value) # rubocop:disable Metrics/MethodLength
52
53
  case value
53
54
  when Array
54
55
  value.map { |item| dash(item) }
@@ -67,7 +68,7 @@ module CaseTransform2
67
68
  #
68
69
  # @example
69
70
  # "some-key" => "some_key",
70
- def underscore(value)
71
+ def underscore(value) # rubocop:disable Metrics/MethodLength
71
72
  case value
72
73
  when Array
73
74
  value.map { |item| underscore(item) }
@@ -82,6 +83,11 @@ module CaseTransform2
82
83
  end
83
84
  end
84
85
 
86
+ # Returns the value unaltered
87
+ def unaltered(value)
88
+ value
89
+ end
90
+
85
91
  private
86
92
 
87
93
  def string_ext
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: case_transform2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
@@ -10,50 +10,92 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-07-05 00:00:00.000000000 Z
13
+ date: 2021-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundle-audit
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: 0.1.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: 0.1.0
15
29
  - !ruby/object:Gem::Dependency
16
30
  name: bundler
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.2.30
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.2.30
43
+ - !ruby/object:Gem::Dependency
44
+ name: guard
17
45
  requirement: !ruby/object:Gem::Requirement
18
46
  requirements:
19
47
  - - "~>"
20
48
  - !ruby/object:Gem::Version
21
- version: '1.16'
49
+ version: 2.18.0
22
50
  type: :development
23
51
  prerelease: false
24
52
  version_requirements: !ruby/object:Gem::Requirement
25
53
  requirements:
26
54
  - - "~>"
27
55
  - !ruby/object:Gem::Version
28
- version: '1.16'
56
+ version: 2.18.0
29
57
  - !ruby/object:Gem::Dependency
30
- name: pry
58
+ name: guard-rspec
31
59
  requirement: !ruby/object:Gem::Requirement
32
60
  requirements:
33
61
  - - "~>"
34
62
  - !ruby/object:Gem::Version
35
- version: 0.10.4
63
+ version: 4.7.3
36
64
  type: :development
37
65
  prerelease: false
38
66
  version_requirements: !ruby/object:Gem::Requirement
39
67
  requirements:
40
68
  - - "~>"
41
69
  - !ruby/object:Gem::Version
42
- version: 0.10.4
70
+ version: 4.7.3
43
71
  - !ruby/object:Gem::Dependency
44
- name: rake
72
+ name: pry
45
73
  requirement: !ruby/object:Gem::Requirement
46
74
  requirements:
47
75
  - - "~>"
48
76
  - !ruby/object:Gem::Version
49
- version: 11.2.2
77
+ version: 0.14.1
50
78
  type: :development
51
79
  prerelease: false
52
80
  version_requirements: !ruby/object:Gem::Requirement
53
81
  requirements:
54
82
  - - "~>"
55
83
  - !ruby/object:Gem::Version
56
- version: 11.2.2
84
+ version: 0.14.1
85
+ - !ruby/object:Gem::Dependency
86
+ name: rake
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 13.0.6
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 13.0.6
57
99
  - !ruby/object:Gem::Dependency
58
100
  name: rspec
59
101
  requirement: !ruby/object:Gem::Requirement
@@ -68,21 +110,49 @@ dependencies:
68
110
  - - "~>"
69
111
  - !ruby/object:Gem::Version
70
112
  version: 3.7.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: rubocop
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '1.22'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '1.22'
127
+ - !ruby/object:Gem::Dependency
128
+ name: rubocop-rspec
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: 2.5.0
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: 2.5.0
71
141
  - !ruby/object:Gem::Dependency
72
142
  name: simplecov
73
143
  requirement: !ruby/object:Gem::Requirement
74
144
  requirements:
75
145
  - - "~>"
76
146
  - !ruby/object:Gem::Version
77
- version: 0.16.1
147
+ version: 0.17.1
78
148
  type: :development
79
149
  prerelease: false
80
150
  version_requirements: !ruby/object:Gem::Requirement
81
151
  requirements:
82
152
  - - "~>"
83
153
  - !ruby/object:Gem::Version
84
- version: 0.16.1
85
- description: Transforms string letter case to camel, snake, dash and underscore without
154
+ version: 0.17.1
155
+ description: Transforms string letter case to camel, snake,dash and underscore without
86
156
  activesupport dependencies. Forked from https://github.com/rails-api/case_transform
87
157
  email: saiqulhaq@gmail.com
88
158
  executables: []
@@ -90,9 +160,13 @@ extensions: []
90
160
  extra_rdoc_files: []
91
161
  files:
92
162
  - ".codeclimate.yml"
163
+ - ".github/workflows/audit.yml"
164
+ - ".github/workflows/codeql-analysis.yml"
165
+ - ".github/workflows/coverage.yml"
166
+ - ".github/workflows/gem-push.yml"
167
+ - ".github/workflows/test.yml"
93
168
  - ".gitignore"
94
169
  - ".rspec"
95
- - ".rubocop.yml"
96
170
  - ".travis.yml"
97
171
  - CODE_OF_CONDUCT.md
98
172
  - Gemfile
@@ -101,14 +175,17 @@ files:
101
175
  - LICENSE.txt
102
176
  - README.md
103
177
  - Rakefile
178
+ - bin/brakeman
179
+ - bin/bundler-audit
104
180
  - bin/console
105
181
  - bin/setup
106
182
  - case_transform2.gemspec
183
+ - docker-compose.yml
107
184
  - lib/case_transform2.rb
108
185
  - lib/case_transform2/hash_ext.rb
109
186
  - lib/case_transform2/string_ext.rb
110
187
  - lib/case_transform2/version.rb
111
- homepage: https://github.com/saiqulhaq/case_transform
188
+ homepage: https://github.com/saiqulhaq/case_transform2
112
189
  licenses:
113
190
  - MIT
114
191
  metadata:
@@ -121,17 +198,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
198
  requirements:
122
199
  - - ">="
123
200
  - !ruby/object:Gem::Version
124
- version: '0'
201
+ version: '2.5'
125
202
  required_rubygems_version: !ruby/object:Gem::Requirement
126
203
  requirements:
127
204
  - - ">="
128
205
  - !ruby/object:Gem::Version
129
206
  version: '0'
130
207
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.7.3
208
+ rubygems_version: 3.1.6
133
209
  signing_key:
134
210
  specification_version: 4
135
- summary: Transforms string letter case to camel, snake, dash and underscore without
211
+ summary: Transforms string letter case to camel, snake,dash and underscore without
136
212
  activesupport dependencies
137
213
  test_files: []
data/.rubocop.yml DELETED
@@ -1,146 +0,0 @@
1
- Metrics/BlockLength:
2
- Exclude:
3
- - 'Rakefile'
4
- - '**/*.rake'
5
- - 'spec/**/*.rb'
6
-
7
- # Prefer &&/|| over and/or.
8
- Style/AndOr:
9
- Enabled: true
10
-
11
- # Do not use braces for hash literals when they are the last argument of a
12
- # method call.
13
- Style/BracesAroundHashParameters:
14
- Enabled: true
15
- EnforcedStyle: context_dependent
16
-
17
- # Align `when` with `case`.
18
- Layout/CaseIndentation:
19
- Enabled: true
20
-
21
- # Align comments with method definitions.
22
- Layout/CommentIndentation:
23
- Enabled: true
24
-
25
- Layout/ElseAlignment:
26
- Enabled: true
27
-
28
- # Align `end` with the matching keyword or starting expression except for
29
- # assignments, where it should be aligned with the LHS.
30
- Layout/EndAlignment:
31
- Enabled: true
32
- EnforcedStyleAlignWith: variable
33
- AutoCorrect: true
34
-
35
- Layout/EmptyLineAfterMagicComment:
36
- Enabled: true
37
-
38
- # In a regular class definition, no empty lines around the body.
39
- Layout/EmptyLinesAroundClassBody:
40
- Enabled: true
41
-
42
- # In a regular method definition, no empty lines around the body.
43
- Layout/EmptyLinesAroundMethodBody:
44
- Enabled: true
45
-
46
- # In a regular module definition, no empty lines around the body.
47
- Layout/EmptyLinesAroundModuleBody:
48
- Enabled: true
49
-
50
- Layout/FirstParameterIndentation:
51
- Enabled: true
52
-
53
- # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
54
- Style/HashSyntax:
55
- Enabled: true
56
-
57
- # Two spaces, no tabs (for indentation).
58
- Layout/IndentationWidth:
59
- Enabled: true
60
-
61
- Layout/LeadingCommentSpace:
62
- Enabled: true
63
-
64
- Layout/SpaceAfterColon:
65
- Enabled: true
66
-
67
- Layout/SpaceAfterComma:
68
- Enabled: true
69
-
70
- Layout/SpaceAroundEqualsInParameterDefault:
71
- Enabled: true
72
-
73
- Layout/SpaceAroundKeyword:
74
- Enabled: true
75
-
76
- Layout/SpaceAroundOperators:
77
- Enabled: true
78
-
79
- Layout/SpaceBeforeComma:
80
- Enabled: true
81
-
82
- Layout/SpaceBeforeFirstArg:
83
- Enabled: true
84
-
85
- Style/DefWithParentheses:
86
- Enabled: true
87
-
88
- # Defining a method with parameters needs parentheses.
89
- Style/MethodDefParentheses:
90
- Enabled: true
91
-
92
- Style/FrozenStringLiteralComment:
93
- Enabled: true
94
- EnforcedStyle: always
95
-
96
- # Use `foo {}` not `foo{}`.
97
- Layout/SpaceBeforeBlockBraces:
98
- Enabled: true
99
-
100
- # Use `foo { bar }` not `foo {bar}`.
101
- Layout/SpaceInsideBlockBraces:
102
- Enabled: true
103
-
104
- # Use `{ a: 1 }` not `{a:1}`.
105
- Layout/SpaceInsideHashLiteralBraces:
106
- Enabled: true
107
-
108
- Layout/SpaceInsideParens:
109
- Enabled: true
110
-
111
- # Check quotes usage according to lint rule below.
112
- Style/StringLiterals:
113
- Enabled: true
114
- EnforcedStyle: double_quotes
115
-
116
- # Detect hard tabs, no hard tabs.
117
- Layout/Tab:
118
- Enabled: true
119
-
120
- # Blank lines should not have any spaces.
121
- Layout/TrailingBlankLines:
122
- Enabled: true
123
-
124
- # No trailing whitespace.
125
- Layout/TrailingWhitespace:
126
- Enabled: true
127
-
128
- # Use quotes for string literals when they are enough.
129
- Style/UnneededPercentQ:
130
- Enabled: true
131
-
132
- # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
133
- Lint/RequireParentheses:
134
- Enabled: true
135
-
136
- Style/RedundantReturn:
137
- Enabled: true
138
- AllowMultipleReturnValues: true
139
-
140
- Style/Semicolon:
141
- Enabled: true
142
- AllowAsExpressionSeparator: true
143
-
144
- # Prefer Foo.method over Foo::method
145
- Style/ColonMethodCall:
146
- Enabled: true